1XEROXLispLibraryPackagesGRAPHERTheGrapherlibrarypackagecontainsacollectionoffunctionsandaninterfaceforlayingout,displaying,andeditinggraphs(i.e.,networksofnodesandlinks).Graphshavenodelabelsbutnotlinklabels.Linksaredrawnbydefaultasstraightlineswithoutarrowheads,butyoucancontroltheappearanceofindividuallinks.Nodelabelscanbesinglelinesoftext,bitmapsofarbitrarysize,orimageobjects.Facilitiesexistforhavingactionstriggeredbyselectingnodesingraphs,andimageobjectscontaininggraphscanbeconstructed,souserscanincludegraphsindocumentsandotherimagestructures.AtypicalwaytouseGrapheristoimplementafunctionthatcreatesapartiallyspecifiedgraphthatrepresentssomeuserdata(orcontrol)structure.Forinstance,theBrowserLispLibrarypackageusesgraphstorepresentfunction-callingstructures(fromMasterscope).Suchapartiallyspecifiedgraphneedhaveonlythegraphlabelsandthelinksspecified.ItisgiventotheLAYOUTGRAPHfunctionalongwithsomeformattinginformation.LAYOUTGRAPHassignsapositiontoeachnode.Thereareformatsforlayingouttrees,lattices,andcyclicgraphs.LAYOUTGRAPHreturnsaGRAPHrecord,whichisusuallygiventothefunctionSHOWGRAPH.SHOWGRAPHdisplaysagraphinawindow.Displayedgraphsareoftenusedasmenus:selectinganodewiththeleftormiddlebuttoncancauseuser-providedfunctionstobecalledonthatnode.Displayedgraphscanbeeditedusingtherightbutton.Nodescanbeadded,deleted,moved,enlarged,orshrunk.Linkscanbeaddedordeleted.DATASTRUCTURESTheGRAPHRecordAgraphisrepresentedbyaGRAPHrecord,whichhasthefollowingfields:GRAPHNODES,DIRECTEDFLG,SIDESFLG,GRAPH.MOVENODEFN,GRAPH.ADDNODEFN,GRAPH.DELETENODEFN,GRAPH.ADDLINKFN,GRAPH.DELETELINKFN,andGRAPH.FONTCHANGEFN.GRAPHNODESisalistofgraphnodes,whicharedescribedbelow.DIRECTEDFLGandSIDESFLGareflagsthatcontrolhowlinksaredrawnbetweenthenodes.IfDIRECTEDFLGisNIL,Grapherdrawseachlinkinsuchawaythatitdoesnotcrossthenodelabelsofthenodesitrunsbetween.Often,thisleavessomeambiguity,whichissettledbySIDESFLG.If q?` p` q?` g_p`+o5q`X+o5,45 f frafn<GJjeJjJje_x_26_x66_x66_x^^#6^66^&U[t`i.[ZYs`#ZH#6ZY66ZY66ZY66ZYYYx6Y66Y Vq`XVuVVqV)%7& -k/E58;A8CGJJV T M"<(j* .W1"5K5:>/AEH[JJT Ro+/^$%+.i3s ;>!@CHfJJRo P< - [#'*d,^0358:>p@EIJJP< N   Y #8#(-46,!?GDJJAc ?0s! %'*r- 4u46>7;=g? JJ?0 <+ " *+ 5;(%C')/ 9:0CIJJ8 6d|$'=+.05;=<@DFIJJ6d 41= %+]-/3@5M8'<+<C8HJJ41 1 1 i %I( *.4K9T?AvFGJJ1 /F46N/ ,v , (.C(.q(.C(. $T J  P%*/j2u5=;@M JJ$T "! 'c<JJ"! !3RHJJ   "G$(+15   "&&)."1R47W;ADDIIJJ   uFq#'Z)+.0256:h<@CFJJ  =0r#b&*.b 5^9;?AI.IJJb q?`B2XEROXLispLibraryPackagesSIDESFLGisNIL,Grapherpreferstodrawlinksthatgobetweenthetopandbottomedgesofnodes.IfSIDESFLGisnon-NIL,Grapherpreferstodrawlinksbetweenthesidesofthenodes.IfDIRECTEDFLGisnon-NIL,theedgesarefixed(e.g.,alwaystotheleftedgeoftheTonode).Thiscancauselinkstocrossthelabelsofthenodestheyrunbetween.Inthiscase,ifSIDESFLGisNIL,theFromendofthelinkisattachedtothebottomedgeoftheFromnode;theToendofthelinkisattachedtothetopedgeoftheTonode.IfDIRECTEDFLGisnon-NILandSIDESFLGisnon-NIL,theFromendofthelinkisattachedtotherightedgeoftheFromnode;theToendofthelinkisattachedtotheleftedgeoftheTonode.Theremainingfieldsgiveyouhooksintothegrapheditor,whichisdescribedbelow.TheGRAPHNODERecordTheGRAPHNODErecordhasthefollowingfieldsofinterest:NODELABEListhethingthatgetsdisplayedasthenode.Ifthisisabitmap,BITBLTisused;ifitisanimageobject,itsImageBoxFnandDisplayFnareused.AnythingelseisprintedwithPRIN3.NODEIDisauniqueidentifier.NODEIDsareusedinthelinkfieldsinsteadofpointerstothenodesthemselves,sothatcircularLispstructurescanbeavoided.NODEIDsareoftenusedaspointerstothestructurerepresentedbythegraph.TONODESisalistofNODEIDs:alinkrunsfromthisnodetoeachnodeinTONODES.Entriesinthisfieldcanbeusedtospecifypropertiesofthelinesdrawnbetweennodes,asdescribedbelow.FROMNODESisalistofNODEIDs:alinkrunstothisnodefromeachnodeinFROMNODES.NODEPOSITIONisthelocationofthecenterofthenode(aPOSITION).NODEFONTspecifiesthefontinwhichthisnode'slabelisdisplayed.ItcanbeanyfontspecificationacceptabletoFONTCREATE,includingaFONTDESCRIPTOR.NODEFONTischangedbythegrapheditoperationsLargerandSmaller.Whenthishappens,thefontfamilymaybechangedaswellasthesize.DefaultisthevalueofDEFAULT.GRAPH.NODEFONT(initiallyNIL).NODEBORDERspecifiestheshadeandwidthoftheborderaroundanodeviathefollowingvalues:NIL,0Noborder(equalsborderofwidthzero)TBlackborder,onepixelwide,asbeforeJ gq`X+o5,45 f frafn<GJjeJjJje ^q`X^u^^q^"$(n+/1F7J9<?DI,JJ^ \53 \u\%P\q\%*,/28:>@(BF\ X > $'.*.:2469A<>m@BGSGJJX VN~gA!#]%*-/56)7:c>$?IFoGJJV T^?W"$t&+/a1 3|78;@=?BDIFIaJJT^ R+OP #"G&X&( 2>39Q]W1!(5*,|0}14b568<AC)G H5IaJJ>] <* `<*u<*- <*q<*"<*u<*#J)<*q<*),@00i6l9V:?BGEGE<* 8PJ n%(J+-X/2d6.;6<BsDFJJ8P 6 qOQ Y '$)+118N:>XACI,JJ6 3   <$Z3 0U p!$e'+-13E6:<5CDQI@JJ0 -1<L &("*}-27CDI- *+Hm!"%m(*1,0_37:<+ Em* &) l'!/#')+/t1 8u&) "Oj "'`*~/35e <=?.BaDGJJ"O    )V0&1?@IaJJ  u #(+X01T5l8>_@CGJJ  l96m$&(a,-A FI  c"%V)*-167;8=]?EJF <!A%'o+6.y (e_!$v(&).() q?`;3XEROXLispLibraryPackages1,2,3...Blackborderofthegivenwidth-1,-2...Whiteborderofthegivenwidth(WS)WhereWisanintegerandSisatextureorashade;yieldsaborderWpixelswidefilledwiththegivenshadeSDefaultisthevalueofDEFAULT.GRAPH.NODEBORDER(initiallyNIL).NODELABELSHADEcontainsthebackgroundshadeofthenode.Ifthisfieldisnon-NIL,thenwhenanodeisdisplayed,thelabelareaforthenodeisfirstpaintedasspecifiedbythisfield,thenthelabelisprintedinINVERTmode.Thisdoesnotapplytolabelsthatarebitmapsorimageobjects.Thelegalvaluesforthefieldare:NIL(sameasWHITESHADE),T(sameasBLACKSHADE),atexture,orabitmap.DefaultisthevalueofDEFAULT.GRAPH.NODELABELSHADE(initiallyNIL).NODEWIDTHandNODEHEIGHTarenormallysetbyGraphertobethewidthandheightofthenode'sNODELABEL.However,ifyouprovideintegersforthesefields,theirvaluesareusedinstead.Thisfeaturecanbeusedtogiveanodealarger-than-normal"margin"arounditslabel.EntriesintheTONODESfieldcanbeusedtospecifytheappearanceofthelinesdrawnbetweennodes.IfanitemintheTONODESofanodeN1isnotaNODEIDbutratheralistoftheform:(Link%ParametersToNodeID.ParamList)thenParamListisinterpretedasapropertylistspecifyingpropertiesofthelinkdrawnfromN1toToNodeID.PropertiesofParamListcurrentlynoticedareLINEWIDTH,DASHING,COLOR,andDRAWLINKFN.ThefirstthreearepasseddirectlytoDRAWLINE.Forexample,iftheTONODESforAis:((Link%ParametersBLINEWIDTH4DASHING(33))(Link%ParametersCDASHING(51)COLOR12))thentwodashedlineswillemanatefromA,withtheonetoBhavingwidth4anddashing(33),andtheonetoChavingthedefaultwidth1,dashing(51),andcolor(ifimplemented)12.IfthepropertyDRAWLINKFNisonthelist,thenitsvaluemustbeafunctiontobecalledinsteadofDRAWLINE.ItispassedalltheargumentsofDRAWLINEplustheParamListasalastargument..( gq`X+o5,45 f frafn<GJjeJjJje ^q`X`e!%)$^ Z+|"%);Z W WuW WqWWuWVWqW?E$*''WuW'WqW(X)+/127;<AAWuWBWqWC;G[JJWT3!&.&.TuT'TqT'T Qt// 47Q M6 !, )5-m/1d5Y569<=CFJJM6 K  "a$'%*,c/H46}<>AEHfJJK H qy !G$j'*l.I/469x;|?YAEfJKKH F\}&"%l), 68-<> IJJF DjmxI*!%'6@ EHDj @ !N#),s..@u@4f4f@q@6:8f:?BFHfJJ@ >] !["%+N1%37<<?DGSJJ>] <*FS)!9"%&*r+7>"CDHA<* 8P+!$ ')X.U0 8:="@EJJ8P 65/!#>$['*+d-.46;<<>a?BRE6 2C 2Cu2CB Z%2Cq2C&&2C .i.iu.iJ.iq.iO  "'*( 1! 89@ JKK(\ &)]% ! "**-}347 >(@BAB&) "O "Ou"O "Oq"O\!")L*,"O u uuuB uqu7!g"(D*u wZ":%'C*F,/z12u7:<>DZEHJJ h C/@#$)+-}0<35m >o@[h  8 "$r' *G,%/3q5p6AoH@H@[ q?`:4XEROXLispLibraryPackagesForconvenience,thevariableLINKPARAMSissettothe(constant)valueLink%Parameters.WhenDISPLAYGRAPHscalesthegraphtotheunitsofaparticularoutputstream,thepropertieswhosenamesarefoundontheSPECVARScalableLinkParametersarealsoscaled.GraphnodescanbecreatedbytheCREATEoperatorfromtherecordpackageorwiththefollowingfunction:(NODECREATEIDLabelPositionToNodeIDsFromNodeIDsFontBorderLabelShade)[Function]ThisfunctionreturnsaGRAPHNODEwithNODEID=ID,NODELABEL=Label,NODEPOSITION=Position,NODEFONT=Font,NODEBORDER=Border,andNODELABELSHADE=LabelShade.THELAYOUTFUNCTIONS(LAYOUTGRAPHNodeLstRootIDsFormatFontMotherDPersonalDFamilyD)[Function]LAYOUTGRAPH"laysout"apartiallyspecifiedgraphbyassigningpositionstoitsgraphnodes.ItreturnsaGRAPHrecordsuitablefordisplayingwithSHOWGRAPH.TheinputNodeLstisalistofGRAPHNODESthatpartiallyspecifiesagraph:onlytheirNODEID,NODELABEL,andTONODESfieldsneedtobefilledin.Optionalfieldsare:NODEFONT,NODEWIDTH,andNODEHEIGHT.TheseoptionalfieldsarefilledinappropriatelyiftheyareNIL.Allotherfieldsareignoredand/oroverwritten.RootIDsisalistofthenodeidentifiersofthenodesthatbecometheroots.Theotherargumentsareoptionalandcontroltheformatofthelayout.Formatcontrolsthegeometryofthelayout.Itisanunorderedlistofatoms.Therearefourbasicformats.COMPACTisthedefaultformat.Thegraphislaidoutasaforest(asetoftrees)insuchawaythattheminimalamountofscreenspaceisused.IntheFASTformat,thegraphislaidoutasaforest,sacrificingscreenspaceforspeed.IntheLATTICEformat,thegraphislaidoutasanacyclicdirectedgraph(alattice).IntheREVERSE/DAUGHTERSformat,thegraphislaidoutwiththeTonodesinreverseorder.Thesebasicformatscomeintwoflavors:HORIZONTAL[thedefault]hasrootsatleftandlinksrunleft-to-right.H@[ gq`X+o5,45 f frafn<GJjeJjJje ^q`X Q ')a+-5/ 6e:":"^u^>Z E^q^F_FJJ^ \ H!#&)+^, 3$7<?\ FKJJ\ Zk!!ZkuZk16ZkqZk136;tZk VN `"2$+A1q57<BE HfJJV T^IT^ P PuPz (Z 1r49W @PqPC JjP L"-!2 8LuL:LqL<E#LuLJLqLJKKL Jw tJwuJwJwqJw!)JwuJw-JwqJw3 @DIJJ< :&!=#t *Z-l 7e7:>n>n:u:C:q:D4EFI,JJ: 8P d$%*-1(7f @CJJ8P 6eD|(U$(+34h =@ JKK6 3di! )+!.I034K6c:1> @EJJ3 1 |1u11q1^3"F% ,.:047=S?CD6GJJ1 /U".$(*,111/ +u+q++  #2'(W)+-4:6z8+<=PADGJJ+ )w)w %< !#')],.s0H1n5r79S:>@CEGJJ% #j 6\"$&'#j  zW."%&',J 3<7<>*Bh  zi "8$'=) */5V9j;?  z$&*,P.1U4K68<>lC{GL  %N ( EH >#%c'*q-02 7( q?`5XEROXLispLibraryPackagesVERTICALhasrootsatthetopandlinksruntop-to-bottom.ThedirectionscanbereversedbyincludingtheatomREVERSEinFormat.Thus,forexample,Format=(LATTICEHORIZONTALREVERSE)laysouthorizontallatticesthathavetherootsontheright,withthelinksrunningright-to-left.Format=(VERTICALREVERSE)laysoutverticaltreesthathavetherootsatthebottom,withlinksrunningbottom-to-top.Format=NILlaysouthorizontaltreesthathavetherootsontheleft.LAYOUTGRAPHcreates"virtual"graphnodestoavoiddrawingatangleofmessylinesincaseswherethegraphisnotaforestoralatticetobeginwith.ItmodifiesthenodesofNODELST,whichmayinvolvechangingsomeoftheTONODESfieldstopointtonewnodes.ThemodifiedNODELSTissetintotheGRAPHNODESfieldofanewlycreatedGRAPHrecord,whichisreturnedasthevalueofLAYOUTGRAPH.ThecreationofvirtualnodesdependsonwhetherLATTICEisamemberofFORMAT.Theforest(i.e.,non-LATTICE)casewillbedescribedfirst.Nodesarelaidoutbytraversingtheforesttop-down,depth-first.Wheneveranalreadylaid-outnodeisfound,insteadofdrawingalinktoitthatmightcutacrossarbitrarypartsofthegraph,LAYOUTGRAPHcreatesacopyofthenode(sameNODELABEL,differentNODEID,noTONODES),laysitdown,and"marks"bothitandtheoriginalnode(bysettingtheirNODEBORDERfieldsandNODELABELSHADEfields).Hence,amarkednodeoccursatleasttwiceintheforest.Thedefaultistoleavetheshadealoneandsetthebordertoone,buttheappearanceofmarkednodescanbecontrolledbyadding(MARK....)totheFORMATargument.Thetailof(MARK....)isapropertylist.IfitisNIL,markingissuppressedaltogether.IfitcontainsBORDERorLABELSHADEproperties,thosevaluesareusedinthecorrespondingfieldsofmarkednodes.Formataddsafewtwiststothisbasicmarkingstrategy.Itcanincludeoneorbothoftheseatoms:COPIES/ONLYOnlythenew"virtual"nodesaremarked.Theoriginalisleftunmarked.NOT/LEAVESMarkingissuppressedwhenthenodehasnodaughters.Forexample,Format=(COPIES/ONLYNOT/LEAVES)marksnodesthatarecopiesofnodesthathavedaughters(i.e.,ifyouseeamark,thenodehasdaughtersthataren'tdrawn).Format=(NOT/LEAVES)marksbothcopiesandoriginals,butonlywhentheyhavenodaughters.Format=NILmarksoriginalsandcopiesregardlessofprogeny.IfFormatincludesLATTICE,thenanodethatisthedaughterofmorethanonenodeisnotmarked.Instead,linksfromallitsparentsaredrawntoit.Noattemptismadetoavoiddrawinglinesthroughnodesortominimizelinecrossings.However,inHORIZONTALformat,nodesarepositionedsothat"From"isalwaysleftof"To."Similarconventionsholdfortheotherformats.InVERTICAL7( gq`X+o5,45 f frafn<GJjeJjJje ^q`XOB'"M%( 1}1}^ Z t` ")$+/u6|8585ZuZ9BZDJKKZ XuXqX !(+.; 49<@ABF[HgJJX V=92 %%a%aVuV)VqV 2:+=?sDqGJJV T^/[X"&+ 5.55T^uT^:@T^qT^>aAoD JJT^ R+A71"=""#E##R+ NQ !%*`,0 56;_=AEFJJNQ LHiKu!9"d&(F,;/01;69f=?WFJKKL Ie#!(,i.13864:;:> CJJI G 1P e!r# $*(+-[27;= BDGJJG E U A7!#(",24:^@B.CwI+JJE CR$|FBV %)*+-4&6CR ?x:Xm !Z#((/! 67/>2@\EJJ?x =E^"Q#&w(H),03[8,>ACFKJJ=E ; u !$'+ 5 :@BJJ; 8  !D$&+/s169 D.HJJ8 6  "$%)M,13I6:k;>cBC5F JJ6 4y i"!$)5*. 02 :<AFHJJ4y 2F hP X!#>%+23+68K9>?@iA1BsCE JJ2F 0~9DT5 ' ./f02q8?8AH JJ0 - >!3"%/ .24Y9>5>>-u-CC-q-GH0JJ- +t"#$E&+.0i3579=E+ ' N'u''q'^%),b1265:;|=D' # , %F) +h.13 :a# !GG u  q 0 % /38:=fBCGJJ  8A "&@(,/69=CUCCuHoqI JJ  &c!$ *-W0^4*7::< CCuD,HqI JJ Of &o(-  uDqb!"?%(*,u2447; =AmBEEJKK yFa3 ]"'(*9*,13N7/8<BEcJJy F #$*,8 5:?,A HJJF ~WJ"^"' /3=5z7;AxACJJ @ q?`T6XEROXLispLibraryPackagesformat,forinstance,theTONODESofanodearepositionedbeneathit,andtheFROMNODESarepositionedaboveit.Cyclicgraphscannotbedrawnusingthisconvention,ofcourse(howcananodebeleftofitself?).WhenLAYOUTGRAPHdetectsanodethatpointstoitself,directlyorindirectly,itcreatesa"virtual"node,asdescribedabove,andmarksboththeoriginalandthecopy.IfFormatincludesCOPIES/ONLY,thenonlythenewlycreatednodeismarked.ThisendsthediscussionoftheFormatargumenttoLAYOUTGRAPH.Theotherargumentsarenotsocomplicated.FontisafontspecificationforuseasthedefaultNODEFONT.Theremainingthreeargumentscontrolthedistancesbetweennodes.NILscause"pretty"defaultsbasedonthesizeofFont.PersonalDcontrolstheminimumdistancebetweenanytwonodes.MotherDistheminimumdistancebetweenamotherandherdaughters.FamilyDcontrolstheminimumdistancebetweennodesfromdifferentnuclearfamilies.TheclosesttwosisternodescanbeisPersonalD.TheclosestthattwonodesthatarenotsisterscanbeisPersonalD+FamilyD.LAYOUTGRAPHreadsbutdoesnotchangethefieldsNODEBORDERandNODELABELSHADEofthenodesgivenit(exceptforthemarkednodes,ofcourse).Thus,ifyouplantoinstallblackbordersaroundthenodesafterthenodeshavebeenlaidout(e.g.,byRESET/NODE/BORDER,describedbelow),itisagoodideatogiveLAYOUTGRAPHnodesthathavewhiteborders.Thiscausesthenodestobelaidoutfarenoughapartthatwhenyoublackentheborderslater,thelabelsofadjacentnodesarenotoverwritten.THEDISPLAYFUNCTIONS(SHOWGRAPHGraphWLeftButtonFnMiddleButtonFnTopJustifyFlgAllowedITFlgCopyButtonEventFn)[Function]SHOWGRAPHdisplaysthenodesintheGraph.IfWisawindow,thegraphisdisplayedinit.Ifthegraphislargerthanthewindow,thewindowismadeascrollingwindow.IfWisNIL,thegraphisdisplayedinawindowlargeenoughtoholdit.IfWisastring,thegraphisdisplayedinawindowlargeenoughtoholdit,andthewindowusesthestringforthewindowtitle.SHOWGRAPHcachessomeinformationintheGRAPHNODEfieldstomakescrollingfaster.ThegraphisstoredontheGRAPHpropertyofthewindow.SHOWGRAPHreturnsthewindow.IfeitherLeftButtonFnorMiddleButtonFnisnon-NIL,thewindowisgivenaButtonEventFnthat,ineffect,turnsthegraphintoamenu.Whenevertheleftormiddlebuttonisdepressedandthecursorisoveranode,thatnodeisdisplayedinverted,indicatingthatitisselected.LettingupontheJ gq`X+o5,45 f frafn<GJjeJjJje ^q`XT"$2%d) + 2859<?H[JJ^ \ 1"}'d)w-14 <>PC-FIJJ\ ZktQ7] _ +02I6*9B=?CIJJZk X8 #@Nk5#'$+0227&:^<ADFJKKX8 V VuV;VqVH !$'*F.D3r78b=V R+ EHR+uR+$(R+qR+$*, 78>;>EHZJJR+ O l O LugLqL< !9#%a*2&L HDb$'(-3_88d;?E[JJHD FCFuFFqF22FuF$FqF%Z+$-4%:$@#CEJJFuFKKF CCqCZl"s(z)/2 4 <8<>?BE3IaJJ x.#!$( )*+X+Xxux,xqx-./4%6:<@BDXEJJx E/nA %A(+/1+38;f>CF0HfJJp q?`7XEROXLispLibraryPackagesbuttoncallseithertheLeftButtonFnortheMiddleButtonFnwithtwoarguments:theselectedGraphNode(thisisNILifthecursorwasnotoveranodewhenthebuttonwasreleased)andthewindow(fromthewindow,thefunctionscanaccessthegraphviaWINDOWPROP).Thegraph'sinitialpositionisdeterminedbyTopJustifyFlg.IfT,thegraph'stopedgeispositionedatthetopedgeofthewindow;ifNIL,thegraph'sbottomedgeispositionedatthebottomedgeofthewindow.THEEDITINGFUNCTIONSIfAllowEditFlgisnon-NIL,therightbuttoncanbeusedtoeditthegraph.(Thenormalwindowcommandscanbeaccessedbyright-buttoningintheborderortitleregions.)Right-buttoningwhilethecontrolshiftisdownallowspositioningofnodesbytrackingthecursor.Right-buttoningwiththecontrolshiftupbringsupamenuofeditoperations.Theeditoperationsallowmoving,adding,anddeletingofnodesandlinks.AddinganodepromptsforaNODELABEL,createsanewnodewiththatlabel,addsittothegraph,andallowsyoutopositionit.Deletinganoderemovesit(usingDREMOVE)fromGRAPHafterdeletingallofthelinkstoandfromit.WhentheSTOPmenucommandisselected,thegraphwindowisclosed.CopyButtonEventFnisafunctiontoberunwhenyoucopy-selectfromtheGrapherwindow.Ifthisisnotspecified,thedefaultsimplyCOPYINSERTsaGrapherimageobject.CertainfieldsoftheGRAPHrecordarefunctionsthatgetcalledbythegrapheditorwheneveranactionisperformedonanelementinthedisplayedgraph.Theyallowthegraphtoserveasasimpleeditinterfacetothestructurebeinggraphed.BelowarethefieldsofGRAPHandtheargumentsthatthecorrespondingfunctioncalls.InallcasesGraphisthegraphbeingdisplayed,andWindowisthewindowinwhichitisdisplayed.(GRAPH.MOVENODEFNNodeNewPosGraphWindow)[Function]iscalledafteryouhavestoppedmovinganodeinteractively(i.e.,isnotcalledasthenodeisbeingmoved).(GRAPH.ADDNODEFNGraphWindow)[Function]iscalledwhenyouselect"Addanode"andreturnsanodeorNILifnonewnodeistobeadded.Anode-movingoperationiscalledonthenewnodeafteritiscreatedtodetermineitsposition.(GRAPH.DELETENODEFNNodeGraphWindow)[Function]J gq`X+o5,45 f frafn<GJjeJjJje ^q`XrFF^u^ $L$L^q^&b)&)&^u^ 3;^q^37[:b BLEJJ^ \u\q\r6(#G&B(,-[147<?EHfJJ\ Zkr%',.25# ?Zk Vqzj & 'VuV' 0vVqV1C1247<=>BPC JJV T^ 5(t #&@+0f45{ <>5@EI+JJT^ R+ +R+ NQvxNQqNQxNQ Jw JwuJw JwqJwV#'*,02P5=7<=@EJJJw HD)+*-2"36zB/HJJ1+ ."N"$'K-2396:=nACGIJJ. ,\`9$(/7/4r7*9=?EWHgJJ, *" !'+O+-f/M3m3m*u*7k*q*79W;?C JJ* (_ (_u(_Rc(_q(_v*"I#f$ +5(_ $oo$u$*$(.$q$B IJJjJj$  <G J%W&*% 295]69F=?\AEiFJJ xx QuCCq JjJj   i $',-1;25u68;?@BD HIIwJJ  @ 7"1$'+.R/o057>N@E u }$)qC JjJjx q?`8XEROXLispLibraryPackagesiscalledwhenanodeisdeleted.Beforethisfunctioniscalled,allofthelinkstoorfromthenodearedeleted.(GRAPH.ADDLINKFNFromToGraphWindow)[Function]iscalledwhenalinkisadded.(GRAPH.DELETELINKFNFromToGraphWindow)[Function]iscalledwhenalinkisdeleted,whichcanbeeitherdirectlyorfromdeletinganode.(GRAPH.FONTCHANGEFNHowNodeGraphWindow)[Function]iscalledwhenyouaskforthelabelonanodetobemadelargerorsmaller.HowisoneofLARGERorSMALLER.1(DISPLAYGRAPHGraphStreamClip/RegTrans)[Function]putsthespecifiedgraphonStream(whichcanbeanyimagestream)withcoordinatestranslatedtoTrans.SomestreamsmightalsoimplementClip/Regasaclippingregion.Thisisprimarilytoimproveefficiencyforthedisplay.(HARDCOPYGRAPHGraph/WindowFileImageTypeTrans)producesafilecontaininganimageofGraph(e.g.,likeSHOWGRAPH,onlyforfiles).IfGraph/Windowisawindow,HARDCOPYGRAPHoperatesonitsGRAPHwindowproperty.TheFileandImageTypeargumentsaregiventoOPENIMAGESTREAMtoobtainastreamthatthegraphwillbedisplayedon.Transisapositioninscreenpoints(i.e.,itisscaledbytheimagestream'sDSPSCALE)ofthelower-leftcornerofthegraphfromthelower-leftcornerofthepieceofpaper.GRAPHERIMAGEOBJECTSAgraphdatastructurecanbeencapsulatedinaGrapherimageobject,sothatitcanbeinsertedinaTEditdocumentorotherimagestructure.Grapherimageobjectsareconstructedbythefollowingfunction.(GRAPHEROBJGraphHalignValign)[Function]returnsaGrapher-typeimageobjectthatdisplaysGraph.HalignandValignspecifyhowthegraphistobealignedwithrespecttothereferencepointinitshost(TEditfile,imageobjectwindow,etc.).Theycanbenumbersbetweenzeroandone,specifyingasaproportionofthewidth/heightoftheJj gq`X+o5,45 f frafn<GJjeJjJje ^q`X I(\z!!q&(.}/46z8':=?AeDG1JJ^ \ \ XXuXz#(XqXC) JJjJjX T T QKKQuQ!&A+RQqQC JjJjQ M6 b#&4(",1"26;<@;M6 I\iiI\uI\ $Q(-I\qI\C JjJjI\ E &/N"$%9(*j,^0?4X6 ;a;>@VCDJJE C? @'C?w`FCC?q`XC?C? ?e '?eu?e &*?eq?eC Jj?e ;-G;u;H!;q;";&)+.+2e7: Bv I+JJ; 9Xu.9Xq9X'!))9Xu9X+9Xq9X,`9Xu9X.9Xq9X/~128=>.AyCI,JJ9X 7% ~ 7% 3K 3Ku3K #@%-303Kq3K1G3K /qi E %^'o'o/qu/q+m/qq/q,@-14 >uADHIJJ/q ->u g->q-> +2 4=6@;AGjGJJ-> + u + q+ *+ u+ TT+ q+ x!%'J57S;<ADMFJJ+ ('AY(u(x(q( &f(,1W457l<>@EJJ( &M "v$ &g*{-0 6[:<}>BD>HH& "v"q""  *H ')v**u/q0B492;=? ACI@JJ  Xu %%qOi#( * **u0q05:= F HfJJ I  u?"qC Jj uq#!%++u/q0J00u4q5)77u;q" FHgJJq3 q?`P9XEROXLispLibraryPackagesgraphthepointinthegraphthatoverlaysthereferencepoint(zeromeansthatthegraphwillsitcompletelyaboveandtotheleftofthereferencepoint;onemeansitwillsitcompletelybelowandtotheright).Theycanalsobepairsoftheform(NodeSpecPos),whereNodeSpecspecifiesanodethatthegraphistobealignedby,andPosspecifieswhereinthenodethealignmentpointis.TheNodeSpeccanbeeitheraNODEIDoroneoftheatoms*TOP*,*BOTTOM*,*LEFT*,or*RIGHT*,indicatingthetopmost,bottommost,etc.,nodeofthegraph.ThePoscanbeanumberspecifyingproportionaldistancesfromthelower-leftcornerofthenode,ortheatomBASELINE,indicatingthecharacterbaseline(forValign,orsimplyzeroforHalign).Forexample,toalignalinguistictreesothatthebaselineoftherootnodeisatthereferencepoint,Valignwouldbe(*TOP*BASELINE).TheButtonEventInFnoftheimageobjectpopsupasingle-itemmenu,whichifselectedcausesthegrapheditortoberun.MISCELLANEOUSFUNCTIONS(GRAPHREGIONGraph)[Function]returnsthesmallestregioncontainingallofthenodesinGRAPH.(FLIPNODENodeDS)[Function]invertsaregioninthestreamDSthatisonepixelbiggerallaroundthanNODE'sregion.Thismakesitpossibletoseeblackbordersafterthenodehasbeenflipped.(RESET/NODE/BORDERNodeBorderStreamGraph)[Function]and(RESET/NODE/LABELSHADENodeShadeStream)[Function]resettheappropriatefieldsinthenode.IfStreamisadisplaystreamorawindow,theoldnodeiserasedandthenewnodeisdisplayed.Changingthebordermaychangethesizeofthenode,inwhichcasethelinestoandfromthenodeareredrawn.TheentiregraphmustbeavailabletoRESET/NODE/BORDERforthispurpose,eithersuppliedastheGraphargumentorobtainedfromtheGRAPHpropertyofStream,ifitisawindow.BothfunctionstaketheatomINVERTasaspecialvalueforBorderandShade.Theyreadthenode'scurrentborderorshade,calculatewhatwouldbeneededtoinvertit,anddoso.(LAYOUTSEXPRSexprFormatFontMotherDPersonalDFamilyD)[Function]Jq gq`X+o5,45 f frafn<GJjeJjJje ^q`XYG!z'E)0n4)7<?B!FaHJJ^ \ _ !#*v.i1)569=; BKFkI+JJ\ Zk@F$,!#p%)C)ZkuZk03/ZkqZk4|88ZkuZk?yZkqZk?EG1JJZk X8q 15Q!$x$xX8uX8&X8qX8'D-O13=59U;BxFGJJX8 Vu7VqVedr"Z$&(*/B4m<BuD3JJV S E # &3)+-2255SuS88SqS;f=j>C JJS Q 3{ &"*,O.24X6:AA HfJJQ OlvvOluOliOlqOl3 %b(**OluOl.OlqOl00|03r9;=>? FHJJOl M9+B!#%?'.i2M9uM9266M9qM9;T=nB JKKM9 KiiKuKKqKf q!&)+, 48n<=CHfJJK HE3H Dv _ DqD D @ @@ @u@@q@CC@@ Jj@ <wZ #%'=)-/Y4 $%a,.3;6Q;>@BE.I@JJ }jd!$v(@*1148=+@BI+JJ  &*02w44u8q9H?AG~JJ W WuW WqW<WuWWqW!"B#$*q*.5479=BDEJJW $g)$u$ll$q$DD$u$V$q$)"-%}',16o85<CFJJ$  1VP 3  u"(/l4qC Jj q?`10XEROXLispLibraryPackagesisjustlikeLAYOUTGRAPH,exceptitgetsitsgraphasans-expressionratherthanalistofGRAPHNODEs.Aformalrecursivedefinitionofitsfirstargumentis:Ifthes-expressionisanatom,itsNODELABELisitselfandithasnoTONODEs;elseitisalistanditsCARistakenasitsNODELABELanditsCDR,whichmustbealistofs-expressions,istakenasitsTONODES.Notethatcirculars-expressionsareallowed.Forexample,thefollowingdisplaysaparsetreeforthesentence"Theprogramdisplaysatree."[SHOWGRAPH(LAYOUTSEXPR'(S(NP(DETthe)(NOUNprogram))(VP(VERBdisplays)(NP(DETa)(NOUNtree))))'(VERTICAL)NIL'(HELVETICA12](DUMPGRAPHGraphStream)[Function]printstheGRAPHoutonSTREAMinaspecial,relativelycompactencodingthatcanbeinterpretedbythefunctionREADGRAPH(seebelow).GraphscannotbesavedonfilessimplybyordinaryprintfunctionssuchasPRIN2.ThisisbecausetheGrapherfunctionsuseFASSOC(i.e.,EQnotEQUAL)tofetchagraphnodegivenitsID,soreadingitbackingivestherightresultonlyiftheIDsareatomic.HPRINTresolvesthisproblem,butittendstodumptoomuchinformation:itdumpsacompletedescriptionofthenodefont,forexample,includingthecharacterbitmaps.DUMPGRAPHandREADGRAPHareusedintheimplementationofGrapherimageobjects.(READGRAPHStream)[Function]readsinformationfromStreamstartingatthecurrentfilepointerandreturnsagraphstructureequivalenttotheonethatwasgiventoDUMPGRAPH.EndNotes1.Thenodelabelsarereprintedwheneverthegraphisredisplayed.Ifthismakesscrollingofalargegraphunacceptablyslow,somespeedupmaybeachievedbyinstructingGraphertocachebitmapsofthelabelswiththenodessotheycanberapidlyBITBLTedtothescreen(setthevariableCACHE/NODE/LABEL/BITMAPS/FLGtoT).Thepossiblegainintime,however,maybeoffsetbytheincreasedstoragerequiredforthecacheDbitmaps.Jj gq`X+ 5,5 f frafn<GJjeJjJje ^q`X Z_L #%y(+/14! <AEFI,JJ^ \ H"Y (*Q,-.5y7J8: CpDFJJ\W Zk .F #&-02`458 ;#=I@BFHJJZ$ X8kN?!T$&(:*,= 57k;i=Z?KFGjJJW V C%&3(/)18=>CFHfJJU SM !%LS O C  !#&_)1B7O L C K S[ cks#{+3;c#L HD C K S[ cks#{+3;CN#(RHD Dj C K S[ cks#{+ M (++Dj @ NN@u@9@q@C Jj@ <1!#F$k) /5;>AxCm JJAC6EH[JJ5 3_ %()-/36: BCrDIJJ3 1 5 Z$(+2w9{<CFJKKrKL"L"1p / #&t'*P 4o5/=u/6;L/=q/;?D/= + +cu++cq+C Jj+c ' 'u''q' B%'q* /E169>@XDJJ' % zk*"$$ -. .x.x%V !v!q!!  C>D!.'*q.0G 89:k=:AGIJJ $9 %#)b,Z.I4a6< =\=\uBqBDHJJ u&Q!#&)+0[748;[@"BEfJJ P%&()"+146T9?BDHJJP  b!|#)*.y q?`W HELVETICA HELVETICA  HELVETICA  HELVETICA  HELVETICA XLOGO  HELVETICA ~GACHA /! + 5 >F OkWj/Z X|p.{ERIS}INTERMEZZO>LIBRARY>GRAPHER.PRESS;1JAMES 4-Apr-85 14:42:28