EditedbyTeitelmanonNovember3,198210:45amthisinterfaceisintendedtobefairlystable,andcontainsvariousroutinesusedinandimplementedbytheuserexecpackagewhichmayalsobeofgeneraluse.DIRECTORYRopeUSING[ROPE],SpellUSING[SpellingList,SpellingGenerator,Modes,Filter],UserExecUSING[ExecHandle],ViewerClassesUSING[Viewer];UserExecUtilities:CEDARDEFINITIONS=BEGINTypesROPE:TYPE=Rope.ROPE;ExecHandle:TYPE=UserExec.ExecHandle;Viewer:TYPE=ViewerClasses.Viewer;InvokingspellingcorrectorproceduresthatinvokethespellingcorrectorusingexecHandletosupplyconvenientdefaultsforinforming,confirming,andaborting.IfclienthasanexecHandleinhand,thisistherightwaytocallthespellingcorrector.GetTheOne:PROCEDURE[unknown:ROPE,spellingList:Spell.SpellingList_NIL,generator:Spell.SpellingGenerator_NIL,exec:ExecHandle,viewer:Viewer_NIL,--eitherexecorviewershouldbesupplied.Ifexec#NILthenusesExecConfirm,otherwiseifviewer#NIL,usesViewerConfirm.filter:Spell.Filter_NIL,modes:Spell.Modes_NIL]RETURNS[correct:ROPE];callsSpell.GetTheOne,providingargumentsforabortProc,confirmProc,andinformProcthatusethecorrespondingExecHandle.Abortingcanbeperformedbyeithertypingcontrol-DELwhentheexecviewerhastheinputfocus,orusingtheSTOPbutton.ConfirmationisperformedviaExecConfirm,describedbelow..GetMatchingList:PROCEDURE[unknown:ROPE,spellingList:Spell.SpellingList_NIL,generator:Spell.SpellingGenerator_NIL,exec:ExecHandle,viewer:Viewer_NIL,--eitherexecorviewershouldbesupplied.Ifexec#NILthenusesExecConfirm,otherwiseifviewer#NIL,usesViewerConfirm.filter:Spell.Filter_NIL,modes:Spell.Modes_NIL]1p a2 i\ M#'R _ {Z$&,058:=? EF ^1 i" &q Zr Y"qY"Y"rY"qDY"rUY"Y" Wrq{WraWrrWr Wr ', Uq&U UrUUU T qTTrTzT Rbs MSrMSqMSPMS r$oMSq Irs Et Blr!BlqBlBlruBl[BlqBlBlrBlu @ r9@q6@@r@r@u ? r ? q? ? r_? D? s :p 7 ! &*T 13\7 >9C< 5 Z ~""$d(*,| 359=;=A?BE 46f u 2r2q2.2r$20q0o0r0/&  q"N/&#7/&r$Z/&-v #cq$-v%-vr&-v+ *q+**r7*p**!$&*/06{8 ;%= @/C:(o q"$(N+2 r& q&u&r&% qF%.%r#`q!r!c!qn!B!r!!p (!(s* 14 9>; BEY-  !'*+2947; D-Im/ $&B),&0i5 =Q>E X!{u [r<[q[f[r][qor  q"N#7r$ZK #cq$K%Kr&K q+r7p!$&*/06{8 ;%= @/C:D q"$(N+2 r  q u r   qF . r 5v)TVm$gRETURNS[matches:LISTOFROPE];filesCheckForFile:PROC[file:ROPE]RETURNS[found:BOOLEAN];returnsTRUEiffileisonthelocaldiskGetTheFile:PROC[file:ROPE,defaultExt:ROPE_NIL,exec:ExecHandle,modes:Spell.Modes_NIL]RETURNS[correct:ROPE];Firstcheckstoseeiffile(orfile.defaultExt)exists,andifnot,callsSpell.GetTheFileprovidingsuitableargumentsforabortProc,confirmProcandinformProcthatusethecorrespondingExecHandle.GetMatchingFileList:PROC[file:ROPE,defaultExt:ROPE_NIL,exec:ExecHandle,modes:Spell.Modes_NIL]RETURNS[matches:LISTOFROPE];likeGetFileNameexceptalwaysreturnsalistoffiles.Iffiledoesnotcontainapattern,thenGetMatchingFileListcallsGetFileNameandreturnsLISTofthatfileiffound,otherwiseNIL.Iffiledoescontainapattern,callsSpell.GetFileNames,withappropriateargumentsforinform,confirm,andabort.confirmationViewerConfirm:PROC[msg:ROPE,viewer:Viewer,timeout:INT_-1,defaultConfirm:BOOL_FALSE]RETURNS[BOOLEAN];providesastandardwayofaskingusertoconfirmanoperationinaviewer.Theconfirmationmessage,msg,isprintedinthemessagewindow.Then,theyes/nobuttonisposted,whichallowstheusertoconfirmorrejectthecorrection.Theusercanconfirmahead,orrejectahead,assoonasSetupViewerConfirmhasbeencalled.(IftheimplementorwishestoaborttheoperationsoonerthanthecalltoViewerConfirm,hecandetermineifindeedtheuserhasconfirmed/deniedaheadusingGetConfirmationdefinedbelow.Inthiscase,theimplementormustcallFinishedViewerConfirmhimself).iftimeout#-1,andtheuserhasnotconfirmedbeforetimeoutmillisecondshaveelapsed,thendefaultConfirmisreturnedasthevalueoftheconfirmation.SetupConfirm:PROC[viewer:Viewer];Calltosetupmenu,etc.,toenableconfirmationahead.FinishedConfirm:PROC[viewer:Viewer];Calltotakedownmenu,etc.NotapartofViewerConfirmbecauseViewerConfirmmaynotbecalledincasethatconfirmationisnotrequired.ExecConfirm:PROC[msg:ROPE,timeout:INT_-1,defaultConfirm:BOOL_FALSE,exec:ExecHandle]RETURNS[BOOLEAN];likeViewerConfirm,except(a)theconfirmationmessageisprintedintheexecutive,ratherthanthemessagewindow.Theusercanconfirmusingthekeyboard,i.e.typey,n,ordel,providedhehasnottypedahead.Typinganythingelse,e.g.?,willcausetheusertobepromptedwithhisoptionsandallowhimtoconfirm/rejectonceagain.Iftheuserhastypedahead,hecanonlyconfirmusingthemenubutton,inorderthatthetypeaheadnotbeinterferedwith.notethatSetupConfirmandFinishedConfirmmustbeusedthesameasforViewerConfirm.lowerlevelfacilities.Providedmainlyincaseimplementorwantstobeabletocheckwhetheruserhasconfirmedordeniedahead,e.g.toaborttheoperation.GetConfirmation:PROC[viewer:Viewer]RETURNS[hasConfirmed,confirmed:BOOL];2qb&rb&cb&q*b&b&r"b&"b&s ]u Z rZqZZrZZqZZrZqZ Zr%Z&3Zq*Z+sZr0ZZ0ZpXl, k#u U rUqUrUrWUUqUpUrUU q%U&Ur)-Uq*U+Ur,U-U16 S q5SSr@Sq(SSr#S#|Sq(S)[Sr+S+SpRKM5h(,/p036@Ptc ## *-x 47`9< N u KhrKhqKh*KhrKhrKhq UKh!)Khr#fKh$CKh q+kKh,?Khr.Khq0sKh1[Khr2~Kh3[Kh6 > I q4IIr@Iq'IIrIIq$I%I')r,I-2IpH 7!&''\)+?.o/2Q5V7<=BFg &).*236u8:>GD1GD5: ?:"T.1 8?YAC4s > u ; r;q;;rg;;q&;;r 7;!;%*q0;0;r3;4;6q@;Ay;rDU;q 9rn9qU9)9r9q@9r9C9p80Ez\"%'7,2.%456;r>5 6sB! +q/K15:?;@(D 4-j "b ) +.1A6;:<9?D+E3:N"'&)-+y 397h9 <>D1M "@$&,.12m47:D/y!|%'|*-\/ 7h:.D.,eJ/6% "$+(/64 ;>C* 9 #&(6* u )8 r7)8q4)8)8r)8$)8p'9#u +bu %r%q%s%rX%%p$ =F"#&(3 16 ?BE;"yhW) "#%u r q b rG  q  r  q% % r' ) +q5 6q r9M q: ; r>x ?T   qrrqr v pm r #" +0H16J7:< @vD{-g!$O)I,/,5V7:n;=?DAG1WP )%(+:,/;25289;AvDrw0}" &*.-/247a:?<ACso"#'7*,T/:3'57Z =h  4)~,.137`9;@ s ]1 p   "a&0'),.,279 5? 5v) TVm$SetConfirmation:PROC[viewer:Viewer,confirmed:BOOL];ResetConfirmation:PROC[viewer:Viewer];sharingglobalresourcesAcquireResource:PROC[resource:ATOM,owner:ROPE_NIL,exec:ExecHandle];apackageusedforsharingaglobalresourcebetweenseveralprocesses.Ifoneprocesshasalreadyacquiredtheresource,anattempttoacquireitbyanotherprocesswillprintasuitablemessage,andtheprocesstowaitfortheresourcetobefreed,i.e.AcquireResourcewillnotreturnuntiltheresourceisavailable.However,whilewaitingfortheresourcetobeavailable,theusercanabortviatheusualmechanisms,andAcquireResourcewillraiseUserExec.UserAborted.Forexample,thispackageisusedtomakesurethatthecompilerisnotrunsimultaneouslybymorethanoneexec,byhavingthecompilercallAcquireResource[$Compiler]beforeattemptingtorun.Ownerisusedinthemessagethatisprinted,whenwaiting.Ifowner=NIL,itdefaultsto(thepnameof)resource.owneristypicallyspecifiedwherethesameresourceisbeingsharedbyseveraldifferentclients.Forexample,itisnotpossiblefortwocommandsregisteredviatheExecinterface(asopposedtoUserExec)torunsimultaneously.Inthiscase,AcquireResourceiscalledwithresource=$ExecDotW,andowner=nameofthecommand,sothatAcquireResourcecanprintoutwhoitisthatownstheresource.ReleaseResource:PROC[resource:ATOM];releasesthenamedresource.Nopifnotcurrentlyacquired.miscellaneousRopeSubst:PROC[old,new,base:ROPE,case:BOOLEAN_FALSE,allOccurrences:BOOLEAN_TRUE]RETURNS[value:ROPE];ifoldisnotfoundinbase,thenvalue=base.ifalloccurrencesTHENsubstituteforeachoccurrenceofold,otherwiseonlyforfirst.RopeFromFile:PROC[file:ROPE]RETURNS[value:ROPE];Returnscontentsoffileasrope,orraisesIO.ErrorFileNotFound.END.--UserExecUtilities3u b&rb&qb&sb&rXb&b&$ q+b&,nb&r.b&/Cb&u `r$`q!``r`` s \\u YrYqYYrYYq Y!Yr$aY%=Yq)Y*Yr-_Yq.Y/Yr0Y1Y5h =pWfC#).52 8:S<ACUQD7#$)*,16J8<*=_BVTy 5!&(t*D-0,:}=?uCFRp0 !%)+.K35?7 = ?WB<DP` !o+.T1 O"h C!$&d*,/289;>f G{Mz\| ~Y#&+~.?KK P J,|"$$&b+P.35y9s;X>@.E1H )#%6*0 3689>@\CF>!'#)p*,3.358I> DG1E6f#!8")+&-78;>C^?; o (+$/146J8? @AC!#}&V')+/J1u >r>q>>r>>q >!>r$a>$>p<PK"D#%+s 8 u 5r]5qZ55r5J5 Rq 5!5r#5$5q(<5(5r.F5q/505r3p54M5q>5>5rD 5q 3r3q33rj33q33r3e3p21e|KM!X$&0e  "$( .0q38;>u . r.q.).r.q.qT.(.re.q M.!!.r&>.&.q*.+.r-...p-;kc!x#1&, q )r s)p O) )v)NTVm$ HELVETICA TIMESROMAN TIMESROMAN TIMESROMANYLAUREL TIMESROMAN TIMESROMAN Oj/)3UserExecUtilities.mesa16-Dec-82 16:28:35