PINFOTI(3) ContributedSoftware PINFOTI(3) NAME pinfoti−DescriptionoftheterminalinterfacetotheportableInfocomdatafileinterpreter. SYNOPSIS #include<stdio.h> #include"infocom.h" externgflagstgflags; externchar*tilocation; externchar*tistatus; constchar*scrusage; constchar*scrlongusage; constchar*scroptlist; intscrcmdarg(intargc,char***argvp); intscrgetopt(intc,constchar*arg); voidscrsetup(intmargin, intindent, intlines, intcontext); voidscrbegin(); voidscrputline(constchar*buffer); voidscrputscore(); voidscrputsound(intnumber, intaction, intvolume, intargc); voidscrputmesg(constchar*buffer,Booliserror); intscrgetline(constchar*prompt, intlength, char*buffer); voidscrwindow(intsize); voidscrsetwin(intwin); FILE*scropensf(intlength,char*buffer,inttype); voidscrclosesf(constchar*buffer,FILE*fp,intissave); voidscrend(); voidscrshutdown(); Revision3.0 21October1992 1 PINFOTI(3) ContributedSoftware PINFOTI(3) DESCRIPTION TheseroutinesformtheinterfacebetweentheportableInfocomdatafileinterpreter(pinfocom) andaparticulartypeofterminal.Thepinfocompackagecomeswithinterfacestothefollowing terminaltypes: termcap Thisterminaltypesupportsall(?)UNIXsystemsviaaninterfacetoeithertermcaporterminfoterminalcapabilityandeithertermio,termios,orsgttylinedisciplinecontrol. OptionalsupportfortheGNUreadlinelineeditingandhistorylibraryisalsoavailable. amigaThisterminaltypesupportsanAmigainterface,includingsoundandcommandlineediting.Seeamiga.cforfulldetails. msdosThisterminaltypesupportsMS-DOSbasedsystems.Seemsdos.cforfulldetails. stream ThisterminaltypeshouldsupportanysystemwithaCcompiler;itusessimpleCstdio routinesthatallClibrarieswillhave.Nothingfancy,butitworks. AlsointheworksisanX11-basedinterface. Thismanpagedescribestheinterfacebetweenthepinfointerpreterandtheterminalsupport packagessothatprogrammerscancreatetheirowninterfacestonewsystems.Terminalinterface willbeabbreviatedtoTIbelow. Environment Theinterpreteroperatesintwomodes:game-playingmode(default)andinformationmode(ifany ofthecommand-lineoptions−h,−o,−O,−vand/or−Varegiven),wherethegameisnot playedbutinformationaboutitisinsteaddisplayedonthescreen. Allinputandoutputingame-playingmodeisdoneviathescr*()functionsdescribedbelow. OutputduringinformationmodeisviasimpleCstdiolibraryfunctions. Theonlyinterfacebetweentheinterpreterandtheterminalhandlingcodeisthroughthefunctionsandglobalvariablesdescribedbelow;noothersymbolsintheTIcodeshouldbeexternally visibleandanyotherexternalsymbolsintheinterpretercodearesubjecttochange. GENERAL Somegeneralissuestobeconsidered: AsynchronousEvents TheinterpreterregistersasignalhandlerfortheSIGINTsignalandsetstoignoretheSIGQUIT signal(ifdefined). AnyothersignalsorotherasynchronouseventsarefreetobehandledbytheTIasitseesfit. Note,however,thatnoneofthesehandlerroutinesmaymodifyoraccessanyinterpretervariables: interpretervariableslistedbelowareonlyguaranteedtobevalidwhenoneofthescr*()functions belowhasbeenproperlycalledfromwithintheinterpretercode. ProportionalFonts IftheTIsupportsmultiplefontsitisperfectlyreasonabletouseproportional-widthfontsfor printinggeneralgametextifyouwish. However,atcertainpointsinthegamefixed-widthfontsarerequired,suchaswhenprinting maps,etc.Toaccomodatethis,beforeprintingtothescreenscrputline()(seebelow)should invokethemacroF2ISSET(BFIXEDFONT).Ifthismacroreturnsnon-0thenthecurrent buffershouldbeprintedinafixed-widthfont;ifitreturns0thenaproportional-widthfontmay beusedifdesired. Scripting AllInfocomgamessupportthescriptcommand,whichissupposedtobeginatranscriptofthe user’sadventure.Normallythisinitializedtheprinterandallsubsequenttextandcommands wereprintedtotheprinteraswellastothescreen. Revision3.0 21October1992 2 PINFOTI(3) ContributedSoftware PINFOTI(3) TheTImaysupportthisfeatureaswell.There’snoZ-Codeprimitiveforturningonandoff scripting,however:insteadaflagissetorreset.Inscrputline()andscrgetline()themacro callF2ISSET(BSCRIPTING)shouldbeused;ifitreturnsnon-0thentheoutputlineor promptandcommandshouldbeprintedtothescriptfileaswellasthedisplay. Theinterfacewillcallscropensf()withafiletypeofSFSCRIPTwhenascriptfileistobe openedandscrclosesf()whenascriptfileistobeclosed. FixedWindow OnlySeastalkermakesuseofthefixedwindowfeatureinStandardSeriesgames,butit’sniceto havenevertheless. IftheTIcansupportafixedwindowinadditiontothenormalscrollingtextwindowthen scrbegin()shouldnotifytheinterpreterbycallingF1SETB(BSTATUSWIN).Inthis casethescrwindow()andscrsetwin()functionsdescribedbelowwillbeusedtocreate/manage/deletethefixedwindow. IftheTIcannotsupportafixedwindowthentheabovemacroshouldnotbecalledand scrwindow()andscrsetwin()maybedummyfunctions. GLOBALVARIABLES TheseglobalvariablesaredefinedintheinterpretercodeandmaybeusedbytheTI: gflags Containsglobalflagsandothergeneralvariablesofinterest.Theonlyfieldwhichmaybemodifiedistheprstatusfield,iftheTIdoesn’tsupportstatuslineprinting. tilocation Thisnul-terminatedstringisashortdescriptionofthecurrentlocationoftheplayer,forprinting onthestatusline.Itisusuallydisplayedontheleft-handsideofthestatusline. tistatus Thisnul-terminatedstringcontainsthestatusoftheplayer.Dependingonthegamethismaybe score,scoreandturnnumber,orthecurrenttimeina12-hourclock.Thisstringisusually printedontheright-handsideofthestatusline. TheseglobalvariablesshouldbedefinedintheTI.cfile;theywillbedeclaredexternalwhere usedintheinterpretercode. scrusage Thescrusagevariableshouldbeinitializedtoastringcontaininginfoaboutanyextracommand-lineoptionsthattheTImakesavailable.Here’sanexamplefromthetermcapTI: constchar*scrusage="[-Hfile][-Cfile]"; Iftherearenoextracommand-lineoptionsthevariableshouldbesettotheemptystring(""), notNULL. scrlongusage Thescrlongusagevariableshouldbeinitializedtobeastringcontainingaone-lineperoption descriptionofanyextracommand-lineoptionsthattheTImakesavailable.Here’sanexample fromthetermcapTI: constchar*scrlongusage="\ \t-Hfile\tread/storecommandhistoryinfile\n\ \t-Cfile\tread/storeusercommandcompletionsinfile\n"; Iftherearenoextracommand-lineoptionsthevariableshouldbesettoNULL. scroptlist Thescroptlistvariableshouldbeinitializedtobeastringcontaininggetopt(3)-styledescrip-tionsofanyextracommand-lineoptionsthattheTImakesavailable.Briefly,eachoptioncharac-terisplacedinthestring;iftheoptionhasanargument(nooptionalargumentsallowed)thenit Revision3.0 21October1992 3 PINFOTI(3) ContributedSoftware PINFOTI(3) shouldbeimmediatelyfollowedbyacolon(:).Here’sanexamplefromthetermcapTI: constchar*scroptlist="C:H:"; Iftherearenoextracommand-lineoptionsthevariableshouldbesettothenulstring(""). InterpreterMacros Thefollowingmacrosaredefinedininfocom.handavailabletotheTIwriterforaccesstocertain datastructures. TheflagsavailablewithF1*()macrosare: BUSETIME Ifsetthemtimeisdisplayedonthestatusline,otherwisescore/movesisdisplayed.This isareadonlyvalue;theTIcannotchangeit. BTANDY TheTandylicenseflag;ifsetthenTandylicensingmodeisturnedon,otherwiseit’s turnedoff. BALTPROMPT Thealternatepromptflag;ifsetthenalternatepromptingisenabled,otherwiseit’sdisabled. BSTATUSWIN IfsettheTIsupportsfixedwindows(forSeastalker),ifnotsetitdoesn’t. TheflagsavailablewithF2*()macrosare: BSCRIPTING Ifsetthenscriptingmodeiscurrentlyenabled,otherwiseit’sdisabled. BFIXEDFONT Ifsetthenthecurrentbuffermustbeprintedinafixed-widthfontifpossible;otherwiseit maybeprintedinaproportionalfont. BSOUND Ifsettheinterpretermayissuescrputsound()requests;otherwiseitwon’t.Notethis flagisreadonlyandmaynotbesetbytheTI. F?ISSET() Thismacroreturnsa0ifthespecifiedgameheaderflagisnotset,andanon-0(notenotneces-sarily1!)ifitisnotset. F?SETB() Thismacrosetsthespecifiedgameheaderflag. F?RESETB() Thismacroresets(un-sets)thespecifiedgameheaderflag.Thefollowingfunctionsaredefinedin theinterpreterandavailabletotheTIwriterforuse(nootherfunctionsintheinterpretershould becalled). xmalloc() Thisfunctioncallsmalloc()andexitswithanerrorifthereisnoheapleft. xrealloc() Thisfunctioncallsrealloc()andexitswithanerrorifthereisnoheapleft. chopbuf() bufBuffertobechopped. maxMaxnumberofcharswanted Thisfunctionlocatesthelongestsectionofbuflessthanorequaltomaxcharacterscontaining atleastonecompleteword.Itdoesnotmodifythebuffer.Itreturnsapointertothespace wherethelineshouldbebroken,ortothenulcharacter(’\0’)ifbufislessthanorequaltomax Revision3.0 21October1992 4 PINFOTI(3) ContributedSoftware PINFOTI(3) charslong. Thisfunctionisusefulwithfixed-widthfontTIsforchoppingupthebufferpassedto scrputline()intosectionswhichfitonthescreen.Seeexamplesofitsuseinstream.c. TIFunctions ThefollowingfunctionsneedtobeprovidedbytheTIcode. scrcmdarg() argcNumberofcommand-lineargs. argvp Pointertoanarrayofstrings;eachoneisacommand-lineargument. Thisfunctionwillbecalledbeforeanyotherscr*()function,andbeforethecommand-lineargu-mentsareexaminedbytheinterpreter.ItallowstheTItoadd(andpossiblyremove)arguments tothecommandline. Iftheinterfacehastheabilitytodeterminecommand-lineoptionsfromanalternatesource,such asaconfigurationfile,anenvironmentvariable,windowingresources,orsavedgameresources, thenitshouldaddtheseoptionstoargvpsotheywillbenoticedbytheinterpreter. Notethatwhenaddingoptionstheyshouldbeinsertedbetween(*argvp)[0]and(*argvp)[1], shiftingtheexistingoptionsover,sothattheywillbeproperlyoverriddenbyanyoptionsgivenon thecommandline. Thisfunctionshouldreturnthenumberofelementsinargvpaftermodification(thenewargumentcount).Itisexpectedthatafterthisfunctioniscalled,(*argvp)[0]remainsthenameof theinterpreterprogram,(*argvp)[1]to(*argvp)[argc-1]arecommand-linearguments,and (*argvp)[argc]is0(NULL). Althoughitisperfectlylegaltoremoveargumentsfromargvpaswell,thisistrickierbecause youmustfollowallUNIXgetopt(1)conventions.Itissuggestedthatscrgetopt()isusedto processargumentsonthecommandline,andscrcmdarg()usedonlytoaddextraargumentsif needed. scrgetopt() cThecommand-lineoptioncharacter. argThecommand-lineoptionargument(ifused). Thisfunctionwillbecalledeachtimeanoptionspecifiedinscroptlistisfoundonthecommandline.Itisguaranteedthatonlyoptionscontainedinscroptlistwillbepassed,andeach optionwhichrequiresacommand-lineargumentwillhaveone.Errormessagesforpoorlyformed optionswillbeprintedbytheinterpreterandthisfunctionwillnotbecalled. scrsetup() margin Thenumberofspacesintherightmargin. indent Thenumberofspacesintheleftmargin.Notethatnormallyonlytheoutputtextis indented,notthecommandprompts. linesThenumberoflinesperscreenful.Ifthisvalueisnon-0thentheTImustmakeevery efforttousethisvalueasthenumberoflinesperscreenful.Ifitis0thentheinterface mustinferthescreensizeasbestitcan. context Thenumberoflinesthatshouldbekeptatthetopofthescreenwhenscrolling;this manylinesshouldbeleftatthetopofeachpageofoutputifapagedoutputmodeisin effect. Thisfunctioniscalledafterthegamehasinitializedandexamineditscommand-linearguments butbeforeanythingelseisdone.Itiscalledforbothgame-playingandinformationmodes,soit Revision3.0 21October1992 5 PINFOTI(3) ContributedSoftware PINFOTI(3) shouldperformanysetupnecessaryforgeneralstdioprinting. Thisfunctionshouldreturnthenumberofcharactersthatmaybeprintedononelineininformationalmode.Ifgame-playingmodeistobeusedthenthisvalueisignored. scrshutdown() Thisfunctionshouldperformanygeneralendprocessingappropriateforbothgame-playingand informationalmodes. scrbegin() Thisfunctionwillbecalledjustbeforetheinterpretergoesintogame-playingmode.Iftheinter-preterisrunningininformationmodethisfunctionwillneverbecalled. Anygame-playingmodespecificprocessingshouldbedonehere,suchasopeninganewwindow, clearingthescreen,settingterminalcharacteristics,etc.Afterthisfunctionreturnsthescreen shouldbesetupandthecursorshouldbepositionedatthelower-lefthandcornerofthescreen. Additionally,iftheTIsupportsthecreationofafixedstatuswindow(inadditiontothenormal statusline)itshouldcallthemacroF1SETB(BSTATUSWIN);heretonotifythegameZ-Codesothatitwillproperlycallthescrwindow()andscrsetwin()functions(seebelow). scrend() Thisfunctionshouldperformanyendprocessingappropriateforgame-playingmodeonly,suchas deletingwindows,resettingterminalcharacteristics,etc. scrputline() bufferAnul-terminatedstringcontaininganynumberofcharacters.Thestringmaybeempty, butthepointerwillnotbeNULL.Therewillbenonewlinecharacter(’\n’)attheendof thestring. Thisfunctionshouldprintbuffertothescreen,performingwhateverlinewrapping,paging,etc. isnecessary.Processingshouldproceedasfollows: Foreachlinefulofcharactersinbuffer: *printwhateverindentwasspecified. *printalinefulalongwithanewlineandwhateverscrollingisnecessary. *iftheinterfacesupportspaging,andit’senabled,andit’sbeen(screenful-context)lines sincethelastpromptwasprinted,thenperformwhateverpagingisnecessary. IftheTIsupportsproportional-andfixed-widthfontsthenthemacrocall F2ISSET(BFIXEDFONT)shouldbeusedbeforeprintingeachline;ifthemacroreturns non-0thenthatlinemustbeprintedinafixed-widthfontifpossible(maps,etc.).Ifthemacro returns0thenaproportionalfontmaybeusedifdesired. IftheTIsupportsscriptingthenthemacrocallF2ISSET(BSCRIPTING)shouldbe checked;ifthemacroreturnsnon-0thenbuffershouldbeprintedtothescriptfileaswell. scrputscore() Thisfunctioniscalledwheneverthevaluesonthestatuslinearetobedisplayed.Iftheinterface supportsstatus-lineprintinganditisenabled,thenthisfunctionshouldusethevaluesof tilocationandtistatustodisplaythestatuslineonthescreeninwhatevermanneritchooses (thesevariablesalwayscontainthepropervalues;theymaybeusedbyanyTIfunction). ThisfunctionshouldbealsobecalledwhenevertheTIcodemighthavedisturbedthestatusline. scrputsound() number Thesoundnumbertobeplayed. actionTheactiontobetaken. Revision3.0 21October1992 6 PINFOTI(3) ContributedSoftware PINFOTI(3) volume Thevolumeatwhichtoplaythesound(between1and8). argcThenumberofarguments(1to3)passedtothefunction. Thisfunctionwillbecalledbytheinterpreterifthegamebeingplayedcontainssoundsupport.If theinterfacedoesn’tsupportsoundthenasimpleoutputlinemaybeprintedbythisfunction statingthatfact. UnfortunatelydifferentversionsofInfocomgamesrequiredifferentmethodsofsoundsupport,but generallyaseparatesoundsfileissuppliedwiththedatafileandthesoundsmustberetrievedand playedfromthere. scrputmesg() bufferAnul-terminatedstringcontainingamessagefromtheinterpreter. iserror Setto1ifthemessageisanerrormessage,or0ifit’saninformationalmessageonly. Thisfunctioniscalledwhenevertheinterpreterneedstoprintamessageforsomereason.Messagesfromthegamewillbeprintedviascrputline().TheTIshouldnotattempttoexittheprogramoranythingelse;theinterpreterwilldecidewhattodoaboutthemessage. scrgetline() prompt Anul-terminatedstringwhichistheprompttobeprintedwhenrequestingacommand. length Themaximumnumberofcharacters(includingthenulcharacter)whichcanbeplacedin buffer. bufferAstringoflengthcharacters,inwhichthecommandshouldbereturned. Thisfunctioniscalledwhentheinterpreterneedscommandinputfromtheuser.Thefunction shouldacceptuptolength-1charactersofinputandplacethem,alongwithaterminatingnul character,intobuffer.Allcommandhistory,editing,shellescaping,etc.etc.mustbedoneinternaltothisfunction.Alsoiftheusertypesmorethanlength-1charactersthefunctionshould flushtherestoftheinputandnotifytheuserthatitisdoingso. Ifthisfunctioncausesthestatuslinetobemessedup(i.e.,ashellescapecausesextralinestobe printed,etc.)careshouldbetakentorewritethestatuslinecorrectly. Theinterpretersupportsan"interpreterescapemode",whereinterpreterflagsandoptionsmay bemodified.Thismodeisinvokedbytheusertypingtheescapecharacter(bydefault‘‘@’’)as thefirstcharacteronthecommandline.Ifthisfunctionseesthatasthefirstcharacter,itshould calltiescape()withtheremainderofthecommandline(nottheescapecharacter).Oncethat functionreturnsthepromptshouldbereprintedandmoreinputshouldbeobtainedwithout returning.IftheTIwishestoprovideitsownescapecommandsitshouldprocessthemitselfand notcalltiescape()forthosecommands. Theescapecharbyitselfwilllisttheavailableoptions.IftheTIwishestosupplyoptionsinadditiontotheinterpreteroptions,itshouldcalltiescape()first,thenprintitsownoptions. NotethattheTImayprovidealternativewaysofmanipulatingtheseoptions,suchaspull-down orpop-upmenusonwindowingsystems;tiescape()canbecalledwhenevercontrolisproperly passedtotheTI;notfromasignalhandler,etc. IftheTIsupportsscripting,thenitshouldcheckthecommandtoseeifitwas"script".Ifitwas andscriptingisnotalreadyenabledthenitshouldbeenabledhere.Iftheenablingfailsthenan errorshouldbeprintedandtheTIshouldaskforanothercommandwithoutreturningtothe interpreter. Thefunctionshouldreturnthenumberofcharactersplacedintobuffer,notcountingtheterminatingnulcharacter. Revision3.0 21October1992 7 PINFOTI(3) ContributedSoftware PINFOTI(3) scrwindow() sizeCreateafixedstatuswindowsizelineshigh.Ifsizeis0,thendeletethecurrentfixed statuswindow(ifany). Thisfunctioniscalledifthegamesupportsafixedstatuswindow(currentlySeastalkeristheonly suchStandardSeriesgame),andtheTIhasregisteredthatitsupportssuchfunctionalitybycallingF1SETB(BSTATUSWIN)inscrbegin()(seeabove). Thefunctionwillbepassedthenumberofverticallinesneededforthefixedstatuswindow. Whenthewindowistobedeleteditwillbepassedanargumentof0.Noteitmaybepasseda0 evenifthewindowcurrentlydoesn’texist;inthiscasethefunctionshouldjustsilentlyreturn. IftheTIdoesn’tsupportafixedstatuswindowthenjustprovideadummyfunctionwhichdoes nothing. scrsetwin() winDetermineswhichwindowtostartprintingin. Thisfunctioniscalledifthegamesupportsafixedstatuswindow(currentlySeastalkeristheonly suchStandardSeriesgame),andtheTIhasregisteredthatitsupportssuchfunctionalitybycallingF1SETB(BSTATUSWIN)inscrbegin()(seeabove). Afterthescrwindow()functionhasbeencalled(seeabove),thisfunctionwillbeusedtoswitch backandforthbetweenthetwowindows.Ifcalledwithwinsetto0,thentheTIshouldsetup tostartprintingintheregulartextwindow.Ifcalledwithwinsetto1,thensetuptostart printinginthefixedstatuswindow.Allactualprintingisdonewiththenormalscrputline() function. scropensf() length Themaximumnumberofcharacters(includingthenulcharacter)whichcanbeplacedin buffer. bufferAstringoflengthcharacters,inwhichthefilenameshouldbereturned. typeThetypeofsavefiletobeopened:SFSAVE,SFRESTORE,orSFSCRIPT. Thisfunctioniscalledwhentheinterpreterneedstoopenasavegamefileforeithersavingor restoring,ortoopenascriptfile. Whenscropensf()iscalled,bufferwillcontainadefaultfilename(initiallyitwillbeastatic name,afterthefirstcallitwillcontainthelastfilenameentered).Iflengthis0,thenthefile shouldjustbeopenedandthefilepointerreturned.Iflengthisgreaterthan0,thefunction shouldprintanappropriateprompt,thenacceptuptolength-1charactersofinputandplace them,alongwithaterminatingnulcharacter,intobufferthenopenthatfileandreturnthefile pointer. IftypeisSFSAVEorSFSCRIPT,thenthefileisbeingopenedtosavethegameorwritescript toandsoshouldbeopenedforwriting(binarymodeforSFSAVEandplaintextmodefor SFSCRIPT).Thefunctionshouldtestifthefilealreadyexistsandifso,asktheusertoconfirm overwritingit. IftypeisSFRESTORE,thenthefileisbeingopenedtorestoreagameandsoshouldbeopened forreadinginbinarymode. Anycommandhistory,editing,filenamecompletion,shellescaping,etc.etc.mustbedoneinternal tothisfunction.Alsoiftheusertypesmorethanlength-1charactersthefunctionshouldflush therestoftheinputandnotifytheuserthatitisdoingso. Ifthisfunctioncausesthestatuslinetobemessedup(i.e.,ashellescapecausesextralinestobe printed,etc.)careshouldbetakentorewritethestatuslinecorrectly. IftheTIwishestousethisfunctionforotherpurposes,thetypeargumentcanbeused:theinterpreterwillonlycallthisfunctionwithvalues>=0fortypesotheTIisfreetocallitwithspecial Revision3.0 21October1992 8 PINFOTI(3) ContributedSoftware PINFOTI(3) values<0ifitwishes. ThefunctionshouldreturnaFILEpointertotheopenfile.Iftheusercancelstheoperation somehowortheopenfails,thenthefunctionshouldreturn0(NULL).Ifthereturnvalueis NULLthentheinterpreterwillexamineerrno:iferrnois0thentheinterpreterwillassumethe operationwascanceled;ifit’snon-0thentheinterpreterwillassumetherewasanerrorduring openingofthefileandprintanappropriateerrormessage. Ifthefunctionreturnsnon-NULL,theinterpreterwillattempttoread/writedatafromthecur-rentpositioninthefilewithoutrewindingorothermanipulation.Thismeansthatyoumaystore TI-specificinformationatthebeginningofsavedgamefilesandreadthembackinwhenrestoring ifyoulike. scrclosesf() filenmThenameofthegamefilejustsaved/restored fpFILEpointerofthegamejustsaved/restored typeThetypeofsavefiletobeopened:SFSAVE,SFRESTORE,orSFSCRIPT. Thisfunctioniscalledimmediatelyafteragamesavefileissavedorrestoredorascriptfileisto beclosed.Attheveryleastthisfunctionshouldperformanfclose(fp)toclosethefile.Additionallyitmayaddmoreterminal-specificdata,createspecialconfigurationfiles,changefileprivi-leges,etc. IftheTIwishestousethisfunctionforotherpurposes,thetypeargumentcanbeused:theinterpreterwillonlycallthisfunctionwithvalues>=0fortypesotheTIisfreetocallitwithspecial values<0ifitwishes. WritingaNewInterface IfyouwishtocreateanewTI,Isuggestthatyoustartwithstream.casthesimplestcurrent interface.Besureyouexamineallofthiscodesoyouunderstandindetailwhateachfunction does.Youshouldthencreateyourown.cfileandaddfunctionalityasyoulike. MAKEFILE AfteryoucreateyournewTIyoushouldnamethe.cfilesomethingrelevant,suchaspcdos.cfor aninterfacetoanIBMPC-compatibleinDOS,orpcwindows.cforaninterfacetoanIBMPC-compatiblerunningMS-Windows,orsomething.ThenyoushouldcreateanewTERMTYPEsec-tionintheMakefile.Decidewhat,ifany,flagsyouneedtogivetothecompilerandfillin TERMFLAGS;likewiseforanyextralibrariesyouneedandTERMLIB. Ifyou’dlikeyourinterfacedistributedwiththepinfocomdistribution,andaninterfacedoesn’t alreadyexist,thensendittothepinfocommaintainerandhe/she’llincorporateitin.Noteyou mustplaceyourinterfacecodeundertheGNUPublicLicenseforittobedistributed(seethe copyrightnoticesintheotherfiles),andprovideanaddressforpeopletocontactyouaboutbugs, enhancements,etc.inacommentinthe.cfile. Ifaninterfacealreadyexiststhenyou’llhavetocontacttheauthorandthetwoofyoucanhashit outbetweenyou:-). Revision3.0 21October1992 9