753 lines
77 KiB
HTML
Executable File
753 lines
77 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=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsVarInit</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF1>U8</span><span class=cF0> **_dst,</span><span class=cF9>CHashClass</span><span class=cF0> *tmpc,</span><span class=cF9>CArrayDim</span><span class=cF0> *tmpad,
|
|
<a name="l2"></a> </span><span class=cF1>U8</span><span class=cF0> *data_addr_rip,</span><span class=cF1>U8</span><span class=cF0> **_base,</span><span class=cF1>Bool</span><span class=cF0> data_heap,</span><span class=cF9>I64</span><span class=cF0> pass)
|
|
<a name="l3"></a>{
|
|
<a name="l4"></a> </span><span class=cF1>U8</span><span class=cF0> *dst=*_dst,*machine_code;
|
|
<a name="l5"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,r,old_flags,type,size;
|
|
<a name="l6"></a> </span><span class=cF9>CMemberLst</span><span class=cF0> *tmpm;
|
|
<a name="l7"></a> </span><span class=cF9>CIntermediateCode</span><span class=cF0> *tmpi;
|
|
<a name="l8"></a> </span><span class=cF9>CAOTCtrl</span><span class=cF0> *aotc=cc->aotc;
|
|
<a name="l9"></a> </span><span class=cF9>CAOTAbsAddr</span><span class=cF0> *tmpa;
|
|
<a name="l10"></a> </span><span class=cF9>CAOTImportExport</span><span class=cF0> *tmpie;
|
|
<a name="l11"></a> </span><span class=cF1>Bool</span><span class=cF0> is_str;
|
|
<a name="l12"></a>
|
|
<a name="l13"></a> tmpc=</span><span class=cF5>OptClassFwd</span><span class=cF0>(tmpc);
|
|
<a name="l14"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm=tmpc->member_lst_and_root) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>'{'</span><span class=cF0>)
|
|
<a name="l16"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '{' at "</span><span class=cF0>);
|
|
<a name="l17"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l18"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l19"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l20"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm) {
|
|
<a name="l21"></a> </span><span class=cFD>PrsVarInit2</span><span class=cF0>(cc,&dst,tmpm->member_class,&tmpm->dim,
|
|
<a name="l22"></a> data_addr_rip,_base,data_heap,pass);
|
|
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l24"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l25"></a> tmpm=tmpm->next;
|
|
<a name="l26"></a> }
|
|
<a name="l27"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l28"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>'}'</span><span class=cF0>)
|
|
<a name="l29"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing '}' at "</span><span class=cF0>);
|
|
<a name="l30"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l31"></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="l32"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->ptr_stars_cnt==1 &&
|
|
<a name="l33"></a> </span><span class=cF7>(</span><span class=cF0>(tmpc-1)->raw_type==</span><span class=cF3>RT_I8</span><span class=cF0> || (tmpc-1)->raw_type==</span><span class=cF3>RT_U8</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l34"></a> !tmpad && cc->token==</span><span class=cF3>TK_STR</span><span class=cF0>)
|
|
<a name="l35"></a> is_str=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l36"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l37"></a> is_str=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l38"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags&</span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0> && is_str) {
|
|
<a name="l39"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l40"></a> machine_code=</span><span class=cF5>LexExtStr</span><span class=cF0>(cc,&i);
|
|
<a name="l41"></a> </span><span class=cF1>if</span><span class=cF0> (pass==2) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l42"></a> tmpa=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTAbsAddr</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l43"></a> tmpa->next=aotc->abss;
|
|
<a name="l44"></a> tmpa->type=</span><span class=cF3>AAT_ADD_U64</span><span class=cF0>;
|
|
<a name="l45"></a> aotc->abss=tmpa;
|
|
<a name="l46"></a> tmpa->rip=data_addr_rip+dst-*_base;
|
|
<a name="l47"></a> *dst(</span><span class=cF9>I64</span><span class=cF0> *)=aotc->rip;
|
|
<a name="l48"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j<i;j++)
|
|
<a name="l49"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,machine_code[j]);
|
|
<a name="l50"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l51"></a> </span><span class=cF5>Free</span><span class=cF0>(machine_code);
|
|
<a name="l52"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l53"></a> old_flags=cc->flags;
|
|
<a name="l54"></a> cc->flags=</span><span class=cF3>CCF_NO_ABSS</span><span class=cF0> | cc->flags &
|
|
<a name="l55"></a> ~(</span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>|</span><span class=cF3>CCF_HAS_MISC_DATA</span><span class=cF0>|</span><span class=cF3>CCF_NOT_CONST</span><span class=cF0>);
|
|
<a name="l56"></a> machine_code=</span><span class=cF5>LexExpression2Bin</span><span class=cF0>(cc,&type);
|
|
<a name="l57"></a> </span><span class=cF1>if</span><span class=cF0> (old_flags&</span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0> &&
|
|
<a name="l58"></a> cc->flags&</span><span class=cF3>CCF_NOT_CONST</span><span class=cF0> &&
|
|
<a name="l59"></a> !</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="l60"></a> cc->flags=cc->flags&~</span><span class=cF3>CCF_NO_ABSS</span><span class=cF0>|</span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>;
|
|
<a name="l61"></a> </span><span class=cF5>Free</span><span class=cF0>(machine_code);
|
|
<a name="l62"></a> </span><span class=cF1>if</span><span class=cF0> (pass==2) {
|
|
<a name="l63"></a> </span><span class=cF5>MemSet</span><span class=cF0>(dst,0,tmpc->size);
|
|
<a name="l64"></a> </span><span class=cF5>LexPopRestore</span><span class=cF0>(cc);
|
|
<a name="l65"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l66"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l67"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
|
|
<a name="l68"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_ABS_ADDR</span><span class=cF0>,data_addr_rip,tmpc+1);
|
|
<a name="l69"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_IMM_I64</span><span class=cF0>,dst-*_base,tmpc+1);
|
|
<a name="l70"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_ADD</span><span class=cF0>,0,tmpc+1);
|
|
<a name="l71"></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="l72"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l73"></a> tmpi=cc->coc.coc_head.last;
|
|
<a name="l74"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi->ic_code==</span><span class=cF3>IC_END_EXP</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l75"></a> tmpi->ic_code=</span><span class=cF3>IC_NOP1</span><span class=cF0>;
|
|
<a name="l76"></a> tmpi->ic_flags=0;
|
|
<a name="l77"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l78"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_ASSIGN</span><span class=cF0>,0,tmpc);
|
|
<a name="l79"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc,</span><span class=cF3>IC_END_EXP</span><span class=cF0>,0,tmpc,</span><span class=cF3>ICF_RES_NOT_USED</span><span class=cF0>);
|
|
<a name="l80"></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="l81"></a> </span><span class=cF1>if</span><span class=cF0> (machine_code=</span><span class=cFD>COCCompile</span><span class=cF7>(</span><span class=cF0>cc,&size,</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF3>NULL</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l82"></a> tmpie=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTImportExport</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l83"></a> tmpie->type=</span><span class=cF3>IET_MAIN</span><span class=cF0>;
|
|
<a name="l84"></a> tmpie->rip=cc->aotc->rip;
|
|
<a name="l85"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpie,cc->aot->last_ie);
|
|
<a name="l86"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<size;i++)
|
|
<a name="l87"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,machine_code[i]);
|
|
<a name="l88"></a> </span><span class=cF5>Free</span><span class=cF0>(machine_code);
|
|
<a name="l89"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l90"></a> </span><span class=cFD>COCPop</span><span class=cF0>(cc);
|
|
<a name="l91"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l92"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l93"></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="l94"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l95"></a> </span><span class=cF1>if</span><span class=cF0> (!machine_code)
|
|
<a name="l96"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l97"></a> r=</span><span class=cF5>Call</span><span class=cF0>(machine_code);
|
|
<a name="l98"></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_HAS_MISC_DATA</span><span class=cF7>)</span><span class=cF0>||pass==1)
|
|
<a name="l99"></a> </span><span class=cF5>Free</span><span class=cF0>(machine_code);
|
|
<a name="l100"></a>
|
|
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (type==</span><span class=cF3>RT_F64</span><span class=cF0> &&
|
|
<a name="l102"></a> tmpc->raw_type!=</span><span class=cF3>RT_F64</span><span class=cF0>)
|
|
<a name="l103"></a> r=r(</span><span class=cF1>F64</span><span class=cF0>);
|
|
<a name="l104"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (type!=</span><span class=cF3>RT_F64</span><span class=cF0> &&
|
|
<a name="l105"></a> tmpc->raw_type==</span><span class=cF3>RT_F64</span><span class=cF0>)
|
|
<a name="l106"></a> r(</span><span class=cF1>F64</span><span class=cF0>)=r;
|
|
<a name="l107"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(dst,&r,tmpc->size);
|
|
<a name="l108"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l109"></a> }
|
|
<a name="l110"></a> dst+=tmpc->size;
|
|
<a name="l111"></a> cc->flags=cc->flags&
|
|
<a name="l112"></a> ~</span><span class=cF3>CCF_NO_ABSS</span><span class=cF0>|old_flags&(</span><span class=cF3>CCF_HAS_MISC_DATA</span><span class=cF0>|</span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>);
|
|
<a name="l113"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l114"></a> *_dst=dst;
|
|
<a name="l115"></a>}
|
|
<a name="l116"></a>
|
|
<a name="l117"></a></span><span class=cF1>class</span><span class=cF0> CVI2
|
|
<a name="l118"></a>{
|
|
<a name="l119"></a> CVI2 *next,*last;
|
|
<a name="l120"></a> </span><span class=cF1>U0</span><span class=cF0> base;
|
|
<a name="l121"></a>};
|
|
<a name="l122"></a>
|
|
<a name="l123"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsVarInit2</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF1>U8</span><span class=cF0> **_dst,</span><span class=cF9>CHashClass</span><span class=cF0> *tmpc,
|
|
<a name="l124"></a> </span><span class=cF9>CArrayDim</span><span class=cF0> *tmpad,</span><span class=cF1>U8</span><span class=cF0> *data_addr_rip,</span><span class=cF1>U8</span><span class=cF0> **_base,</span><span class=cF1>Bool</span><span class=cF0> data_heap,</span><span class=cF9>I64</span><span class=cF0> pass)
|
|
<a name="l125"></a>{
|
|
<a name="l126"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,cnt;
|
|
<a name="l127"></a> </span><span class=cF1>U8</span><span class=cF0> *st,*_b;
|
|
<a name="l128"></a> CVI2 head,*tmpvi,*tmpvi1;
|
|
<a name="l129"></a> </span><span class=cF9>CArrayDim</span><span class=cF0> *tmpad1;
|
|
<a name="l130"></a> tmpc=</span><span class=cF5>OptClassFwd</span><span class=cF0>(tmpc);
|
|
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (tmpad1=tmpad->next) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpc->ptr_stars_cnt &&
|
|
<a name="l133"></a> </span><span class=cF7>(</span><span class=cF0>tmpc->raw_type==</span><span class=cF3>RT_I8</span><span class=cF0> || tmpc->raw_type==</span><span class=cF3>RT_U8</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l134"></a> cc->token==</span><span class=cF3>TK_STR</span><span class=cF0>) {
|
|
<a name="l135"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l136"></a> st=</span><span class=cF5>LexExtStr</span><span class=cF0>(cc,&i);
|
|
<a name="l137"></a> </span><span class=cF1>if</span><span class=cF0> (tmpad1->cnt<0) </span><span class=cF7>{</span><span class=cF2>//[]</span><span class=cF0>
|
|
<a name="l138"></a> tmpad1->cnt=i;
|
|
<a name="l139"></a> tmpad->total_cnt=i*tmpad1->total_cnt;
|
|
<a name="l140"></a> </span><span class=cF5>Free</span><span class=cF0>(*_base);
|
|
<a name="l141"></a> </span><span class=cF1>if</span><span class=cF0> (data_heap)
|
|
<a name="l142"></a> *_base=</span><span class=cF5>MAlloc</span><span class=cF0>(i);
|
|
<a name="l143"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l144"></a> *_base=</span><span class=cF5>MAlloc</span><span class=cF0>(i,</span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l145"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(*_base,st,i);
|
|
<a name="l146"></a> *_dst=*_base+i;
|
|
<a name="l147"></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="l148"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(*_dst,st,tmpad1->cnt);
|
|
<a name="l149"></a> *_dst+=tmpad1->cnt;
|
|
<a name="l150"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l151"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l152"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l153"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l154"></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="l155"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l156"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l157"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l158"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l159"></a> </span><span class=cF1>if</span><span class=cF0> (tmpad1->cnt<0) </span><span class=cF7>{</span><span class=cF2>//[]</span><span class=cF0>
|
|
<a name="l160"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&head);
|
|
<a name="l161"></a> cnt=0;
|
|
<a name="l162"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token!=</span><span class=cF6>'}'</span><span class=cF0>) {
|
|
<a name="l163"></a> tmpvi=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF0>CVI2.base</span><span class=cF7>)</span><span class=cF0>+tmpad1->total_cnt*tmpc->size);
|
|
<a name="l164"></a> _b=&tmpvi->base;
|
|
<a name="l165"></a> </span><span class=cFD>PrsVarInit2</span><span class=cF0>(cc,&_b,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
|
|
<a name="l166"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpvi,head.last);
|
|
<a name="l167"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l168"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l169"></a> cnt++;
|
|
<a name="l170"></a> }
|
|
<a name="l171"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip '}'</span><span class=cF0>
|
|
<a name="l172"></a> tmpad1->cnt=cnt;
|
|
<a name="l173"></a> tmpad->total_cnt=cnt*tmpad1->total_cnt;
|
|
<a name="l174"></a> j=tmpad1->total_cnt*tmpc->size;
|
|
<a name="l175"></a> i=cnt*j;
|
|
<a name="l176"></a> </span><span class=cF5>Free</span><span class=cF0>(*_base);
|
|
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (data_heap)
|
|
<a name="l178"></a> *_base=_b=</span><span class=cF5>MAlloc</span><span class=cF0>(i);
|
|
<a name="l179"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l180"></a> *_base=_b=</span><span class=cF5>MAlloc</span><span class=cF0>(i,</span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l181"></a> tmpvi=head.next;
|
|
<a name="l182"></a> </span><span class=cF1>while</span><span class=cF0> (tmpvi!=&head) {
|
|
<a name="l183"></a> tmpvi1=tmpvi->next;
|
|
<a name="l184"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(_b,&tmpvi->base,j);
|
|
<a name="l185"></a> _b+=j;
|
|
<a name="l186"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpvi);
|
|
<a name="l187"></a> tmpvi=tmpvi1;
|
|
<a name="l188"></a> }
|
|
<a name="l189"></a> *_dst=_b;
|
|
<a name="l190"></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="l191"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<tmpad1->cnt;i++) {
|
|
<a name="l192"></a> </span><span class=cFD>PrsVarInit2</span><span class=cF0>(cc,_dst,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
|
|
<a name="l193"></a> </span><span class=cF1>if</span><span class=cF0> (tmpad1->cnt>1 && cc->token==</span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l194"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l195"></a> }
|
|
<a name="l196"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>'}'</span><span class=cF0>)
|
|
<a name="l197"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l198"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l199"></a> }
|
|
<a name="l200"></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="l201"></a> </span><span class=cFD>PrsVarInit</span><span class=cF0>(cc,_dst,tmpc,tmpad1,data_addr_rip,_base,data_heap,pass);
|
|
<a name="l202"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l203"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l204"></a>}
|
|
<a name="l205"></a>
|
|
<a name="l206"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsGlblInit</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CHashGlblVar</span><span class=cF0> *tmpg,</span><span class=cF9>I64</span><span class=cF0> pass)
|
|
<a name="l207"></a>{
|
|
<a name="l208"></a> </span><span class=cF1>U8</span><span class=cF0> *dst=tmpg->data_addr;
|
|
<a name="l209"></a> </span><span class=cFD>PrsVarInit2</span><span class=cF0>(cc,&dst,tmpg->var_class,&tmpg->dim,
|
|
<a name="l210"></a> tmpg->data_addr_rip,&tmpg->data_addr,
|
|
<a name="l211"></a> </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>||
|
|
<a name="l212"></a> </span><span class=cF5>Bt</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>,pass);
|
|
<a name="l213"></a>}
|
|
<a name="l214"></a>
|
|
<a name="l215"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsStaticInit</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CMemberLst</span><span class=cF0> *tmpm,</span><span class=cF9>I64</span><span class=cF0> pass)
|
|
<a name="l216"></a>{
|
|
<a name="l217"></a> </span><span class=cF1>U8</span><span class=cF0> *machine_code,*dst=tmpm->static_data;
|
|
<a name="l218"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc=tmpm->member_class;
|
|
<a name="l219"></a> </span><span class=cF9>I64</span><span class=cF0> i,size;
|
|
<a name="l220"></a> </span><span class=cF9>CAOTImportExport</span><span class=cF0> *tmpie;
|
|
<a name="l221"></a>
|
|
<a name="l222"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags&</span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0> && pass==2) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l223"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l224"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
|
|
<a name="l225"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l226"></a> </span><span class=cFD>PrsVarInit2</span><span class=cF0>(cc,&dst,tmpc,&tmpm->dim,tmpm->static_data_rip,
|
|
<a name="l227"></a> &tmpm->static_data,</span><span class=cF5>Bt</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>,pass);
|
|
<a name="l228"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags&</span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0> && pass==2) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l229"></a> </span><span class=cF1>if</span><span class=cF0> (cc->coc.coc_head.next!=&cc->coc.coc_head) {
|
|
<a name="l230"></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="l231"></a> </span><span class=cF1>if</span><span class=cF0> (machine_code=</span><span class=cFD>COCCompile</span><span class=cF7>(</span><span class=cF0>cc,&size,</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF3>NULL</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l232"></a> </span><span class=cF1>if</span><span class=cF0> (pass==2) {
|
|
<a name="l233"></a> tmpie=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAOTImportExport</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l234"></a> tmpie->type=</span><span class=cF3>IET_MAIN</span><span class=cF0>;
|
|
<a name="l235"></a> tmpie->rip=cc->aotc->rip;
|
|
<a name="l236"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpie,cc->aot->last_ie);
|
|
<a name="l237"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<size;i++)
|
|
<a name="l238"></a> </span><span class=cFD>AOTStoreCodeU8</span><span class=cF0>(cc,machine_code[i]);
|
|
<a name="l239"></a> }
|
|
<a name="l240"></a> </span><span class=cF5>Free</span><span class=cF0>(machine_code);
|
|
<a name="l241"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l242"></a> } </span><span class=cF2>//TODO: else del misc?</span><span class=cF0>
|
|
<a name="l243"></a> </span><span class=cFD>COCPop</span><span class=cF0>(cc);
|
|
<a name="l244"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l245"></a>}
|
|
<a name="l246"></a>
|
|
<a name="l247"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsArrayDims</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>I64</span><span class=cF0> mode,</span><span class=cF9>CArrayDim</span><span class=cF0> *dim)
|
|
<a name="l248"></a>{</span><span class=cF2>//dim->next!=0 for array</span><span class=cF0>
|
|
<a name="l249"></a> </span><span class=cF9>CArrayDim</span><span class=cF0> *tmpad,*tmpad1;
|
|
<a name="l250"></a> </span><span class=cF9>I64</span><span class=cF0> j;
|
|
<a name="l251"></a> dim->next=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l252"></a> dim->cnt=0;
|
|
<a name="l253"></a> dim->total_cnt=1;
|
|
<a name="l254"></a> tmpad1=&dim->next;
|
|
<a name="l255"></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="l256"></a> </span><span class=cF1>if</span><span class=cF0> (mode.u8[1]==</span><span class=cF3>PRS1B_FUN_ARG</span><span class=cF0>)
|
|
<a name="l257"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"No arrays in fun args at "</span><span class=cF0>);
|
|
<a name="l258"></a> </span><span class=cF1>do</span><span class=cF0> {
|
|
<a name="l259"></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> && !dim->next)
|
|
<a name="l260"></a> j=0;
|
|
<a name="l261"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l262"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>j=</span><span class=cF5>LexExpressionI64</span><span class=cF0>(cc)</span><span class=cF7>)</span><span class=cF0><0)
|
|
<a name="l263"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Invalid array size at "</span><span class=cF0>);
|
|
<a name="l264"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l265"></a> tmpad=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CArrayDim</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l266"></a> tmpad->next=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l267"></a> tmpad1=&dim;
|
|
<a name="l268"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l269"></a> tmpad1->total_cnt*=j;
|
|
<a name="l270"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpad1->next) {
|
|
<a name="l271"></a> tmpad1->next=tmpad;
|
|
<a name="l272"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l273"></a> }
|
|
<a name="l274"></a> tmpad1=tmpad1->next;
|
|
<a name="l275"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (tmpad1);
|
|
<a name="l276"></a> tmpad1=tmpad;
|
|
<a name="l277"></a> tmpad->cnt=j;
|
|
<a name="l278"></a> tmpad->total_cnt=1;
|
|
<a name="l279"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>']'</span><span class=cF0>)
|
|
<a name="l280"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ']' at "</span><span class=cF0>);
|
|
<a name="l281"></a> } </span><span class=cF1>while</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="l282"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l283"></a>}
|
|
<a name="l284"></a>
|
|
<a name="l285"></a></span><span class=cF9>CHashClass</span><span class=cF0> *</span><span class=cFD>PrsType</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CHashClass</span><span class=cF0> **_tmpc1,
|
|
<a name="l286"></a> </span><span class=cF9>I64</span><span class=cF0> *_mode,</span><span class=cF9>CMemberLst</span><span class=cF0> *tmpm,</span><span class=cF1>U8</span><span class=cF0> **_ident,</span><span class=cF9>CHashFun</span><span class=cF0> **_fun_ptr,
|
|
<a name="l287"></a> </span><span class=cF9>CHashExport</span><span class=cF0> **_tmpex,</span><span class=cF9>CArrayDim</span><span class=cF0> *tmpad,</span><span class=cF9>I64</span><span class=cF0> fsp_flags)
|
|
<a name="l288"></a>{
|
|
<a name="l289"></a> </span><span class=cF9>I64</span><span class=cF0> k,ptr_stars_cnt,mode=*_mode;
|
|
<a name="l290"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc1=*_tmpc1,*tmpc2;
|
|
<a name="l291"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *fun_ptr=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l292"></a> </span><span class=cF9>CHashExport</span><span class=cF0> *tmpex=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l293"></a>
|
|
<a name="l294"></a> pt_start:
|
|
<a name="l295"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpc1 || !</span><span class=cF7>(</span><span class=cF0>tmpc1->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="l296"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Invalid class at "</span><span class=cF0>);
|
|
<a name="l297"></a>
|
|
<a name="l298"></a> ptr_stars_cnt=0;
|
|
<a name="l299"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token==</span><span class=cF6>'*'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l300"></a> </span><span class=cF1>if</span><span class=cF0> (mode.u8[1]) {
|
|
<a name="l301"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l302"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l303"></a> }
|
|
<a name="l304"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l305"></a> tmpc1++;
|
|
<a name="l306"></a> </span><span class=cF1>if</span><span class=cF0> (++ptr_stars_cnt></span><span class=cF3>PTR_STARS_NUM</span><span class=cF0>)
|
|
<a name="l307"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Too many *'s at "</span><span class=cF0>);
|
|
<a name="l308"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l309"></a>
|
|
<a name="l310"></a> k=</span><span class=cF5>PrsKeyWord</span><span class=cF0>(cc);
|
|
<a name="l311"></a> </span><span class=cF1>if</span><span class=cF0> (k==</span><span class=cF3>KW_UNION</span><span class=cF0> || k==</span><span class=cF3>KW_CLASS</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l312"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l313"></a> tmpc2=</span><span class=cFD>PrsClass</span><span class=cF0>(cc,k,fsp_flags,mode&255==</span><span class=cF3>PRS0_EXTERN</span><span class=cF0>);
|
|
<a name="l314"></a> tmpc2->fwd_class=tmpc1;
|
|
<a name="l315"></a> tmpc1=tmpc2;
|
|
<a name="l316"></a> </span><span class=cF1>if</span><span class=cF0> (_tmpc1) *_tmpc1=tmpc1;
|
|
<a name="l317"></a> mode=</span><span class=cF3>PRS0_NULL</span><span class=cF0>|</span><span class=cF3>PRS1_NULL</span><span class=cF0>;
|
|
<a name="l318"></a> </span><span class=cF1>goto</span><span class=cF0> pt_start;
|
|
<a name="l319"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l320"></a>
|
|
<a name="l321"></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="l322"></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="l323"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '*' at "</span><span class=cF0>);
|
|
<a name="l324"></a> ptr_stars_cnt=1; </span><span class=cF2>//fun_ptr</span><span class=cF0>
|
|
<a name="l325"></a> </span><span class=cF1>while</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="l326"></a> ptr_stars_cnt++; </span><span class=cF2>//fun_ptr</span><span class=cF0>
|
|
<a name="l327"></a> </span><span class=cF1>if</span><span class=cF0> (ptr_stars_cnt></span><span class=cF3>PTR_STARS_NUM</span><span class=cF0>)
|
|
<a name="l328"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Too many *'s at "</span><span class=cF0>);
|
|
<a name="l329"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l330"></a> ptr_stars_cnt=-1; </span><span class=cF2>//fun_ptr</span><span class=cF0>
|
|
<a name="l331"></a>
|
|
<a name="l332"></a> </span><span class=cF1>if</span><span class=cF0> (_ident) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l333"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF3>TK_IDENT</span><span class=cF0>) {
|
|
<a name="l334"></a> tmpex=cc->hash_entry;
|
|
<a name="l335"></a> *_ident=cc->cur_str;
|
|
<a name="l336"></a> cc->cur_str=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l337"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l338"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l339"></a> </span><span class=cF1>if</span><span class=cF0> (!mode.u8[1])
|
|
<a name="l340"></a> *_ident=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l341"></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> || cc->token==</span><span class=cF6>';'</span><span class=cF0> || cc->token==</span><span class=cF6>')'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l342"></a> tmpex=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l343"></a> *_ident=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>"_anon_"</span><span class=cF0>);
|
|
<a name="l344"></a> tmpm->flags|=</span><span class=cF3>MLF_NO_UNUSED_WARN</span><span class=cF0>;
|
|
<a name="l345"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l346"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting identifier at "</span><span class=cF0>);
|
|
<a name="l347"></a> }
|
|
<a name="l348"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l349"></a>
|
|
<a name="l350"></a> </span><span class=cF1>if</span><span class=cF0> (ptr_stars_cnt>=0) </span><span class=cF7>{</span><span class=cF0> </span><span class=cF2>//fun_ptr</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> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l353"></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="l354"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '(' at "</span><span class=cF0>);
|
|
<a name="l355"></a> fun_ptr=</span><span class=cFD>PrsFunJoin</span><span class=cF0>(cc,tmpc1,</span><span class=cF3>NULL</span><span class=cF0>,fsp_flags)+ptr_stars_cnt;
|
|
<a name="l356"></a> tmpc1=</span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]+ptr_stars_cnt;
|
|
<a name="l357"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l358"></a> </span><span class=cFD>PrsArrayDims</span><span class=cF0>(cc,mode,tmpad);
|
|
<a name="l359"></a>
|
|
<a name="l360"></a> tmpc2=</span><span class=cF5>OptClassFwd</span><span class=cF0>(tmpc1);
|
|
<a name="l361"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc2->ptr_stars_cnt) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l362"></a> tmpc2-=tmpc2->ptr_stars_cnt;
|
|
<a name="l363"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc2->type&</span><span class=cF3>HTT_INTERNAL_TYPE</span><span class=cF0> && !tmpc2->size)
|
|
<a name="l364"></a> </span><span class=cF5>LexWarn</span><span class=cF0>(cc,</span><span class=cF6>"use \"U8 *\" instead of \"U0 *\" at "</span><span class=cF0>);
|
|
<a name="l365"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l366"></a>
|
|
<a name="l367"></a> </span><span class=cF1>if</span><span class=cF0> (_mode) *_mode=mode;
|
|
<a name="l368"></a> </span><span class=cF1>if</span><span class=cF0> (_fun_ptr) *_fun_ptr=fun_ptr;
|
|
<a name="l369"></a> </span><span class=cF1>if</span><span class=cF0> (_tmpex) *_tmpex=tmpex;
|
|
<a name="l370"></a> </span><span class=cF1>return</span><span class=cF0> tmpc1;
|
|
<a name="l371"></a>}
|
|
<a name="l372"></a>
|
|
<a name="l373"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsDotDotDot</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CHashFun</span><span class=cF0> *tmpf,</span><span class=cF9>I64</span><span class=cF0> _reg)
|
|
<a name="l374"></a>{
|
|
<a name="l375"></a> </span><span class=cF9>CMemberLst</span><span class=cF0> *tmpm;
|
|
<a name="l376"></a> </span><span class=cF9>CArrayDim</span><span class=cF0> *tmpad;
|
|
<a name="l377"></a>
|
|
<a name="l378"></a> </span><span class=cF5>Bts</span><span class=cF0>(&tmpf->flags,</span><span class=cF3>Ff_DOT_DOT_DOT</span><span class=cF0>);
|
|
<a name="l379"></a>
|
|
<a name="l380"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l381"></a> tmpm=</span><span class=cFD>MemberLstNew</span><span class=cF0>(_reg);
|
|
<a name="l382"></a> tmpm->flags=</span><span class=cF3>MLF_DOT_DOT_DOT</span><span class=cF0>;
|
|
<a name="l383"></a> tmpm->member_class=</span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>];
|
|
<a name="l384"></a> tmpm->str=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>"argc"</span><span class=cF0>);
|
|
<a name="l385"></a> tmpm-></span><span class=cF1>offset</span><span class=cF0>=tmpf->size;
|
|
<a name="l386"></a> tmpm->size=8;
|
|
<a name="l387"></a> tmpf->size+=8;
|
|
<a name="l388"></a> </span><span class=cFD>MemberAdd</span><span class=cF0>(cc,tmpm,tmpf,</span><span class=cF3>PRS1B_FUN_ARG</span><span class=cF0>);
|
|
<a name="l389"></a>
|
|
<a name="l390"></a> tmpm=</span><span class=cFD>MemberLstNew</span><span class=cF0>(_reg);
|
|
<a name="l391"></a> tmpm->flags=</span><span class=cF3>MLF_DOT_DOT_DOT</span><span class=cF0>;
|
|
<a name="l392"></a> tmpm->member_class=</span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>];
|
|
<a name="l393"></a> tmpm->str=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>"argv"</span><span class=cF0>);
|
|
<a name="l394"></a> tmpm->dim.total_cnt=127; </span><span class=cF2>//arbitrary</span><span class=cF0>
|
|
<a name="l395"></a> tmpm->dim.next=tmpad=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CArrayDim</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l396"></a> tmpad->next=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l397"></a> tmpad->cnt=127; </span><span class=cF2>//arbitrary</span><span class=cF0>
|
|
<a name="l398"></a> tmpad->total_cnt=1;
|
|
<a name="l399"></a> tmpm-></span><span class=cF1>offset</span><span class=cF0>=tmpf->size;
|
|
<a name="l400"></a> tmpm->size=8; </span><span class=cF2>//Close enough</span><span class=cF0>
|
|
<a name="l401"></a> tmpf->size+=8;</span><span class=cF2>//Close enough</span><span class=cF0>
|
|
<a name="l402"></a> </span><span class=cFD>MemberAdd</span><span class=cF0>(cc,tmpm,tmpf,</span><span class=cF3>PRS1B_FUN_ARG</span><span class=cF0>);
|
|
<a name="l403"></a>
|
|
<a name="l404"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l405"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l406"></a>}
|
|
<a name="l407"></a>
|
|
<a name="l408"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>PrsVarLst</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc,</span><span class=cF9>CHashClass</span><span class=cF0> *tmpc,</span><span class=cF9>I64</span><span class=cF0> mode,</span><span class=cF9>I64</span><span class=cF0> union_base=0)
|
|
<a name="l409"></a>{
|
|
<a name="l410"></a> </span><span class=cF9>I64</span><span class=cF0> i,k,old_flags=cc->flags,old_flags2,type,_reg;
|
|
<a name="l411"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc1,*tmpc2;
|
|
<a name="l412"></a> </span><span class=cF9>CHash</span><span class=cF0> *tmph;
|
|
<a name="l413"></a> </span><span class=cF9>CMemberLst</span><span class=cF0> *tmpm;
|
|
<a name="l414"></a> </span><span class=cF9>CMemberLstMeta</span><span class=cF0> *tmp_meta;
|
|
<a name="l415"></a> </span><span class=cF1>U8</span><span class=cF0> *machine_code;
|
|
<a name="l416"></a> </span><span class=cF1>Bool</span><span class=cF0> undef_array_size,first;
|
|
<a name="l417"></a> cc->flags|=</span><span class=cF3>CCF_DONT_MAKE_RES</span><span class=cF0>;
|
|
<a name="l418"></a> </span><span class=cF1>if</span><span class=cF0> (mode.u8[1]==</span><span class=cF3>PRS1B_CLASS</span><span class=cF0>)
|
|
<a name="l419"></a> cc->flags|=</span><span class=cF3>CCF_CLASS_DOL_OFFSET</span><span class=cF0>;
|
|
<a name="l420"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>mode.u8[1]!=</span><span class=cF3>PRS1B_LOCAL_VAR</span><span class=cF0> && mode.u8[1]!=</span><span class=cF3>PRS1B_STATIC_LOCAL_VAR</span><span class=cF0> ||
|
|
<a name="l421"></a> mode&</span><span class=cF3>PRSF_UNION</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF7>(</span><span class=cF0>cc->token==</span><span class=cF6>'('</span><span class=cF0> || cc->token==</span><span class=cF6>'{'</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l422"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l423"></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="l424"></a> </span><span class=cF1>if</span><span class=cF0> (mode&</span><span class=cF3>PRSF_UNION</span><span class=cF0>)
|
|
<a name="l425"></a> cc->class_dol_offset=union_base;
|
|
<a name="l426"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l427"></a> cc->class_dol_offset=tmpc->size;
|
|
<a name="l428"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token==</span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l429"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l430"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token==</span><span class=cF6>'$'</span><span class=cF0>) {
|
|
<a name="l431"></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 $</span><span class=cF0>
|
|
<a name="l432"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting '=' at "</span><span class=cF0>);
|
|
<a name="l433"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip =</span><span class=cF0>
|
|
<a name="l434"></a> cc->class_dol_offset=</span><span class=cF5>LexExpression</span><span class=cF0>(cc);
|
|
<a name="l435"></a> </span><span class=cF1>if</span><span class=cF0> (-cc->class_dol_offset>tmpc->neg_offset)
|
|
<a name="l436"></a> tmpc->neg_offset=-cc->class_dol_offset;
|
|
<a name="l437"></a> </span><span class=cF1>if</span><span class=cF0> (mode&</span><span class=cF3>PRSF_UNION</span><span class=cF0>)
|
|
<a name="l438"></a> union_base=cc->class_dol_offset;
|
|
<a name="l439"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l440"></a> tmpc->size=cc->class_dol_offset;
|
|
<a name="l441"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token!=</span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l442"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l443"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip ;</span><span class=cF0>
|
|
<a name="l444"></a> }
|
|
<a name="l445"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>')'</span><span class=cF0> || cc->token==</span><span class=cF6>'}'</span><span class=cF0>) {
|
|
<a name="l446"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l447"></a> </span><span class=cF1>goto</span><span class=cF0> pvl_done;
|
|
<a name="l448"></a> }
|
|
<a name="l449"></a> _reg=</span><span class=cF3>REG_UNDEF</span><span class=cF0>;
|
|
<a name="l450"></a>pvl_restart1:
|
|
<a name="l451"></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>) {
|
|
<a name="l452"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_REG</span><span class=cF0>:
|
|
<a name="l453"></a> _reg=</span><span class=cF3>REG_ALLOC</span><span class=cF0>;
|
|
<a name="l454"></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>
|
|
<a name="l455"></a> k=</span><span class=cF5>DefineMatch</span><span class=cF0>(cc->cur_str,</span><span class=cF6>"ST_U64_REGS"</span><span class=cF0>);
|
|
<a name="l456"></a> </span><span class=cF1>if</span><span class=cF0> (k>=0) {
|
|
<a name="l457"></a> _reg=k;
|
|
<a name="l458"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l459"></a> }
|
|
<a name="l460"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l461"></a> </span><span class=cF1>goto</span><span class=cF0> pvl_restart1;
|
|
<a name="l462"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_NOREG</span><span class=cF0>:
|
|
<a name="l463"></a> _reg=</span><span class=cF3>REG_NONE</span><span class=cF0>;
|
|
<a name="l464"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l465"></a> </span><span class=cF1>goto</span><span class=cF0> pvl_restart1;
|
|
<a name="l466"></a> }
|
|
<a name="l467"></a>
|
|
<a name="l468"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF3>TK_ELLIPSIS</span><span class=cF0> && mode.u8[1]==</span><span class=cF3>PRS1B_FUN_ARG</span><span class=cF0>) {
|
|
<a name="l469"></a> </span><span class=cFD>PrsDotDotDot</span><span class=cF0>(cc,tmpc,_reg);
|
|
<a name="l470"></a> </span><span class=cF1>goto</span><span class=cF0> pvl_done;
|
|
<a name="l471"></a> }
|
|
<a name="l472"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l473"></a> tmph=cc->hash_entry;
|
|
<a name="l474"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l475"></a> tmph=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l476"></a> </span><span class=cF1>if</span><span class=cF0> (!tmph)
|
|
<a name="l477"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l478"></a> k=</span><span class=cF5>PrsKeyWord</span><span class=cF0>(cc);
|
|
<a name="l479"></a> </span><span class=cF1>if</span><span class=cF0> (k==</span><span class=cF3>KW_UNION</span><span class=cF0>) {
|
|
<a name="l480"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l481"></a> </span><span class=cFD>PrsVarLst</span><span class=cF0>(cc,tmpc,mode|</span><span class=cF3>PRSF_UNION</span><span class=cF0>,tmpc->size);
|
|
<a name="l482"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l483"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmph->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="l484"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Expecting type at "</span><span class=cF0>);
|
|
<a name="l485"></a> first=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l486"></a>pvl_restart2:
|
|
<a name="l487"></a> tmpc1=tmph;
|
|
<a name="l488"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l489"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip type or ','</span><span class=cF0>
|
|
<a name="l490"></a> tmpm=</span><span class=cFD>MemberLstNew</span><span class=cF0>(_reg);
|
|
<a name="l491"></a> _reg=</span><span class=cF3>REG_UNDEF</span><span class=cF0>;
|
|
<a name="l492"></a> </span><span class=cF1>if</span><span class=cF0> (mode.u8[1]==</span><span class=cF3>PRS1B_STATIC_LOCAL_VAR</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l493"></a> tmpm->flags|=</span><span class=cF3>MLF_STATIC</span><span class=cF0>;
|
|
<a name="l494"></a> tmpm-></span><span class=cF1>reg</span><span class=cF0>=</span><span class=cF3>REG_NONE</span><span class=cF0>;
|
|
<a name="l495"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l496"></a> </span><span class=cF1>if</span><span class=cF0> (mode.u8[1]==</span><span class=cF3>PRS1B_FUN_ARG</span><span class=cF0> || mode.u8[1]==</span><span class=cF3>PRS1B_LOCAL_VAR</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l497"></a>pvl_restart3:
|
|
<a name="l498"></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>) {
|
|
<a name="l499"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_REG</span><span class=cF0>:
|
|
<a name="l500"></a> tmpm-></span><span class=cF1>reg</span><span class=cF0>=</span><span class=cF3>REG_ALLOC</span><span class=cF0>;
|
|
<a name="l501"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l502"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l503"></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>
|
|
<a name="l504"></a> k=</span><span class=cF5>DefineMatch</span><span class=cF0>(cc->cur_str,</span><span class=cF6>"ST_U64_REGS"</span><span class=cF0>);
|
|
<a name="l505"></a> </span><span class=cF1>if</span><span class=cF0> (k>=0) {
|
|
<a name="l506"></a> tmpm-></span><span class=cF1>reg</span><span class=cF0>=k;
|
|
<a name="l507"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l508"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l509"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l510"></a> }
|
|
<a name="l511"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l512"></a> </span><span class=cF1>goto</span><span class=cF0> pvl_restart3;
|
|
<a name="l513"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_NOREG</span><span class=cF0>:
|
|
<a name="l514"></a> tmpm-></span><span class=cF1>reg</span><span class=cF0>=</span><span class=cF3>REG_NONE</span><span class=cF0>;
|
|
<a name="l515"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l516"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l517"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l518"></a> </span><span class=cF1>goto</span><span class=cF0> pvl_restart3;
|
|
<a name="l519"></a> }
|
|
<a name="l520"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l521"></a> tmpm->member_class=</span><span class=cFD>PrsType</span><span class=cF0>(cc,&tmpc1,&mode,tmpm,&tmpm->str,
|
|
<a name="l522"></a> &tmpm->fun_ptr,</span><span class=cF3>NULL</span><span class=cF0>,&tmpm->dim,0);
|
|
<a name="l523"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->fun_ptr)
|
|
<a name="l524"></a> tmpm->flags|=</span><span class=cF3>MLF_FUN</span><span class=cF0>;
|
|
<a name="l525"></a> </span><span class=cF1>if</span><span class=cF0> (first)
|
|
<a name="l526"></a> </span><span class=cFD>MemberAdd</span><span class=cF0>(cc,tmpm,tmpc,mode.u8[1]);
|
|
<a name="l527"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l528"></a> </span><span class=cFD>MemberAdd</span><span class=cF0>(cc,tmpm,tmpc,</span><span class=cF3>PRS1B_NULL</span><span class=cF0>);
|
|
<a name="l529"></a> tmpc->member_cnt++;
|
|
<a name="l530"></a>
|
|
<a name="l531"></a> tmpc2=tmpm->member_class;
|
|
<a name="l532"></a> i=tmpc2->size*tmpm->dim.total_cnt;
|
|
<a name="l533"></a> </span><span class=cF1>switch</span><span class=cF0> (mode.u8[1]) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l534"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS1B_STATIC_LOCAL_VAR</span><span class=cF0>:
|
|
<a name="l535"></a> </span><span class=cF1>if</span><span class=cF0> (i<0) {
|
|
<a name="l536"></a> i=0;
|
|
<a name="l537"></a> undef_array_size=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l538"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l539"></a> undef_array_size=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l540"></a> </span><span class=cF1>if</span><span class=cF0> (mode&</span><span class=cF3>PRSF_UNION</span><span class=cF0>)
|
|
<a name="l541"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Static unions are not implemented "</span><span class=cF0>);
|
|
<a name="l542"></a> k=(i+7)&~7;
|
|
<a name="l543"></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="l544"></a> tmpm->static_data=</span><span class=cF5>MAlloc</span><span class=cF0>(k);
|
|
<a name="l545"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l546"></a> tmpm->static_data=</span><span class=cF5>MAlloc</span><span class=cF0>(k,</span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l547"></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="l548"></a> tmpm->static_data_rip=cc->aotc->rip;
|
|
<a name="l549"></a> k>>=3;
|
|
<a name="l550"></a> </span><span class=cF1>while</span><span class=cF0> (k--)
|
|
<a name="l551"></a> </span><span class=cFD>AOTStoreCodeU64</span><span class=cF0>(cc,0);
|
|
<a name="l552"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l553"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_var_init_flag</span><span class=cF0>)
|
|
<a name="l554"></a> </span><span class=cF5>MemSet</span><span class=cF0>(tmpm->static_data,</span><span class=cFB>sys_var_init_val</span><span class=cF0>,k);
|
|
<a name="l555"></a> </span><span class=cF5>LexPopNoRestore</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> cc->flags=cc->flags&
|
|
<a name="l558"></a> ~</span><span class=cF3>CCF_DONT_MAKE_RES</span><span class=cF0>|old_flags&</span><span class=cF3>CCF_DONT_MAKE_RES</span><span class=cF0>;
|
|
<a name="l559"></a> </span><span class=cF1>if</span><span class=cF0> (undef_array_size) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l560"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l561"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l562"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip =</span><span class=cF0>
|
|
<a name="l563"></a> </span><span class=cFD>PrsStaticInit</span><span class=cF0>(cc,tmpm,1);
|
|
<a name="l564"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l565"></a> i=tmpc2->size*tmpm->dim.total_cnt;
|
|
<a name="l566"></a> k=(i+7)&~7;
|
|
<a name="l567"></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="l568"></a> k>>=3;
|
|
<a name="l569"></a> </span><span class=cF1>while</span><span class=cF0> (k--)
|
|
<a name="l570"></a> </span><span class=cFD>AOTStoreCodeU64</span><span class=cF0>(cc,0);
|
|
<a name="l571"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l572"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_var_init_flag</span><span class=cF0>)
|
|
<a name="l573"></a> </span><span class=cF5>MemSet</span><span class=cF0>(tmpm->static_data,</span><span class=cFB>sys_var_init_val</span><span class=cF0>,k);
|
|
<a name="l574"></a> </span><span class=cF5>LexPopRestore</span><span class=cF0>(cc);
|
|
<a name="l575"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l576"></a> </span><span class=cF5>LexPush</span><span class=cF0>(cc);
|
|
<a name="l577"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip =</span><span class=cF0>
|
|
<a name="l578"></a> </span><span class=cFD>PrsStaticInit</span><span class=cF0>(cc,tmpm,2);
|
|
<a name="l579"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l580"></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="l581"></a> </span><span class=cF1>for</span><span class=cF0> (k=0;k<i;k++)
|
|
<a name="l582"></a> </span><span class=cFD>AOTStoreCodeU8At</span><span class=cF0>(cc,tmpm->static_data_rip+k,
|
|
<a name="l583"></a> tmpm->static_data[k]);
|
|
<a name="l584"></a> tmpm->use_cnt=0;
|
|
<a name="l585"></a> cc->flags|=</span><span class=cF3>CCF_DONT_MAKE_RES</span><span class=cF0>;
|
|
<a name="l586"></a> }
|
|
<a name="l587"></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="l588"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpm->static_data);
|
|
<a name="l589"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l590"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS1B_LOCAL_VAR</span><span class=cF0>:
|
|
<a name="l591"></a> </span><span class=cF1>if</span><span class=cF0> (mode&</span><span class=cF3>PRSF_UNION</span><span class=cF0>) {
|
|
<a name="l592"></a> </span><span class=cF1>if</span><span class=cF0> (union_base-tmpc->size<i)
|
|
<a name="l593"></a> i=union_base-i-tmpc->size;
|
|
<a name="l594"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l595"></a> i=0;
|
|
<a name="l596"></a> }
|
|
<a name="l597"></a> </span><span class=cF1>if</span><span class=cF0> (i>=8)
|
|
<a name="l598"></a> tmpc->size=(tmpc->size-i)&~7;
|
|
<a name="l599"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i>=4)
|
|
<a name="l600"></a> tmpc->size=(tmpc->size-i)&~3;
|
|
<a name="l601"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i>=2)
|
|
<a name="l602"></a> tmpc->size=(tmpc->size-i)&~1;
|
|
<a name="l603"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l604"></a> tmpc->size-=i;
|
|
<a name="l605"></a> tmpm-></span><span class=cF1>offset</span><span class=cF0>=tmpc->size;
|
|
<a name="l606"></a> tmpm->size=i;
|
|
<a name="l607"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>'='</span><span class=cF0>) {
|
|
<a name="l608"></a> cc->flags=cc->flags&~</span><span class=cF3>CCF_DONT_MAKE_RES</span><span class=cF0>|
|
|
<a name="l609"></a> old_flags&</span><span class=cF3>CCF_DONT_MAKE_RES</span><span class=cF0>;
|
|
<a name="l610"></a> </span><span class=cF5>LexPopRestore</span><span class=cF0>(cc);
|
|
<a name="l611"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l612"></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="l613"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l614"></a> tmpm->use_cnt=0;
|
|
<a name="l615"></a> cc->flags|=</span><span class=cF3>CCF_DONT_MAKE_RES</span><span class=cF0>;
|
|
<a name="l616"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l617"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l618"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l619"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS1B_FUN_ARG</span><span class=cF0>:
|
|
<a name="l620"></a> </span><span class=cF1>if</span><span class=cF0> (mode&</span><span class=cF3>PRSF_UNION</span><span class=cF0>) {
|
|
<a name="l621"></a> tmpm-></span><span class=cF1>offset</span><span class=cF0>=union_base;
|
|
<a name="l622"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->size-union_base<8)
|
|
<a name="l623"></a> tmpc->size=8+union_base;
|
|
<a name="l624"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l625"></a> tmpm-></span><span class=cF1>offset</span><span class=cF0>=tmpc->size;
|
|
<a name="l626"></a> tmpc->size+=8;
|
|
<a name="l627"></a> }
|
|
<a name="l628"></a> tmpm->size=8;
|
|
<a name="l629"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token==</span><span class=cF6>'='</span><span class=cF0>) {
|
|
<a name="l630"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l631"></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_LASTCLASS</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l632"></a> tmpm->flags|=</span><span class=cF3>MLF_LASTCLASS</span><span class=cF0>;
|
|
<a name="l633"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l634"></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="l635"></a> old_flags2=cc->flags;
|
|
<a name="l636"></a> cc->flags&=~</span><span class=cF3>CCF_HAS_MISC_DATA</span><span class=cF0>;
|
|
<a name="l637"></a> machine_code=</span><span class=cF5>LexExpression2Bin</span><span class=cF0>(cc,&type);
|
|
<a name="l638"></a> </span><span class=cF1>if</span><span class=cF0> (!machine_code)
|
|
<a name="l639"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l640"></a> tmpm->dft_val=</span><span class=cF5>Call</span><span class=cF0>(machine_code);
|
|
<a name="l641"></a> tmpc2=</span><span class=cF5>OptClassFwd</span><span class=cF0>(tmpc2);
|
|
<a name="l642"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc2->raw_type==</span><span class=cF3>RT_F64</span><span class=cF0>) {
|
|
<a name="l643"></a> </span><span class=cF1>if</span><span class=cF0> (type!=</span><span class=cF3>RT_F64</span><span class=cF0>)
|
|
<a name="l644"></a> tmpm->dft_val(</span><span class=cF1>F64</span><span class=cF0>)=tmpm->dft_val;
|
|
<a name="l645"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l646"></a> </span><span class=cF1>if</span><span class=cF0> (type==</span><span class=cF3>RT_F64</span><span class=cF0>)
|
|
<a name="l647"></a> tmpm->dft_val=tmpm->dft_val(</span><span class=cF1>F64</span><span class=cF0>);
|
|
<a name="l648"></a> }
|
|
<a name="l649"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_HAS_MISC_DATA</span><span class=cF0>) {
|
|
<a name="l650"></a> tmpm->dft_val=</span><span class=cF5>StrNew</span><span class=cF0>(tmpm->dft_val);
|
|
<a name="l651"></a> tmpm->flags|=</span><span class=cF3>MLF_STR_DFT_AVAILABLE</span><span class=cF0>;
|
|
<a name="l652"></a> }
|
|
<a name="l653"></a> </span><span class=cF5>Free</span><span class=cF0>(machine_code);
|
|
<a name="l654"></a> cc->flags|=old_flags2&</span><span class=cF3>CCF_HAS_MISC_DATA</span><span class=cF0>;
|
|
<a name="l655"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l656"></a> tmpm->flags|=</span><span class=cF3>MLF_DFT_AVAILABLE</span><span class=cF0>;
|
|
<a name="l657"></a> }
|
|
<a name="l658"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l659"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l660"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>PRS1B_CLASS</span><span class=cF0>:
|
|
<a name="l661"></a> </span><span class=cF1>if</span><span class=cF0> (mode&</span><span class=cF3>PRSF_UNION</span><span class=cF0>) {
|
|
<a name="l662"></a> tmpm-></span><span class=cF1>offset</span><span class=cF0>=union_base;
|
|
<a name="l663"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->size-union_base<i)
|
|
<a name="l664"></a> tmpc->size=i+union_base;
|
|
<a name="l665"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l666"></a> tmpm-></span><span class=cF1>offset</span><span class=cF0>=tmpc->size;
|
|
<a name="l667"></a> tmpc->size+=i;
|
|
<a name="l668"></a> }
|
|
<a name="l669"></a> tmpm->size=i;
|
|
<a name="l670"></a> </span><span class=cF1>if</span><span class=cF0> (mode&</span><span class=cF3>PRSF_UNION</span><span class=cF0>)
|
|
<a name="l671"></a> cc->class_dol_offset=union_base;
|
|
<a name="l672"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l673"></a> cc->class_dol_offset=tmpc->size;
|
|
<a name="l674"></a>
|
|
<a name="l675"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token==</span><span class=cF3>TK_IDENT</span><span class=cF0>) {
|
|
<a name="l676"></a> tmp_meta=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMemberLstMeta</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l677"></a> tmp_meta->next=tmpm->meta;
|
|
<a name="l678"></a> tmpm->meta=tmp_meta;
|
|
<a name="l679"></a> tmp_meta->str=cc->cur_str;
|
|
<a name="l680"></a> tmp_meta->flags=0;
|
|
<a name="l681"></a> cc->cur_str=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l682"></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_STR</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l683"></a> tmp_meta->user_data=</span><span class=cF5>LexExtStr</span><span class=cF0>(cc);
|
|
<a name="l684"></a> tmp_meta->flags|=</span><span class=cF3>MLMF_IS_STR</span><span class=cF0>;
|
|
<a name="l685"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l686"></a> tmp_meta->user_data=</span><span class=cF5>LexExpression</span><span class=cF0>(cc);
|
|
<a name="l687"></a> }
|
|
<a name="l688"></a> </span><span class=cF5>LexPopNoRestore</span><span class=cF0>(cc);
|
|
<a name="l689"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l690"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l691"></a> </span><span class=cF1>switch</span><span class=cF0> (cc->token) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l692"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>','</span><span class=cF0>:
|
|
<a name="l693"></a> </span><span class=cF1>if</span><span class=cF0> (mode.u8[1]==</span><span class=cF3>PRS1B_FUN_ARG</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>mode&</span><span class=cF3>PRSF_UNION</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l694"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l695"></a> </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l696"></a> first=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l697"></a> </span><span class=cF1>goto</span><span class=cF0> pvl_restart2;
|
|
<a name="l698"></a> }
|
|
<a name="l699"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l700"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>')'</span><span class=cF0>:
|
|
<a name="l701"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'}'</span><span class=cF0>:
|
|
<a name="l702"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l703"></a> </span><span class=cF1>goto</span><span class=cF0> pvl_done;
|
|
<a name="l704"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>';'</span><span class=cF0>:
|
|
<a name="l705"></a> cc->flags=cc->flags&~</span><span class=cF3>CCF_DONT_MAKE_RES</span><span class=cF0>|
|
|
<a name="l706"></a> old_flags&</span><span class=cF3>CCF_DONT_MAKE_RES</span><span class=cF0>;
|
|
<a name="l707"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l708"></a> cc->flags|=</span><span class=cF3>CCF_DONT_MAKE_RES</span><span class=cF0>;
|
|
<a name="l709"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>mode.u8[1]==</span><span class=cF3>PRS1B_LOCAL_VAR</span><span class=cF0>||mode.u8[1]==
|
|
<a name="l710"></a> </span><span class=cF3>PRS1B_STATIC_LOCAL_VAR</span><span class=cF7>)</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>mode&</span><span class=cF3>PRSF_UNION</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l711"></a> </span><span class=cF1>goto</span><span class=cF0> pvl_done;
|
|
<a name="l712"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l713"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l714"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ';' at"</span><span class=cF0>);
|
|
<a name="l715"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l716"></a> }
|
|
<a name="l717"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l718"></a>pvl_done:
|
|
<a name="l719"></a> cc->flags=cc->flags&~(</span><span class=cF3>CCF_CLASS_DOL_OFFSET</span><span class=cF0>|</span><span class=cF3>CCF_DONT_MAKE_RES</span><span class=cF0>)|
|
|
<a name="l720"></a> old_flags&(</span><span class=cF3>CCF_CLASS_DOL_OFFSET</span><span class=cF0>|</span><span class=cF3>CCF_DONT_MAKE_RES</span><span class=cF0>);
|
|
<a name="l721"></a>}
|
|
</span></pre></body>
|
|
</html>
|