%!PS-Adobe-1.0 %%Creator: devnull:dshr (David Rosenthal) %%Title: stdin (ditroff) %%CreationDate: Thu Nov 10 09:05:24 1988 %%EndComments % lib/psdit.pro -- prolog for psdit (ditroff) files % Copyright (c) 1984, 1985 Adobe Systems Incorporated. All Rights Reserved. % last edit: shore Sat Nov 23 20:28:03 1985 % RCSID: $Header: psdit.pro,v 2.1 85/11/24 12:19:43 shore Rel $ /$DITroff 140 dict def $DITroff begin /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def /xi {0 72 11 mul translate 72 resolution div dup neg scale 0 0 moveto /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def F /pagesave save def}def /xiL {72 8.25 mul 72 11 mul translate -90 rotate 72 resolution div dup neg scale 0 0 moveto /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def F /pagesave save def}def /PB{save /psv exch def currentpoint translate resolution 72 div dup neg scale 0 0 moveto}def /PE{psv restore}def /arctoobig 90 def /arctoosmall .05 def /m1 matrix def /m2 matrix def /m3 matrix def /oldmat matrix def /tan{dup sin exch cos div}def /point{resolution 72 div mul}def /dround {transform round exch round exch itransform}def /xT{/devname exch def}def /xr{/mh exch def /my exch def /resolution exch def}def /xp{}def /xs{docsave restore end}def /xt{}def /xf{/fontname exch def /slotno exch def fontnames slotno get fontname eq not {fonts slotno fontname findfont put fontnames slotno fontname put}if}def /xH{/fontheight exch def F}def /xS{/fontslant exch def F}def /s{/fontsize exch def /fontheight fontsize def F}def /f{/fontnum exch def F}def /F{fontheight 0 le {/fontheight fontsize def}if fonts fontnum get fontsize point 0 0 fontheight point neg 0 0 m1 astore fontslant 0 ne{1 0 fontslant tan 1 0 0 m2 astore m3 concatmatrix}if makefont setfont .04 fontsize point mul 0 dround pop setlinewidth}def /X{exch currentpoint exch pop moveto show}def /N{3 1 roll moveto show}def /Y{exch currentpoint pop exch moveto show}def /S{show}def /ditpush{}def/ditpop{}def /AX{3 -1 roll currentpoint exch pop moveto 0 exch ashow}def /AN{4 2 roll moveto 0 exch ashow}def /AY{3 -1 roll currentpoint pop exch moveto 0 exch ashow}def /AS{0 exch ashow}def /MX{currentpoint exch pop moveto}def /MY{currentpoint pop exch moveto}def /MXY{moveto}def /cb{pop}def % action on unknown char -- nothing for now /n{}def/w{}def /p{pop showpage pagesave restore /pagesave save def}def % sun logo /u{newpath -28 7.5 moveto 15 7.5 lineto 15.5 15 7.5 270 90 arc -28 22.5 lineto stroke} def /un{ gsave 30 30 translate u 180 rotate u grestore 90 rotate} def /logo{ gsave un un un un grestore} def % Manual Feed Definitions /SetStTime{statusdict /manualfeedtimeout 120 put} def /SetStatus{statusdict /manualfeed true put statusdict /product get (LaserWriter) eq {version (23.0) eq % Don't redefine showpage if printer is not "Classic LW" {/p { {statusdict /printerstatus get exec 16#22000000 and 0 eq{exit}if}loop pop showpage pagesave restore /pagesave save def}def}if }if}def /abspoint{currentpoint exch pop add exch currentpoint pop add exch}def /distance{dup mul exch dup mul add sqrt}def /dstroke{currentpoint stroke moveto}def /Dl{2 copy gsave rlineto stroke grestore rmoveto}def /arcellipse{/diamv exch def /diamh exch def oldmat currentmatrix pop currentpoint translate 1 diamv diamh div scale /rad diamh 2 div def currentpoint exch rad add exch rad -180 180 arc oldmat setmatrix}def /Dc{dup arcellipse dstroke}def /De{arcellipse dstroke}def /Da{/endv exch def /endh exch def /centerv exch def /centerh exch def /cradius centerv centerv mul centerh centerh mul add sqrt def /eradius endv endv mul endh endh mul add sqrt def /endang endv endh atan def /startang centerv neg centerh neg atan def /sweep startang endang sub dup 0 lt{360 add}if def sweep arctoobig gt {/midang startang sweep 2 div sub def /midrad cradius eradius add 2 div def /midh midang cos midrad mul def /midv midang sin midrad mul def midh neg midv neg endh endv centerh centerv midh midv Da currentpoint moveto Da} {sweep arctoosmall ge {/controldelt 1 sweep 2 div cos sub 3 sweep 2 div sin mul div 4 mul def centerv neg controldelt mul centerh controldelt mul endv neg controldelt mul centerh add endh add endh controldelt mul centerv add endv add centerh endh add centerv endv add rcurveto dstroke} {centerh endh add centerv endv add rlineto dstroke}ifelse}ifelse}def /Barray 200 array def % 200 values in a wiggle /D~{mark}def /D~~{counttomark Barray exch 0 exch getinterval astore /Bcontrol exch def pop /Blen Bcontrol length def Blen 4 ge Blen 2 mod 0 eq and {Bcontrol 0 get Bcontrol 1 get abspoint /Ycont exch def /Xcont exch def Bcontrol 0 2 copy get 2 mul put Bcontrol 1 2 copy get 2 mul put Bcontrol Blen 2 sub 2 copy get 2 mul put Bcontrol Blen 1 sub 2 copy get 2 mul put /Ybi /Xbi currentpoint 3 1 roll def def 0 2 Blen 4 sub {/i exch def Bcontrol i get 3 div Bcontrol i 1 add get 3 div Bcontrol i get 3 mul Bcontrol i 2 add get add 6 div Bcontrol i 1 add get 3 mul Bcontrol i 3 add get add 6 div /Xbi Xcont Bcontrol i 2 add get 2 div add def /Ybi Ycont Bcontrol i 3 add get 2 div add def /Xcont Xcont Bcontrol i 2 add get add def /Ycont Ycont Bcontrol i 3 add get add def Xbi currentpoint pop sub Ybi currentpoint exch pop sub rcurveto }for dstroke}if}def end /ditstart{$DITroff begin /nfonts 60 def % NFONTS makedev/ditroff dependent! /fonts[nfonts{0}repeat]def /fontnames[nfonts{()}repeat]def /docsave save def }def % character outcalls /oc {/pswid exch def /cc exch def /name exch def /ditwid pswid fontsize mul resolution mul 72000 div def /ditsiz fontsize resolution mul 72 div def ocprocs name known{ocprocs name get exec}{name cb} ifelse}def /fractm [.65 0 0 .6 0 0] def /fraction {/fden exch def /fnum exch def gsave /cf currentfont def cf fractm makefont setfont 0 .3 dm 2 copy neg rmoveto fnum show rmoveto currentfont cf setfont(\244)show setfont fden show grestore ditwid 0 rmoveto} def /oce {grestore ditwid 0 rmoveto}def /dm {ditsiz mul}def /ocprocs 50 dict def ocprocs begin (14){(1)(4)fraction}def (12){(1)(2)fraction}def (34){(3)(4)fraction}def (13){(1)(3)fraction}def (23){(2)(3)fraction}def (18){(1)(8)fraction}def (38){(3)(8)fraction}def (58){(5)(8)fraction}def (78){(7)(8)fraction}def (sr){gsave 0 .06 dm rmoveto(\326)show oce}def (is){gsave 0 .15 dm rmoveto(\362)show oce}def (->){gsave 0 .02 dm rmoveto(\256)show oce}def (<-){gsave 0 .02 dm rmoveto(\254)show oce}def (==){gsave 0 .05 dm rmoveto(\272)show oce}def end % an attempt at a PostScript FONT to implement ditroff special chars % this will enable us to % cache the little buggers % generate faster, more compact PS out of psdit % confuse everyone (including myself)! 50 dict dup begin /FontType 3 def /FontName /DIThacks def /FontMatrix [.001 0 0 .001 0 0] def /FontBBox [-260 -260 1000 1000] def% a lie but ... /Encoding 256 array def 0 1 255{Encoding exch /.notdef put}for Encoding dup 8#040/space put %space dup 8#224/rc put %right ceil dup 8#213/lt put %left top curl dup 8#210/bv put %bold vert dup 8#217/lk put %left mid curl dup 8#214/lb put %left bot curl dup 8#215/rt put %right top curl dup 8#220/rk put %right mid curl dup 8#216/rb put %right bot curl dup 8#222/rf put %right floor dup 8#221/lf put %left floor dup 8#223/lc put %left ceil dup 8#204/sq put %square dup 8#205/bx put %box dup 8#206/ci put %circle dup 8#207/br put %box rule dup 8#140/rn put %root extender dup 8#145/vr put %vertical rule dup 8#146/ob put %outline bullet dup 8#267/bu put %bullet dup 8#211/ru put %rule dup 8#137/ul put %underline dup 8#212/su put %sun logo pop /DITfd 100 dict def /BuildChar{0 begin /cc exch def /fd exch def /charname fd /Encoding get cc get def /charwid fd /Metrics get charname get def /charproc fd /CharProcs get charname get def charwid 0 fd /FontBBox get aload pop setcachedevice 2 setlinejoin 40 setlinewidth newpath 0 0 moveto gsave charproc grestore end}def /BuildChar load 0 DITfd put %/UniqueID 5 def /CharProcs 50 dict def CharProcs begin /space{}def /.notdef{}def /ru{500 0 rls}def /rn{0 800 moveto 500 0 rls}def /vr{0 800 moveto 0 -800 rls}def /bv{0 800 moveto 0 -1000 rls}def /br{0 800 moveto 0 -1000 rls}def /ul{0 -200 moveto 500 0 rls}def /ob{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath stroke}def /bu{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath fill}def /sq{80 0 rmoveto currentpoint dround newpath moveto 640 0 rlineto 0 640 rlineto -640 0 rlineto closepath stroke}def /bx{80 0 rmoveto currentpoint dround newpath moveto 640 0 rlineto 0 640 rlineto -640 0 rlineto closepath fill}def /ci{360 280 rmoveto currentpoint newpath 333 0 360 arc 50 setlinewidth stroke}def /lt{0 -200 moveto 0 550 rlineto currx 800 2cx s4 add exch s4 a4p stroke}def /lb{0 800 moveto 0 -550 rlineto currx -200 2cx s4 add exch s4 a4p stroke}def /rt{0 -200 moveto 0 550 rlineto currx 800 2cx s4 sub exch s4 a4p stroke}def /rb{0 800 moveto 0 -500 rlineto currx -200 2cx s4 sub exch s4 a4p stroke}def /lk{0 800 moveto 0 300 -300 300 s4 arcto pop pop 1000 sub 0 300 4 2 roll s4 a4p 0 -200 lineto stroke}def /rk{0 800 moveto 0 300 s2 300 s4 arcto pop pop 1000 sub 0 300 4 2 roll s4 a4p 0 -200 lineto stroke}def /lf{0 800 moveto 0 -1000 rlineto s4 0 rls}def /rf{0 800 moveto 0 -1000 rlineto s4 neg 0 rls}def /lc{0 -200 moveto 0 1000 rlineto s4 0 rls}def /rc{0 -200 moveto 0 1000 rlineto s4 neg 0 rls}def /su{10 setlinewidth 480 240 translate 45 rotate -7 7 scale logo} def end /Metrics 50 dict def Metrics begin /.notdef 0 def /space 500 def /ru 500 def /br 0 def /lt 416 def /lb 416 def /rt 416 def /rb 416 def /lk 416 def /rk 416 def /rc 416 def /lc 416 def /rf 416 def /lf 416 def /bv 416 def /ob 350 def /bu 350 def /ci 750 def /bx 750 def /sq 750 def /rn 500 def /ul 500 def /vr 0 def /su 900 def end DITfd begin /s2 500 def /s4 250 def /s3 333 def /a4p{arcto pop pop pop pop}def /2cx{2 copy exch}def /rls{rlineto stroke}def /currx{currentpoint pop}def /dround{transform round exch round exch itransform} def end end /DIThacks exch definefont pop ditstart (psc)xT 576 1 1 xr 1(Times-Roman)xf 1 f 2(Times-Italic)xf 2 f 3(Times-Bold)xf 3 f 4(Times-BoldItalic)xf 4 f 5(Helvetica)xf 5 f 6(Helvetica-Bold)xf 6 f 7(Courier)xf 7 f 8(Courier-Bold)xf 8 f 9(Symbol)xf 9 f 10(DIThacks)xf 10 f 10 s 1 f xi %%EndProlog %%Page: 1 1 10 s 0 xH 0 xS 1 f 8 s 3 f 12 s 1100 976(A)N 1193(User-Interface)X 1815(Toolkit)X 2138(in)X 2242(Object-Oriented)X 2945(P)X 10 s 3004(OST)X 12 s 3163(S)X 10 s 3216(CRIPT)X 2 f 1961 1168(Owen)N 2168(M.)X 2275(Densmore)X 1926 1264(David)N 2142(S.)X 2222(H.)X 2320(Rosenthal)X 1 f 1986 1408(Sun)N 2130(Microsystems)X 2039 1504(2300)N 2219(Geng)X 2413(Rd.)X 1955 1600(Palo)N 2117(Alto)X 2279(CA)X 2410(94043)X 2 f 2094 1888(ABSTRACT)N 1 f 1043 2080(Only)N 1227(the)X 1348(die-hards)X 1670(want)X 1849(to)X 1934(develop)X 2211(applications)X 2621(using)X 2817(basic)X 3005(window)X 3286(system)X 3531(facili-)X 843 2176(ties.)N 1024(The)X 1179(preferred)X 1505(approach)X 1830(is)X 1913(a)X 1979(higher-level)X 2397(``toolkit'')X 2743(of)X 2840(user)X 3004(interface)X 3316(components,)X 843 2272(such)N 1019(as)X 1115(menus)X 1353(and)X 1498(scroll)X 1705(bars.)X 1908(Experience)X 2298(with)X 2468(current)X 2724(toolkits)X 2991(shows)X 3219(the)X 3345(need)X 3525(for)X 3647(an)X 843 2368(object-oriented)N 1349(interface)X 1651(to)X 1733(these)X 1918(components.)X 843 2492(NeWS,)N 1101(the)X 1223(Network/extensible)X 1875(Window)X 2175(System,)X 2454(allows)X 2687(user)X 2845(interface)X 3151(components)X 3562(to)X 3647(be)X 843 2588(programmed)N 1302(in)X 1412(P)X 8 s 1456(OST)X 10 s 1577(S)X 8 s 1621(CRIPT)X 10 s 1803(.)X 1891(Fortunately,)X 2348(object-oriented)X 2882(interfaces)X 3243(are)X 3390(natural)X 3661(in)X 843 2684(P)N 8 s 887(OST)X 10 s 1008(S)X 8 s 1052(CRIPT)X 10 s 1234(,)X 1306(and)X 1454(they)X 1624(have)X 1808(been)X 1992(used)X 2171(to)X 2265(create)X 2490(a)X 2558(toolkit)X 2798(with)X 2972(some)X 3173(novel)X 3382(properties.)X 843 2780(Among)N 1104(these)X 1290(are)X 1410(the)X 1529(use)X 1657(of)X 1744(concurrent)X 2108(processing)X 2471(and)X 2607(run-time)X 2903(inheritance)X 3280(of)X 3367(component)X 843 2876(methods.)N 1260 3144(``PostScript)N 1662(is)X 1735(the)X 1853(future)X 2065(of)X 2152(words)X 2368(on)X 2468(paper.'')X 2 f 2761(Arthur)X 2994(C.)X 3087(Clarke)X 3 f 555 3384(1.)N 655(Introduction)X 1 f 555 3508(The)N 701(needs)X 905(for)X 1020(portability,)X 1414(distribution,)X 1843(and)X 1980(standardisation)X 2486(are)X 2606(encouraging)X 3024(the)X 3143(implementation)X 3666(of)X 3753(window)X 555 3604(systems)N 838(for)X 962(U)X 8 s 1020(NIX)X 10 s 1163(as)X 1260(network)X 1553(window)X 1841(servers,)X 2139(rather)X 2357(than)X 2525(as)X 2622(extensions)X 2989(to)X 3080(the)X 3207(operating)X 3539(system)X 3790(kernel.)X 555 3700(These)N 779(servers)X 1039(are)X 1170(user-level)X 1519(daemon)X 1805(processes;)X 2187(clients)X 2428(connect)X 2710(to)X 2804(them)X 2996(and)X 3144(make)X 3350(what)X 3537(are)X 3667(effectively)X 555 3796(remote)N 806(procedure)X 1156(calls)X 1331(in)X 1421(order)X 1619(to)X 1709(create)X 1930(and)X 2074(destroy)X 2338(windows,)X 2695(and)X 2839(to)X 2928(draw)X 3116(in)X 3205(them.)X 3432(Examples)X 3775(include)X 555 3892(Carnegie-Mellon's)N 2 f 1181(Andrew)X 1 f 1430(,)X 8 s 3867(1)Y 10 s 1502 3892(MIT's)N 1727(X)X 1805(Window)X 2101(System,)X 8 s 2356 3867(2)N 10 s 2408 3892(and)N 2544(Sun)X 2688(Microsystems')X 3184(NeWS.)X 8 s 3418 3867(3)N 10 s 555 4016(Most)N 751(network)X 1046(window)X 1336(servers)X 1596(base)X 1771(their)X 1950(client-server)X 2384(communication)X 2914(on)X 3026(a)X 3093(\256xed)X 3284(protocol;)X 3624(applications)X 555 4112(express)N 816(the)X 934(operations)X 1288(they)X 1446(need)X 1618(in)X 1700(terms)X 1898(of)X 1985(the)X 2103(\256xed)X 2283(set)X 2392(of)X 2479(operators)X 2798(supported)X 3134(by)X 3234(the)X 3352(protocol.)X 3679(The)X 3824(imag-)X 555 4208(ing)N 679(model)X 901(they)X 1061(support)X 1323(is)X 1398(pixel)X 1580(coordinates)X 1972(and)X 2110(RasterOp.)X 2475(In)X 2564(NeWS,)X 2840(by)X 2942(contrast,)X 3258(client-server)X 3682(communi-)X 555 4304(cation)N 777(uses)X 941(a)X 1002(subset)X 1227(of)X 1319(Adobe's)X 1616(P)X 8 s 1660(OST)X 10 s 1781(S)X 8 s 1825(CRIPT)X 2007 4279(4)N 10 s 2064 4304(page)N 2241(description)X 2622(language.)X 2977(P)X 8 s 3021(OST)X 10 s 3142(S)X 8 s 3186(CRIPT)X 10 s 3393(is)X 3471(a)X 3532(Forth-like)X 3877(pro-)X 555 4400(gramming)N 905(language,)X 1236(and)X 1373(it)X 1438(supports)X 1730(the)X 1849(Warnock)X 2165(and)X 2302(Wyatt)X 2519(imaging)X 2802(model.)X 8 s 4375(5)Y 10 s 3075 4400(The)N 3221(fact)X 3363(that)X 3504(applications)X 3912(are)X 555 4496(talking)N 802(to)X 889(a)X 950(programming)X 1411(environment)X 1841(with)X 2008(a)X 2069(high-level)X 2419(imaging)X 2705(model,)X 2949(rather)X 3161(than)X 3323(a)X 3383(\256xed-function)X 3861(RPC)X 555 4592(server)N 772(with)X 934(pixel-level)X 1297(imaging,)X 1619(has)X 1746(radical)X 1985(effects)X 2220(in)X 2302(both)X 2464(the)X 2582(printing)X 2855(and)X 2991(window)X 3269(system)X 3511(worlds.)X 10 f 555 4716(\267)N 1 f 675(It)X 744(provides)X 1040(for)X 1154(resolution-independent)X 1913(and)X 2049(display)X 2300(technology-independent)X 3095(imaging.)X 8 s 10 f 555 4808(\211\211\211\211\211\211\211\211\211\211\211\211\211\211\211\211\211\211)N 1 f 555 4888(Trademarks:)N 555 4956 MXY 1648 0 Dl 761 5024(Mark)N 1584(Owner)X 555 5052 MXY 1648 0 Dl 587 5120(MacApp)N 1170(Apple)X 1342(Computer)X 1614(Inc.)X 587 5200(NeWS)N 1170(Sun)X 1286(Microsystems)X 1661(Inc.)X 587 5280(Object)N 773(Pascal)X 1170(Apple)X 1342(Computer)X 1614(Inc.)X 587 5360(P)N 6 s 623(OST)X 8 s 714(S)X 6 s 750(CRIPT)X 8 s 1170(Adobe)X 1356(Systems)X 1586(Inc.)X 587 5440(SunView)N 1170(Sun)X 1286(Microsystems)X 1661(Inc.)X 587 5520(U)N 6 s 633(NIX)X 8 s 1170(Bell)X 1293(Laboratories.)X 587 5600(X)N 649(Window)X 885(System)X 1170(Massachusetts)X 1555(Institute)X 1781(of)X 1850(Technology.)X 555 5628 MXY 1648 0 Dl 555 MX 0 -672 Dl 2203 5628 MXY 0 -672 Dl 2 p %%Page: 2 2 8 s 0 xH 0 xS 1 f 10 s 2216 384(-)N 2263(2)X 2323(-)X 10 f 555 672(\267)N 1 f 675(It)X 748(allows)X 981(for)X 1099(extensibility)X 1518(in)X 1603(a)X 1662(controlled)X 2010(and)X 2149(portable)X 2435(way.)X 2632(Applications)X 3064(can)X 3199(customise)X 3542(the)X 3663(\(display)X 3944(or)X 675 768(printing\))N 975(service)X 1223(to)X 1305(their)X 1472(needs)X 1675(by)X 1775(writing)X 2026(programs.)X 10 f 555 892(\267)N 1 f 675(It)X 749(provides)X 1050(for)X 1169(a)X 1230(\257exible)X 1494(distribution)X 1886(of)X 1977(function.)X 2308(Individual)X 2661(applications)X 3072(can)X 3208(determine)X 3553(which)X 3773(of)X 3864(their)X 675 988(operations)N 1029(should)X 1262(be)X 1358(performed)X 1713(in)X 1795(the)X 1913(printer)X 2147(or)X 2234(display)X 2485(service.)X 10 f 555 1112(\267)N 1 f 675(It)X 754(provides)X 1060(an)X 1166(integration)X 1543(between)X 1841(printing)X 2123(and)X 2268(displays)X 2559(that)X 2708(has)X 2844(been)X 3025(lost)X 3169(since)X 3363(the)X 3490(days)X 3666(when)X 3869(both)X 675 1208(teminals)N 966(and)X 1102(printers)X 1367(spoke)X 1574(ASCII.)X 1843(This)X 2005(integration)X 2372(naturally)X 2677(supports)X 2968(both)X 3130(text)X 3270(and)X 3406(graphics.)X 555 1332(To)N 664(support)X 924(interactive)X 1283(displays,)X 1605(NeWS)X 1839(extends)X 2104(P)X 8 s 2148(OST)X 10 s 2269(S)X 8 s 2313(CRIPT)X 10 s 2515(with)X 2677(new)X 2831(primitives)X 3175(for:)X 10 f 555 1456(\267)N 1 f 675(multiple)X 961(overlapping)X 1364(drawing)X 1647(surfaces)X 10 f 555 1580(\267)N 1 f 675(multiple)X 961(threads)X 1213(of)X 1300(P)X 8 s 1344(OST)X 10 s 1465(S)X 8 s 1509(CRIPT)X 10 s 1711(execution)X 10 f 555 1704(\267)N 1 f 675(multiple)X 961(input)X 1145(devices)X 3 f 555 1896(2.)N 655(Toolkits)X 954(&)X 1041(the)X 1168(Need)X 1362(for)X 1485(Object-Oriented)X 2071(Programming)X 1 f 555 2020(Some)N 763(window)X 1047(systems,)X 1366(Andrew)X 1651(and)X 1793(the)X 1917(Mac)X 2086(are)X 2211(examples,)X 2580(attempt)X 2846(to)X 2934(enforce)X 3202(a)X 3264(consistent)X 3609(style)X 3785(of)X 3877(user)X 555 2116(interface)N 869(across)X 1102(all)X 1214(the)X 1344(applications)X 1763(that)X 1915(use)X 2053(them.)X 2284(Others,)X 2569(SunWindows)X 3031(and)X 3178(X)X 3267(are)X 3397(examples,)X 3771(attempt)X 555 2212(only)N 723(to)X 811(provide)X 1082(low-level)X 1411(mechanisms,)X 1873(and)X 2015(avoid)X 2219(specifying)X 2579(any)X 2721(details)X 2956(of)X 3049(the)X 3172 0.3750(appearance)AX 3560(or)X 3652(function)X 3944(of)X 555 2308(an)N 651(application's)X 1085(user)X 1239(interface.)X 555 2432(Nevertheless,)N 1032(systems)X 1307(like)X 1449(SunWindows)X 1902(and)X 2040(X)X 2119(do)X 2220(not)X 2343(expect)X 2574(every)X 2774(application)X 3151(to)X 3234(hand-craft)X 3586(its)X 3682(user)X 3837(inter-)X 555 2528(face)N 718(from)X 902(scratch.)X 1198(They)X 1390(normally)X 1706(provide)X 1978(a)X 2041(layer)X 2229(above)X 2448(the)X 2573(basic)X 2765(window)X 3050(system)X 3299(that)X 3446(implements)X 3846(com-)X 555 2624(mon)N 718(components)X 1126(of)X 1214(a)X 1271(user)X 1426(interface,)X 1769(such)X 1937(as)X 2025(menus,)X 2295(scroll)X 2494(bars,)X 2689(buttons)X 2944(and)X 3080(text)X 3220(panels.)X 3485(This)X 3647(upper)X 3850(layer)X 555 2720(provides)N 853(a)X 911(``toolkit'';)X 1291(a)X 1349(user)X 1505(interface)X 1809(can)X 1943(be)X 2041(rapidly)X 2289(assembled)X 2644(by)X 2745(selecting)X 3051(and)X 3188(composing)X 3560(tools)X 3736(from)X 3913(the)X 555 2816(kit.)N 555 2940(As)N 668(experience)X 1041(has)X 1172(been)X 1348(gained)X 1586(with)X 1752(these)X 1941(toolkits,)X 2244(it)X 2312(has)X 2442(become)X 2715(obvious)X 2991(that)X 3134(the)X 3255(appropriate)X 3644(interface)X 3949(to)X 555 3036(the)N 678(user)X 837(interface)X 1144(components)X 1556(they)X 1719(supply)X 1957(is)X 2035(an)X 2136(object-oriented)X 2647(one.)X 2828(Applications)X 3262(want)X 3443(to)X 3530(be)X 3631(able)X 3790(to)X 3877(take)X 555 3132(generic)N 820(objects)X 1075(from)X 1259(the)X 1385(toolkit,)X 1661(such)X 1836(as)X 1931(a)X 1995(menu,)X 2241(and)X 2385(customise)X 2733(them)X 2921(for)X 3043(their)X 3218(need)X 3397(without)X 3668(needing)X 3949(to)X 555 3228(understand)N 941(their)X 1121(internals.)X 1470(They)X 1668(want)X 1857(to)X 1952(be)X 2061(able)X 2228(to)X 2323(create)X 2549(sub-classes)X 2943(of)X 3043(the)X 3174(generic)X 3444(object)X 3673(classes,)X 3949(to)X 555 3324(create,)N 811(for)X 928(example,)X 1263(the)X 1384(class)X 1563(ColorChoice)X 1995(from)X 2174(the)X 2294(class)X 2472(menu.)X 2712(In)X 2801(this)X 2938(way)X 3094(applications)X 3503(can)X 3637(inherit)X 3868(con-)X 555 3420(sistent)N 782(behaviours)X 1157(for)X 1274(all)X 1377(the)X 1498(aspects)X 1753(of)X 1843(a)X 1902(menu)X 2103(they)X 2264(do)X 2367(not)X 2492(need)X 2667(to)X 2752(specialise,)X 3126(and)X 3264(specify)X 3518(only)X 3682(the)X 3802(details)X 555 3516(they)N 713(are)X 832(really)X 1035(interested)X 1367(in.)X 555 3640(This)N 726(evolution)X 1057(towards)X 1340(object-orientation)X 1939(is)X 2021(visible)X 2262(in)X 2352(the)X 2478(history)X 2728(of)X 2823(many)X 3029(existing)X 3310(toolkits,)X 3617(for)X 3739(example)X 555 3736(Sun's)N 765(SunView)X 1091(toolkit.)X 1367(But)X 1510(the)X 1636(best)X 1793(example)X 2093(is)X 2173(MacApp,)X 8 s 2474 3711(6)N 10 s 2533 3736(because)N 2815(it)X 2886(was)X 3038(able)X 3199(to)X 3288(use)X 3422(an)X 3525(object-oriented)X 555 3832(language)N 871(\(Object)X 1138(Pascal\))X 1396(rather)X 1610(than)X 1773(to)X 1860(work,)X 2090(as)X 2182(SunView)X 2505(was)X 2655(forced)X 2886(to,)X 3013(in)X 3100(an)X 3201(object-oriented)X 3712(style)X 3888(in)X 3975(a)X 555 3928(language)N 865(that)X 1005(doesn't)X 1261(support)X 1521(it)X 1585(\(C\).)X 555 4052(Many)N 771(of)X 866(the)X 992(essential)X 1296(ideas)X 1489(in)X 1579(object-oriented)X 2093(systems)X 2374(are)X 2501(similar)X 2751(to)X 2841(the)X 2967(more)X 3160(traditional)X 3517 0.3523(``package''-)AX 3944(or)X 555 4148(``module''-based)N 1133(systems.)X 1446(Brie\257y:)X 10 f 555 4272(\267)N 1 f 675(Packages)X 994(\(modules\))X 1339(are)X 1458(replaced)X 1751(by)X 2 f 1851(classes)X 1 f 2078(.)X 10 f 555 4396(\267)N 1 f 675(Procedures)X 1052(in)X 1134(packages)X 1449(are)X 1568(replaced)X 1861(by)X 2 f 1961(methods)X 1 f 2248(in)X 2330(classes.)X 10 f 555 4520(\267)N 1 f 675(Creating)X 971(package)X 1255(objects)X 1502(is)X 1575(replaced)X 1868(by)X 1968(creating)X 2247(new)X 2 f 2401(instances)X 1 f 2719(of)X 2806(a)X 2862(class.)X 10 f 555 4644(\267)N 1 f 675(Package)X 963(local)X 1139(and)X 1275(global)X 1495(variables)X 1805(are)X 1924(replaced)X 2217(by)X 2 f 2317(class)X 2497(variables)X 1 f 2795(.)X 10 f 555 4768(\267)N 1 f 675(Object)X 909(variables)X 1219(are)X 1338(replaced)X 1631(by)X 2 f 1731(instance)X 2018(variables)X 1 f 2316(.)X 555 4892(New)N 727(notions)X 982(are:)X 10 f 555 5016(\267)N 1 f 675(Classes)X 936(are)X 1056(ordered)X 1323(into)X 1467(a)X 1523(hierarchy)X 1847(by)X 2 f 1947(subclassing)X 1 f 2340(a)X 2396(new)X 2550(class)X 2726(from)X 2902(a)X 2958(prior)X 3134(one,)X 2 f 3290(inheriting)X 1 f 3625(its)X 3720(methods,)X 675 5112(instance)N 958(variables,)X 1288(and)X 1424(class)X 1600(variables.)X 10 f 555 5236(\267)N 1 f 675(Methods)X 983(are)X 1110(invoked)X 1396(by)X 1504(use)X 1639(of)X 1734(the)X 5 f 9 s 1860(send)X 1 f 10 s 2044(primitive.)X 2405(The)X 2558(term)X 2 f 2733(message)X 1 f 3033(is)X 3114(used)X 3289(for)X 3411(an)X 3515(invocation)X 3881(of)X 3975(a)X 675 5332(method)N 935(with)X 1097(its)X 1192(arguments.)X 10 f 555 5456(\267)N 1 f 675(There)X 887(is)X 964(a)X 1024(means)X 1253(of)X 1344(constructing)X 1764(classes)X 2011(on)X 2115(the)X 2237(\257y.)X 2385(This)X 2551(is)X 2628(absent)X 2857(from)X 3037(most)X 3215(languages')X 3586(module)X 3849(crea-)X 675 5552(tion.)N 10 f 555 5676(\267)N 1 f 675(Two)X 849(new)X 1010(concepts,)X 1338(the)X 2 f 1463(self)X 1 f 1601(and)X 2 f 1744(super)X 1 f 1949(pseudo-variables,)X 2540(are)X 2666(introduced.)X 3075(They)X 3266(are)X 3391(used)X 3564(in)X 3652(methods)X 3949(to)X 675 5772(refer)N 848(to)X 930(the)X 1048(object)X 1264(that)X 1404(sent)X 1553(the)X 1671(message)X 1963(and)X 2099(the)X 2217(method's)X 2535(superclass,)X 2905(respectively.)X 3 p %%Page: 3 3 10 s 0 xH 0 xS 1 f 2216 384(-)N 2263(3)X 2323(-)X 3 f 555 672(3.)N 655(Concurrency)X 1 f 555 796(A)N 648(major)X 870(problem)X 1172(in)X 1269(writing)X 1535(user)X 1704(interfaces)X 2052(in)X 2149(conventional)X 2597(sequential)X 2956(programming)X 3426(languages)X 3781(is)X 3868(con-)X 555 892(currency.)N 755 1016(``Providing)N 1146(a)X 1204(suitable)X 1475(graphical)X 1796(display)X 2049(is)X 2124(not)X 2248(especially)X 2591(dif\256cult;)X 2908(what)X 3086(causes)X 3318(problems)X 3638(is)X 3713(the)X 755 1112(complicated)N 1178(\257ow)X 1351(of)X 1449(control)X 1707(required)X 2006(to)X 2099(deal)X 2264(with)X 2437(all)X 2547(the)X 2675(possible)X 2967(sequences)X 3323(of)X 3420(user)X 3584(actions)X 755 1208(with)N 929(the)X 1059(input)X 1255(devices.)X 1568(One)X 1734(might)X 1952(consider)X 2256(a)X 2324(scrolling)X 2635(menu)X 2844(...)X 2935(as)X 3033(a)X 3100(\256nite)X 3295(state)X 3473(automaton)X 755 1304(reading)N 1018(a)X 1076(token)X 1276(for)X 1392(each)X 1562(event)X 1758(...)X 1840(however)X 2139(...)X 2220(the)X 2339(presence)X 2642(of)X 2730(multiple)X 3017(input)X 3202(devices)X 3464(invalidates)X 755 1400(the)N 873(notion)X 1097(of)X 1184(a)X 1240(single)X 1451(stream)X 1685(of)X 1772(tokens.'')X 8 s 2055 1375(7)N 10 s 555 1524(The)N 707(problems)X 1032(are)X 1157(legion.)X 1423(The)X 1574(user)X 1734(may)X 1898(be)X 2000(using)X 2199(multiple)X 2491(physical)X 2784(devices)X 3051(simultaneously.)X 3601(The)X 3752(applica-)X 555 1620(tion)N 712(may)X 883(wish)X 1067(to)X 1162(update)X 1409(its)X 1517(image)X 1746(while)X 1957(the)X 2088(user)X 2254(is)X 2339(dragging)X 2656(a)X 2724(slider.)X 2974(An)X 3104(individual)X 3460(event)X 3666(may)X 3836(be)X 3944(of)X 555 1716(interest)N 811(to)X 893(a)X 949(number)X 1214(of)X 1301(user)X 1455(interface)X 1757(components.)X 555 1840(To)N 671(cope)X 850(with)X 1019(the)X 1144(multiplicity)X 1543(of)X 1637(independent)X 2056(input)X 2247(sources)X 2514(toolkits)X 2779(for)X 2899(conventional)X 3339(sequential)X 3690(languages)X 555 1936(have)N 735(been)X 915(forced)X 1149(to)X 1239(take)X 1401(the)X 1527(\257ow)X 1697(of)X 1791(control)X 2045(away)X 2242(from)X 2425(the)X 2550(application;)X 2955(instead)X 3209(of)X 3303(doing)X 3512(explicit)X 3779(I/O)X 3913(the)X 555 2032(application)N 940(must)X 1124(register)X 1394(interest,)X 1679(describing)X 2042(the)X 2169(routines)X 2456(it)X 2529(wishes)X 2775(called)X 2995(when)X 3197(certain)X 3444(I/O)X 3579(events)X 3812(occur.)X 555 2128(The)N 711(``noti\256er'')X 1081(of)X 1179(the)X 1308(SunView)X 1637(toolkit)X 1876(is)X 1960(an)X 2067(example)X 2370(of)X 2468(this)X 2614(approach.)X 8 s 2929 2103(8)N 10 s 2992 2128(The)N 3148(dif\256culties)X 3521(it)X 3596(causes)X 3837(when)X 555 2224(attempting)N 923(to)X 1010(port)X 1164(pre-existing)X 1572(applications)X 1984(or)X 2076(to)X 2163(add)X 2304(window)X 2587(system)X 2834(support)X 3099(to)X 3186(other)X 3376(languages)X 3722(are)X 3846(well-)X 555 2320(known.)N 840(Further,)X 1143(each)X 1318(routine)X 1572(registering)X 1942(interest)X 2205(in)X 2294(an)X 2397(I/O)X 2531(event)X 2732(must)X 2913(implement)X 3281(its)X 3382(own)X 3546(state)X 3719(machine,)X 555 2416(preserving)N 921(its)X 1023(state)X 1197(in)X 1286(private)X 1536(storage.)X 1835(Each)X 2023(call)X 2166(is)X 2246(a)X 2309(separate)X 2600(invocation,)X 3005(preventing)X 3375(use)X 3509(of)X 3602(the)X 3726(stack)X 3917(for)X 555 2512(retaining)N 860(state.)X 555 2636(Cardelli)N 841(and)X 985(Pike)X 8 s 1127 2611(7)N 10 s 1187 2636(tackle)N 1407(this)X 1550(problem)X 1845(by)X 1953(inventing)X 2283(a)X 2346(new)X 2507(language)X 2824 0.2841(\(``squeak''\))AX 3236(with)X 3405(explict)X 3650(support)X 3917(for)X 555 2732(concurrency,)N 1015(and)X 1153(compiling)X 1499(it)X 1565(into)X 1711(a)X 1768(sequential)X 2114(language)X 2425(\(C\).)X 2593(NeWS)X 2828(also)X 2978(supports)X 3270(concurrency)X 3689(explicitly.)X 555 2828(P)N 8 s 599(OST)X 10 s 720(S)X 8 s 764(CRIPT)X 10 s 970(has)X 1101(been)X 1276(extended)X 1589(with)X 1754(operators)X 2076(that)X 2219(fork)X 2376(new)X 2533(threads)X 2788(of)X 2878(execution,)X 3253(wait)X 3414(for)X 3531(threads)X 3786(to)X 3871(exit,)X 555 2924(create)N 772(and)X 912(use)X 1043(monitors)X 1351(to)X 1437(interlock)X 1746(between)X 2038(threads,)X 2334(and)X 2474(send)X 2645(and)X 2785(receive)X 3042(interprocess)X 3453(messages.)X 3819(These)X 555 3020(threads)N 809(of)X 898(execution)X 1232(are)X 1353(called)X 1567(``lightweight)X 2007(processes'')X 2391(because)X 2668(they)X 2828(exist)X 3001(in)X 3085(a)X 3143(single)X 3356(U)X 8 s 3414(NIX)X 10 s 3548(address)X 3810(space;)X 555 3116(they)N 713(are)X 832(artefacts)X 1125(of)X 1212(the)X 1330(P)X 8 s 1374(OST)X 10 s 1495(S)X 8 s 1539(CRIPT)X 10 s 1741(interpreter)X 2096(and)X 2232(need)X 2404(no)X 2504(special)X 2747(kernel)X 2968(support.)X 555 3240(P)N 8 s 599(OST)X 10 s 720(S)X 8 s 764(CRIPT)X 10 s 973(lightweight)X 1364(processes)X 1699(are)X 1825(very)X 1995(cheap,)X 2250(and)X 2393(they)X 2558(can)X 2697(be)X 2800(used)X 2974(without)X 3245(inhibition)X 3581(to)X 3669(implement)X 555 3336(user)N 712(interface)X 1017(behaviours.)X 1432(A)X 1513(typical)X 1754(menu)X 1955(implementation,)X 2520(for)X 2636(example,)X 2970(will)X 3116(use)X 3245(one)X 3383(process)X 3646(to)X 3730(track)X 3913(the)X 555 3432(mouse)N 786(and)X 924(highlight)X 1234(the)X 1354(current)X 1604(menu)X 1804(selection,)X 2151(and)X 2289(another)X 2552(to)X 2636(listen)X 2831(for)X 2947(the)X 3067(button)X 3293(up)X 3394(event)X 3589(that)X 3730(activates)X 555 3528(the)N 673(selection.)X 1018(Moving)X 1291(into)X 1435(a)X 1491(pull-right)X 1813(will)X 1957(fork)X 2111(another)X 2372(pair)X 2517(of)X 2604(processes.)X 3 f 555 3720(4.)N 655(Object-Oriented)X 1241(P)X 8 s 1290(OST)X 10 s 1419(S)X 8 s 1463(CRIPT)X 1 f 10 s 555 3844(The)N 724(P)X 8 s 768(OST)X 10 s 889(S)X 8 s 933(CRIPT)X 10 s 1159(implementation)X 1705(of)X 1816(classes)X 2083(uses)X 2265(dictionaries)X 2683(to)X 2789(represent)X 3128(the)X 3270(classes)X 3537(and)X 3697(instances.)X 555 3940(Instances)N 890(contain)X 1162(all)X 1278(the)X 1412(instance)X 1711(variables)X 2037(of)X 2140(all)X 2256(their)X 2438(superclasses.)X 2910(Classes)X 3185(contain)X 3456(their)X 3638(methods)X 3944(as)X 555 4036(P)N 8 s 599(OST)X 10 s 720(S)X 8 s 764(CRIPT)X 10 s 972(procedures.)X 1390(Our)X 1540(current)X 1793(implementation)X 2320(of)X 2412(classes)X 2660(is)X 2738(entirely)X 3008(in)X 3095(P)X 8 s 3139(OST)X 10 s 3260(S)X 8 s 3304(CRIPT)X 10 s 3486(,)X 3531(it)X 3600(uses)X 3763(none)X 3944(of)X 555 4132(the)N 673(NeWS)X 907(extensions,)X 1285(and)X 1421(the)X 1539(details)X 1768(were)X 1945(described)X 2273(at)X 2351(the)X 2469(USENIX)X 2783(Monterey)X 3115(workshop.)X 8 s 3451 4107(9)N 10 s 555 4256(Brie\257y,)N 838(the)X 957(class)X 1134(implementation)X 1657(depends)X 1941(on)X 2041(P)X 8 s 2085(OST)X 10 s 2206(S)X 8 s 2250(CRIPT)X 10 s 2432('s)X 2510(use)X 2637(of)X 2724(a)X 2780(dictionary)X 3125(stack)X 3310(to)X 3392(resolve)X 3644(names.)X 3909(All)X 555 4352(names)N 782(used)X 951(in)X 1034(P)X 8 s 1078(OST)X 10 s 1199(S)X 8 s 1243(CRIPT)X 10 s 1446(are)X 1566(resolved)X 1859(at)X 1938(run-time)X 2235(by)X 2336(looking)X 2601(them)X 2782(up)X 2883(in)X 2966(each)X 3135(of)X 3223(the)X 3342(dictionaries)X 3737(in)X 3820(a)X 3877(pro-)X 555 4448(cess')N 750(dictionary)X 1109(stack)X 1308(in)X 1404(turn,)X 1587(starting)X 1861(from)X 2051(the)X 2182(most)X 2370(recently)X 2662(pushed)X 2922(dictionary.)X 3320(This)X 3495(allows)X 3737(for)X 3864(\256ne-)X 555 4544(grained)N 819(control)X 1069(over)X 1235(the)X 1356(naming)X 1619(context)X 1878(of)X 1968(each)X 2139(operation)X 2465(and,)X 2644(since)X 2832(dictionaries)X 3229(can)X 3364(be)X 3463(shared,)X 3735(provides)X 555 4640(control)N 805(over)X 971(name)X 1168(space)X 1370(sharing)X 1629(between)X 1920(processes.)X 2291(When)X 2506(a)X 2565(P)X 8 s 2609(OST)X 10 s 2730(S)X 8 s 2774(CRIPT)X 10 s 2979(process)X 3242(forks,)X 3469(the)X 3589(child)X 3771(inherits)X 555 4736(a)N 613(copy)X 791(of)X 880(the)X 1000(parent's)X 1281(dictionary)X 1628(stack,)X 1855(and)X 1993(thus)X 2147(operates)X 2436(in)X 2519(the)X 2638(same)X 2824(name)X 3019(space.)X 3259(Both)X 3435(the)X 3554(parent)X 3776(and)X 3913(the)X 555 4832(child)N 749(can)X 895(push)X 1080(new)X 1248(dictionaries,)X 1696(creating)X 1989(local)X 2179(names,)X 2458(or)X 2559(pop)X 2713(them,)X 2947(removing)X 3287(their)X 3467(access)X 3706(to)X 3801(shared)X 555 4928(names.)N 555 5052(The)N 700(class)X 876(implementation)X 1398(provides)X 1694(the)X 1812(following)X 2143(operators:)X 10 f 555 5176(\267)N 5 f 9 s 675(classbegin)X 1 f 10 s 1046(and)X 5 f 9 s 1193(classend)X 1 f 10 s 1477(.)X 1548(These)X 1771(operators)X 2101(create)X 2325(a)X 2391(new)X 2555(class)X 2741(\(represented)X 3169(by)X 3279(a)X 3345(dictionary\),)X 3767(given)X 3975(a)X 675 5272(name,)N 912(a)X 971(list)X 1091(of)X 1181(instance)X 1467(variables,)X 1800(and)X 1939(a)X 1998(superclass.)X 2391(They)X 2579(bracket)X 2839(a)X 2897(series)X 3102(of)X 5 f 9 s 3191(defs)X 1 f 10 s 3349(used)X 3518(to)X 3602(add)X 3740(methods)X 675 5368(and)N 811(variables)X 1121(to)X 1203(the)X 1321(class.)X 1537(Here,)X 1754(for)X 1868(example,)X 2200(is)X 2273(the)X 2391(de\256nition)X 2717(for)X 2831(the)X 2949(basic)X 3134(class)X 5 f 9 s 3310(Object)X 1 f 10 s 3518(:)X 4 p %%Page: 4 4 10 s 0 xH 0 xS 1 f 5 f 1 f 2216 384(-)N 2263(4)X 2323(-)X 5 f 963 720(/Object)N 1237(null)X 1383([])X 1449(classbegin)X 1073 816(/new)N 1263({)X 1539(%)X 2 f 1632(class)X 1812(=>)X 1940(instance)X 2227(\(make)X 2444(a)X 2504(new)X 2653(object\))X 5 f 1183 912(...)N 1073 1008(})N 1122(def)X 1073 1104(/doit)N 1245({)X 1539(%)X 2 f 1632(proc)X 1799(ins)X 1912(=>)X 2040(-)X 2087(\(compile)X 2388(&)X 2470(execute)X 2732(the)X 2850(proc\))X 5 f 1183 1200(...)N 1073 1296(})N 1122(def)X 963 1392(classend)N 1299(def)X 1 f 675 1564(It)N 745(de\256nes)X 993(two)X 1134(methods,)X 5 f 9 s 1466(new)X 1 f 10 s 1619(to)X 1702(make)X 1897(a)X 1954(new)X 2109(object,)X 2366(and)X 5 f 9 s 2503(doit)X 1 f 2619(,)X 2674(a)X 2725(sort)X 2852(of)X 2931(meta-method.)X 3366(It)X 3429(takes)X 3595(a)X 3645(procedure)X 3951(as)X 675 1660(argument,)N 983(and)X 1105(executes)X 1371(it)X 1429(in)X 1503(the)X 1609(context)X 1839(of)X 1917(the)X 2023(object.)X 2253(In)X 2331(this)X 2453(way,)X 2627(new)X 2765(methods)X 3027(can)X 3145(be)X 3231(added)X 3421(at)X 3491(run-time.)X 10 s 10 f 555 1784(\267)N 5 f 9 s 675(send)X 1 f 10 s 831(.)X 893(The)X 1040(methods)X 1333(of)X 1421(an)X 1518(object)X 1735(are)X 1855(invoked)X 2134(by)X 5 f 9 s 2235(send)X 1 f 10 s 2391(.)X 2452(It)X 2522(takes)X 2708(some)X 2898(\(optional\))X 3235(arguments,)X 3630(the)X 3749(name)X 3944(of)X 675 1880(the)N 793(method,)X 1093(and)X 1229(the)X 1347(object)X 1563(and)X 1699(then:)X 10 f 675 2004(\267)N 1 f 795(establishes)X 1162(the)X 1280(object's)X 1554(context)X 1810(by)X 1910(putting)X 2156(it)X 2220(and)X 2356(its)X 2451(class)X 2627(hierarchy)X 2951(on)X 3051(the)X 3169(dictionary)X 3514(stack.)X 10 f 675 2128(\267)N 1 f 795(executes)X 1092(the)X 1210(method.)X 10 f 675 2252(\267)N 1 f 795(restores)X 1065(the)X 1183(context)X 1439(by)X 1539(removing)X 1866(the)X 1984(object)X 2200(and)X 2336(its)X 2431(class)X 2607(hierarchy)X 2931(from)X 3107(the)X 3225(dictionary)X 3570(stack.)X 675 2376(For)N 806(example,)X 1138(we)X 1252(make)X 1446(a)X 1502(new)X 5 f 9 s 1656(Object)X 1 f 10 s 1884(by:)X 5 f 963 2520(/new)N 1153(Object)X 1405(send)X 1 f 10 f 555 2692(\267)N 5 f 9 s 675(self)X 1 f 10 s 787(.)X 854(When)X 1073(used)X 1247(as)X 1341(the)X 1466(object)X 1689(with)X 1858(a)X 5 f 9 s 1921(send)X 1 f 10 s 2077(,)X 2144(it)X 2215(refers)X 2426(to)X 2515(the)X 2640(instance)X 2930(causing)X 3202(the)X 3327(current)X 3581(method)X 3847(to)X 3935(be)X 675 2788(invoked.)N 10 f 555 2912(\267)N 5 f 9 s 675(super)X 1 f 10 s 855(.)X 922(When)X 1141(used)X 1315(as)X 1409(the)X 1534(object)X 1757(with)X 1926(a)X 5 f 9 s 1989(send)X 1 f 10 s 2145(,)X 2212(it)X 2283(refers)X 2494(to)X 2583(the)X 2708(method)X 2975(being)X 3179(overridden)X 3553(by)X 3659(the)X 3783(current)X 675 3008(method.)N 555 3132(The)N 707(relationship)X 1112(between)X 1406(an)X 1508(instance)X 1797(and)X 1939(its)X 2040(class)X 2222(and)X 2364(superclass)X 2720(is)X 2799(shown)X 3034(in)X 3122(the)X 3246(\256gure)X 3459(below.)X 3721(We)X 3859(have)X 555 3228(made)N 751(an)X 849(instance,)X 1154(`)X 5 f 9 s 1181(aFoo)X 1 f 10 s 1345(,')X 1414(of)X 1503(class)X 1681(`)X 5 f 9 s 1708(Foo)X 1 f 10 s 1832(,')X 1901(which)X 2119(is)X 2194(a)X 2252(subclass)X 2541(of)X 2630(class)X 3 f 9 s 2806(Object)X 1 f 10 s 3014(.)X 3076(An)X 3196(instance)X 3481(has)X 3609(a)X 3666(copy)X 3843(of)X 3931(all)X 555 3324(instance)N 856(variables)X 1184(of)X 1289(its)X 1402(superclasses,)X 1857(thus)X 2028(`)X 5 f 9 s 2055(aFoo)X 1 f 10 s 2219(')X 2284(has)X 2428(those)X 2634(required)X 2939(by)X 3056(both)X 3235(`)X 5 f 9 s 3262(Foo)X 1 f 10 s 3386(')X 3450(and)X 3 f 9 s 3601(Object)X 1 f 10 s 3809(.)X 3886(The)X 555 3420(methods)N 859(known)X 1110(by)X 1223(an)X 1332(instance)X 1628(are)X 1760(stored)X 1989(in)X 2084(the)X 2215(classes)X 2471(in)X 2566(its)X 2674(superclass)X 3037(chain.)X 3283(Thus)X 3475(`)X 5 f 9 s 3502(aFoo)X 1 f 10 s 3666(')X 3725(can)X 3869(only)X 555 3516(respond)N 829(to)X 911(methods)X 1202(residing)X 1480(in)X 1562(`)X 5 f 9 s 1589(Foo)X 1 f 10 s 1713(')X 1760(and)X 3 f 9 s 1894(Object)X 1 f 10 s 2102(.)X 5 f 1966 3727 MXY 44 42 De 821 MX 44 42 De 850 MX 828 0 Dl 1620 3742 MXY 58 -15 Dl 1620 3713 MXY 58 14 Dl 2002 MX 828 0 Dl 2772 3742 MXY 58 -15 Dl 2772 3713 MXY 58 14 Dl 2866 3799 MXY 576 0 Dl 1714 MX 576 0 Dl 2866 4375 MXY 0 -720 Dl 575 0 Dl 0 719 Dl -575 0 Dl 1714 4375 MXY 0 -720 Dl 576 0 Dl 0 719 Dl -576 0 Dl 562 3799 MXY 576 0 Dl 562 4375 MXY 0 -720 Dl 576 0 Dl 0 719 Dl -576 0 Dl 3089 4124(&)N 2931 4203(methods)N 2916 4038(variables)N 2924 3959(class)N 1772(class)X 1764 4038(variables)N 1779 4203(methods)N 1937 4124(&)N 2909 3642(Object)N 1743(Foo)X 3060 3764(null)N 613 4038(variables)N 613 3959(instance)N 584 3628(aFoo)N 555 4491(instance)N 1707(class)X 2887 4484(class)N 2 f 1576 4619(Relationship)N 2000(between)X 2283(Instances)X 2606(and)X 2746(Classes)X 1 f 555 4791(Sending)N 844(a)X 907(message)X 1205(to)X 1293(an)X 1395(instance)X 1684(requires)X 1969(packaging)X 2325(the)X 2449(arguments)X 2809(to)X 2897(the)X 3021(method,)X 3307(\256nding)X 3559(the)X 3683(method)X 3949(in)X 555 4887(the)N 676(class)X 855(chain,)X 1072(invoking)X 1379(the)X 1500(method)X 1763(in)X 1848(the)X 1969(proper)X 2202(context,)X 2481(and)X 2619(possibly)X 2907(returning)X 3223(a)X 3281(result)X 3481(to)X 3565(the)X 3685(sender.)X 3957(If)X 555 4983(the)N 677(pseudo-variable)X 3 f 1214(self)X 1 f 1354(is)X 1431(used)X 1601(for)X 1718(the)X 1839(object)X 2058(in)X 2143(sending)X 2415(a)X 2474(message,)X 2789(the)X 2910(search)X 3139(for)X 3256(the)X 3377(method)X 3640(starts)X 3832(at)X 3913(the)X 555 5079(beginning)N 895(of)X 982(the)X 1100(chain,)X 1314(while)X 1512(if)X 3 f 1581(super)X 1 f 1792(is)X 1865(used)X 2032(the)X 2150(search)X 2376(starts)X 2565(in)X 2647(the)X 2765(superclass.)X 5 p %%Page: 5 5 10 s 0 xH 0 xS 1 f 2216 384(-)N 2263(5)X 2323(-)X 1102 787 MXY 44 42 De 2247 MX 44 42 De 842 1435 MXY 0 -720 Dl 576 0 Dl 0 720 Dl -575 0 Dl 842 859 MXY 576 0 Dl 1994 1435 MXY 0 -720 Dl 576 0 Dl 0 720 Dl -576 0 Dl 3147 MX 0 -720 Dl 575 0 Dl 0 720 Dl -576 0 Dl 1994 859 MXY 577 0 Dl 3147 MX 576 0 Dl 2282 787 MXY 828 0 Dl 3053 802 MXY 57 -15 Dl 3053 773 MXY 57 14 Dl 1130 MX 829 0 Dl 1901 802 MXY 58 -15 Dl 1901 773 MXY 58 14 Dl 2477 1003 MXY 611 0 Dl 3031 1018 MXY 57 -15 Dl 3031 989 MXY 57 14 Dl 3629 1190 MXY D~ 158 0 216 65 0 136 -1727 51 -1719 -85 0 -165 122 -13 93 0 D~~ 713 MX 57 -15 Dl 713 1161 MXY 57 14 Dl 3197 1163(obj1:)N 3190 1004(foo1:)N 864 688(aFoo)N 3341 824(null)N 2023 702(Foo)N 3190(Object)X 3398 1235(self)N 2196 1047(super)N 2030 968(foo1:)N 2 f 2049 1586(Self)N 2189(and)X 2329(Super)X 1 f 555 1758(In)N 646(order)X 840(to)X 926(use)X 3 f 1057(self)X 1 f 1197(and)X 3 f 1337(super)X 1 f 1528(,)X 1592(the)X 1714(method)X 1978(must)X 2157(be)X 2256(``compiled''.)X 2725(This)X 2890(is)X 2966(done)X 3145(automatically)X 3604(by)X 3 f 3707(classend)X 1 f 3991(,)X 555 1854(and)N 691(by)X 791(the)X 3 f 909(doit)X 1 f 1062(method)X 1322(of)X 1409(class)X 3 f 1585(Object)X 1 f 1817(.)X 1877(This)X 2039(binds)X 2232(the)X 2350(names)X 3 f 2575(self)X 1 f 2711(and)X 3 f 2847(super)X 1 f 3058(at)X 3136(method)X 3396(compile)X 3674(time.)X 3 f 555 2046(5.)N 655(The)X 808(``lite'')X 1043(Toolkit)X 1 f 555 2170(NeWS)N 799(supplies)X 1091(a)X 1157(toolkit,)X 1435(the)X 1563(``lite'')X 1803(toolkit,)X 2081(based)X 2294(on)X 2404(this)X 2549(P)X 8 s 2593(OST)X 10 s 2714(S)X 8 s 2758(CRIPT)X 10 s 2970(class)X 3156(mechanism.)X 3591(It)X 3670(provides)X 3975(a)X 555 2266(basic)N 740(class)X 3 f 916(Object)X 1 f 1148(,)X 1208(and)X 1344(three)X 1525(important)X 1856(subclasses:)X 10 f 555 2390(\267)N 3 f 675(Window)X 1 f 9 f 984(-)X 1 f 1049(the)X 1168(window)X 1447(object)X 1664(is)X 1738(simply)X 1976(a)X 2033(set)X 2143(of)X 2231(canvases)X 2538(and)X 2675(an)X 2772(event)X 2967(manager,)X 3305(a)X 3361(process)X 3622(listening)X 3917(for)X 675 2486(speci\256ed)N 991(events)X 1227(and)X 1374(executing)X 1716(corresponding)X 2205(actions.)X 2502(The)X 2657(default)X 2910(window)X 3198(style)X 3379(manages)X 3690(a)X 3 f 3756(Frame-)X 675 2582(Canvas)N 1 f 928(,)X 978(a)X 3 f 1044(ClientCanvas)X 1 f 1506(,)X 1556(and)X 1701(an)X 3 f 1806(IconCanvas)X 1 f 2210(.)X 2279(It)X 2357(provides)X 2662(two)X 2811(types)X 3009(of)X 3105(user)X 3268(interface)X 3579(management:)X 675 2678(menu)N 873(interaction)X 1236(and)X 1372(direct)X 1575(mouse)X 1804(interaction)X 2167(with)X 2329(the)X 2447(window)X 2725(or)X 2812(icon.)X 10 f 555 2802(\267)N 3 f 675(Menu)X 1 f 9 f 905(-)X 1 f 979(Menus)X 1227(associate)X 1546(a)X 1611(key,)X 1776(generally)X 2104(a)X 2169(string,)X 2400(with)X 2571(an)X 2676(action)X 2901(to)X 2992(be)X 3097(performed)X 3461(when)X 3664(that)X 3813(key)X 3958(is)X 675 2898(selected)N 954(by)X 1054(the)X 1172(user.)X 1366(If)X 1440(the)X 1558(menu)X 1756(action)X 1972(is)X 2045(another)X 2306(menu,)X 2524(it)X 2588(is)X 2661(displayed)X 2988(in)X 3070(turn.)X 10 f 555 3022(\267)N 3 f 675(Item)X 1 f 9 f 880(-)X 1 f 968(A)X 1070(common)X 1394(need)X 1590(in)X 1696(interactive)X 2079(systems)X 2376(is)X 2473(a)X 2553(simple,)X 2830(user-de\256nable,)X 3348(graphic,)X 3652(interactive,)X 675 3118(input/output)N 1090(object.)X 1351(Examples)X 1692(are)X 1816(buttons,)X 2096(sliders,)X 2350(scrollbars,)X 2707(dials,)X 2903(text)X 3048(\256elds,)X 3266(message)X 3563(areas,)X 3773(and)X 3913(the)X 675 3214(like.)N 855(The)X 1000(class)X 3 f 1176(Item)X 1 f 1357(de\256nes)X 1604(a)X 1660(skeleton)X 1947(for)X 2061(such)X 2228(an)X 2324(object.)X 555 3338(The)N 716(item)X 894(package)X 1194(currently)X 1520(implements)X 1928(the)X 2061(base)X 2239(class,)X 3 f 2450(Item)X 1 f 2646(\(which)X 2904(is)X 2992(useless)X 3254(by)X 3369(itself\),)X 3611(the)X 3744(subclass)X 3 f 555 3434(LabeledItem)N 1 f 1011(\(which)X 1254(also)X 1403(is)X 1476(useless\),)X 1770(and)X 1906(several)X 2154(practical)X 2451(subclasses)X 2805(of)X 3 f 2892(LabeledItem)X 1 f 3348(\(which)X 2 f 3591(are)X 1 f 3718(useful\).)X 555 3558(An)N 3 f 673(item)X 1 f 845(has)X 972(these)X 1157(major)X 1364(components:)X 10 f 555 3682(\267)N 1 f 675(A)X 753(canvas)X 992(that)X 1132(depicts)X 1379(the)X 1497(item)X 1659(and)X 1795(is)X 1868(the)X 1986(target)X 2189(of)X 2276(the)X 2394(item's)X 2614(input.)X 10 f 555 3806(\267)N 1 f 675(A)X 753(set)X 862(of)X 949(procedures)X 1322(that)X 1462(paint)X 1642(the)X 1760(canvas)X 1999(and)X 2135(handle)X 2369(activation)X 2705(and)X 2841(tracking)X 3124(events.)X 10 f 555 3930(\267)N 1 f 675(A)X 762(current)X 1018(value)X 1220(and)X 1364(a)X 1428(procedure)X 1778(that)X 1926(noti\256es)X 2189(the)X 2315(client)X 2521(when)X 2723(that)X 2871(value)X 3073(changes)X 3360(due)X 3504(to)X 3594(action)X 3818(of)X 3913(the)X 675 4026(tracking)N 958(procedures.)X 10 f 555 4150(\267)N 1 f 675(Methods)X 977(for)X 1093(creating,)X 1394(moving)X 1660(and)X 1798(painting)X 2082(the)X 2202(item,)X 2386(and)X 2523(for)X 2638(returning)X 2953(the)X 3072(item's)X 3293(location)X 3572(and)X 3709(bounding)X 675 4246(box.)N 555 4370(The)N 3 f 700(LabeledItem)X 1 f 1156(class)X 1332(adds)X 1499(to)X 1581(these:)X 10 f 555 4494(\267)N 1 f 675(A)X 761(polymorphic)X 1198(label-object)X 1605(pair,)X 1798(either)X 2009(of)X 2104(which)X 2328(may)X 2494(be)X 2598(a)X 2662(string,)X 2911(an)X 3014(icon,)X 3199(or)X 3293(a)X 3356(general)X 3620(P)X 8 s 3664(OST)X 10 s 3785(S)X 8 s 3829(CRIPT)X 10 s 675 4590(procedure.)N 10 f 555 4714(\267)N 1 f 675(A)X 753(``round)X 1014(rectangle'')X 1383(frame)X 1591(enclosing)X 1918(the)X 2036(item.)X 10 f 555 4838(\267)N 1 f 675(Simple)X 923(layout)X 1145(rules)X 1323(for)X 1438(automatic)X 1775(positioning)X 2155(of)X 2243(the)X 2362(label)X 2539(and)X 2676(object.)X 2933(The)X 3079(object)X 3296(position)X 3574(may)X 3733(be)X 3830(to)X 3913(the)X 675 4934(Right,)N 912(Left,)X 1106(Top)X 1255(or)X 1342(Bottom)X 1601(of)X 1688(the)X 1806(label.)X 555 5058(The)N 700(\(useful\))X 970(subclasses)X 1324(of)X 3 f 1411(LabeledItem)X 1 f 1867(are:)X 10 f 555 5182(\267)N 3 f 675(ButtonItem)X 1 f 1071(:)X 1113(provides)X 1409(a)X 1465(simple)X 1698(activation/con\256rmation)X 2465(item)X 10 f 555 5306(\267)N 3 f 675(CycleItem)X 1 f 1028(:)X 1070(provides)X 1366(check)X 1574(boxes)X 1781(and)X 1917(choices)X 10 f 555 5430(\267)N 3 f 675(SliderItem)X 1 f 1040(:)X 1082(provides)X 1378(a)X 1434(continuous)X 1805(range)X 2004(of)X 2091(values)X 10 f 555 5554(\267)N 3 f 675(TextItem)X 1 f 992(:)X 1034(provides)X 1330(a)X 1386(type-in)X 1633(area)X 10 f 555 5678(\267)N 3 f 675(MessageItem)X 1 f 1126(:)X 1168(provides)X 1464(an)X 1560(output)X 1784(area)X 6 p %%Page: 6 6 10 s 0 xH 0 xS 1 f 2216 384(-)N 2263(6)X 2323(-)X 10 f 555 672(\267)N 3 f 675(ArrayItem)X 1 f 1046(:)X 1088(provides)X 1384(an)X 1480(array)X 1666(of)X 1753(choices)X 555 796(The)N 704(toolkit)X 936(simultaneously)X 1444(exploits)X 1721(the)X 1843(NeWS)X 2081(lightweight)X 2469(process)X 2734(mechanism)X 3123(and)X 3263(hides)X 3456(it)X 3524(from)X 3703(the)X 3824(appli-)X 555 892(cation)N 789(using)X 999(the)X 1134(toolkit.)X 1419(Windows)X 1763(have)X 1952(processes)X 2297(listening)X 2609(for)X 2740(manipulation)X 3199(commands)X 3583(such)X 3767(as)X 3871(pop,)X 555 988(move,)N 809(and)X 961(reshape,)X 1283(and)X 1435(executing)X 1783(them)X 1979(asynchronously)X 2518(with)X 2696(the)X 2830(application.)X 3262(Menus)X 3516(have)X 3703(processes)X 555 1084(painting)N 851(their)X 1032(images)X 1293(and)X 1443(executing)X 1789(the)X 1921(associated)X 2285(commands.)X 2705(Items)X 2916(have)X 3101(processes)X 3442(listening)X 3750(for)X 3877(user)X 555 1180(actions)N 802(and)X 938(generating)X 1297(appropriate)X 1683(echoes.)X 3 f 555 1372(6.)N 655(An)X 777(Example)X 1099(Program)X 1 f 555 1496(We)N 689(now)X 849(present)X 1103(a)X 1161(complete,)X 1517(working,)X 1846(example)X 2140(NeWS)X 2376(program)X 2670(using)X 2865(the)X 2985(``lite'')X 3217(toolkit.)X 3486(It)X 3556(\256lls)X 3696(a)X 3753(window)X 555 1592(with)N 720(a)X 779(fan)X 905(of)X 995(lines)X 1169(\(of)X 1286(varying)X 1554(colors)X 1773(on)X 1876(a)X 1935(color)X 2123(display\).)X 2444(The)X 2591(complete)X 2907(text)X 3049(is)X 3124(shown)X 3355(in)X 3439(the)X 3559(appendix;)X 3917(we)X 555 1688(now)N 713(examine)X 1005(the)X 1123(parts)X 1299(in)X 1381(detail.)X 3 f 555 1880(6.1.)N 715(Overall)X 993(Structure)X 1 f 555 2004(The)N 700(overall)X 943(structure)X 1244(of)X 1331(this,)X 1506(and)X 1642(many)X 1840(other)X 2025(simple)X 2258(programs,)X 2621(is:)X 5 f 843 2148(#!)N 931(/usr/NeWS/bin/psh)X 2 f 1131 2244(PostScript)N 1484(program)X 1 f 555 2416(In)N 644(other)X 831(words,)X 1089(its)X 1186(a)X 1244(Unix)X 1426(script.)X 1666(The)X 1813(P)X 8 s 1857(OST)X 10 s 1978(S)X 8 s 2022(CRIPT)X 10 s 2225(program)X 2518(is)X 2592(handed)X 2845(as)X 2933(input)X 3118(to)X 5 f 9 s 3201(psh)X 1 f 10 s 3317(,)X 3378(a)X 3435(program)X 3728(that)X 3869(sim-)X 555 2512(ply)N 683(establishes)X 1056(a)X 1117(connection)X 1494(to)X 1581(the)X 1704(NeWS)X 1943(server)X 2165(and)X 2306(sends)X 2509(its)X 2609(standard)X 2906(input)X 3095(across)X 3321(for)X 3440(the)X 3563(server)X 3785(to)X 3872(exe-)X 555 2608(cute.)N 752(One)X 909(major)X 1119(breakthrough)X 1570(that)X 1713(NeWS)X 1950(provides)X 2249(is)X 2325(precisely)X 2638(this;)X 2818(it)X 2885(is)X 2961(a)X 3019(window)X 3299(system)X 3543(programmable)X 555 2704(at)N 633(a)X 689(shell-like)X 1007(level.)X 3 f 555 2896(6.2.)N 715(Paint)X 917(Method)X 1 f 555 3020(The)N 710(program)X 1012(is)X 1095(going)X 1307(to)X 1399(create)X 1622(an)X 1728(object)X 1954(of)X 2051(whatever)X 2376(class)X 2562(is)X 2645(currently)X 2964(named)X 3207(by)X 5 f 9 s 3316(DefaultWindow)X 1 f 10 s 3800(.)X 3869(This)X 555 3116(window)N 835(object)X 1053(needs)X 1258(a)X 1316(method)X 1578(to)X 1662(paint)X 1844(its)X 1941(window,)X 2261(and)X 2399(a)X 2457(method)X 2719(to)X 2803(paint)X 2985(its)X 3082(icon.)X 3282(In)X 3371(this)X 3508(case)X 3669(\(and)X 3833(many)X 555 3212(others\))N 806(they)X 972(can)X 1112(be)X 1216(the)X 1342(same.)X 1575(The)X 1728(system)X 1978(arranges)X 2279(for)X 2401(the)X 2527(Window)X 2831(or)X 2925(the)X 3050(Icon)X 3220(canvas)X 3466(to)X 3555(be)X 3658(the)X 3783(current)X 555 3308(canvas)N 794(when)X 988(the)X 1106(method)X 1366(is)X 1439(invoked.)X 5 f 843 3452(/\256llcanvaswithlines)N 1521({)X 3147(%)X 2 f 3240(linesperside)X 3647(=>)X 3775(-)X 5 f 1131 3548(gsave)N 1131 3644(1)N 1197(\256llcanvas)X 3147(%)X 2 f 3240(paint)X 3424(the)X 3542(background)X 5 f 1131 3740(0)N 1197(setgray)X 3147(%)X 2 f 3240(default)X 3482(color)X 3671(is)X 3744(black)X 5 f 1131 3836(clippath)N 1427 -0.4643(pathbbox)AX 1131 3932(scale)N 1339(pop)X 1493(pop)X 3147(%)X 2 f 3240(make)X 3430(coords)X 3668(0)X 3728(to)X 3810(1)X 5 f 1131 4028(0)N 1197(1)X 1263(3)X 1329(-1)X 1422(roll)X 1551(div)X 1675(1)X 1741({)X 3147(%)X 2 f 3240(0)X 3300(delta)X 3480(1)X 3540({..})X 3664(for)X 5 f 1419 4124(ColorDisplay?)N 1938({dup)X 2119(1)X 2185(1)X 2251(sethsbcolor})X 2707(if)X 3147(%)X 2 f 3240(change)X 3492(color)X 3681(if)X 3745(needed)X 5 f 1419 4220(0)N 1485(0)X 1551(moveto)X 1834(1)X 1900(1)X 1966(index)X 2178(lineto)X 2390(stroke)X 3147(%)X 2 f 3240(draw)X 3424(line)X 3564(to)X 3646(top)X 5 f 1419 4316(0)N 1485(0)X 1551(moveto)X 1834(1)X 1900(lineto)X 2112(stroke)X 3147(%)X 2 f 3240(draw)X 3424(line)X 3564(to)X 3646(side)X 5 f 1419 4412(pause)N 3147(%)X 2 f 3240(let)X 3340(others)X 3560(run)X 5 f 1131 4508(})N 1180(for)X 1131 4604(grestore)N 843 4700(})N 892(def)X 1 f 555 4872(This)N 723(is)X 802(just)X 943(a)X 1005(loop)X 1173(that)X 1319(draws)X 1537(a)X 1599(pair)X 1750(of)X 1843(lines)X 2020(each)X 2194(time.)X 2402(It)X 2477(also)X 2632(does)X 2805(a)X 5 f 9 s 2867(pause)X 1 f 10 s 3063(,)X 3129(because)X 3409(the)X 3532(window)X 3815(object)X 555 4968(will)N 704(fork)X 863(a)X 924(new)X 1083(lightweight)X 1471(process)X 1736(to)X 1822(execute)X 2092(the)X 2214(paint)X 2398(method.)X 2702(The)X 5 f 9 s 2851(pause)X 1 f 10 s 3071(ensures)X 3336(that,)X 3500(even)X 3676(if)X 3749(painting)X 555 5064(the)N 673(window)X 951(takes)X 1136(a)X 1192(long)X 1354(time)X 1516(it)X 1580(will)X 1724(not)X 1846(prevent)X 2107(other)X 2292(processes)X 2620(from)X 2796(running.)X 3 f 555 5256(6.3.)N 715(Menu)X 1 f 555 5380(The)N 702(user)X 858(of)X 947(this)X 1084(application)X 1462(needs)X 1667(a)X 1725(way)X 1881(of)X 1969(telling)X 2194(the)X 2313(program)X 2606(how)X 2765(many)X 2964(lines)X 3136(to)X 3219(draw.)X 3441(A)X 3520(menu)X 3719(that)X 3860(pops)X 555 5476(up)N 655(over)X 818(the)X 936(window)X 1214(is)X 1287(the)X 1405(answer.)X 1693(We)X 1825(set)X 1934(this)X 2069(up)X 2169(by:)X 10 f 555 5600(\267)N 1 f 675(De\256ning)X 975(an)X 1071(initial)X 1277(value)X 1471(for)X 1585(the)X 1703(number)X 1968(of)X 2055(lines.)X 10 f 555 5724(\267)N 1 f 675(De\256ning)X 979(a)X 1039(procedure)X 1385(that)X 1529(gets)X 1682(invoked)X 1964(by)X 2068(the)X 2190(menu)X 2392(when)X 2590(an)X 2690(key)X 2830(is)X 2907(selected.)X 3230(It)X 3303(converts)X 3599(the)X 3721(currently)X 675 5820(selected)N 964(key)X 1110(from)X 1296(a)X 1361(string)X 1572(to)X 1663(a)X 1728(number,)X 2042(updates)X 2316(the)X 2443(number)X 2717(of)X 2813(lines,)X 3033(and)X 3178(the)X 3305(updates)X 3579(the)X 3706(image)X 3931(by)X 7 p %%Page: 7 7 10 s 0 xH 0 xS 1 f 2216 384(-)N 2263(7)X 2323(-)X 675 672(sending)N 944(a)X 5 f 9 s 1000(/paintclient)X 1 f 10 s 1364(message)X 1656(to)X 1738(the)X 1856(window)X 2134(object.)X 10 f 555 796(\267)N 1 f 675(Creating)X 973(a)X 1031(new)X 1187(object)X 1405(of)X 1494(whatever)X 1811(class)X 1989(is)X 2064(named)X 2300(by)X 5 f 9 s 2402(DefaultMenu)X 1 f 10 s 2810(,)X 2852(giving)X 3078(it)X 3144(a)X 3202(list)X 3321(of)X 3410(keys,)X 3619(and)X 3757(the)X 3877(pro-)X 675 892(cedure)N 910(we)X 1024(just)X 1159(de\256ned)X 1415(as)X 1502(the)X 1620(procedure)X 1962(to)X 2044(be)X 2140(executed)X 2446(when)X 2640(one)X 2776(of)X 2863(the)X 2981(keys)X 3148(is)X 3221(selected.)X 5 f 1131 1064(/linesperside)N 1600(10)X 1710(def)X 3147(%)X 2 f 3240(start)X 3406(with)X 3563(10)X 3663(lines)X 5 f 1131 1160(/setlinesfromuser)N 1760({)X 3147(%)X 2 f 3240(value)X 3434(=>)X 3562(-)X 5 f 1419 1256(/linesperside)N 1888(exch)X 2078(store)X 3147(%)X 2 f 3240(set)X 3349(new)X 3498(value)X 5 f 1419 1352(/paintclient)N 1821(win)X 1963(send)X 3147(%)X 2 f 3240(make)X 3430(window)X 3698(repaint)X 5 f 1131 1448(})N 1180(def)X 1131 1544 -0.2625(.....................)AN 1131 1640(/ClientMenu)N 3147(%)X 2 f 3240(the)X 3358(menu)X 3552(sets)X 3692(linesperside)X 5 f 1419 1736([)N 1463(\(10\))X 1627(\(20\))X 1791(\(100\))X 1999(\(250\))X 2207(\(500\))X 2415(])X 1419 1832([)N 1463({currentkey)X 1884(cvi)X 2004(setlinesfromuser})X 2638(])X 1419 1928(/new)N 1609(DefaultMenu)X 2082(send)X 2276(def)X 1 f 555 2100(When)N 769(a)X 827(menu)X 1027(is)X 1102(activated,)X 1454(the)X 1573(toolkit)X 1802(arranges)X 2096(for)X 2211(the)X 2330(menu)X 2529(code)X 2702(to)X 2785(run)X 2913(in)X 2996(a)X 3053(separate)X 3338(P)X 8 s 3382(OST)X 10 s 3503(S)X 8 s 3547(CRIPT)X 10 s 3750(process.)X 555 2196(Thus,)N 778(other)X 966(processes)X 1297(can)X 1432(run,)X 1602(even)X 1777(the)X 1898(process)X 2162(painting)X 2447(the)X 2568(lines)X 2742(display,)X 3036(while)X 3237(the)X 3357(menu)X 3557(is)X 3632(active.)X 3886(The)X 555 2292(application)N 931(is)X 1004(not)X 1126(aware)X 1339(that)X 1479(this)X 1614(is)X 1687(being)X 1885(done.)X 3 f 555 2484(6.4.)N 715(Window)X 1 f 555 2608(This)N 720(application)X 1099(creates)X 1346(its)X 1444(own)X 1605(sub-class)X 1922(of)X 2012(whatever)X 2330(is)X 2405(the)X 2525(current)X 2775(default)X 3020(Window)X 3318(class.)X 3536(The)X 3683(only)X 3847(thing)X 555 2704(that)N 696(is)X 770(different)X 1068(is)X 1142(that)X 1283(objects)X 1531(of)X 1619(class)X 5 f 9 s 1795(LinesWindow)X 1 f 10 s 2243(have)X 2415(a)X 2471(sub-canvas)X 2848(of)X 2935(the)X 5 f 9 s 3053(ClientCanvas)X 1 f 10 s 3501(to)X 3583(draw)X 3764(in.)X 3886(The)X 555 2800(reason)N 785(for)X 899(doing)X 1101(this)X 1236(will)X 1380(become)X 1650(obvious)X 1923(when)X 2117(we)X 2231(consider)X 2523(Items)X 2721(below.)X 5 f 1131 2944(/LinesWindow)N 1649(DefaultWindow)X 3147(%)X 2 f 3240(new)X 3389(subclass)X 3680(of)X 3762(DefaultWindow)X 5 f 1131 3040 -0.2500([/LinesCanvas])AN 3147(%)X 2 f 3240(instance)X 3527(var:)X 3681(the)X 3799(subwindow)X 5 f 1131 3136(classbegin)N 3147(%)X 2 f 3240(override)X 3532(2)X 3592(methods)X 5 f 1419 3232 -0.1736(/CreateClientCanvas)AN 2176({)X 3147(%)X 2 f 3240(this)X 3375(one)X 3511(creates)X 3763(the)X 3881(canvas)X 5 f 1707 3328 -0.1736(/CreateClientCanvas)AN 2464(super)X 2685(send)X 3147(%)X 2 f 3240(do)X 3340(super's)X 3596(create)X 5 f 1707 3424(/LinesCanvas)N 2211(ClientCanvas)X 1707 3520(newcanvas)N 2127(store)X 3147(%)X 2 f 3240(create)X 3461(a)X 3521(subcanvas)X 5 f 1707 3616(LinesCanvas)N 2189(/Mapped)X 2520(true)X 2679(put)X 3147(%)X 2 f 3240(map)X 3398(it)X 3462(in)X 5 f 1419 3712(})N 1468(def)X 1419 3808 -0.2574(/ShapeClientCanvas)AN 2166({)X 3147(%)X 2 f 3240(This)X 3397(one)X 3533(\(re\)-shapes)X 3919(it)X 5 f 1707 3904 -0.2574(/ShapeClientCanvas)AN 2454(super)X 2675(send)X 3147(%)X 2 f 3240(do)X 3340(super's)X 3596(shape)X 5 f 1707 4000(gsave)N 1707 4096(ClientCanvas)N 2203(setcanvas)X 2583(clippath)X 3147(%)X 2 f 3240(make)X 3430(path)X 3592(and)X 5 f 1707 4192(LinesCanvas)N 2189 -0.3021(reshapecanvas)AX 3147(%)X 2 f 3240(reshape)X 3514(lines)X 3685(canvas)X 5 f 1707 4288(grestore)N 1419 4384(})N 1468(def)X 1131 4480(classend)N 1467(def)X 3147(%)X 2 f 3240(call)X 3380(new)X 3529(class)X 3709(LinesWindow)X 1 f 555 4652(The)N 706(application)X 1088(needs)X 1297(a)X 1359(window)X 1643(to)X 1731(run)X 1864(in.)X 1991(We)X 2128(create)X 2346(an)X 2447(object)X 2668(of)X 2760(class)X 5 f 9 s 2941(LinesWindow)X 1 f 10 s 3369(,)X 3434(and)X 3575(send)X 3747(it)X 3816(a)X 3877(pro-)X 555 4748(cedure.)N 833(The)X 981(effect)X 1188(of)X 1278(this)X 1416(is)X 1491(to)X 1575(have)X 1749(the)X 1869(procedure)X 2213(executed)X 2521(in)X 2605(the)X 2725(context)X 2983(of)X 3072(the)X 3192(window)X 3472(object.)X 3730(The)X 3877(pro-)X 555 4844(cedure)N 798(re-de\256nes)X 1143(those)X 1340(attributes)X 1666(and)X 1810(methods)X 2109(of)X 2204(the)X 2330(generic)X 2595(window)X 2881(object)X 3105(that)X 3253(are)X 3380(appropriate)X 3774(for)X 3896(this)X 555 4940(application,)N 971(namely:)X 10 f 555 5064(\267)N 5 f 9 s 675(FrameLabel)X 1 f 10 s 9 f 1079(-)X 1 f 1143(the)X 1261(string)X 1463(displayed)X 1790(in)X 1872(the)X 1990(window)X 2268(frame.)X 10 f 555 5188(\267)N 5 f 9 s 675(PaintClient)X 1 f 10 s 9 f 1048(-)X 1 f 1117(the)X 1240(method)X 1505(for)X 1624(painting)X 1911(the)X 2034(window.)X 2357(This)X 2524(is)X 2602(the)X 5 f 9 s 2725(\256llnameswithlines)X 1 f 10 s 3310(procedure)X 3657(we)X 3775(de\256ned)X 675 5284(earlier.)N 10 f 555 5408(\267)N 5 f 9 s 675(PaintIcon)X 1 f 10 s 9 f 1000(-)X 1 f 1068(we)X 1186(use)X 1317(the)X 1439(same)X 1628(procedure)X 1974(in)X 2060(the)X 2182(icon)X 2344(painting)X 2630(method,)X 2934(but)X 3060(only)X 3226(draw)X 3411(10)X 3515(lines.)X 3730(Drawing)X 675 5504(too)N 797(many)X 995(lines)X 1166(in)X 1248(a)X 1304(small)X 1497(icon)X 1655(doesn't)X 1911(look)X 2073(good.)X 10 f 555 5628(\267)N 5 f 9 s 675(ClientMenu)X 1 f 10 s 9 f 1061(-)X 1 f 1127(as)X 1216(described)X 1546(above,)X 1800(we)X 1916(create)X 2131(a)X 2189(menu)X 2389(object)X 2607(and)X 2745(assign)X 2967(it)X 3033(as)X 3122(the)X 3242(menu)X 3441(to)X 3524(be)X 3621(displayed)X 3949(in)X 675 5724(the)N 793(window.)X 8 p %%Page: 8 8 10 s 0 xH 0 xS 1 f 2216 384(-)N 2263(8)X 2323(-)X 555 672(Then,)N 782(when)X 978(we)X 1094(have)X 1268(customised)X 1650(the)X 1770(generic)X 2029(window)X 2309(object)X 2527(for)X 2643(this)X 2780(application,)X 3197(we)X 3312(get)X 3431(it)X 3496(some)X 3686(real)X 3828(estate)X 555 768(on)N 656(the)X 775(screen)X 1001(by)X 1101(sending)X 1370(it)X 1434(the)X 5 f 9 s 1552(/reshapefromuser)X 1 f 10 s 2136(message.)X 2468(The)X 2613(window)X 2891(object)X 3107(has)X 3234(inherited)X 3539(the)X 3657(method)X 3917(for)X 555 864(this)N 690(from)X 866(the)X 984(environment;)X 1451(typically)X 1751(it)X 1815(involves)X 2106(dragging)X 2411(out)X 2533(a)X 2589(rectangle)X 2904(on)X 3004(the)X 3122(screen.)X 5 f 1131 1008(/win)N 1295(framebuffer)X 1724(/new)X 1914(LinesWindow)X 2410(send)X 2604(def)X 3147(%)X 2 f 3240(make)X 3430(a)X 3490(new)X 3639(LinesWindow)X 5 f 1131 1104({)N 1419 1200(/FrameLabel)N 1888(\(Lines\))X 2154(def)X 3147(%)X 2 f 3240(Label)X 3442(it)X 3506(Lines)X 5 f 1419 1296(/PaintClient)N 1848({)X 3147(%)X 2 f 3240(PaintClient)X 3628(method)X 5 f 1707 1392(LinesCanvas)N 2189(setcanvas)X 3147(%)X 2 f 3240(\256lls)X 3375(LinesCanvas)X 5 f 1707 1488(linesperside)N 2154(\256llcanvaswithlines)X 3147(%)X 2 f 3260(with)X 3417(linesperside)X 3824(lines)X 5 f 1707 1584(FrameBorderColor)N 2390(strokecanvas)X 3147(%)X 2 f 3240(and)X 3380(draws)X 3595(a)X 3655(box)X 5 f 1419 1680(})N 1468(def)X 1419 1776(/PaintIcon)N 1794({)X 3147(%)X 2 f 3240(PaintIcon)X 3576(method)X 5 f 1707 1872(10)N 1817(\256llcanvaswithlines)X 2473(0)X 2539(strokecanvas)X 3147(%)X 2 f 3240(uses)X 3398(10)X 3498(lines)X 5 f 1419 1968(})N 1468(def)X 1419 2064(/ClientMenu)N 3147(%)X 2 f 3240(the)X 3358(menu)X 3552(sets)X 3692(linesperside)X 5 f 1419 2160([)N 1463(\(10\))X 1627(\(20\))X 1791(\(100\))X 1999(\(250\))X 2207(\(500\))X 2415(])X 1419 2256([)N 1463({currentkey)X 1884(cvi)X 2004(setlinesfromuser})X 2638(])X 1419 2352(/new)N 1609(DefaultMenu)X 2082(send)X 2276(def)X 1131 2448(})N 1180(win)X 1322(send)X 3147(%)X 2 f 3240(override)X 3532(the)X 3650(methods)X 5 f 1131 2544(/reshapefromuser)N 1777(win)X 1919(send)X 3147(%)X 2 f 3240(shape)X 3447(the)X 3565(window)X 5 f 1131 2640(/map)N 1330(win)X 1472(send)X 3147(%)X 2 f 3240(Map)X 3407(it)X 3471(in)X 1 f 555 2812(Finally,)N 847(we)X 967(send)X 1140(the)X 1264(window)X 1548(a)X 5 f 9 s 1610(/map)X 1 f 10 s 1796(message)X 2094(to)X 2182(get)X 2306(it)X 2376(to)X 2464(display)X 2721(itself)X 2907(in)X 2995(the)X 3119(selected)X 3403(area.)X 3603(The)X 3753(window)X 555 2908(inserts)N 792(itself)X 980(in)X 1070(the)X 1196(window)X 1482(hierarchy,)X 1854(and)X 1998(the)X 2124(NeWS)X 2366(server)X 2591(generates)X 2923(a)X 5 f 9 s 2987(/Damaged)X 1 f 10 s 3347(event)X 3549(for)X 3670(its)X 3772(canvas.)X 555 3004(The)N 704(window)X 986(object)X 1206(has)X 1337(forked)X 1571(a)X 1631(process)X 1896(listening)X 2195(for)X 2313(these)X 2502(events,)X 2771(when)X 2968(they)X 3129(are)X 3251(detected)X 3542(the)X 5 f 9 s 3663(PaintClient)X 1 f 10 s 555 3100(or)N 5 f 9 s 642(PaintIcon)X 1 f 10 s 962(method)X 1222(is)X 1295(invoked)X 1573(as)X 1660(appropriate.)X 555 3224(In)N 666(general,)X 987(window)X 1289(classes)X 1556(arrange)X 1842(to)X 1948(run)X 2099(their)X 5 f 9 s 2290(PaintClient)X 1 f 10 s 2682(methods)X 2997(in)X 3103(a)X 3183(separate)X 3491(process.)X 3816(If)X 3913(the)X 5 f 9 s 555 3320(PaintClient)N 1 f 10 s 934(method)X 1205(is)X 1289(invoked)X 1578(again,)X 1803(it)X 1878(checks)X 2128(to)X 2221(see)X 2355(whether)X 2645(a)X 2712(preceding)X 5 f 9 s 3060(PaintClient)X 1 f 10 s 3439(invocation)X 3808(is)X 3892(still)X 555 3416(underway.)N 942(If)X 1026(it)X 1100(is,)X 1223(it)X 1297(is)X 1380(aborted)X 1651(before)X 1887(a)X 1953(new)X 2117(process)X 2388(is)X 2471(forked)X 2710(for)X 2833(the)X 2960(re-paint.)X 3279(In)X 3375(this)X 3519(way,)X 3722(windows)X 555 3512(respond)N 839(immediately)X 1268(to)X 1359(being)X 1566(re-shaped;)X 1930(there)X 2120(is)X 2202(no)X 2311(need)X 2492(to)X 2583(wait)X 2750(for)X 2873(completion)X 3262(of)X 3358(one)X 3503(re-shape)X 3805(before)X 555 3608(starting)N 820(another.)X 1126(Note)X 1307(that)X 1452(this)X 1592(use)X 1723(of)X 1814(concurrency)X 2236(is)X 2313(invisible)X 2612(to)X 2698(the)X 5 f 9 s 2820(PaintClient)X 1 f 10 s 3192(method)X 3456(itself,)X 3680(it)X 3748(depends)X 555 3704(only)N 717(on)X 817(the)X 935(occasional)X 5 f 9 s 1294(pause)X 1 f 10 s 1490(.)X 3 f 555 3896(6.5.)N 715(Item)X 1 f 555 4020(As)N 668(an)X 768(example)X 1064(of)X 1155(the)X 1277(use)X 1408(of)X 5 f 9 s 1499(Item)X 1 f 10 s 1663(objects,)X 1954(we)X 2072(can)X 2208(add)X 2348(an)X 2448(alternative)X 2811(way)X 2969(of)X 3060(setting)X 3296(the)X 3417(number)X 3685(of)X 3775(lines)X 3949(to)X 555 4116(be)N 651(displayed)X 9 f 978(-)X 1 f 1042(a)X 5 f 9 s 1098(SliderItem)X 1 f 10 s 1442(across)X 1663(the)X 1781(bottom)X 2027(of)X 2114(the)X 2232(window.)X 2550(This)X 2712(needs)X 2915(the)X 3033(following)X 3364(changes:)X 10 f 555 4240(\267)N 1 f 675(Add)X 833(a)X 889(new)X 1043(instance)X 1326(variable)X 1605(to)X 1687(the)X 5 f 9 s 1805(LinseWindow)X 1 f 10 s 2253(class)X 2429(to)X 2511(point)X 2695(to)X 2777(the)X 5 f 9 s 2895(SliderItem)X 1 f 10 s 3239(object.)X 10 f 555 4364(\267)N 1 f 675(Change)X 944(the)X 5 f 9 s 1066(CreateClientCanvas)X 1 f 10 s 1734(method)X 1998(to)X 2084(create)X 2301(a)X 5 f 9 s 2361(SliderItem)X 1 f 10 s 2709(and)X 2849(position)X 3130(it)X 3198(at)X 3280(the)X 3402(bottom)X 3652(of)X 3743(the)X 3864(win-)X 675 4460(dow.)N 10 f 555 4584(\267)N 1 f 675(Change)X 944(the)X 5 f 9 s 1066(ShapeClientCanvas)X 1 f 10 s 1726(method)X 1990(to)X 2076(position)X 2357(the)X 2479(slider)X 2681(and)X 2821(restrict)X 3068(the)X 5 f 9 s 3190(LinesCanvas)X 1 f 10 s 3630(not)X 3756(to)X 3841(over-)X 675 4680(lap)N 793(it.)X 897(\(Now)X 1100(it)X 1164(is)X 1237(obvious)X 1510(why)X 1668(we)X 1782(used)X 1949(a)X 2005(separate)X 2289(canvas\).)X 10 f 555 4804(\267)N 1 f 675(Change)X 940(the)X 5 f 9 s 1058(PaintClient)X 1 f 10 s 1426(method)X 1686(to)X 1768(send)X 1935(a)X 1991(paint)X 2171(message)X 2463(to)X 2545(the)X 2663(slider)X 2861(object.)X 10 f 555 4928(\267)N 1 f 675(Change)X 5 f 9 s 943(setlinesfromuser)X 1 f 10 s 1494(to)X 1579(update)X 1816(the)X 1937(value)X 2134(of)X 2223(the)X 5 f 9 s 2343(SliderItem)X 1 f 10 s 2667(,)X 2709(so)X 2802(that)X 2944(if)X 3015(the)X 3135(menu)X 3335(is)X 3410(used)X 3579(to)X 3663(change)X 3913(the)X 675 5024(number)N 940(of)X 1027(lines,)X 1238(the)X 1356(slider)X 1554(will)X 1698(move)X 1896(to)X 1978(correspond.)X 555 5148(Here)N 732(is)X 805(the)X 923(new)X 1077(de\256nition)X 1403(of)X 1490(the)X 5 f 9 s 1608(LinesWindow)X 1 f 10 s 2056(class:)X 9 p %%Page: 9 9 10 s 0 xH 0 xS 1 f 5 f 1 f 2216 384(-)N 2263(9)X 2323(-)X 5 f 1131 720(/LinesWindow)N 1649(DefaultWindow)X 3147(%)X 2 f 3240(new)X 3389(subclass)X 3680(of)X 3762(DefaultWindow)X 5 f 1131 816([/LinesCanvas)N 1657(/LinesItem])X 3147(%)X 2 f 3240(instance)X 3527(var:)X 3681(the)X 3799(subwindow)X 5 f 1131 912(classbegin)N 3147(%)X 2 f 3240(override)X 3532(2)X 3592(methods)X 5 f 1131 1008 -0.2250(/LinesItemHeight)AN 1750(30)X 1860(def)X 1307 1104(/LinesInset)N 1729(10)X 1839(def)X 1419 1200 -0.1736(/CreateClientCanvas)AN 2176({)X 3147(%)X 2 f 3240(this)X 3375(one)X 3511(creates)X 3763(the)X 3881(canvas)X 5 f 1707 1296 -0.1736(/CreateClientCanvas)AN 2464(super)X 2685(send)X 3147(%)X 2 f 3240(do)X 3340(super's)X 3596(create)X 5 f 1707 1392(/LinesItem)N 2096(\(Lines:\))X 2384([1)X 2472(500)X 2626(linesperside])X 1707 1488(/Right)N 1937({ItemValue)X 2344(10)X 2454(mul)X 2605(setlinesfromuser})X 1707 1584(ClientCanvas)N 2203(500)X 2357(0)X 2423(/new)X 2613(SliderItem)X 2994(send%)X 2 f 3259(make)X 3449(a)X 3509(slider)X 5 f 1707 1680(dup)N 1861(/ItemFrame)X 2291(2)X 2357(put)X 1707 1776(10)N 1817(2)X 1883(/move)X 2122(3)X 2188(index)X 2400(send)X 2594(store)X 3147(%)X 2 f 3240(position)X 3517(slider)X 5 f 1707 1872([LinesItem])N 2118(forkitems)X 2464(pop)X 3147(%)X 2 f 3240(fork)X 3389(process)X 3654(for)X 3767(slider)X 5 f 1707 1968(/LinesCanvas)N 2211(ClientCanvas)X 1707 2064(newcanvas)N 2127(store)X 3147(%)X 2 f 3240(create)X 3461(a)X 3521(subcanvas)X 5 f 1707 2160(LinesCanvas)N 2189(/Mapped)X 2520(true)X 2679(put)X 3147(%)X 2 f 3240(map)X 3398(it)X 3462(in)X 5 f 1419 2256(})N 1468(def)X 1419 2352 -0.2574(/ShapeClientCanvas)AN 2166({)X 3147(%)X 2 f 3240(This)X 3397(one)X 3533(\(re\)-shapes)X 3919(it)X 5 f 1707 2448 -0.2574(/ShapeClientCanvas)AN 2454(super)X 2675(send)X 3147(%)X 2 f 3240(do)X 3340(super's)X 3596(shape)X 5 f 1707 2544(10)N 1817(2)X 1883(/move)X 2122(LinesItem)X 2489(send)X 1707 2640(gsave)N 1707 2736(ClientCanvas)N 2203(setcanvas)X 2583(clippath)X 3147(%)X 2 f 3240(make)X 3430(path)X 3592(and)X 5 f 1707 2832 -0.4643(pathbbox)AN 2055(LinesInset)X 2439 -0.2232(LinesItemHeight)AX 3036(translate)X 1707 2928 -0.2232(LinesItemHeight)AN 2304(sub)X 2454(LinesInset)X 2838(sub)X 1707 3024(exch)N 1897(LinesInset)X 2281(2)X 2347(mul)X 2498(sub)X 2648(exch)X 2838(rectpath)X 3147(%)X 2 f 3240(leave)X 3430(room)X 3619(for)X 3732(slider)X 5 f 1707 3120(LinesCanvas)N 2189 -0.3021(reshapecanvas)AX 3147(%)X 2 f 3240(reshape)X 3514(lines)X 3685(canvas)X 5 f 1707 3216(grestore)N 1419 3312(})N 1468(def)X 1131 3408(classend)N 1467(def)X 3147(%)X 2 f 3240(call)X 3380(new)X 3529(class)X 3709(LinesWindow)X 1 f 555 3580(The)N 5 f 9 s 700(setlinesfromuser)X 1 f 10 s 1248(procedure)X 1590(now)X 1748(looks)X 1941(like:)X 5 f 1131 3724(/setlinesfromuser)N 1760({)X 3147(%)X 2 f 3240(value)X 3434(=>)X 3562(-)X 5 f 1419 3820(/linesperside)N 1888(exch)X 2078(store)X 3147(%)X 2 f 3240(set)X 3349(new)X 3498(value)X 5 f 1419 3916({)N 1707 4012(LinesItem)N 2074(/ItemValue)X 1707 4108(linesperside)N 2154(put)X 1419 4204(})N 1468(win)X 1610(send)X 3147(%)X 2 f 3240(update)X 3478(slider)X 3680(value)X 5 f 1131 4300(/paintclient)N 1533(win)X 1675(send)X 3147(%)X 2 f 3240(make)X 3430(window)X 3698(repaint)X 5 f 931 4396(})N 980(def)X 1 f 555 4568(The)N 5 f 9 s 700(PaintClient)X 1 f 10 s 1068(method)X 1328(now)X 1486(looks)X 1679(like:)X 5 f 1131 4712(/PaintClient)N 1560({)X 3147(%)X 2 f 3240(PaintClient)X 3628(method)X 5 f 1419 4808(/paint)N 1635(LinesItem)X 2002(send)X 3147(%)X 2 f 3240(paint)X 3424(the)X 3542(slider)X 5 f 1419 4904(LinesCanvas)N 1901(setcanvas)X 3147(%)X 2 f 3240(\256lls)X 3375(LinesCanvas)X 5 f 1419 5000(linesperside)N 1866(\256llcanvaswithlines)X 3147(%)X 2 f 3260(with)X 3417(linesperside)X 3824(lines)X 5 f 1419 5096(FrameBorderColor)N 2102(strokecanvas)X 3147(%)X 2 f 3240(and)X 3380(draws)X 3595(a)X 3655(box)X 5 f 1131 5192(})N 1180(def)X 1 f 555 5364(Note)N 741(once)X 923(again)X 1127(the)X 1255(use)X 1392(of)X 1489(concurrency.)X 1957(The)X 5 f 9 s 2112(SliderItem)X 1 f 10 s 2466(is)X 2549(driven)X 2783(by)X 2892(a)X 2957(separate)X 3250(process,)X 3560(created)X 3822(in)X 3913(the)X 5 f 9 s 555 5460(forkitems)N 1 f 10 s 868(call.)X 1045(This)X 1208(means)X 1434(that)X 1575(the)X 1694(user)X 1849(can)X 1982(drag)X 2146(the)X 2265(slider)X 2464(to)X 2547(a)X 2604(new)X 2759(value)X 2954(at)X 3033(any)X 3170(time,)X 3372(even)X 3544(while)X 3742(the)X 3860(lines)X 555 5556(display)N 815(is)X 897(painting)X 1188(itself.)X 1417(And,)X 1624(as)X 1720(soon)X 1900(as)X 1996(a)X 2060(new)X 2222(value)X 2424(is)X 2505(indicated)X 2827(by)X 2935(the)X 3061(slider)X 3267(or)X 3362(the)X 3488(menu,)X 3734(the)X 3860(lines)X 555 5652(display)N 814(is)X 895(re-painted,)X 1289(even)X 1469(if)X 1546(another)X 1815(drawing)X 2106(attempt)X 2374(has)X 2509(to)X 2599(be)X 2703(aborted)X 2972(to)X 3062(do)X 3170(so.)X 3309(And,)X 3515(best)X 3672(of)X 3766(all,)X 3913(the)X 555 5748(application)N 933(code)X 1107(need)X 1281(not)X 1404(be)X 1501(aware)X 1715(of)X 1803(any)X 1940(of)X 2028(this.)X 2204(Simply)X 2455(providing)X 2787(objects)X 3035(with)X 3198(appropriate)X 3585(behaviours)X 3958(is)X 555 5844(enough,)N 851(the)X 969(toolkit)X 1197(takes)X 1382(care)X 1537(of)X 1624(providing)X 1955(concurrency)X 2373(where)X 2590(it)X 2654(is)X 2727(needed.)X 10 p %%Page: 10 10 10 s 0 xH 0 xS 1 f 2196 384(-)N 2243(10)X 2343(-)X 3 f 555 672(7.)N 655(Review)X 1 f 555 796(The)N 700(example)X 992(program)X 1284(speci\256es)X 1580(exactly)X 1832(those)X 2021(attributes)X 2339(and)X 2475(methods)X 2766(that)X 2906(it)X 2970(requires.)X 3289(These)X 3501(include:)X 10 f 555 920(\267)N 1 f 675(The)X 820(method)X 1080(for)X 1194(painting)X 1476(the)X 1594(contents)X 1881(of)X 1968(the)X 2086(window)X 2364(and)X 2500(icon.)X 10 f 555 1044(\267)N 1 f 675(The)X 820(keys)X 987(and)X 1123(corresponding)X 1602(procedures)X 1975(for)X 2089(the)X 2207(menu.)X 10 f 555 1168(\267)N 1 f 675(The)X 820(label)X 996(for)X 1110(the)X 1228(frame.)X 10 f 555 1292(\267)N 1 f 675(The)X 820(position,)X 1137(label,)X 1353(and)X 1489(scale)X 1670(of)X 1757(the)X 1875(slider.)X 2 f 555 1416(Everything)N 1 f 938(else)X 1094(is)X 1178(inherited)X 1494(from)X 1681(the)X 1810(generic)X 2078(Window,)X 2425(Menu)X 2663(and)X 2810(Slider)X 3032(objects.)X 3330(And,)X 3539(unlike)X 3770(library-)X 555 1512(based)N 759(toolkits,)X 1059(it)X 1124(is)X 1198(inherited)X 1504(at)X 1583(run-time.)X 1920(This)X 2083(means)X 2309(that)X 2450(the)X 2569(default)X 2813(behaviour)X 3155(of)X 3243(any)X 3380(of)X 3467(these)X 3652(objects)X 3899(can)X 555 1608(be)N 651(changed)X 939(by)X 1039(the)X 1157(user,)X 1351(with)X 1513(no)X 1613(need)X 1785(to)X 1867(modify)X 2118(the)X 2236(application)X 2612(at)X 2690(all.)X 555 1732(Further,)N 864(note)X 1035(that)X 1188(the)X 1318(only)X 1492(way)X 1658(in)X 1752(which)X 1980(the)X 2110(example)X 2414(program)X 2718(needs)X 2933(to)X 3027(acknowledge)X 3483(the)X 3613(concurrency)X 555 1828(implicit)N 832(in)X 923(the)X 1050(NeWS)X 1293(lightweight)X 1686(process)X 1956(mechanism)X 2350(is)X 2432(in)X 2523(the)X 2650(disciplined)X 3030(use)X 3166(of)X 5 f 9 s 3262(pause)X 1 f 10 s 3487(to)X 3578(cede)X 3755(to)X 3846(other)X 555 1924(processes)N 893(at)X 981(intervals.)X 1327(Providing)X 1672(the)X 1800(objects)X 2057(with)X 2229(appropriate)X 2624(methods)X 2924(is)X 3006(enough,)X 3311(the)X 3438(toolkit)X 3675(deals)X 3869(with)X 555 2020(invoking)N 863(these)X 1052(methods)X 1347(in)X 1433(separate)X 1721(processes)X 2053(when)X 2250(that)X 2393(is)X 2469(required.)X 2800(The)X 2948(result)X 3149(is)X 3225(an)X 3324(application)X 3703(that)X 3846(deals)X 555 2116(correctly)N 861(with)X 1023(multiple)X 1309(things)X 1524(going)X 1726(on)X 1826(at)X 1904(one)X 2040(time,)X 2242(with)X 2404(almost)X 2637(no)X 2737(programming)X 3193(effort.)X 3 f 555 2308(8.)N 655(Conclusion)X 1 f 555 2432(We)N 692(have)X 869(shown)X 1103(that,)X 1268(in)X 1355(addition)X 1642(to)X 1729(its)X 1829(role)X 1979(as)X 2070(a)X 2130(page)X 2306(description)X 2686(language,)X 3020(P)X 8 s 3064(OST)X 10 s 3185(S)X 8 s 3229(CRIPT)X 10 s 3435(is)X 3512(capable)X 3782(of)X 3873(sup-)X 555 2528(porting)N 811(an)X 912(object-oriented)X 1423(programming)X 1884(style.)X 2099(Despite)X 2368(being)X 2570(implemented)X 3012(entirely)X 3281(in)X 3367(standard)X 3663(interpreted)X 555 2624(P)N 8 s 599(OST)X 10 s 720(S)X 8 s 764(CRIPT)X 10 s 946(,)X 1006(the)X 1124(style)X 1295(is)X 1368(ef\256cient)X 1651(enough)X 1907(to)X 1989(be)X 2085(used)X 2252(as)X 2339(the)X 2457(basis)X 2637(for)X 2751(a)X 2807(user)X 2961(interface)X 3263(toolkit.)X 555 2748(The)N 726(``lite'')X 982(toolkit)X 1236(illustrates)X 1592(the)X 1735(use)X 1887(of)X 1999(the)X 2142(NeWS)X 2401(extensions)X 2784(to)X 2891(PostScript,)X 3304(primarily)X 3647(lightweight)X 555 2844(processes,)N 929(to)X 1017(construct)X 1337(user)X 1497(interfaces)X 1836(that)X 1982(deal)X 2142(correctly)X 2454(with)X 2622(many)X 2826(concurrency)X 3250(issues)X 3466(without)X 3735(complex)X 555 2940(programming.)N 555 3064(We)N 691(are)X 814(still)X 957(at)X 1039(any)X 1179(early)X 1364(stage)X 1553(in)X 1639(the)X 1761(development)X 2199(of)X 2290(NeWS-based)X 2738(user)X 2896(interfaces.)X 3273(Much)X 3484(work)X 3672(remains)X 3949(to)X 555 3160(be)N 651(done,)X 867(and)X 1003(among)X 1241(the)X 1359(issues)X 1570(to)X 1652(be)X 1748(addressed)X 2085(are:)X 10 f 555 3284(\267)N 1 f 675(Better)X 891(performance)X 1318(for)X 1432(the)X 1550(class)X 1726(mechanism,)X 2151(through)X 2420(implementing)X 5 f 9 s 2884(send)X 1 f 10 s 3060(as)X 3147(a)X 3203(primitive.)X 10 f 555 3408(\267)N 1 f 675(Exploration)X 1073(of)X 1160(alternate)X 1457(class)X 1633(hierarchies.)X 10 f 555 3532(\267)N 1 f 675(Improved)X 1028(integration)X 1416(between)X 1725(the)X 1864(P)X 8 s 1908(OST)X 10 s 2029(S)X 8 s 2073(CRIPT)X 10 s 2296(running)X 2586(in)X 2689(the)X 2828(NeWS)X 3083(server)X 3321(and)X 3478(the)X 3617(C)X 3711(\(or)X 3846(other)X 675 3628(language\))N 1012(programs)X 1335(running)X 1604(in)X 1686(the)X 1804(client.)X 3 f 555 3820(References)N 1 f 555 3972(1.)N 755(J.)X 828(H.)X 928(Morris,)X 1188(M.)X 1301(Satyanarayanan,)X 1852(and)X 1990(others,)X 2228(``Andrew:)X 2585(A)X 2665(Distributed)X 3047(Personal)X 3345(Computing)X 3726(Environ-)X 755 4068(ment,'')N 2 f 1009(Commun.)X 1338(Assoc.)X 1565(Comput.)X 1858(Mach.)X 1 f 2061(,)X 2101(vol.)X 2243(29,)X 2363(no.)X 2483(3,)X 2563(pp.)X 2683(184-201,)X 2990(March,)X 3240(1986.)X 555 4192(2.)N 755(R.)X 856(W.)X 980(Schei\257er)X 1293(and)X 1437(J.)X 1516(Gettys,)X 1773(``The)X 1980(X)X 2066(Window)X 2370(System,'')X 2 f 2707(ACM)X 2903(Trans.)X 3136(on)X 3243(Graphics)X 1 f 3541(,)X 3588(vol.)X 3737(6,)X 3824(no.)X 3951(3,)X 755 4288(1986.)N 555 4412(3.)N 755(Sun)X 899(Microsystems,)X 1388(``NeWS)X 1676(Technical)X 2013(Overview,'')X 2424(800-1498-05,)X 2878(April)X 3067(1987.)X 555 4536(4.)N 755(Adobe)X 989(Systems)X 1275(Inc.,)X 2 f 1438(PostScript)X 1791(Language)X 2131(Reference)X 2473(Manual,)X 1 f 2762(Addison)X 3053(Wesley,)X 3334(July,)X 3507(1985.)X 555 4660(5.)N 755(J.)X 830(Warnock)X 1149(and)X 1289(D.)X 1391(K.)X 1493(Wyatt,)X 1733(``A)X 1869(Device)X 2121(Independent)X 2541(Graphics)X 2854(Imaging)X 3144(Model)X 3376(for)X 3493(Use)X 3641(with)X 3806(Raster)X 755 4756(Devices,'')N 2 f 1108(Computer)X 1448(Graphics)X 1 f 1746(,)X 1786(vol.)X 1928(16,)X 2048(no.)X 2168(3,)X 2248(pp.)X 2368(313-320,)X 2675(July,)X 2848(1982.)X 555 4880(6.)N 755(Kurt)X 922(J.)X 993(Schmucker,)X 2 f 1394(Object-Oriented)X 1940(Programming)X 2409(for)X 2522(the)X 2640(Macintosh,)X 1 f 3018(Hayden)X 3288(Book)X 3481(Co.,)X 3634(1986.)X 555 5004(7.)N 755(L.)X 849(Cardelli)X 1132(and)X 1273(R.)X 1371(Pike,)X 1557(``Squeak)X 1871(-)X 1922(A)X 2004(Language)X 2345(for)X 2463(Communicating)X 3002(with)X 3168(Mice,'')X 2 f 3431(Computer)X 3775(Graph-)X 755 5100(ics)N 1 f 844(,)X 884(vol.)X 1026(19,)X 1146(no.)X 1266(3,)X 1346(pp.)X 1466(199-204,)X 1773(July)X 1926(1985.)X 555 5224(8.)N 755(S.)X 839(Evans,)X 1075(``The)X 1274(Noti\256er,'')X 1617(in)X 2 f 1699(Proc.)X 1895(USENIX)X 2191(Summer)X 2474('86)X 2601(Conf.)X 1 f 2776(,)X 2816(Atlanta)X 3072(GA,)X 3228(1986.)X 555 5348(9.)N 755(O.)X 872(M.)X 1002(Densmore,)X 1391(``Object-Oriented)X 2006(Programming)X 2485(in)X 2586(NeWS,'')X 2913(in)X 2 f 3014(Proc.)X 3228(3rd)X 3377(USENIX)X 3691(Computer)X 755 5444(Graphics)N 1073(Workshop)X 1 f 1398(,)X 1438(Monterey,)X 1790(CA,)X 1941(November,)X 2320(1986.)X 11 p %%Page: 11 11 10 s 0 xH 0 xS 1 f 2196 384(-)N 2243(11)X 2343(-)X 3 f 555 672(Appendix:)N 954(the)X 1081(example)X 1386(program)X 5 f 8 s 843 828(#!)N 915(/usr/NeWS/bin/psh)X 843 908(/\256llcanvaswithlines)N 1389({)X 3147(%)X 2 f 3222(linesperside)X 3547(=>)X 3649(-)X 5 f 1131 988(gsave)N 1131 1068(1)N 1185(\256llcanvas)X 3147(%)X 2 f 3222(paint)X 3370(the)X 3464(background)X 5 f 1131 1148(0)N 1185(setgray)X 3147(%)X 2 f 3222(default)X 3416(color)X 3567(is)X 3626(black)X 5 f 1131 1228(clippath)N 1371(pathbbox)X 1131 1308(scale)N 1299(pop)X 1425(pop)X 3147(%)X 2 f 3222(make)X 3372(coords)X 3562(0)X 3610(to)X 3676(1)X 5 f 1131 1388(0)N 1185(1)X 1239(3)X 1293(-1)X 1368(roll)X 1471(div)X 1571(1)X 1625({)X 3147(%)X 2 f 3222(0)X 3270(delta)X 3414(1)X 3462({..})X 3562(for)X 5 f 1419 1468(ColorDisplay?)N 1836({dup)X 1983(1)X 2037(1)X 2091(sethsbcolor})X 2459(if)X 3147(%)X 2 f 3222(change)X 3422(color)X 3573(if)X 3625(needed)X 5 f 1419 1548(0)N 1473(0)X 1527(moveto)X 1756(1)X 1810(1)X 1864(index)X 2036(lineto)X 2208(stroke)X 3147(%)X 2 f 3222(draw)X 3370(line)X 3482(to)X 3548(top)X 5 f 1419 1628(0)N 1473(0)X 1527(moveto)X 1756(1)X 1810(lineto)X 1982(stroke)X 3147(%)X 2 f 3222(draw)X 3370(line)X 3482(to)X 3548(side)X 5 f 1419 1708(pause)N 3147(%)X 2 f 3222(let)X 3302(others)X 3478(run)X 5 f 1131 1788(})N 1170(for)X 1131 1868(grestore)N 843 1948(})N 882(def)X 843 2028(/main)N 1018({)X 1131 2108(/linesperside)N 1510(10)X 1600(def)X 3147(%)X 2 f 3222(start)X 3356(with)X 3483(10)X 3563(lines)X 5 f 1131 2188(/setlinesfromuser)N 1638({)X 3147(%)X 2 f 3222(value)X 3376(=>)X 3478(-)X 5 f 1419 2268(/linesperside)N 1798(exch)X 1952(store)X 3147(%)X 2 f 3222(set)X 3309(new)X 3428(value)X 5 f 1419 2348(/paintclient)N 1745(win)X 1859(send)X 3147(%)X 2 f 3222(make)X 3372(window)X 3588(repaint)X 5 f 1131 2428(})N 1170(def)X 1131 2588(/LinesWindow)N 1549(DefaultWindow)X 3147(%)X 2 f 3222(new)X 3341(subclass)X 3574(of)X 3640(DefaultWindow)X 5 f 1131 2668([/LinesCanvas])N 3147(%)X 2 f 3222(instance)X 3451(var:)X 3573(the)X 3667(subwindow)X 5 f 1131 2748(classbegin)N 3147(%)X 2 f 3222(override)X 3454(2)X 3502(methods)X 5 f 1419 2828(/CreateClientCanvas)N 2030({)X 3147(%)X 2 f 3222(this)X 3331(one)X 3439(creates)X 3639(the)X 3733(canvas)X 5 f 1707 2908(/CreateClientCanvas)N 2318(super)X 2497(send)X 3147(%)X 2 f 3222(do)X 3302(super's)X 3506(create)X 5 f 1707 2988(/LinesCanvas)N 2115(ClientCanvas)X 1707 3068(newcanvas)N 2047(store)X 3147(%)X 2 f 3222(create)X 3397(a)X 3445(subcanvas)X 5 f 1707 3148(LinesCanvas)N 2097(/Mapped)X 2366(true)X 2495(put)X 3147(%)X 2 f 3222(map)X 3348(it)X 3400(in)X 5 f 1419 3228(})N 1458(def)X 1419 3308 0.2279(/ShapeClientCanvas)AN 2024({)X 3147(%)X 2 f 3222(This)X 3349(one)X 3457(\(re\)-shapes)X 3763(it)X 5 f 1707 3388 0.2279(/ShapeClientCanvas)AN 2312(super)X 2491(send)X 3147(%)X 2 f 3222(do)X 3302(super's)X 3506(shape)X 5 f 1707 3468(gsave)N 1707 3548(ClientCanvas)N 2107(setcanvas)X 2415(clippath)X 3147(%)X 2 f 3222(make)X 3372(path)X 3502(and)X 5 f 1707 3628(LinesCanvas)N 2097 0.2656(reshapecanvas)AX 3147(%)X 2 f 3222(reshape)X 3440(lines)X 3577(canvas)X 5 f 1707 3708(grestore)N 1419 3788(})N 1458(def)X 1131 3868(classend)N 1403(def)X 3147(%)X 2 f 3222(call)X 3334(new)X 3453(class)X 3597(LinesWindow)X 5 f 1131 4028(/win)N 1263(framebuffer)X 1610(/new)X 1764(LinesWindow)X 2164(send)X 2322(def)X 3147(%)X 2 f 3222(make)X 3372(a)X 3420(new)X 3539(LinesWindow)X 5 f 1131 4108({)N 1419 4188(/FrameLabel)N 1798(\(Lines\))X 2012(def)X 3147(%)X 2 f 3222(Label)X 3384(it)X 3436(Lines)X 5 f 1419 4268(/PaintClient)N 1766({)X 3147(%)X 2 f 3222(PaintClient)X 3534(method)X 5 f 1707 4348(LinesCanvas)N 2097(setcanvas)X 3147(%)X 2 f 3222(\256lls)X 3331(LinesCanvas)X 5 f 1707 4428(linesperside)N 2068(\256llcanvaswithlines)X 3147(%)X 2 f 3238(with)X 3365(linesperside)X 3690(lines)X 5 f 1707 4508(FrameBorderColor)N 2256(strokecanvas)X 3147(%)X 2 f 3222(and)X 3334(draws)X 3507(a)X 3555(box)X 5 f 1419 4588(})N 1458(def)X 1419 4668(/PaintIcon)N 1724({)X 3147(%)X 2 f 3222(PaintIcon)X 3490(method)X 5 f 1707 4748(10)N 1797(\256llcanvaswithlines)X 2325(0)X 2379(strokecanvas)X 3147(%)X 2 f 3222(uses)X 3348(10)X 3428(lines)X 5 f 1419 4828(})N 1458(def)X 1419 4908(/ClientMenu)N 3147(%)X 2 f 3222(the)X 3316(menu)X 3470(sets)X 3582(linesperside)X 5 f 1419 4988([)N 1455(\(10\))X 1587(\(20\))X 1719(\(100\))X 1887(\(250\))X 2055(\(500\))X 2223(])X 1419 5068([)N 1455({currentkey)X 1794(cvi)X 1890(setlinesfromuser})X 2400(])X 1419 5148(/new)N 1573(DefaultMenu)X 1956(send)X 2114(def)X 1131 5228(})N 1170(win)X 1284(send)X 3147(%)X 2 f 3222(override)X 3454(the)X 3548(methods)X 5 f 1131 5308(/reshapefromuser)N 1653(win)X 1767(send)X 3147(%)X 2 f 3222(shape)X 3387(the)X 3481(window)X 5 f 1131 5388(/map)N 1292(win)X 1406(send)X 3147(%)X 2 f 3222(Map)X 3355(it)X 3407(in)X 5 f 843 5468(})N 882(def)X 843 5628(main)N 11 p %%Trailer xt xs