28.01.2015 Views

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

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.

2.8.1ApplicationBuilder unboundedbuer,aninstanceoftheadapter,<strong>and</strong>aninstanceoftheclient. ItalsobuildsaprocesswhichinterpretstheQuitcallmessagebycalling theQuitserviceinboththebuer<strong>and</strong>theadapter. HereisthecodeofApplicationBuilder.Itcreatesaninstanceofthe Hereistheonlytrickypart:ApplicationBuildertruststhebuer,the 2.AMiniatureSystem49<br />

thismightbeanarbitrarymodule,whichmightnotevenreturnfromits initializationcall.SoApplicationBuildershouldbesuretocalltheclient adapter,<strong>and</strong>thequith<strong>and</strong>lerprocesses.Itdoesn'ttrusttheclient,since window.ThiswillcausethequitdispatcherprogramtocallQuitinthe thewindowmanagerwillstillberunning.Theendusercanthenkillthe last.Iftheclientgoesintoaloopordeadlocks,wearestillsafe,because client<strong>and</strong>theapplicationbuilderprocessesbecomeisolated,<strong>and</strong>theywill begarbagecollected. buer<strong>and</strong>theadapter.Whenthebuer<strong>and</strong>theadapterterminate,the ApplicationBuilder: Quit,QuitDispatcher) using(St<strong>and</strong>ard,StartWindowApplication,BBExternal,Adapter,<br />

Adapter process(Init:WindowApplicationIn)<br />

begin declare Parms:WindowApplicationInterface;--initializationcallmessage<br />

block receiveParmsfromInit; Client:St<strong>and</strong>ardOut;--clientprocess ClientGetLine:GetLineOut;--GetLinefromClienttoBuffer ClientGetPgm:GetProgramOut;--GetProgramfromClientto ClientPutLine:PutLineOut;--PutLinefromClienttoAdapter ParmString:Charstring;--parametertoclientprocess declare begin AdapterQuit:QuitOut;--adapter'squitport BufferQuit:QuitOut;--buffer'squitport<br />

Client:=createofParms.GetProgram(Parms.ProgramName); call(BBout#(createofParms.GetProgram("unboundedbuffer"))) call(QuitDispOut#(createofParms.GetProgram("quitdispatcher"))) ParmString:=Parms.ParmString; call(AdapterOut#(createofParms.GetProgram("adapter"))) (Parms.WriteToWindow,Parms.WindowName,Parms.GetProgram, AdapterQuit,ClientPutLine,ClientGetPgm); (0,Parms.InputToWindow,ClientGetLine,BufferQuit); (AdapterQuit,BufferQuit,Parms.Quit);

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

Saved successfully!

Ooh no, something went wrong!