17.01.2013 Views

COMPORT – Compilador Portugol - Nilo Menezes

COMPORT – Compilador Portugol - Nilo Menezes

COMPORT – Compilador Portugol - Nilo Menezes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

while (1);<br />

code[L2] = code[L2] - L3 + L1;<br />

return (L0);<br />

}<br />

else<br />

return (L1);<br />

void<br />

fix (long at, long with)<br />

{<br />

code[at] = code[at] / 0x10000 * 0x10000 + (with % 0x10000);<br />

}<br />

void<br />

FixWith (long L0, long L1)<br />

{<br />

long L2;<br />

while (L0 != 0)<br />

{<br />

L2 = code[L0] % 0x10000;<br />

fix (L0, L1 - L0);<br />

L0 = L2;<br />

}<br />

}<br />

void<br />

FixLink (long L)<br />

{<br />

long L1;<br />

while (L != 0)<br />

{<br />

L1 = code[L] % 0x10000;<br />

fix (L, pc - L);<br />

L = L1;<br />

}<br />

}<br />

void<br />

IncLevel (int n)<br />

{<br />

curlev += n;<br />

}<br />

void<br />

MakeConstItem (Item & x, Type typ, long val)<br />

{<br />

x.mode = Const;<br />

x.type = typ;<br />

x.a = val;<br />

}<br />

void<br />

MakeItem (Item & x, Object y)<br />

{<br />

long r;<br />

x.mode = y->Class;<br />

x.type = y->type;<br />

x.lev = y->lev;<br />

x.a = y->val;<br />

if (y->lev == 0)<br />

ComPort <strong>–</strong> <strong>Compilador</strong> <strong>Portugol</strong><br />

90

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!