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.

101.2.GettingStarted|ASimple<strong>Hermes</strong>Program<br />

aserver<strong>and</strong>aclient.Clientsarethemostcommontypeofprocess<strong>and</strong> theeasiesttowrite.Inlatersections,we'llseehowtouse<strong>Hermes</strong>towrite connectotherprocesses.Someprogramsmayplaymultipleroles,e.g.both them.Also,theyareusersofservices|notprovidersofservices.Roughly speaking,clientsmakecalls,serversreceivecalls,<strong>and</strong>shellscreate<strong>and</strong> parentprocess|typicallyashellorsystembuilder|dothebindingfor clientcorrespondstoanapplicationsprogramonconventionaloperating increatingprocesses,orbindingoutputports.Theyarecontenttolettheir shells<strong>and</strong>servers. systems.Clientprogramshaveaspecicjobtodo|they'renotinterested<br />

quenceofthefactthata<strong>Hermes</strong>programisanentiredynamicsystem,not simplyyourapplication.Youhavelearnedthefollowing<strong>Hermes</strong>nomenclature:processmodule,process,variable,type,typefamily,typestate,input<br />

program:rstreceiveaparametercallmessagefromtheinitializationport; port,outputport,callmessage,initializationport,initialized,uninitialized, client,server,<strong>and</strong>shell.Youhaveseenthestructureofatypicalclient Summary:Inthissection,youhaveseenthatin<strong>Hermes</strong>,thereisno ports)arevariables,notconstants.Youhaveseenthatthisisaconse-<br />

globaldata,<strong>and</strong>inparticularfunctionnames(which<strong>Hermes</strong>callsoutput<br />

return. 1.3ASecondProgram Beforemovingontothesystemsprogrammingconstructsin<strong>Hermes</strong>,let's thenusetheoutportportspassedinthatcallmessagetoaccessservices.<br />

lookatonemoreclientprogram,whichweshallcallEcho: Youhavelearnedthefollowing<strong>Hermes</strong>statements:receive,call,<strong>and</strong><br />

block receiveParmsfromInit; declare begin Line:Charstring;--linereadfromst<strong>and</strong>ardinput while('true')repeat callParms.GetLine(Line);<br />

type,togetherwithitsassociatedcallmessagetypeiscalledaninterface, programHelloWorld.Therefore,thevariableParmswillhavethesame componentnames<strong>and</strong>typesasinprogramHelloWorld.Aninputport WeassumethattheinitializationportInitisofthesametypeasin returnParms; on(GetLineInterface.EndStream) endblock; endwhile; callParms.PutLine(Line);

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

Saved successfully!

Ooh no, something went wrong!