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.

121.4.PuttingProcessesTogether<br />

thecallmayberewrittenusingthefamiliarfunctionnotation.Likeother availablelanguages(asof1989)oer. degreeofcheckinggoesbeyondwhateventhemostmoderncommercially Incidentally,thecalltoGetLinemayalsobewritten: Line:=Parms.GetLine(); Wheneveracallhasnarguments,<strong>and</strong>thelastargumentisareturnvalue, FIGURE1.3.Interfacetoourtypicalclient<br />

expressions,functionsreturnanonymousvalueswhichmaythemselvesbe<br />

Client<br />

usedasoper<strong>and</strong>s.Inthiscase,theresultissimplyassignedtothevariable<br />

seenexamplesofthefollowing<strong>Hermes</strong>statements:assignment,function Line,sothereisnoparticularadvantagetothefunctionnotation.<br />

call,while,block. terface,typestatechecking,exception,exceptionh<strong>and</strong>lerclause.Youhave aboutexceptions.Youhavelearnedthefollowing<strong>Hermes</strong>terminology:in-<br />

denitionsdenewhichparameterspassedascallargumentsfromthecaller <strong>and</strong>whichparametersreturnedtothecallerareexpectedtobeinitialized. Theseexpectationsareenforcedbytypestatechecking.Youhavelearned callmessage.(Thisiscalledpassingparametersbyvalue-result.)Interface Summary:Youhavelearnedthatcallsareprocessedbyexchanginga<br />

intheinitializationcallmessage.Nowyou'regoingtolearntodoyourown otherprocesses<strong>and</strong>bindtheoutputportofonetotheinputportofthe sumedthatallportswereboundbytheparent<strong>and</strong>passedasparameters Sofar,wehavewrittensimpleone-processprograms.Theseprogramsas-<br />

second. systemsprogramming.Wewillwriteaprocessthatwillinstantiatetwo 1.4PuttingProcessesTogether<br />

PutLine,GetLine,<strong>and</strong>GetProgram,sotheyaredepictedasboxeswith threearrowsrepresentingthreeconnectionstotheenvironment. isdepictedingure1.3.Theseprogramsareinitiallypassedthreeports: willconsistofourclientprogram(eitherprogramHelloWorldorprogram Echo|itdoesn'tmatter),connectedtoalterprogram.Thelterhasone TheinterfacewehavebeenusingforprogramsHelloWorld<strong>and</strong>Echo We'regoingtobuildacompositeprogramtothesameinterface.It<br />

GetProgram<br />

GetLine<br />

PutLine

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

Saved successfully!

Ooh no, something went wrong!