13.07.2015 Views

The PowerPC 604 RISC Microprocessor - eisber.net

The PowerPC 604 RISC Microprocessor - eisber.net

The PowerPC 604 RISC Microprocessor - eisber.net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

12 Pascal implementation: Compiler and Asse '11er/interpreter Compiler Listing 13569 until Lep » nil;510 if ;left then lcp1".11ink t» fcp else lcp1".rlink t» fcp571 end;572 fcp'.11ink t» nil; fcp".rlink im nil573 end ,(*onterid") 1574575 procedure soarchsectiOn(fcpt ctp; var tcplt ctp);576 ("to find record fields and forward declared procedure id's517 --> procedure proceduredoclaration570 --> procedure selector")579 label 1;580 begin581 while fcp nil do582 it fcp .name - id then goto583 else if fcp".neme < id then fcp 1» fcp".rlink584 else fcp 1. fcp".11inki585 1: fcpl tm fcp586 end ("searchs,oction")567588 procedure saarchid(fidclst setofids; var rcpt ctp);569 label I;590 var Icpt ctp;591 begin592 for disk top downto 0 do593 begin lcp 1» displeytdiaxlanamo;594 while lcp nil do595 if Icp".name » id then596 if ler.kleee in fidels then goto 1597 else590 begin if prterr then arror(103);599 lcp t» Icp'.rlink600 end601 else602 if Icp".name < id then603 lcp tm lcp".rlink<strong>604</strong> else lcp t• Icp".11ink605 end;606 (*search not successful; suppreee.error message in case607 of forward referenced type id in pointer type definition600 --> procedure simpletypo")609 if prterr then610 begin orror(104);611 ("to avoid returning nil, reference an entry612 for an undeclared id of appropriate class613 --> procedure enterundecl*)614 if typos in fickle then lcp t» utypptr615 else616 if yore in fidcle then lcp 1» uvarptr617 oleo618 if field in fidcle then Lep t» ufldptr619 oleo620 if konst in fidcle then lcp uestptr621 else622 if proc in fidcls then lcp t= uprcptr623 she lcp t• ufetptr;624 end;625 1, fcp lcp626 end ("searchid") ;627628 procedure getbounds(fept 84; var Imln,fmaxt integer);629 ("get internal bounds of subrange or scalar typo")630 ("assume fepOintptr and fspOrealptr")631 begin632 (min 0; fmax i ■ 0;633 if fep nil then634 with tap" do635 if form » subrange then636 begin fmin t• nin.ivell fmax max.ival end637 else6 38 if fep • charptr then639 begin fmin t ordminchar; (max t» ordmexcher640 end641 also642 if fconst nil then643 fmax tin fconst".values.ivol644 and ("geLbounds")645646 function allgnquot(fspi etp)s integer;647 begin648 alignquot 1- 1;649 if fep nil then650 with fep" do651 ceee form of652 scalars if fep•intptr then alignquot I» Intel653 oleo if fep-boolptr then alignquot boolel654 else if ecalkind ■ declared then alignquot t- Intel655 else if fep-charptr then alignquot 1» choral656 else if fep-realptr then alignquot realal651 else ("permptr 0 ) alignquot 1- ',small658 subrange[ alignquot t» alignquot(congetypo),659 pointers alignquot adral;660 power, alignquot sotal;661 files, alignquot fileel;662 arrays' alignquot Is alignquot(seltype);663 records, alignquot recal;664 verient,tegfidt orror(501)665 end666 end (*alignquot");667668 procedure elign(tept dip; var tics integer);669 var tc,it integer;670 begin671 k im alignquot(fsp);672 1 1. flc-1;673 flc im 1 + k (k+1) mod k674 end ("align"),675676 procedure printtableo(fbi boolean);677 (*print data otructure end name table")676 var i, lim, disprenge;619680 procedure market;681 ("mark •iota etructure entries to avoid multiple printout")602 vac 1; integer;683684 procedure marketp(fps ctp); forward;665686 procedure markutp(tps sip);687 (*mark data structures, prevent cycles')688 begin689 if fp 0 nil then690 with fp" do691 begin perked 1* true;692 case form of693 scolart694 subrange' marketp(rangetype);695 pointers ("don't mark eltypal cycle possible; will be marked696 anyway, it fp true") i

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

Saved successfully!

Ooh no, something went wrong!