--EditedbyTeitelmanonJune10,198211:35am--thisinterfaceisintendedtobeextremelystable,andcontainallthatisnecessaryforvanillauseoftheuserexec.--UserExecUtilitiesisalsoastableinterfacewhichcontainsvariousroutinesusedinandimplementedbytheuserexecpackagewhichmayalsobeofgeneralusetoclients.Thesefacilitiesarecharacterizedingeneralasusingtheexec,butnotbeingthoughtofasfunctionsofanexecutive.--UserExecExtrasisaninterfacewhichcontainsfacilitieswhichmaybeofuseforspecializedapplications.Itexposesalittlemoreofthestructureoftheexecutive,andthereforeislikelytobealittlemorevolatilewithrespecttochanges.--UserExecPrivateisforinternalcommunicationbetweenmodulesofUserExec,and,incertainexceptionalcases,forusebyprivelegedclientsDIRECTORYHistoryUSING[HistoryEvent],IOUSING[STREAM],RopeUSING[ROPE],RTBasicUSING[TV,Type];UserExec:CEDARDEFINITIONS=BEGIN--TypesROPE:TYPE=Rope.ROPE;STREAM:TYPE=IO.STREAM;TV:TYPE=RTBasic.TV;Type:TYPE=RTBasic.Type;ProcTakesAnyReturnsAny:TYPE=PROCANYRETURNSANY;ExecHandle:TYPE=REFExecRecord;ExecRecord:TYPE=RECORD[in,out,error:STREAM,commandLine:ROPE,commandLineStream:STREAM,viewer:REFANY,--NarrowstoViewer.Maybeofinterestifclientwantstoflashtheviewer.butformostapplications,alltheclientwouldusewouldbethehandles.currentEvent:History.HistoryEvent,--usuallyhistorylist.first,butincaseofcompoundevents,thecurrentsubevent.privateStuff:REFExecPrivateRecord];ExecPrivateRecord:TYPE;--opaque.definedinuserexecprivate.Expression:TYPE=REFExpressionRecord;ExpressionRecord:TYPE;CommandProc:TYPE=PROC[exec:ExecHandle,clientData:REFANY_NIL]RETURNS[ok:BOOLEAN_TRUE,msg:Rope.ROPE_NIL];--msgisforinclusioninthehistory,sothatforexampletheusercanseewhetheracompilatonwassuccessful,orwhyanattempttorunaprogramfailed.1p b&%\qOb&b&"$%p y` ~^$(+`002+46i<_>BENF y^ y]5 &'%)l.3i8;=F? G y[  "n$(+3,1c5F :< E( yY9qYYpY Y\!"')b+024 yXC j]"( -y1\4L67:AE yT t ySR @ (B-]24;:=?` yQ f "r yNaq LrtLZLqLL KrKKqKr8KqKeK Ipr?Ip$IpqnIprIpqIpEIp GrGGq=GrGq$GG F$ yBrBB qBr y?qp y@^DG< y%1 }xs!`#')|+q # ?p"##+#$)(14Q58:@E[ y!'q @ r @c @q? @' @ t yOqOrOOqOpDOO!&\(t y qrqBr'qt yq&r#qt yl q6lr4llqlrpllql`l ) r0l0l256q9 lr9l:lq?wl?lrBOlClqHYlr yqU~r9 qrA)qLp y! *R  "%Q'x,/246;= D y { x^ !' qu)TVm$uMethodProc:TYPE=PROC[exec:ExecHandle,clientData:REFANY_NIL]RETURNS[handled:BOOLEAN_FALSE];--creatinganexecutiveCreateUserExecutive:PROCEDURE[name:ROPE_NIL,viewer:REFANY_NIL]RETURNS[exec:ExecHandle];--usedtocreateandstartupaninstanceoftheexecutiveUserExecutive.nameisthecaptionatthetopofthewindow/viewer.name=NILdefaultsto"CedarExecutive".Ifviewerissupplied,itshouldNARROWtoTypescript.TS.GetExecHandle:PROCEDURERETURNS[ExecHandle];--Ifcalledfromprocessrunningdirectlyunderanexechandle,returnsthatexechandle,otherwisereturnsdefaultexechandle--loginandpasswordGetNameAndPassword:PROCRETURNS[name,password:ROPE];SetNameAndPassword:PROC[name,password:ROPE];Login:PROC[in,out:STREAM]RETURNS[name,password:ROPE];--promptsuserfornameandpassword.echoespasswordcharacterswith*.--RegistrationofcommandsandmethodsRegisterCommand:PROC[name:ROPE,proc:CommandProc,briefDoc,doc:ROPE_NIL,clientData:REFANY_NIL];--registersacommandandcorrespondingprocedure.Subsequently,whentheusertypesnameparams{cr},procwillbecalledwiththecorrespondingexecHandle,fromwhichhecanobtaintheinput/outputstreams,aswellasthecommandLine,eitherasaropeorastream.ThecontentsofthecommandLineistherestoftheline(uptoCRor;),i.e.doesnotincludename..--briefDocisabriefdescriptionofthecommandpresentedwhenusertypes?--docismorecompletedescriptionsuppliedwhenusertypesname?.Note:RegisterCommanddoesNOTcalltheproc.--clientDatawillbesuppliedasanargumentwhentheprocedureiscalled.RegisterMethod:PROC[proc:MethodProc,name,doc:ROPE_NIL,clientData:REFANY_NIL];--usedtospecifyhandlingofclassesofinput,e.g.tomaketyping&.mesaopenavieweronthecorrespondingfile.Whenthecorrespondingprocedureiscalled,commandLineistheentireline.Note:itispermissibletoreadfromexec.commandLineStream,asitisreloadedbeforeeachattempttocallamethod.RegisterAlias:PROC[name:ROPE,becomes:ROPE,args:LISTOFROPE_NIL];--registersanalias,asimplemacroexpansionfacilityforcommands.Wheneverbeginsacommandline,itwillbereplacedby,e.g.RegisterAlias["compile","compiler"].Ifargsisnon-NIL,thenthenextntokensonthecommandlinewillbesubstitutedforthenargumentsin,andtheresultingropewillreplacename.--Example:RegisterAlias["rn","copyfoo.mesa_from.mesa';deletefrom.mesa';copyto.mesa_foo.mesa\n",LIST["from","to"]]registersanaliaswhichwillcause"rnuserexecimplUserExecImpl"tobetransformedinto"copyfoo.mesa_userexecimpl.mesa';deleteuserexecimpl.mesa';copy2t yb! qb!rb!b!q@b!r&b!b!qb!b! ' r.b!/b!1|4u5q7b!r8b!9yb!q>-b!>b!rDWb!Eb!q y`{r `{ `{q`{`{p y[ !t yX>qX>rxX> X>q X> yX>r$X>%X>q(-X>r)X>*X>q+X>,X>r1X>2TX>40q7)X>r8X>9X>q:X>r;X><}X>qA1X>AX> yV p T T  KiZM$&0(|.] 7;J<?CEiG ySM h o %'<+ 3148:O?A6 yQ~" t yN\ qN\rN\N\q"sN\"N\ p yL  ~_DX##&( 0347 >D yK yF Yt yBqBrBBq"B"B' r-B.UBq0B0Bt y?q?r??qg?? r'Y?(-?q*j?*?t y<<q <<r<<<<qt<<<<r<<k<<q<<r~<<R<<q#<<#h<<'r-<<.<<q1<<1k<<p y:  h"z&,z 25 y5 /qt y2ZqS2ZrP2Z2Zq2Z@2Zry2ZM2Zq!2Z"g2Z& /5r92Z92Zq<2Zr>2Z>2Zq@2Z@2Z r y0 )"_qk0R0p / /PC % ,_ 48f:=A y-i  nO J" +0 26(: ;>uB y+ g[' , )O-.0 345:=wBDf y* C6 &"$6&(n*>,p/t16qp (w (w&K !$*0 36r9qp & &V !&*w-\05Q9D[ y%,  # ue!X'^*-,3W4t y qrq $(r,,q/~r1 1q34br9:=W@PAqCCp    M!#J'&)+K.37; G y  H U!T,-1=>eu) >TVm$VUserExecImpl.mesa_foo.mesa--abortingUserAbort:PROC[exec:ExecHandle]RETURNS[abort:BOOLEAN];--returnsTRUEiftheuserhasrequestedanabortoftheoperationrunninginexec.Theclientprogramisresponsibleforeffectingtheabort,whichistypicallyperformedbyraisingthesignalUserAborted.SetUserAbort:PROC[exec:ExecHandle];--setstheuserabort,i.e.providesaprogrammablewaytoabort(theoperationcurrentlyrunningin)anexec.ResetUserAbort:PROC[exec:ExecHandle];--turntheabortbitoff.UserAborted:ERROR[msg:ROPE_NIL];--canbeusedbyimplementortoeffectanabortwhentheimplementorhasdetected,viaUserAbort,thattheuserhasabortedtheoperation.Thissignaliscaughtbytheuserexecutive.END.--UserExec3p yb&* y[ t yXCqXCrXCGXCq,XCXC# r!>XC"XCq'/XC'XCr+XC,dXCq1KXC1XCp V V |& %l'_*,.49;>AEp yT ^ $o%+?13r7:0> qt yQ qQrQBQq'QQ p P P  !A *,.2 4:@}EG yNaqt yK qKrKKq}KKt p Ip Ip 8t yF$ qF$rF$F$qpF$F$r/F$F$qF$r 7F$! F$q"CF$"F$p D~ D~ Vf@ #H%;(,G. 6S8>R@ Gk yB @ "&',b.=0 qr y