You are on page 1of 14
vtitle # Mecnine implementation 1983 tend le once mores iy wores on more than cell. (Clear the file~id field in Fin? 983 Wr in #Readtupla and #Mviteruple feb, 12) 1983 Caanee rxtend# ite once 10) 98S; lake Poraaterile test to see if file already exts oO raturn epror Fi leEx ists, seins using batow to extend file. Few tse Fem, %) 1983 Keurite procedure FExtendfiles change parts of Pdpenriley snd PHriteruple ta use new Pextendr le, Fem. 0) Loe Add’ prac dures PExtendfile, and PilriteTuple. Fen. 1 Leas pe . . Add sracedures PClosefiler and Pkeadiurie. fy 1988 Add Procedures FileleteFiles Pinitializes and POpenFile. Ls 1985 ene’ Rrezter ite uw for the file: and ini i Jan, 29) 198% : Fet termpse to create Extend olocks tslize all created blocks to zeroes. oa Entered routines FUreeteriles Mirror, and deterrf les. tatrder 14 ipdet Lip ided iecdet ft] macros vaacec print texts 2stria bro next tr ° d nexty Busnes sendn Print # Mach wet Error beautst Varian CurdrenF ant las pOspacet Fibs fin ete fat pmec date rayurtsnoexes? ine Col ani per Goehand 14>) (Success 0) )(Meximenk i bes rd) + Maxey leNeme ra) > status constants phoebe {iad fd)» CbadmecNum) + (Ei TeNotipan >) (Mane i] te declarations af taant dame. uarbirtmat ixy tee For=(UFarcot? xab=xabinc setrput spider sbika Maxdeenii te foley Mexdpent': les biel Maxupenr | ple Mexdpenri | Bini Mexupene il tblke | Mexdeenr | pina ob Talke L2erexdeent ile: lest stone @ t slong sechnexeres!sectmourt, slong O40 i any 2 pO space addresses ag) fie 28 ts.recettr fated atric_recettriiolet 32 4 ° pnac_ce rdrnowrt exes? b+ F Routines Minitiatize i dparations initiglize P Machine so tast & opergtions will worn. i Specifically, initistize a Filelds to contain an A element ror avers ‘possinte open filer end eacn : @lement with a uniaue file id, Set PErtFlas = Succe: i preument None. } Side gffectst Fileids, Fide, Perrfles. sentry Finitialize med noven” Fileidssed movi empty 4 movaty ddr of 3 elements cirt Kor roisd to Maxdpentiles-4 dot: movi sel Fite id in selon bert ada! glared Pr of next a element Meaue Pd) ea cro) j insert element at i las to Success. bee § Routines PUreeter i lei lenemes tur lesz ; dperationt — treete file wita nene j With Fixed Lenath : initislize rile to farsumentst ace) ~ address of file dary = address of fixed iodide Effects! Peeriies: Fen sentry Foreaterile emer n> mover Papp. movi’ fans ero. movp = (nO) Fabty. ensine movi a(n Os Panel tna (ro boren ¢r. coal rOy kms fat peal 20h bibs rOrLoy aspu | Getiere las ret vot HOV ¥F lex ists KErrE les idpssen2 chansFent{ styine ret hove 8B (aP) Veb$u_mngs (r2: novi | #extends tape alacray dereate (rey BIDE. POs d9t dassen_3 chan={autl_stvir2) ete Betcrer les nene Fenst indicated in records oF txvtend blocks in ds Fy leNamer upiesize lenstn. Tensth gtring descriptor norecerd size for tile of gap of filename heme lensta descr fame add brea = 304 deci Pasesirad mul|S Peseatr4]#512,iutestr4y tat! peeesinad ret Ad map iteld to caller to use as addr of string descriptor Baro = addr of tuple size of er to receive file id beef i lei) rt to addr BPE o input of #118 neme to open utes; Peses max files epen? no yes - error Bot rgizaddr of fa tuiseddr of fname dsc Bet file name set file ne open tiie on success continue on error exit one mora file open rateaddr of fid elem harseree pid return fid to user beve tile channel save record size Bet. effec record ize, must be even edie oF Xepine as used Te fom se not peag the # of putes. if tite 1s emp ts + don?t map it Feate & ter section using saved chan map wnole file @xpand, region map into Fo returd marr set exit Routine? Foloser ile fetid s purerationt Close (ile identified oy fsleidy deleting virtue j Sddresses file was marred toy and deassisnins the fel tne file was mapped to, Alsoy replace j File id on Filelds aveve ; ments: atAP) ~ address of file id of File to close jide Effects: fErekles, Curdpenfiless Fides, Fileids, Chans, kanses ventra PClosa® ile cméren Sera) movl | Be Cap) pez ho r2t=file id of file to close cnet rasgMaxPenf i les j3 this @ valid (1d? Bissu 10+ i yes hoy! Riad icuréner tas dno error ~ vad file id ret i exit ivit beth ea } is file open? bnes oe byes (reesir () 0 novi hieNotdrensPerrhles fj no = error ~ fife not oren ret boext vet Aettvews ingdr } delete mapped addresses bide PO, 99d oon error exit cir kecsizir cd } Sisnal that file is closed idessen.s chan=Chanstr2d i deassien file channe Bie Roy P9b boon error exit vab Pidsrns T3izaddr of free fids elems muliS rtréleyra ratzoffset into elens for tid Sdai2 hayes” tSiseddr of efem for this Fd insaue (eS) yak ileldsea i Insert et test of free Fid 3 deci Gurdpenf ites fone less oren file vit bsnw | Sebérryvies 4 set PErreflas ret exit Koutines FReadiuplet#ileids fue tesizes Tur leNumber Hug fer) Gperation: ead siven tupie number from file indicated oy fs ieid and return data read into Butta aAraumentst sia) - address of File id for tais file B(AP) - address of size of records in this file i istar)= address Sf record nunber to reed from tile } Le(AP}~ address of descriptor of buffer to read date in } Side Effects: FErrFlas centra #kepd tur be nore Separes) . : (apd are for2tefile id for the file barkMacUr ent i las jis this a velid Eid? Lod Silay ids Herne le } 1O'= error = pad file id we Hecsszinz i 20% 5 noyl Wi leNotoransFErrFlas — j ~ file avi open okt MOTE S Recs izeretyetaterd orl 7 # to reed cnet” rirBetestr2d i te? Blea sub” j record movl — #BadRecNum/PErrF las i bad record num rat } Bots ubI2 Reesiztr2derd i lowest bute # to read hoveas Hensezered sr i of marred eddrs adds “Goren dyes i of record to read movi” Loker) sro” j r Of Huffer descr iFtor movl, Kecgiztr2dard } rlisé of Dytes to nove moves ply er) p@a tno), } head dete into suffer moyl $8UccesS/PErrh Las i Sueet Success ret bent ar Side entra woke subs 99b ment effect Routines werationt Pee iteTue le novi cap | blegu novi ret tstl bnes novi ret aur s cmp i ales emul ediy stl peal ine | movi nov | moves oven l bape ret, Px tevur le G1 leids Tu less zes Tue |eNumber tur fer) Write siven tuple numoer to tae fri Filelds with siven tuple size. Write info in Buffer. ° HErrf las, Kenses B4 Cap) pee brnkuP en Les Recsizir zl GPF lenotarens Erne ies Recs zir2d,@12 rerbytestra] 404 Torkl seo BCExteandesl 2? nS sob ra sextendsra Pasestr2irra ra re 82, Pe ctendé le roe hecsrz re vangestralere hop rrorn a dolar) erg Si zkr eden dh Pi vea (nO) 7 (rad ara) Setirre ies Pere arraans Smee SPATS Tg? indicated oy «file acab) ~ address of file id (fi) BCAR) ~ address of record size f2tar)- address oF record junber ae address of descriptor of buffer to write fe id se valid Fid? error ~ ged file id exit is file open yes, no = error = file nok open exit, ro i= niehest pute $ to write ane there re bytes in file? yes ~ so write tne record. convert roto auad in rains raise Extnd oles rSereme inder if remainder <> 0 then head extend more blocks tise "nine File is to neve r4izé bles to add to file extend tne file by r4 pages Tie, with file id ro ror exit Lowest pute # ta write Of mapped add of record to write roof puffer dsc Hor bates to ur ite butter vor a | side vente Laks 998 tout inet iperationt Ar sument Add #eses pages iow with function Peeess tnat we extends routine is PExtendé ite mercer Senay ad mov | CaP) en? moveo = Fityrd cirt Findunt bd cry hover Fatyra ide itve.. 8, adr =Ransestr 2d boro yt $f Iotmwex tends Ff ibtu_exctl (rap movi B Cap) sf so4l cexsz ers) addi3 Fasestr2i sar) rg hove ryroanay addws VBL LoCray hove move bar Ow.e= botomod i fy: chansirad~ osb= idee a fat ror eet sosbsr0 Seaterrrlas PExtendé i ie(F i leidsPeses) to the fot modify to Riso Use Psdatri st 50 we can end of an, siresdy open ¢ extend the ¢ e. to mer i jntended for use only py routines in 1 hy 50 1t doesn’t check Fileld for validity. alae) - file id of frie to extend BCAP) ~ numberof biocks to extend the file Effects! Kenses, tutes, Peses: Cheng: tose Fabs Fiby Fibdse, Atrist, Fat ilecid. addr OF ret file mapeed to continue tt File exter ray delete Vas bn success on erro Set-up. ¥aiow bo modify file exten using the file?s ch tatus FIbeSs extend Bet new eofik also on error exit set final statu: pn error exit nt £ of blocks in file set # of bytes in file map the file using Saved file channel use mae whole file expand into addr ras In PO space return mapped addres set Perri las exit ist Routines PEs vor Cer rarNum) jeer etiont Return current error stetus into ErrorNum, 4(aPM) ~ address of lonsword te receive error statu Hone. fe Etter i arsument: sentry PEprar novi ret return arror status Routines jeeretions KePor be movi em | Blssu eme | plea movl beat ret, puecann ioese| word Jord ord syser Pep or berror (éresum) Print apron messege essocieted with ErrAun, Becide' it “ErtNum 133 Pmac=specit ic errors if 50 pring @ Mmac~speciiic messase. Otherwise print tne system-wide error message. acai) = address of error numer, saver ror mi? | . 4k ae) ane fo potmarror # Badr id i C lowest! pmac error? By ser foves gtem error roreMaxF i lesteen i S"nisnest ‘Pmac error? precerr pono must peo Pmsc. error rOrMssVec ts dF id eéMext 1 Lesdpen- edt! i PBedF a i iedke 3b Fi lee } rileNoturen 5 MaxF) lesdeen CUPMAC-E-HAUF IM, ¢1le id must be in OiMexdrenk i les~1) (BPHAC-E“SAURECNUM attempt to read record past EOF) (MPMAU-E-FILEEXISTS) this file neme elreedy exists? (MPMAC-E-FILENGTOPEN, attempt to use unopened file id) CAPMAU-E-MAXPILESOPEN) elready have Mexipenfiles open? } Routine! seterrFias i dreretions Set Ferri ies according value In rd. | j iy status (low bit then return Success+ alse pig inte Perr laa. evelue in 6) ar suments t system stetus to decide sow to set PErrf ies from. iodide Effects: Ferrites Setirrf las be ray Lob jf shatuszon then movi #Success/PErrr tas bo PerrFlagt=suce sp } else. 1obt movi rae PEPrF Les FErrk lagt=roz reo Bb oexit

You might also like