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.

221.5.Declarations<strong>and</strong>Denitions St<strong>and</strong>ardIn:inportofSt<strong>and</strong>ardInterfaceffullg; GetProgramInterface:callmessage( St<strong>and</strong>ardOut:outportofSt<strong>and</strong>ardIn; exitffullg; Name:Charstring, TheProgram:Program)<br />

onlyrefertotypesdenedwithinSt<strong>and</strong>arditself,ortopredenedtypes. GetProgramOut:outportofGetProgramIn; enddefinitions ModuleSt<strong>and</strong>arddoesnotimportanyotherdenitionsmodules.Itmay GetProgramIn:inportofGetProgramInterfacefinit(Name)g; exceptionNotFoundfinit(Name)g; constant(Name)<br />

Thismoduledenesfourcallinterfaces.Inourpreviousanalogyofprocessesaselectricalcomponentswithplugs<strong>and</strong>sockets,interfacesdenitions<br />

exitfinit(Name),full(TheProgram)g<br />

informationthatcanbecommunicatedbetweentwoprocesses. describetheshapesoftheplugs<strong>and</strong>sockets.Acallinterfacedenesthe facesmustbedenedindefinitionsmodules<strong>and</strong>processesinprocess modules.Thisseparationmakesaninterfaceavailabletoanyprocessthat wantstouseit.Thecompilerrequiresthataprocessmodulewhichuses evenmoreinformationonainterface. inoutparameters([Ada83]).<strong>Hermes</strong>allows(<strong>and</strong>requires)youtospecify <strong>and</strong>typeofaprocedure'sparameters.Pascalalsoletsaprogrammerdistinguishconstant<strong>and</strong>varparameters;Adaletsyoudistinguishin,out,<strong>and</strong><br />

Youdeneaninterfaceseparatelyfromtheprocessesthatuseit;inter-<br />

Mosthigh-levellanguagesprovideamechanismfordeningthenumber<br />

conformtothesameinterfacecancommunicate. thecallerexpectstoreceiveuponreturn).Anycaller<strong>and</strong>receiverwhich ilarlyitdeneswhatareceiverpromisestoreturn(<strong>and</strong>thereforewhat promisestosend(<strong>and</strong>thereforewhatthereceiverexpectstoreceive);sim-<br />

aninterfaceconformtotheinterface.Theinterfacedeneswhatacaller sage,aninputport,<strong>and</strong>anoutputport. eachparameter.Inthecallingprocess,youmustsupplyalistofarguments selectedcomponentnotation,e.g.Parms.PutLine. ofmatchingtype.Inthecalledprocess,younametheparametersusing alistofthoseparameterswhosevaluesmustnotchangeduringthecall. Eachinterfacetypicallyincludesthree<strong>Hermes</strong>typedenitions:acallmes-<br />

calledprocess. Acallmessagedenitioncontainsadeclarationofthename<strong>and</strong>typeof<br />

fortypestatechecking.Atypestateisasetofprogramattributesknown Youmayincludeaconstantslistinthecallmessagedenition.Thisis Younowneedtosupplytheadditionalinformationwhichisrequired Youmustsupplyalistoftheexceptionswhichmaybereturnedbythe

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

Saved successfully!

Ooh no, something went wrong!