17.05.2015 Views

Pascal News

Pascal News

Pascal News

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.

1681<br />

1682<br />

1683<br />

1684<br />

1685<br />

1686<br />

1687<br />

1688<br />

1689<br />

1690<br />

1691<br />

1692<br />

1693<br />

1694<br />

1695<br />

1696<br />

1697<br />

1698<br />

1699<br />

1700<br />

1701<br />

1702<br />

1703<br />

1704<br />

1705<br />

1706<br />

1707<br />

1708<br />

1709<br />

1710<br />

1711<br />

1712<br />

1713<br />

1714<br />

1715<br />

1716<br />

1718<br />

1719<br />

1720<br />

1722<br />

1723<br />

1724<br />

function element(fsys:sos):sp<br />

):sp;<br />

var lsp,lsp1,hsp:sp; min ,max. :integer; ok:boolean; sepsy:symbol; lip:ip;<br />

oksys :808;<br />

begin insym; nextif(lbrack,..o34); hsp:=n11;<br />

repeat lsp:=newsp(artyp,O); initpos(lsp~ .arpos);<br />

lsp~ .aeltype:=hsp; hsp:=lsp; {link reversed}<br />

if artyp=carray then<br />

begin sepsy:=semicolon; oksys:=[identJ;<br />

lip: =newident( carrbnd ,lsp,n11,..o35);<br />

if" lipnil then enterid (lip);<br />

nextif( colon2, ..036);<br />

lip: =newident( carrbnd ,lsp,lip,..037);<br />

if"lipn11 then enterid(l1p);<br />

next1f(colonl, ..038); lspl: =typid{+039);<br />

ok: =nicescalar( desub( lspl»;<br />

encI<br />

else<br />

begin sepsy:=comma; oksys:=[ident •• lparentJ;<br />

lspl: =simpletyp( fsys+ [comma,rbrack,ofsy,ident•• packedsyJ);<br />

ok:=bounds( lspl,min,max)<br />

end;<br />

if not ok then begin error( +0'10); lsp 1: =nil end;<br />

lsp~ .inxtype:=lspl<br />

until endofloop( fsys+[rbrack,ofsy, ident •• packedsyJ, okays,<br />

sepsy,..o41); {+042)<br />

nextif(rbrack,..o1l3); next1f(ofsy,..o'l'l);<br />

lsp:=element(fsys) ;<br />

if lspnil then sflag:=sflag + lspA .sflag * [withfileJ;<br />

repeat {rever se 1 inks and compute s1 ze)<br />

lap1:=hspA .aeltype; hSpA .aeltype:=lsp; hSpA .sflag:=sflag;<br />

if artyp=arrays then hSpA .size:=arraysize(hsp,spack in sflag);<br />

lsp:=hsp; hsp:=lspl<br />

until hsp=nil; {lsp points to array with highest dimension)<br />

arraytyp: =lap<br />

encI;<br />

function type fays :sos): sp;<br />

var lsp"lsp1!sp; oc,sz,mln,max:lnteger;<br />

sflag:sflagset; Inp:np;<br />

function fldlist(fsys:sos):sp;<br />

{level 2: « typ)<br />

var fip,hip,lip:ip; lsp:sp;<br />

1737<br />

1738<br />

1739<br />

1740<br />

1741<br />

1742<br />

lH3<br />

1744<br />

1745<br />

1746<br />

1747<br />

1748<br />

1749<br />

1750<br />

1751<br />

1752<br />

1753<br />

1754<br />

1755<br />

1756<br />

1757<br />

1758<br />

1759<br />

1760<br />

1761<br />

1762<br />

1763<br />

1764<br />

1765<br />

1766<br />

1767<br />

1768<br />

1769<br />

1770<br />

1771<br />

1772<br />

1773<br />

1774<br />

1775<br />

1776<br />

1777<br />

1778<br />

1779<br />

1780<br />

begin lid:=id; insym end;<br />

end;<br />

if sy=ofsy then {otherwise you may destroy id)<br />

begin id:=lid; l1p:=searchid([typesJ) end;<br />

end;<br />

if lip=nil then tfsp:=nil else tfsp:=lipA .idtype;<br />

if bounds( tfsp,lnt ,nvar) then nvar: =nvar-int+ 1 else<br />

begin nvar: =0:<br />

if tfspnil then begin error(+047); tfsp:=nil end<br />

end;<br />

tspA .tfldsp: =tfsp;<br />

if tipnll then {explicit tag)<br />

begin tipA .1dtype :=tfsp;<br />

tip~ .foffset:=address(oc,sizeof(tfsp) ,spack in sflag)<br />

end;<br />

nextif(ofsy,..o48); minoc:=oc; maxoc:=minoc; headsp:=nil;<br />

repeat hsp:=nil; {for each caselabel list)<br />

repeat nvar:=nvar-1;<br />

int: =cstinteger( fsys+[ident .. plussy ,comma ,colon 1, lparent,<br />

semicolon .casesy,rparent] t tfsp, +049);<br />

lsp:=headsp; {each label may occur only once)<br />

while lspnll do<br />

begin if' lspA .varval=int then error(+050);<br />

lsp:=lspA .nxtvar<br />

end;<br />

vsp:=newsp( variant,O); vsp'" .varval :=int;<br />

vsp'" .nxtvar:=headsp; headsp:=vsp; {ohain of oase labels}<br />

VSpA .subtsp:=hsp; hsp:=vsp;<br />

{use this field to link labels with same variant)<br />

untl.l endofloop( fsys+[oolon 1, lparent,semioolon ,casesy,rparentJ,<br />

[ident •• plussyJ,comma,..o51~; {+052)<br />

nextif(colonl,..o53); nextif( lparent,+054);<br />

tsp 1: =fldlist (fsys+[rparent ,semicolon,ident•• plussyJ);<br />

it oc>maxoo then maxoc: =00;<br />

while v sp nil do<br />

begin VSpA .size:=oc; hsp:=VSpA .subtsp;<br />

VSpA .subtsp:=tspl; vsp:=hsp<br />

encI;<br />

nextif(rparent ,..055);<br />

oc:=minoc;<br />

until lastsemicolon(fsys,[ident •• plussyJ,..o56); (+057 ..058)<br />

if nvar>O then error(-(+059»;<br />

tsp .... fstvar:=headsp; tsp .... size:=minoc; oc:=maxoc; varpart:=tsp;<br />

end;<br />

...,<br />

:J><br />

en<br />

C'""><br />

:J><br />

r-<br />

z:<br />

FT1<br />

:a::<br />

en<br />

N ""<br />

N<br />

0<br />

"" N<br />

\.N<br />

V><br />

FT1<br />

...,<br />

-I<br />

FT1<br />

:3<br />

t:C<br />

FT1<br />

.::0<br />

.....<br />

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

Saved successfully!

Ooh no, something went wrong!