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

Create successful ePaper yourself

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

2AMiniatureSystem Sincetherealpurposeofthissectionistoillustratesystemsprogramming with<strong>Hermes</strong><strong>and</strong>nottodesigntheidealwindowsystem,wewilleliminate thehairydetailsofgraphics,tiling,etc.,<strong>and</strong>striptheproblemtothebare bones. Ournalexamplewillbeadynamicsystem|asimpliedwindowsystem.<br />

SupposeIhaveaterminaldevice.Let'sassumethatitusesthesameoversimpliedterminalinterfacewehavebeenusinginthepreviousexamples:<br />

Mostofthe<strong>Hermes</strong>constructsusedinthisexamplearealreadyfamiliar; howeverwewillintroduce<strong>and</strong>explainafewnewconstructsaswegoalong. 2.1Requirements GetLine<strong>and</strong>PutLine.Inowwouldliketomultiplexthisterminalsothat<br />

withtheapplicationrunninginit. startupanewapplicationinanewwindow,or(3)killawindowtogether window.Inputfromtheterminalwillbedirectedtothewindowcurrently infocus.Fromtheterminal,Icanalso(1)changethecurrentfocus,(2) initsownwindow.Outputfromanapplicationwillbedirectedtoits writtentousetheterminaldevice,sotheyusetheGetLine<strong>and</strong>PutLine Icanrunseveralclientapplications.Eachclientapplicationwasoriginally<br />

line-at-a-timeinterface,asfollows:Everywindowwillhaveacharacter interfaces,too.<br />

stringname.Whenalineiswrittenoutbyanapplication,itwillappear Inthisexample,wewillimplementthesefunctions,usingourlimited, Iwanttodividemyterminalintologicalwindows.Eachapplicationruns<br />

areveescapesequences: byanescapecharacteristreatedspeciallybythewindowmanager.There (!)isassumedtobetypedintothecurrentwindow.Everyinputlineheaded ontheterminalintheform:.Toremindtheuser typedoutasaprompt.Everyinputlinenotheadedbyanescapecharacter whichwindowisinfocus,thenameofwindowcurrentlyinfocuswillbe !Cwindownameapplicationparms-createawindowwindowname !Fwindowname-changefocustowindowname !!line-dispatch!linetothewindowcurrentlyinfocus.Thisis howyousenddatawhichbeginswithanescapecharacter. runningapplication

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

Saved successfully!

Ooh no, something went wrong!