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.

ecords<strong>and</strong>callmessages)containpartscalledcomponentswhicharenamed usingthedotnotationcommontomanyprocedurallanguages.Thetype names.Theseidentiersarecalledbasevariables.Structuredvariables(e.g. endprocess Youonlyneedtodeclarethetypeofsimpleidentiersusedasvariable --codeforprocesscompound1.Introductionto<strong>Hermes</strong>21<br />

ofacomponentlikeParms.GetLineisinferredfromthetypeofthebase variableParms.<br />

writedownischeckedagainstthetypethatisinferred. maywriteboolean#'true'insteadof'true'.Inthatcase,thetypeyou maywriteatypespecierevenwhenitisnotnecessary|forexample,you usinginferencerules.Incertaincases,thetypeofanexpressioncannotbe inferred,<strong>and</strong>youmustprecedetheexpressionwithatypespecier.You raryvariabletoholdtheresultofthatexpression.Examplesofexpressions arefunctioncalls(e.g.Parms.GetLine()),arithmeticoperations(e.g.A+B) <strong>and</strong>literals(e.g.'true').Thecompilerinfersthetypeofanexpression Whenyouwriteanexpression,youareimplicitlydeclaringatempo-<br />

denitionsdescribingwhatast<strong>and</strong>ardclientispassedoninitialization,<strong>and</strong> theinterfacestothest<strong>and</strong>ardservicesGetLine,PutLine,<strong>and</strong>GetProgram: 1.5.2Definitions Nowlet'slookatthedenitionsmodules.Let'sbeginwithSt<strong>and</strong>ard|the St<strong>and</strong>ard:using()definitions PutLineInterface:callmessage( Line:Charstring) constant(Line)<br />

GetLineIn:inportofGetLineInterfacefg; GetLineInterface:callmessage( PutLineOut:outportofPutLineIn; PutLineIn:inportofPutLineInterfaceffullg; Line:Charstring) exitfinit(Line)g exceptionEndStreamfg; exitffullg;<br />

St<strong>and</strong>ardInterface:callmessage( GetLineOut:outportofGetLineIn; PutLine:PutLineOut, GetProgram:GetProgramOut, ParmString:Charstring) constant(GetLine,PutLine,GetProgram,ParmString) GetLine:GetLineOut,

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

Saved successfully!

Ooh no, something went wrong!