;skip 1 ;vsp 6 ;squish ;lftmar 0 ;topmar 0 ;botmar 0 ;rgtmar 0 ;dfont TIMESROMAN10,TIMESROMAN10,TIMESROMAN10I,HELVETICA10,TIMESROMAN18B,TIMESROMAN12B,TIMESROMAN12B,GACHA10,GACHA10B,MATH10,HIPPO10 "‡"A  New Window System q1 xStream Operations "`  1. Stream Operations "( PThis‚chapter‚documents‚some‚messages‚that‚you‚can‚send‚to‚a‚window‚that‚has‚"stream"  facilities,‚for‚instance‚a‚Lisp‚Listener.‚A‚message‚is‚listed‚here‚if‚it‚is‚intended‚to‚be‚sent‚by  the‚user‚and‚if‚it‚pertains‚to‚"input/output"‚rather‚than‚operations‚on‚the‚window‚itself.‚You  won't‚înd‚îmessages‚îto‚îchange‚îthe‚îsize‚îof‚îa‚îwindow‚îhere,‚for‚îinstance.‚ " PThe‚support‚for‚these‚messages‚is‚provided‚by‚the‚avors‚tv:stream-mixin‚and‚tv:graphics-  mixin.‚ " PThis‚chapter‚is‚organized‚into‚topical‚sections;‚within‚each‚section‚messages‚are‚listed  starting‚with‚the‚simplest‚and‚most‚generally‚interesting‚and‚proceeding‚to‚the‚more‚esoteric,  with‚îrelated‚îmessages‚înext‚îto‚îeach‚îother.‚ " PMany‚simple‚programs‚that‚don't‚need‚their‚own‚windows‚will‚use‚only‚these‚messages.  These‚îprograms‚îwill‚îinput‚îfrom‚îand‚îoutput‚îto‚îthe‚îLisp‚îlistener‚îfrom‚îwhich‚îthey‚îare‚îcalled.‚ " PThese‚messages‚deal‚only‚with‚the‚inside‚part‚of‚the‚window,‚not‚with‚the‚margins‚(which  include‚the‚black‚border,‚the‚white‚margin‚inside‚the‚border,‚the‚label,‚etc.)‚All‚(x,y)  coordinates‚used‚in‚these‚messages,‚without‚exception,‚are‚inside‚coordinates.‚This‚means‚that  the‚îpoint‚î(0,0)‚îis‚îat‚îthe‚îupper‚îleft‚îcorner‚îof‚îthe‚îwindow,‚inside‚îthe‚margins.‚X‚increases‚to‚the  right‚îand‚îy‚îincreases‚îdown.‚  "  :which-operations Returns‚a‚list‚of‚all‚the‚messages‚this‚window‚can‚handle.‚This‚is‚not‚just‚the‚stream operations,‚but‚îall‚îmessages.‚  "@  1.1 Input " PThese‚messages‚read‚input‚characters‚from‚a‚window.‚Input‚normally‚comes‚from‚the  keyboard,‚but‚can‚also‚be‚forced‚from‚other‚sources‚[put‚a‚cross-reference‚here‚later].  Characters‚are‚not‚echoed‚by‚these‚messages.‚You‚can‚echo‚them‚yourself‚or‚call‚the‚higher-  level‚input‚functions‚tyi,‚read,‚and‚readline;‚these‚functions‚accept‚a‚window‚as‚their‚stream  argument‚îand‚îwill‚îecho‚îthe‚îcharacters‚îthey‚îread.‚  "  :tyi‚&optional‚eof-action Reads‚the‚next‚character‚of‚input‚from‚the‚window,‚waiting‚if‚there‚is‚none.‚The character‚comes‚from‚the‚window's‚I/O‚buer‚if‚it‚contains‚any‚characters,‚otherwise from‚the‚keyboard.‚Eof-action‚is‚ignored‚since‚"end-of-le"‚is‚not‚meaningful‚for windows.‚ "‡"/  DSK:LMWIND;STREAM 25 Z4-OCT-80î "‡"A  New Window System q2 Input "`  :tyi-no-hang‚&optional‚eof-action Like‚î:tyi‚îbut‚îif‚îno‚îinput‚îis‚îimmediately‚îavailable‚îreturns‚înil‚îinstead‚îof‚waiting‚for‚input. This‚îis‚îused‚îby‚îprograms‚îthat‚îcontinuously‚îdo‚îsomething‚îuntil‚îa‚îkey‚is‚typed,‚then‚look at‚îthe‚îkey‚îand‚îdecide‚îwhat‚îto‚îdo‚înext.‚  "  :untyi‚ch Puts‚ch‚back‚into‚the‚window‚so‚that‚it‚will‚be‚the‚next‚character‚returned‚by‚:tyi. Note‚that‚ch‚must‚be‚exactly‚the‚last‚character‚that‚was‚:tyi'ed‚and‚that‚it‚is‚illegal‚to do‚îtwo‚î:untyi's‚îin‚îa‚îrow.‚This‚îis‚îused‚îby‚îparsers‚îthat‚îlook‚îahead‚îone‚îcharacter,‚such‚as read.‚  "  :listen Returns‚t‚if‚there‚are‚any‚characters‚available‚to‚:tyi,‚or‚nil‚if‚there‚are‚not.‚For example,‚the‚editor‚uses‚this‚to‚defer‚redisplay‚until‚it‚has‚caught‚up‚with‚all‚of‚the characters‚îthat‚îhave‚îbeen‚îtyped‚îin.‚  "  :clear-input Clear‚îthis‚window's‚input‚buer‚.‚This‚ushes‚all‚the‚characters‚that‚have‚been‚typed‚at this‚îwindow,‚but‚îhave‚înot‚îyet‚îbeen‚îread.‚  "  :rubout-handler‚options‚function‚&rest‚args Applies‚function‚to‚args‚inside‚an‚environment‚where‚inputting‚from‚this‚window‚will echo‚the‚characters‚typed‚and‚provide‚for‚simple‚input‚editing.‚This‚is‚documented‚in more‚îdetail‚îin‚îthe‚îLisp‚îMachine‚îManual.‚ " Options‚is‚an‚assq‚list‚of‚keyword‚symbols‚and‚arguments‚to‚them.‚ The‚options acceptable‚îto‚îwindows‚îare:‚ " :full-rubout ag HIf‚îthe‚user‚rubs‚out‚all‚of‚the‚characters‚that‚he‚has‚typed‚in,‚normally Hthe‚rubout-handler‚just‚waits‚for‚more‚characters.‚If‚the‚:full-rubout Hoption‚is‚supplied,‚it‚returns‚instead.‚Two‚values‚are‚returned,‚nil‚and Hag‚.‚ " :initial-input string HThe‚îcharacters‚îin‚îstring‚îare‚îtreated‚îas‚îtypeahead‚îbefore‚îreading‚anything Hfrom‚îthe‚îkeyboard.‚ " :pass-through ch1 ch2... HThe‚characters‚ch1‚,‚ch2‚,‚etc.‚are‚treated‚as‚ordinary‚characters‚even‚if Hthey‚îwould‚înormally‚îbe‚îspecial‚îcommands‚îto‚îthe‚îrubout-handler.‚ " :prompt function HFunction‚is‚a‚function‚to‚be‚called‚before‚reading‚any‚characters; Htypically‚it‚will‚display‚a‚prompt.‚The‚arguments‚to‚function‚are‚the Hwindow‚and‚a‚ag.‚When‚the‚rubout-handler‚is‚rst‚entered‚the‚ag‚is Hnil,‚but‚if‚it‚is‚necessary‚to‚prompt‚again,‚for‚instance‚if‚the‚user Hcleared‚the‚screen,‚function‚is‚called‚with‚the‚character‚the‚user‚typed "F  DSK:LMWIND;STREAM 25 Z4-OCT-80î "‡"A  New Window System q3 Character Output "` H(e.g.‚#\form)‚îas‚îits‚îag‚îargument.‚ " :reprompt function HThe‚îsame‚îas‚î:prompt‚îexcept‚îthat‚îthe‚îfunction‚îis‚înot‚called‚the‚rst‚time Hthrough.‚  "@  1.2 Character Output " PThese‚messages‚allow‚a‚window‚to‚be‚used‚like‚a‚traditional‚display‚terminal.‚Note‚that  Lisp‚îmachine‚îwindows‚îare‚îcapable‚îof‚îoverstriking‚îtwo‚îcharacters‚îon‚îtop‚îof‚îeach‚îother;‚on‚many  terminals‚the‚rst‚character‚would‚simply‚be‚replaced‚by‚the‚second‚character.‚Windows‚also  provide‚for‚multiple‚fonts‚and‚variable-width‚characters;‚this‚makes‚character‚display‚more  complicated.‚These‚îissues‚îare‚îmostly‚îdeferred‚îuntil‚îthe‚înext‚îsection.‚  "  :tyo‚ch Outputs‚a‚character‚to‚the‚window.‚If‚ch‚is‚a‚printing‚character‚it‚is‚displayed‚in‚the current‚font,‚and‚the‚cursor‚is‚advanced‚by‚the‚width‚of‚the‚character.‚If‚ch‚is‚a‚tab, backspace,‚or‚carriage‚return‚the‚cursor‚moves‚appropriately.‚Carriage‚return‚moves‚to a‚new‚line‚and‚clears‚it.‚If‚ch‚is‚another‚special‚character‚it‚is‚displayed‚as‚its‚name with‚îa‚îbox‚îaround‚îit.‚ " Printing‚a‚character‚when‚the‚cursor‚is‚too‚close‚to‚the‚right-hand‚edge‚of‚the‚window causes‚an‚end-of-line‚exception,‚which‚normally‚advances‚to‚the‚next‚line‚then‚prints the‚character.‚Printing‚a‚character‚when‚the‚cursor‚is‚too‚close‚to‚the‚bottom‚edge‚of the‚window‚causes‚an‚end-of-page‚exception,‚which‚normally‚homes‚up‚the‚cursor, clears‚îthe‚top‚line,‚and‚then‚prints‚the‚character.‚Advancing‚to‚a‚line‚which‚is‚the‚last one‚before‚output‚the‚user‚has‚not‚yet‚had‚a‚chance‚to‚read‚causes‚a‚more‚exception, which‚înormally‚îprints‚î"**MORE**"‚îand‚îwaits‚îfor‚îtypein‚îbefore‚îproceeding.‚  "  :string-out‚string‚&optional‚(start‚0)‚(end‚nil) Outputs‚string‚to‚the‚window,‚starting‚at‚character‚start‚and‚ending‚with‚character‚end‚. If‚îend‚îis‚înil,‚continue‚îto‚îthe‚îend‚îof‚îthe‚îstring.‚This‚îbehaves‚îexactly‚îas‚îif‚îit‚îwas‚î:tyoing each‚îcharacter‚îin‚îthe‚îstring‚î(or‚îin‚îthe‚îspecied‚îsubstring),‚but‚îis‚îmuch‚îfaster.‚  "  :line-out‚string‚&optional‚(start‚0)‚(end‚nil) Exactly‚îlike‚î:string-out,‚but‚îa‚înewline‚îis‚îoutput‚îafter‚îthe‚îstring‚îor‚îsubstring.‚  "  :beep‚&optional‚beep-type Flashes‚îthe‚îscreen‚îand/or‚îbeeps‚the‚beeper‚in‚the‚keyboard.‚The‚beep-type‚argument‚is intended‚to‚select‚among‚several‚dierent-sounding‚beeps‚to‚indicate‚dierent‚things. However,‚these‚îhave‚înot‚îyet‚îbeen‚îdened‚îso‚îthis‚îargument‚îshould‚înot‚îbe‚îsupplied.‚ "‡"K  DSK:LMWIND;STREAM 25 Z4-OCT-80î "‡"A  New Window System q4 Character Output "`  :fresh-line Gets‚the‚cursor‚to‚the‚beginning‚of‚a‚blank‚line.‚This‚is‚done‚in‚one‚of‚two‚ways.‚If the‚îcursor‚îis‚îalready‚îat‚îthe‚îbeginning‚îof‚îa‚îline,‚the‚îline‚îis‚îcleared‚îto‚îmake‚îit‚blank‚and the‚îcursor‚îis‚îleft‚îwhere‚îit‚îwas.‚Otherwise,‚the‚îcursor‚îis‚îadvanced‚îto‚îthe‚înext‚îline‚îand‚îit is‚îcleared,‚just‚îas‚îif‚îa‚î#\cr‚îhad‚îbeen‚îoutput.‚  "  :read-cursorpos‚&optional‚(units‚':pixel) Does‚îa‚îdouble-value‚return‚with‚the‚x‚and‚y‚coordinates‚of‚the‚upper‚left‚corner‚of‚the cursor.‚These‚coordinates‚are‚in‚pixels‚by‚default,‚but‚if‚units‚is‚:character,‚the coordinates‚are‚given‚in‚character-widths‚and‚line-heights,‚which‚is‚not‚useful‚with variable-width‚îfonts.‚  "  :set-cursorpos‚x‚y‚&optional‚(units‚':pixel) Moves‚the‚cursor‚to‚the‚specied‚coordinates.‚Units‚may‚be‚specied‚as‚with‚:read- cursorpos.‚If‚the‚coordinates‚are‚outside‚the‚window‚the‚nearest‚place‚that‚is‚in‚the window‚îis‚îassumed.‚  "  :home-cursor Returns‚îthe‚îcursor‚îto‚îthe‚îupper‚îleft‚îcorner‚îof‚îthe‚îwindow.‚  "  :home-down Moves‚îthe‚îcursor‚îto‚îthe‚îlower‚îleft‚îcorner‚îof‚îthe‚îwindow.‚  "  :size-in-characters Does‚a‚double-value‚return‚of‚the‚dimensions‚of‚the‚window‚in‚character-widths‚and line-heights.‚When‚using‚variable-width‚fonts‚the‚width‚is‚in‚terms‚of‚a‚nominal‚space- width‚îsince‚îthe‚îcharacters‚îare‚îall‚îdierent‚îwidths.‚  "  :clear-char Erases‚the‚character‚at‚the‚current‚cursor‚position.‚When‚using‚variable-width‚fonts‚this will‚not‚do‚what‚you‚might‚expect;‚it‚does‚not‚know‚the‚actual‚width‚of‚the‚character under‚îthe‚îcursor,‚but‚îsimply‚îerases‚îa‚îstandard‚îwidth.‚  "  :clear-eof Erases‚îfrom‚îthe‚îcurrent‚îposition‚îof‚îthe‚îcursor‚îto‚îthe‚îbottom‚îof‚îthe‚îwindow.‚  "  :clear-eol Erases‚îfrom‚îthe‚îcurrent‚îposition‚îof‚îthe‚îcursor‚îto‚îthe‚îend‚îof‚îthe‚îcurrent‚îline.‚  "  :clear-screen‚&optional‚margins-too Erases‚the‚whole‚window‚and‚homes‚the‚cursor‚to‚the‚upper‚left.‚Don't‚supply‚the argument!‚ "‡";  DSK:LMWIND;STREAM 25 Z4-OCT-80î "‡"A  New Window System q5 Character Output "`  :delete-char‚&optional‚(n‚1) Without‚an‚argument,‚this‚deletes‚the‚character‚at‚the‚current‚cursor‚position. Otherwise,‚it‚deletes‚n‚characters,‚starting‚with‚that‚character.‚The‚display‚of‚the current‚line‚to‚the‚right‚of‚the‚deleted‚section‚is‚moved‚left‚to‚close‚the‚resultant‚gap. IMPORTANT:‚This‚does‚not‚do‚the‚right‚thing‚with‚variable-width‚fonts.‚See‚the‚next section.‚  "  :delete-string‚string‚&optional‚(start‚0)‚end This‚is‚for‚deleting‚specic‚strings‚in‚the‚current‚font.‚It‚is‚one‚of‚the‚things‚to‚use when‚îdealing‚îwith‚îvariable-width‚îfonts.‚ " If‚îstring‚îis‚îa‚înumber,‚it‚îis‚considered‚to‚be‚a‚character‚code.‚A‚region‚exactly‚as‚wide as‚that‚character‚will‚be‚excised‚at‚the‚current‚cursor‚position,‚and‚the‚display‚to‚the right‚îof‚îthe‚îexcised‚îregion‚îwill‚îbe‚îmoved‚îto‚îthe‚îleft‚îto‚îclose‚îthe‚îgap.‚ " If‚string‚is‚a‚string,‚a‚region‚exactly‚as‚wide‚as‚that‚string,‚or‚a‚substring‚specied‚by start‚îand‚îend‚,‚will‚îbe‚îexcised‚îand‚îthe‚îgap‚îclosed‚îas‚îin‚îthe‚îsingle-character‚îcase.‚  "  :delete-line‚&optional‚(n‚1) Without‚an‚argument,‚this‚deletes‚the‚line‚that‚the‚cursor‚is‚on.‚Otherwise‚it‚deletes‚n lines,‚starting‚with‚the‚one‚the‚cursor‚is‚on.‚The‚display‚below‚the‚deleted‚section‚is moved‚îup‚îto‚îclose‚îthe‚îresulting‚îgap.‚  "  :insert-char‚&optional‚(n‚1) Opens‚up‚a‚space‚the‚width‚of‚n‚characters‚in‚the‚current‚line‚at‚the‚current‚cursor position.‚The‚îcharacters‚îto‚îthe‚îright‚îof‚îthe‚îcursor‚îare‚îshifted‚îto‚îthe‚îright‚îto‚make‚room. Characters‚pushed‚past‚the‚right-hand‚edge‚of‚the‚window‚are‚lost.‚This‚does‚not‚do anything‚îuseful‚îwith‚îvariable-width‚îfonts.‚  "  :insert-string‚string‚&optional‚(start‚0)‚end‚(type-too‚t) This‚is‚for‚inserting‚a‚string‚at‚the‚current‚cursor‚position,‚moving‚the‚rest‚of‚the‚line to‚îthe‚îright‚îto‚îmake‚îroom‚îfor‚îit.‚ " The‚string‚to‚insert‚is‚specied‚by‚string‚;‚a‚substring‚thereof‚may‚be‚specied‚with start‚îand‚îend‚,‚as‚îwith‚î:string-out.‚ " string‚îmay‚îalso‚îbe‚îa‚înumber,‚in‚îwhich‚îcase‚îthe‚îcharacter‚îwith‚îthat‚îcode‚îis‚îinserted.‚ " If‚îtype-too‚îis‚îspecied‚îas‚înil,‚the‚îactual‚îdisplay‚îof‚îthe‚îstring‚îis‚supressed,‚and‚the‚space that‚îwas‚îopened‚îis‚îleft‚îblank.‚ "‡"‡"  DSK:LMWIND;STREAM 25 Z4-OCT-80î "‡"A  New Window System q6 Fonts "`  :insert-line‚&optional‚(n‚1) Takes‚the‚line‚containing‚the‚cursor‚and‚all‚the‚lines‚below‚it,‚and‚move‚them‚down one‚îline.‚The‚îline‚îcontaining‚îthe‚îcursor‚îis‚îmoved‚îin‚its‚entirety,‚not‚broken,‚no‚matter where‚îthe‚îcursor‚îis‚îon‚îthe‚îline.‚A‚îblank‚îline‚îis‚îcreated‚îat‚îthe‚îcursor.‚If‚îan‚îargument‚în is‚îgiven,‚open‚îup‚în‚îblank‚îlines.‚Lines‚îpushed‚îo‚îthe‚îbottom‚îof‚îthe‚îwindow‚îare‚îlost.‚  "  :notify‚message This‚îis‚îused‚to‚inform‚the‚user‚of‚some‚event‚which‚is‚interesting‚even‚if‚it‚happens‚to a‚process‚other‚than‚the‚one‚the‚user‚is‚currently‚working‚with.‚The‚system‚beeps‚and prints‚îa‚îmessage‚îlike‚î `[Process foobar message] This‚comes‚out‚on‚the‚selected‚window‚if‚it‚accepts‚notications‚(Lisp‚Listeners‚do), otherwise‚îit‚îcomes‚îout‚îon‚îa‚îsmall‚îpop-up‚î"notication"‚îwindow.‚ " The‚argument‚message‚should‚be‚a‚string‚such‚as‚"needs‚some‚attention"‚which‚ts grammatically‚into‚the‚above‚message.‚Message‚can‚also‚be‚the‚keyword‚:error‚which does‚îsome‚îspecial‚îthings‚îfor‚îthe‚îerror-handler.‚  "@  1.3 Fonts " PThis‚section‚lists‚the‚messages‚that‚have‚to‚do‚with‚fonts‚and‚the‚arrangement‚of‚characters  on‚a‚window's‚display.‚The‚concepts‚herein‚will‚be‚explained‚somewhere‚else‚[or‚maybe‚here]  someday.‚  "  :baseline Returns‚the‚distance‚from‚the‚top‚of‚a‚character‚cell‚to‚the‚character‚baseline‚in‚this window.‚  "  :current-font Returns‚îthe‚îwindow's‚îcurrently‚îselected‚îfont.‚  "  :set-current-font‚font Changes‚îthe‚îwindow's‚îcurrently‚îselected‚îfont.‚Font‚îmay‚îbe‚îa‚înumber‚îwhich‚is‚an‚index in‚îthe‚îfont‚îmap,‚or‚îmay‚îbe‚îa‚îfont‚îitself,‚which‚îmust‚îbe‚îone‚îof‚îthose‚îin‚îthe‚îfont‚îmap.‚  "  :set-font-map‚fm Changes‚the‚set‚of‚fonts‚which‚the‚window‚may‚use.‚Fm‚can‚be‚nil‚(meaning‚the default‚îfont),‚a‚îlist‚îof‚îfont-specications,‚or‚îan‚îarray‚îof‚îfont-specications.‚Changing‚the font‚îmap‚îchanges‚îa‚îvariety‚îof‚îparameters‚îsuch‚îas‚îthe‚îheight‚îof‚îa‚îcharacter‚îline.‚ "‡"‡"  DSK:LMWIND;STREAM 25 Z4-OCT-80î "‡"A  New Window System q7 Fonts "`  :more-p Returns‚ît‚îif‚î"**MORE**"‚îprocessing‚îis‚îenabled‚îfor‚îthis‚îwindow,‚nil‚îotherwise.‚  "  :set-more-p‚t-or-nil Enables‚îor‚îdisables‚î"**MORE**"‚îprocessing.‚  "  :reverse-video-p Returns‚înil‚înormally‚or‚t‚if‚the‚window‚displays‚in‚white‚on‚black‚rather‚than‚black‚on white.‚This‚îis‚îseparate‚îfrom‚îthe‚îwhole‚îscreen's‚îinverse‚îvideo‚îmode‚î(set‚îby‚îTerminal-C).‚  "  :set-reverse-video-p‚t-or-nil Enables‚îor‚îdisables‚îreverse-video‚îdisplay.‚Changing‚îthis‚îmode‚îerases‚îthe‚îwindow.‚  "  :vsp Returns‚îthe‚înumber‚îof‚îblank‚îraster‚îlines‚îbetween‚îcharacter‚îlines.‚  "  :character-width‚char‚&optional‚(font‚current-font) Returns‚the‚width‚of‚the‚character‚char‚,‚in‚pixels.‚The‚current‚font‚is‚used‚if‚font‚is not‚specied.‚If‚char‚is‚a‚backspace,‚:character-width‚can‚return‚a‚negative‚number. For‚tab,‚the‚number‚returned‚depends‚on‚the‚current‚cursor‚position.‚For‚newline,‚the result‚îis‚îdened‚îto‚îbe‚îzero.‚  "  :compute-motion‚string‚&optional‚(start‚0)‚(end‚nil)‚(x‚cursor-x)‚(y‚cursor-y) ‚?‚?‚?‚?‚?‚?‚?‚?‚(cr-at-end-p‚nil)‚(stop-x‚0)‚stop-y‚bottom-limit This‚is‚used‚to‚gure‚out‚where‚the‚cursor‚would‚end‚up‚if‚you‚were‚to‚output‚string using‚:string-out.‚It‚does‚the‚right‚thing‚if‚you‚give‚it‚just‚the‚string‚as‚an‚argument. start‚and‚end‚can‚be‚used‚to‚specify‚a‚substring‚as‚with‚:string-out.‚x‚and‚y‚can‚be used‚to‚start‚your‚imaginary‚cursor‚at‚some‚point‚other‚than‚the‚present‚position‚of‚the real‚cursor.‚If‚you‚specify‚cr-at-end-p‚as‚t,‚it‚pretends‚to‚do‚a‚:line-out‚instead‚of‚a :string-out.‚stop-x‚and‚stop-y‚dene‚the‚size‚of‚the‚imaginary‚window‚in‚which‚the string‚is‚being‚printed;‚the‚printing‚stops‚if‚the‚cursor‚becomes‚simultaneously‚ >‚both of‚îthem.‚These‚default‚to‚the‚lower‚left-hand‚corner‚of‚the‚window.‚I'm‚not‚sure‚what bottom-limit‚îcontrols.‚ " The‚method‚does‚a‚triple-value‚return‚of‚the‚x‚and‚y‚coordinates‚you‚ended‚up‚at‚and an‚indication‚of‚how‚far‚down‚the‚string‚you‚got.‚This‚indication‚is‚nil‚if‚the‚whole string‚was‚exhausted,‚or‚the‚index‚of‚the‚next‚character‚to‚be‚processed‚when‚the stopping‚îpoint‚î(end‚îof‚îwindow)‚îwas‚îreached,‚or‚ît‚îif‚îthe‚îstopping‚îpoint‚was‚reached‚only because‚îof‚îan‚îextra‚îcarriage‚îreturn‚îdue‚îto‚îcr-at-end-p‚îbeing‚ît.‚ " All‚îcoordinates‚îfor‚îthis‚îmessage‚îare‚îin‚îpixels.‚ "‡"[  DSK:LMWIND;STREAM 25 Z4-OCT-80î "‡"A  New Window System q8 Graphic Output "`  :string-length‚string‚&optional‚(start‚0)‚(end‚nil)‚stop-x‚(font‚current-font)‚(start-x ‚?‚?‚?‚?‚?‚?‚?‚?‚0) This‚îis‚îvery‚îmuch‚îlike‚î:compute-motion,‚but‚îworks‚îin‚îonly‚îone‚îdimension.‚It‚tells‚you how‚îfar‚îthe‚îcursor‚îwould‚îmove‚îif‚îstring‚îwere‚îto‚îbe‚îdisplayed‚îin‚îthe‚îcurrent‚îfont‚starting at‚the‚left‚margin,‚or‚at‚start-x‚if‚that‚is‚specied.‚start‚and‚end‚work‚as‚with‚:string- out‚to‚specify‚a‚substring‚of‚string‚.‚If‚stop-x‚is‚not‚specied‚or‚nil,‚the‚window‚is assumed‚to‚have‚innite‚width;‚otherwise‚the‚simulated‚display‚will‚stop‚when‚a position‚îstop-x‚îpixels‚îfrom‚îthe‚îleft‚îedge‚îis‚îreached.‚The‚îfont‚îcan‚îbe‚îspecied.‚ " :string-length‚does‚a‚double-value‚return‚of‚where‚the‚imaginary‚cursor‚ended‚up‚and the‚index‚of‚the‚next‚character‚in‚the‚string.‚The‚second‚value‚is‚normally‚end‚(the length‚of‚the‚string),‚unless‚it‚stops‚early‚because‚the‚next‚character‚would‚have‚moved the‚îcursor‚îpast‚îstop-x‚.‚  "@  1.4 Graphic Output " PThese‚messages‚provide‚for‚the‚display‚of‚graphic‚images‚on‚the‚window.‚The‚:draw-foo  messages‚îall‚îclip‚;‚that‚îis,‚if‚îyou‚îtry‚îto‚draw‚something‚bigger‚than‚the‚window‚no‚error‚occurs  and‚îthe‚îvisible‚îportions‚îof‚îthe‚îobject‚îare‚îdrawn.‚ " PThe‚coordinates‚in‚these‚messages‚can‚be‚either‚xnums‚or‚onums‚[that‚is‚not‚true‚of‚all  the‚îmessages‚îcurrently,‚it‚îshould‚îbe‚îxed.]‚î " PMost‚of‚these‚messages‚take‚an‚alu‚argument,‚which‚controls‚how‚the‚bits‚of‚the‚graphic  object‚being‚drawn‚are‚combined‚with‚the‚bits‚already‚present‚in‚the‚window.‚In‚most‚cases  this‚argument‚is‚optional‚and‚defaults‚to‚the‚window's‚char-aluf,‚the‚same‚alu‚function‚as‚is  used‚to‚draw‚characters,‚which‚is‚normally‚inclusive-or.‚The‚following‚symbols‚have‚the  possible‚îalu‚îfunctions‚îas‚îtheir‚îvalues:‚  "  tv:alu-ior hInclusive-or.‚Bits‚in‚the‚object‚being‚drawn‚are‚turned‚on‚and‚other‚bits‚are hleft‚îalone.‚This‚îis‚îthe‚îchar-aluf‚îof‚îmost‚îwindows.‚  "  tv:alu-andca hAnd-with-complement.‚Bits‚in‚the‚object‚being‚drawn‚are‚turned‚o‚and‚other hbits‚îare‚îleft‚îalone.‚This‚îis‚îthe‚îerase-aluf‚îof‚îmost‚îwindows.‚  "  tv:alu-xor hExclusive-or.‚Bits‚in‚the‚object‚being‚drawn‚are‚complemented‚and‚other‚bits hare‚left‚alone.‚Many‚graphics‚programs‚use‚this.‚These‚messages‚take‚quite‚a hbit‚of‚care‚to‚do‚"the‚right‚thing"‚when‚an‚exclusive-or‚ALU‚function‚is‚used, hdrawing‚each‚point‚exactly‚once‚and‚including‚or‚excluding‚boundary‚points‚so hthat‚îadjacent‚îobjects‚ît‚îtogether‚înicely.‚  "  tv:alu-seta hSet‚all‚bits‚in‚the‚aected‚region.‚!This‚is‚not‚useful‚with‚the‚drawing hoperations,‚because‚the‚exact‚size‚and‚shape‚of‚the‚aected‚region‚depend‚on hthe‚implementation‚details‚of‚the‚microcode.‚The‚seta‚function‚is‚useful‚with hthe‚bitblt‚operations,‚where‚it‚causes‚the‚source‚rectangle‚to‚be‚transferred‚to hthe‚destination‚rectangle‚with‚no‚dependency‚on‚the‚previous‚contents‚of‚the "J  DSK:LMWIND;STREAM 25 Z4-OCT-80î "‡"A  New Window System q9 Graphic Output "` hdestination.‚ " PYou‚îshould‚îsend‚îthese‚îmessages‚îrather‚îthan‚îdirectly‚îcalling‚îthe‚îmicrocode‚îprimitives‚because  these‚messages‚provide‚several‚essential‚services‚which‚are‚too‚complex‚for‚the‚microcode.‚If  you‚think‚these‚messages‚are‚too‚slow,‚complain‚and‚we‚will‚make‚them‚faster‚or‚provide‚a  better‚îway‚îto‚îdo‚îwhat‚îyou‚îneed.‚  "  :pixel‚x‚y Returns‚the‚numerical‚value‚of‚the‚picture‚element‚at‚the‚specied‚coordinates.‚The result‚îis‚î0‚îor‚î1‚îon‚îa‚îblack-and-white‚îTV.‚It‚îis‚îan‚îerror‚îto‚îreference‚îoutside‚îthe‚îwindow.‚  "  :set-pixel‚x‚y‚value Stores‚value‚into‚the‚picture‚element‚at‚the‚specied‚coordinates.‚Value‚should‚be‚0‚or 1‚îon‚îa‚îblack-and-white‚îTV.‚It‚îis‚îan‚îerror‚îto‚îstore‚îoutside‚îthe‚îwindow.‚  "  :bitblt‚alu‚width‚height‚from-array‚from-x‚from-y‚to-x‚to-y Copies‚a‚rectangle‚of‚bits‚from‚from-array‚onto‚the‚window.‚"The‚rectangle‚has dimensions‚îwidth‚îby‚îheight‚,‚and‚îits‚îupper‚îleft‚îcorner‚îhas‚îcoordinates‚from-x,‚from-y‚.‚It is‚transferred‚onto‚the‚window‚so‚that‚its‚upper‚left‚corner‚will‚have‚coordinates‚to-x, to-y‚.‚The‚bits‚of‚the‚transferred‚rectangle‚are‚combined‚with‚the‚bits‚on‚the‚display according‚to‚the‚Boolean‚function‚specied‚by‚alu‚.‚As‚in‚the‚bitblt‚function,‚if‚from- array‚îis‚îtoo‚îsmall‚îit‚îis‚îautomatically‚îreplicated.‚  "  :bitblt-from-sheet‚alu‚width‚height‚from-x‚from-y‚to-array‚to-x‚to-y Copies‚a‚rectangle‚of‚bits‚from‚the‚window‚to‚to-array‚.‚Except‚for‚their‚order,‚all‚the other‚îarguments‚îhave‚îthe‚îsame‚îsignicance‚îas‚îin‚î:bitblt.‚ "$  [The‚bitblt‚messages‚are‚going‚to‚be‚changed‚in‚the‚future,‚since‚they‚don't‚clip‚at‚window  boundaries,‚don't‚allow‚for‚negative‚width‚and‚height,‚and‚don't‚provide‚any‚way‚to‚bitblt‚a  window‚îto‚îitself.]‚î  "  :draw-char‚font‚char‚x‚y‚&optional‚alu The‚character‚with‚code‚char‚from‚font‚font‚is‚displayed‚on‚the‚window‚with‚its‚upper left‚îcorner‚îat‚îcoordinates‚î(x,y‚).‚  "  :draw-line‚x1‚y1‚x2‚y2‚&optional‚alu‚(draw-end-point‚t) A‚îline‚îis‚îdrawn‚îon‚îthe‚îwindow‚with‚endpoints‚(x1,y1‚)‚and‚(x2,y2‚).‚If‚draw-end-point‚is specied‚as‚nil,‚the‚last‚point‚is‚not‚drawn.‚This‚is‚useful‚in‚cases‚such‚as‚xoring‚a polygon‚îmade‚îup‚îof‚îseveral‚îconnected‚îline‚îsegments.‚  "  :draw-lines‚alu‚x0‚y0‚x1‚y1‚...‚xn‚yn n‚îlines‚îare‚îdrawn‚îon‚îthe‚îscreen,‚the‚îrst‚îwith‚îendpoints‚î(x0,y0‚)‚îand‚î(x1,y1‚),‚the‚îsecond with‚endpoints‚(x1,y1‚)‚and‚(x2,y2‚),‚and‚so‚on.‚The‚points‚between‚lines‚are‚drawn exactly‚îonce‚îand‚îthe‚îlast‚îendpoint,‚at‚î(xn‚,yn‚)‚îis‚înot‚îdrawn.‚ "n  DSK:LMWIND;STREAM 25 Z4-OCT-80î "‡"A  New Window System j10 Graphic Output "`  :draw-curve‚x-array‚y-array‚&optional‚end‚alu Draws‚a‚sequence‚of‚connected‚line‚segments.‚The‚points‚at‚the‚ends‚of‚the‚segments are‚in‚the‚arrays‚x-array‚and‚y-array‚.‚The‚points‚between‚line‚segments‚are‚drawn exactly‚once‚and‚the‚point‚at‚the‚end‚of‚the‚last‚line‚is‚not‚drawn‚at‚all;‚this‚is‚useful when‚îalu‚îis‚îtv:alu-xor.‚The‚înumber‚îof‚îline‚îsegments‚drawn‚is‚1‚less‚than‚the‚length‚of the‚arrays,‚unless‚a‚nil‚is‚found‚in‚one‚of‚the‚arrays‚rst.‚If‚end‚is‚specied‚it‚is‚used in‚îplace‚îof‚îthe‚îactual‚îlength‚îof‚îthe‚îarrays.‚  "  :draw-wide-curve‚x-array‚y-array‚width‚&optional‚end‚alu Like‚î:draw-curve‚îbut‚îwidth‚îis‚îhow‚îwide‚îto‚îmake‚îthe‚îlines.‚  "  :draw-rectangle‚width‚height‚x‚y‚&optional‚alu A‚lled-in‚rectangle‚with‚dimensions‚width‚by‚height‚is‚drawn‚on‚the‚window‚with‚its upper‚îleft‚îcorner‚îat‚îcoordinates‚î(x,y‚).‚  "  :draw-triangle‚x1‚y1‚x2‚y2‚x3‚y3‚&optional‚alu A‚lled-in‚triangle‚with‚its‚corners‚at‚(x1,y1‚),‚(x2,y2‚),‚and‚(x3,y3‚)‚is‚drawn‚on‚the window.‚  "  :draw-circle‚center-x‚center-y‚radius‚&optional‚alu Draws‚îthe‚îoutline‚îof‚îa‚îcircle‚îspecied‚îby‚îits‚îcenter‚îand‚îradius.‚  "  :draw-filled-in-circle‚center-x‚center-y‚radius‚&optional‚alu Draws‚îa‚îlled-in‚îcircle.‚  "  :draw-filled-in-sector‚center-x‚center-y‚radius‚theta-1‚theta-2‚&optional‚alu Draws‚a‚"triangular"‚section‚of‚a‚lled-in‚circle,‚bounded‚by‚an‚arc‚of‚the‚circle‚and the‚two‚radii‚at‚theta-1‚and‚theta-2‚.‚These‚angles‚are‚in‚radians‚from‚the‚positive-X direction.‚  "  :draw-regular-polygon‚x1‚y1‚x2‚y2‚n‚&optional‚alu Draws‚a‚lled-in,‚closed,‚convex,‚regular‚polygon‚of‚(abs‚n‚)‚sides,‚where‚the‚line from‚(x1,y1)‚to‚(x2,y2)‚is‚one‚of‚the‚sides.‚If‚n‚is‚positive‚then‚the‚interior‚of‚the polygon‚îis‚îon‚îthe‚îright-hand‚îside‚îof‚îthe‚îedge.‚ "‡"‡"‡"U  DSK:LMWIND;STREAM 25 Z4-OCT-80î "‡"A  New Window System j11 #Message Index "` \Message Index  "d  :baseline (. H. h. . (. H. h. . (. H. i.  . +. L6 :set-current-font r. . 4. U. v. . :. \. ~. . B6  :beep . !. A. a. . #. D. e. . '. H. i.  . +. L3 :set-cursorpos V. w. . 9. Z. {. . =. ^. ® . B4  :bitblt . '. G. g. . '. G. g. . '. H. i.  . +. L9 :set-font-map R. s. . 5. V. w. . :. \. ~. . B6  :bitblt-from-sheet  . ,. L. l.  . ,. L. l.  . ,. L9 :set-more-p ;. [. {. . ;. [. |. . >. _. . !. B7  :character-width ~. . @. a. . #. D. f. . *. L7 :set-pixel !. A. a. . !. A. a. . !. A. a. . !. B9  :clear-char =. ^. ®  . A. b. . $. E. f. . *. L4 :set-reverse-video-p . ;. [. |. . >. _. . !. B7  :clear-eof 0. R. t. . 8. Z. |. . @. c. . ). L4 :size-in-characters . +. M. p. . 6. Y. |. . B4  :clear-eol /. Q. s. . 7. Y. {. . @. c. . ). L4 :string-length S. t. . 6. W. x. . :. \. ~. . B8  :clear-input G. g. . '. G. g. . '. H. i.  . +. L2 :string-out /. P. q. . 3. T. v. . :. \. ~. . B3  :clear-screen U. w. . ;. ]. ® !. C. e. . ). L4 :tyi ]. }. . =. ]. }. . =. ]. }. . >. _. . !. B1  :compute-motion . (. H. h. . (. H. i.  . +. L7 :tyi-no-hang G. i. . -. O. q. . 6. Y. |. . B2  :current-font U. w. . ;. ]. ® !. C. e. . ). L6 :tyo e. . ). K. m. . 1. S. u. . 9. [. }. . B3  :delete-char J. j.  . *. J. j.  . *. J. j.  . +. L5 :untyi {. . ;. [. {. . ;. [. |. . >. _. . !. B2  :delete-line D. d. . $. D. e. . '. H. i.  . +. L5 :vsp g. . *. L. n. . 2. T. v. . :. \. ~. . B7  :delete-string Z. {. . =. ^. . ". D. f. . *. L5 :which-operations . *. M. p. . 6. Y. |. . B1  :draw-char >. _. . !. B. c. . %. F. g. . *. L9  :draw-circle K. l. î. .. P. r. . 6. X. z. . >10  :draw-curve L. m. . /. P. r. . 6. X. z. . >10  :draw-lled-in-circle /. P. r. . 6. X. z. . >10  :draw-lled-in-sector 3. T. u. . 7. X. z. . >10  :draw-line 8. Y. z. . <. ^. . ". D. f. . *. L9  :draw-lines A. a. . #. D. e. . '. H. i.  . +. L9  :draw-rectangle u. . 6. W. x. . :. [. |. . >10  :draw-regular-polygon H. k. . 1. T. w. . >10  :draw-triangle f. . *. L. n. . 2. U. x. . >10  :draw-wide-curve  . .. P. r. . 6. X. z. . >10  :fresh-line 8. Y. z. . <. ^. . ". D. f. . *. L4  :home-cursor [. |. . >. _. . ". D. f. . *. L4  :home-down T. v. . :. \. ~.  . B. d. . ). L4  :insert-char D. d. . $. D. e. . '. H. i.  . +. L5  :insert-line ?. `. . ". C. d. . &. G. h.  . *. L6  :insert-string U. w. . ;. ]. ® !. C. e. . ). L5  :line-out #. C. c. . #. D. e. . '. H. i.  . +. L3  :listen . '. G. g. . '. G. g. . '. H. i.  . +. L2  :more-p . ?. `. . ". C. d. . &. G. h.  . *. L7  :notify . 1. S. u. . 9. [. }. . A. c. . ). L6  :pixel . #. C. c. . #. D. e. . '. H. i.  . +. L9  :read-cursorpos u. . 9. [. }. . A. c. . ). L4  :reverse-video-p ~. . @. a. . #. D. f. . *. L7  :rubout-handler y. . <. ^. . ". D. f. . *. L2 "*  Z4-OCT-80î "‡"A  New Window System q1 Table of Contents "` >Table of Contents "d  1. Stream Operations ;. [. {. . ;. [. {. . ;. [. {. . ;. [. {. . ;. [. {. . ;. [. |. . >. _. . !. B1  1.1 Input >. ^. ~. . >. ^. ~. . >. ^. ~. . >. ^. ~. . >. ^. ~. . >. ^. ~. . >. ^. ~. . >. _. . !. B1  1.2 Character Output I. i.  . *. K. l. î. .. O. p. . 2. S. t. . 6. W. x. . :. [. |. . >. _. . !. B3  1.3 Fonts @. `. .  . @. `. .  . @. `. .  . @. `. .  . @. `. .  . @. `. . . @. `. . . @. `. . !. B6  1.4 Graphic Output 8. X. x. . 8. X. x. . 8. X. x. . 8. X. x. . 8. X. x. . :. [. |. . >. _. . !. B8 "  Message Index m. î. -. M. m. î. -. M. m. î. -. M. m. î. -. M. m. î. -. M. m. î. -. M. n. . 0. Q. r. . 411 "‡"‡"‡"‡"‡"‡"‡"‡"‡"h  Z4-OCT-80î