%!PS %%Version: 3.3.2 %%DocumentFonts: (atend) %%Pages: (atend) %%EndComments % % Version 3.3.2 prologue for troff files. % /#copies 1 store /aspectratio 1 def /formsperpage 1 def /landscape false def /linewidth .3 def /magnification 1 def /margin 0 def /orientation 0 def /resolution 720 def /rotation 1 def /xoffset 0 def /yoffset 0 def /roundpage true def /useclippath true def /pagebbox [0 0 612 792] def /R /Times-Roman def /I /Times-Italic def /B /Times-Bold def /BI /Times-BoldItalic def /H /Helvetica def /HI /Helvetica-Oblique def /HB /Helvetica-Bold def /HX /Helvetica-BoldOblique def /CW /Courier def /CO /Courier def /CI /Courier-Oblique def /CB /Courier-Bold def /CX /Courier-BoldOblique def /PA /Palatino-Roman def /PI /Palatino-Italic def /PB /Palatino-Bold def /PX /Palatino-BoldItalic def /Hr /Helvetica-Narrow def /Hi /Helvetica-Narrow-Oblique def /Hb /Helvetica-Narrow-Bold def /Hx /Helvetica-Narrow-BoldOblique def /KR /Bookman-Light def /KI /Bookman-LightItalic def /KB /Bookman-Demi def /KX /Bookman-DemiItalic def /AR /AvantGarde-Book def /AI /AvantGarde-BookOblique def /AB /AvantGarde-Demi def /AX /AvantGarde-DemiOblique def /NR /NewCenturySchlbk-Roman def /NI /NewCenturySchlbk-Italic def /NB /NewCenturySchlbk-Bold def /NX /NewCenturySchlbk-BoldItalic def /ZD /ZapfDingbats def /ZI /ZapfChancery-MediumItalic def /S /S def /S1 /S1 def /GR /Symbol def /inch {72 mul} bind def /min {2 copy gt {exch} if pop} bind def /setup { counttomark 2 idiv {def} repeat pop landscape {/orientation 90 orientation add def} if /scaling 72 resolution div def linewidth setlinewidth 1 setlinecap pagedimensions xcenter ycenter translate orientation rotation mul rotate width 2 div neg height 2 div translate xoffset inch yoffset inch neg translate margin 2 div dup neg translate magnification dup aspectratio mul scale scaling scaling scale addmetrics 0 0 moveto } def /pagedimensions { useclippath userdict /gotpagebbox known not and { /pagebbox [clippath pathbbox newpath] def roundpage currentdict /roundpagebbox known and {roundpagebbox} if } if pagebbox aload pop 4 -1 roll exch 4 1 roll 4 copy landscape {4 2 roll} if sub /width exch def sub /height exch def add 2 div /xcenter exch def add 2 div /ycenter exch def userdict /gotpagebbox true put } def /addmetrics { /Symbol /S null Sdefs cf /Times-Roman /S1 StandardEncoding dup length array copy S1defs cf } def /pagesetup { /page exch def currentdict /pagedict known currentdict page known and { page load pagedict exch get cvx exec } if } def /decodingdefs [ {counttomark 2 idiv {y moveto show} repeat} {neg /y exch def counttomark 2 idiv {y moveto show} repeat} {neg moveto {2 index stringwidth pop sub exch div 0 32 4 -1 roll widthshow} repeat} {neg moveto {spacewidth sub 0.0 32 4 -1 roll widthshow} repeat} {counttomark 2 idiv {y moveto show} repeat} {neg setfunnytext} ] def /setdecoding {/t decodingdefs 3 -1 roll get bind def} bind def /w {neg moveto show} bind def /m {neg dup /y exch def moveto} bind def /done {/lastpage where {pop lastpage} if} def /f { dup /font exch def findfont exch dup /ptsize exch def scaling div dup /size exch def scalefont setfont linewidth ptsize mul scaling 10 mul div setlinewidth /spacewidth ( ) stringwidth pop def } bind def /changefont { /fontheight exch def /fontslant exch def currentfont [ 1 0 fontheight ptsize div fontslant sin mul fontslant cos div fontheight ptsize div 0 0 ] makefont setfont } bind def /sf {f} bind def /cf { dup length 2 idiv /entries exch def /chtab exch def /newencoding exch def /newfont exch def findfont dup length 1 add dict /newdict exch def {1 index /FID ne {newdict 3 1 roll put}{pop pop} ifelse} forall newencoding type /arraytype eq {newdict /Encoding newencoding put} if newdict /Metrics entries dict put newdict /Metrics get begin chtab aload pop 1 1 entries {pop def} for newfont newdict definefont pop end } bind def % % A few arrays used to adjust reference points and character widths in some % of the printer resident fonts. If square roots are too high try changing % the lines describing /radical and /radicalex to, % % /radical [0 -75 550 0] % /radicalex [-50 -75 500 0] % % Move braceleftbt a bit - default PostScript character is off a bit. % /Sdefs [ /bracketlefttp [201 500] /bracketleftbt [201 500] /bracketrighttp [-81 380] /bracketrightbt [-83 380] /braceleftbt [203 490] /bracketrightex [220 -125 500 0] /radical [0 0 550 0] /radicalex [-50 0 500 0] /parenleftex [-20 -170 0 0] /integral [100 -50 500 0] /infinity [10 -75 730 0] ] def /S1defs [ /underscore [0 80 500 0] /endash [7 90 650 0] ] def %%EndProlog %%BeginSetup mark /resolution 720 def setup 2 setdecoding %%EndSetup %%Page: 1 1 /saveobj save def mark 1 pagesetup 12 B f (Pads Programming Guide \261 Revision 1)5 1993 1 1883 1230 t 12 I f (ABSTRACT)2597 1670 w 10 CW f (Pads)1330 1966 w 10 R f (is an object-oriented user interface package for bitmap terminals, most suit-)10 3019 1 1595 1966 t ( in C++ and linked with the)6 1101( Written)1 355(able for browser-like applications.)3 1369 3 1080 2086 t 10 CW f (Pads)3965 2086 w 10 R f (library, an)1 410 1 4230 2086 t (application program instantiates objects and describes them to)7 2483 1 1080 2206 t 10 CW f (Pads)3623 2206 w 10 R f (, creating windows)2 757 1 3863 2206 t ( Asynchronously,)1 730(and lines of text, to which the objects are bound.)9 1939 2 1080 2326 t 10 CW f (Pads)3809 2326 w 10 R f (manages the)1 496 1 4074 2326 t (display of this set of overlapping, scrolling windows and maps each semantic operation)12 3493 1 1080 2446 t (from the user to a call of a member function of the appropriate object.)13 2788 1 1080 2566 t (In the current implementation the application is a timesharing process on a UNIX\262)12 3306 1 1330 2722 t (system, communicating with a generic terminal process in a DMD 5620 or Blit terminal.)13 3544 1 1080 2842 t (The abstractions used in the)4 1115 1 1080 2962 t 10 CW f (Pads)2255 2962 w 10 R f (interface make few assumptions about the terminal's)6 2107 1 2520 2962 t (properties and it should be possible to use)7 1674 1 1080 3082 t 10 CW f (Pads)2814 3082 w 10 R f (in a variety of other environments.)5 1381 1 3079 3082 t (This document contains: \(i\) an explanation of)6 1820 1 1330 3238 t 10 CW f (Pads)3210 3238 w 10 R f (' non-sequential programming)2 1215 1 3450 3238 t (model, \(ii\) a description of the mechanics of the 5620/Blit human interface, \(iii\) some)13 3426 1 1080 3358 t (sample programs, \(iv\) the details of programming with)7 2192 1 1080 3478 t 10 CW f (Pads)3332 3478 w 10 R f (, which assumes some)3 888 1 3572 3478 t (familiarity with C++.)2 854 1 1080 3598 t 10 B f ( Model)1 297(1. Programming)1 724 2 720 3988 t 10 CW f (Pads)970 4144 w 10 R f ( An)1 174(is a bitmap user interface package based on an object-oriented programming model.)11 3359 2 1236 4144 t 10 I f (object)4796 4144 w 10 R f (in)720 4264 w 10 CW f (Pads)865 4264 w 10 R f (is the instantiation of a)4 939 1 1137 4264 t 10 CW f (C++)2143 4264 w 10 R f ( human)1 303( The)1 212([1] class: a collection of data with a set of operations.)10 2202 3 2323 4264 t (user is presented with textual descriptions of objects, each of which is augmented with a set of operations.)17 4320 1 720 4384 t ( one of)2 285( If)1 120( its set of operations becomes available in a menu.)9 2044(When the user selects an object on the screen,)8 1871 4 720 4504 t ( line of input from the keyboard may)7 1501( A)1 126( entries is selected, its operation is invoked on the object.)10 2321(the menu)1 372 4 720 4624 t (also be directed to an object.)5 1142 1 720 4744 t ( the sequential flow of a conventional procedure-)7 1987(The global control flow in such a program is unlike)9 2083 2 970 4900 t ( execution of a)3 608( The)1 211(oriented program.)1 721 3 720 5020 t 10 CW f (Pads)2325 5020 w 10 R f (program is driven by direct invocations of its objects' mem-)9 2445 1 2595 5020 t ( input stream; member functions are)5 1460( application has no global control for interpreting an)8 2102( The)1 207(ber functions.)1 551 4 720 5140 t ( to the display,)3 613( each invocation results in a change)6 1473( Usually)1 370(invoked from an external control mechanism.)5 1864 4 720 5260 t ( function invocation is completed in isolation and)7 1980( Each)1 249(showing the user some new or changed information.)7 2091 3 720 5380 t (must leave the program ready to accept the user's next operation.)10 2602 1 720 5500 t ( of the program is devoted to deciding what set of applicable)11 2465(Compared to procedural software, more)4 1605 2 970 5656 t ( Error)1 271(operations should be presented to the user and less to trying to guide the user and interpret input.)17 4049 2 720 5776 t ( finds itself in the middle of a complex)8 1645( a program)2 454( Suppose)1 400(handling techniques illustrate the difference.)4 1821 4 720 5896 t ( the procedural model, the program might:)6 1695( In)1 133(operation when it cannot open a file.)6 1461 3 720 6016 t ( user must fix the problem and restart the the)9 1825( The)1 209( and abort the operation.)4 989(\(a\) issue an error message)4 1047 4 970 6172 t (operation, possibly having to repeat a lot of work to recover the lost context.)13 3054 1 970 6292 t ( pause with a prompt that lets the user choose whether to try again or)14 2835(\(b\) issue an error message and)5 1235 2 970 6448 t ( the program itself cannot help to fix)7 1504( But)1 201( least gives the user a chance to continue.)8 1697( at)1 104( This)1 235(give up.)1 329 6 970 6568 t (the problem; it is stuck waiting for an answer to the question.)11 2448 1 970 6688 t (In)720 6844 w 10 CW f (Pads)865 6844 w 10 R f (, when an object runs into trouble, it can report the problem and place a set of recovery actions in)19 3935 1 1105 6844 t ( user can)2 410( The)1 233( user chooses to send it another operation.)7 1871( does nothing more until the)5 1270( It)1 140(its menu.)1 396 6 720 6964 t 8 S1 f (__________________)720 7064 w 8 R f (\262 UNIX is a trademark of AT&T Bell Laboratories.)8 1647 1 720 7164 t cleartomark showpage saveobj restore %%EndPage: 1 1 %%Page: 2 2 /saveobj save def mark 2 pagesetup 10 R f (- 2 -)2 166 1 2797 480 t ( fix the problem, returning to it arbitrarily later, or ignoring it forever.)12 2902(communicate with other objects to)4 1418 2 720 840 t (Effectively, an object)2 876 1 720 960 t 10 I f (cannot)1631 960 w 10 R f (pose a question to the user and demand a response before the program as a)14 3102 1 1938 960 t ( their menus, leaving the)4 1017( do so it would have to arrange that all other objects remove)12 2480( To)1 168(whole proceeds.)1 655 4 720 1080 t ( it must leave itself in a state from which it can continue, at the user's behest.)16 3079( Rather,)1 341(user no choice.)2 601 3 720 1200 t (Different implementations of this model are possible.)6 2152 1 970 1356 t 10 CW f (Pads)3245 1356 w 10 R f ( a host process,)3 622(runs the application as)3 905 2 3513 1356 t ( host creates objects and binds them to windows)8 1934( The)1 206( in the terminal.)3 636(communicating with a generic process)4 1544 4 720 1476 t ( ter-)1 168( The)1 210( each object a textual description and set of operations is sent to the terminal.)14 3132( For)1 193(or lines of text.)3 617 5 720 1596 t ( user selects a cur-)4 744( The)1 207(minal program presents them to the user as a set of overlapping, scrolling windows.)13 3369 3 720 1716 t ( menu selection results in a mes-)6 1316( Each)1 251( selections.)1 446(rent window, or a line within a window, and makes menu)10 2307 4 720 1836 t (sage to the host that invokes the corresponding member function of the object bound to the window or line.)18 4287 1 720 1956 t ( notion of a reply, result or acknowl-)7 1562(Host-terminal communications are asynchronous; there is no)6 2508 2 970 2112 t ( object descriptions to the terminal arbitrarily; the terminal may send opera-)11 3081( host may send)3 615(edgement. The)1 624 3 720 2232 t ( the order of messages along each path is guaranteed.)9 2122( Only)1 250(tions to the host arbitrarily.)4 1086 3 720 2352 t 10 B f ( Interaction)1 502(2. Human)1 448 2 720 2592 t 10 R f ( are the only)3 508( These)1 292( Blit.)1 205(The remainder of this document assumes the terminal to be a DMD 5620 or)13 3065 4 970 2748 t (terminals for which)2 796 1 720 2868 t 10 CW f (Pads)1583 2868 w 10 R f ( one-button mouse,)2 781( terminals, say with a)4 880( Other)1 284(has been implemented to date.)4 1240 4 1855 2868 t (would behave differently.)2 1028 1 720 2988 t ( mouse con-)2 494( The)1 208( a set of windows containing lines of text.)8 1692(The application's objects are displayed as)5 1676 4 970 3144 t ( are)1 163( Operations)1 505( overlap and scrolling and selects a current window and line.)10 2590(trols window positioning,)2 1062 4 720 3264 t (directed to the current window or line from pop-up menus or the keyboard.)12 2997 1 720 3384 t ( at a window makes it current, with a heavy border; pointing)11 2479( Pointing)1 396(The left mouse button points.)4 1195 3 970 3540 t ( window shows proportion-)3 1102( black scroll bar at the left of each)8 1365( The)1 206(at a line makes it current, video-inverted.)6 1647 4 720 3660 t ( provide)1 335( To)1 166( pointing into the scroll region repositions it.)7 1819(ally how much of the text of a window is visible;)10 2000 4 720 3780 t (finer scrolling in large files, selecting the top or bottom line moves it to the middle of the window.)18 3931 1 720 3900 t ( in two)2 290( is)1 97( It)1 116(The middle mouse button menu has line-level operations; they apply to the current line.)13 3567 4 970 4056 t ( operations below the separator are)5 1413( The)1 209( above the separator are specific to each line.)8 1823( operations)1 446(parts. The)1 429 5 720 4176 t (generic line operations:)2 937 1 720 4296 t 10 B f (cut)970 4452 w 10 R f (removes the line;)2 690 1 1129 4452 t 10 B f (sever)1845 4452 w 10 R f (removes the line and all lines above it;)7 1554 1 2093 4452 t 10 B f (fold)3674 4452 w 10 R f (folds a line that is wider than)6 1172 1 3868 4452 t (its window, so all of it appears;)6 1306 1 970 4572 t 10 B f (truncate)2310 4572 w 10 R f ( wide line at the right, so it occupies only one)10 1898(truncates a)1 438 2 2704 4572 t (physical line.)1 533 1 970 4692 t ( operations above the)3 872( The)1 212( is in three parts.)4 691( It)1 118( menu has window-level operations.)4 1473(The right mouse button)3 954 6 720 4848 t ( all the available win-)4 897( the lower separator is a list of)7 1269( Below)1 320(upper separator are specific to each window.)6 1834 4 720 4968 t ( The)1 216( screen order, current at the top.)6 1334( appear in front-to-back)3 974( They)1 265(dows; selecting one makes it current.)5 1531 5 720 5088 t (operations between the separators are generic window operations:)7 2629 1 720 5208 t 10 B f (reshape, move, close)2 865 1 970 5364 t 10 R f (are familiar;)1 490 1 1860 5364 t 10 B f (fold)2375 5364 w 10 R f (and)2567 5364 w 10 B f (truncate)2736 5364 w 10 R f (apply to all the lines in the window.)7 1433 1 3121 5364 t ( characters accumulate at the)4 1207( Keyboard)1 457(Some windows and lines accept input from the keyboard.)8 2406 3 970 5520 t ( the current line accepts input, it flashes with each keystroke; otherwise, if the current)14 3415( If)1 116( the layer.)2 396(bottom of)1 393 4 720 5640 t ( carriage return is ignored until a line or window)9 1947( neither flashes,)2 629( If)1 116(window accepts input, its border flashes.)5 1628 4 720 5760 t ( Hitting)1 341( carriage return, the whole input line is sent to the line or window.)13 2729( On)1 179( selected.)1 378(that does flash is)3 693 5 720 5880 t ( line or window)3 639( Each)1 252( is a safe way to find out where an input line would go.)13 2236(backspace to see what flashes)4 1193 4 720 6000 t (that accepts keyboard input produces a one-line help message in response to)11 3041 1 720 6120 t 10 CW f (?)3821 6120 w 10 R f (.)3881 6120 w ( cursor icon indicates that the host is still completing an operation; the terminal)13 3175(The arrow-dot-dot-dot)1 895 2 970 6276 t (is ready)1 314 1 720 6396 t 10 I f (asynchronously.)1060 6396 w 10 R f ( confirmation of a menu selection by pressing)7 1828(The exclamation mark icon calls for)5 1449 2 1763 6396 t (that menu's button again.)3 1016 1 720 6516 t 10 B f ( programs)1 441(3. Sample)1 442 2 720 6756 t 10 R f (The null)1 336 1 970 6912 t 10 CW f (Pads)1366 6912 w 10 R f (program is:)1 458 1 1631 6912 t cleartomark showpage saveobj restore %%EndPage: 2 2 %%Page: 3 3 /saveobj save def mark 3 pagesetup 10 R f (- 3 -)2 166 1 2797 480 t 10 CW f (#include )1 1140 1 1080 900 t (void main\(\))1 660 1 1080 1140 t ({)1080 1260 w (PadsInit\(\);)1330 1380 w (PadsServe\(\);)1330 1500 w (})1080 1620 w 10 R f ( file)1 233(It is compiled with the header)5 1560 2 720 1800 t 10 CW f (/usr/jerq/include/pads.pub)2648 1800 w 10 R f (and the library)2 732 1 4308 1800 t 10 CW f (/usr/jerq/lib/libpads.a)720 1920 w 10 R f ( host code does)3 613( The)1 205( system to system.)3 734( pathnames may vary from)4 1074(. These)1 314 5 2100 1920 t ( on the type of terminal; the same files are used for 256K and 1M DMD 5620 and 68000 Blit.)19 3873(not depend)1 447 2 720 2040 t (The program is compiled:)3 1035 1 720 2160 t 10 CW f (CC null.c -I/usr/jerq/include /usr/jerq/lib/libpads.a)3 3180 1 1080 2340 t 10 R f (When the program is run,)4 1079 1 720 2520 t 10 CW f (PadsInit\(\))1873 2520 w 10 R f ( must be the first call to)6 1034( It)1 126(downloads the terminal program.)3 1368 3 2512 2520 t 10 CW f (Pads)720 2640 w 10 R f ( on the)2 272(. Depending)1 513 2 960 2640 t 10 CW f (TERM)1805 2640 w 10 R f (environment variable the download is)4 1509 1 2070 2640 t 10 CW f (32ld /usr/jerq/mbin/pads.m)1 1560 1 1080 2820 t 10 R f (or)720 3000 w 10 CW f (68ld /usr/blit/mbin/pads.m)1 1560 1 1080 3180 t (PadsServe\(\))970 3396 w 10 R f (hands control of the host process to)6 1415 1 1655 3396 t 10 CW f (Pads)3130 3396 w 10 R f ( never returns; from that point the glo-)7 1534(. It)1 136 2 3370 3396 t (bal control flow of the program remains with)7 1891 1 720 3516 t 10 CW f (Pads)2684 3516 w 10 R f ( is now passive, invoked by)5 1165( application code)2 708(. The)1 243 3 2924 3516 t (calls from)1 419 1 720 3636 t 10 CW f (Pads)1216 3636 w 10 R f (.)1456 3636 w 10 CW f (PadsServe\(\))1618 3636 w 10 R f ( the terminal to invoke operations on objects)7 1905(reads requests from)2 815 2 2320 3636 t ( host process)2 538( The)1 216( this program there are none; nothing more can happen.)9 2320( In)1 145(defined by the application.)3 1101 5 720 3756 t (blocks reading from the terminal in)5 1412 1 720 3876 t 10 CW f (PadsServe\(\))2192 3876 w 10 R f (.)2852 3876 w ( receive input, a pad must)5 1041( To)1 164( must create at least one pad \(window\).)7 1584(To produce output, the program)4 1281 4 970 4032 t (be bound to an instantiation of one of the program's classes, and a menu of operations must be supplied.)18 4167 1 720 4152 t ( a window that displays the date when)7 1579(The following program creates)3 1254 2 970 4308 t 10 CW f ('date')3871 4308 w 10 R f (is selected from its)3 776 1 4264 4308 t (only pad's menu:)2 694 1 720 4428 t cleartomark showpage saveobj restore %%EndPage: 3 3 %%Page: 4 4 /saveobj save def mark 4 pagesetup 10 R f (- 4 -)2 166 1 2797 480 t 10 CW f (#include )1 1140 1 1080 900 t (#include )1 1260 1 1080 1020 t (class Date : public PadRcv {)5 1680 1 1080 1260 t ( *pad;)1 510(class Pad)1 540 2 1330 1380 t (void date\(\);)1 920 1 1330 1500 t (Date\(\);)1830 1620 w (};)1080 1740 w (Date.Date\(\))1080 1980 w ({)1080 2100 w (Menu m;)1 420 1 1330 2220 t (pad = new Pad\( \(PadRcv*\) this \);)6 1920 1 1330 2340 t (pad->banner\( "Current Date" \);)3 1800 1 1330 2460 t (pad->name\( "date" \);)2 1200 1 1330 2580 t (m.first\( "date", \(Action\) &date \);)4 2040 1 1330 2700 t (pad->menu\( m \);)2 900 1 1330 2820 t (pad->makecurrent\(\);)1330 2940 w (})1080 3060 w (void Date.date\(\))1 960 1 1080 3300 t ({)1080 3420 w (char *ctime\(long*\);)1 1140 1 1330 3540 t (long time\(long*\), t;)2 1200 1 1330 3660 t (time\(&t\);)1330 3780 w (pad->insert\( 1, "%s", ctime\(&t\) \);)4 2040 1 1330 3900 t (})1080 4020 w (void main\(\))1 660 1 1080 4260 t ({)1080 4380 w (char *error = PadsInit\(\);)3 1500 1 1330 4500 t (if\( error \){)2 720 1 1330 4620 t (fprintf\( stderr, "%s", error \);)4 1860 1 1580 4740 t (exit\(1\);)1580 4860 w (})1330 4980 w (new Date;)1 540 1 1330 5100 t (PadsServe\(\);)1330 5220 w (})1080 5340 w 10 R f (After downloading and checking for an error return from)8 2367 1 970 5556 t 10 CW f (PadsInit\(\))3409 5556 w 10 R f (,)4009 5556 w 10 CW f (main\(\))4106 5556 w 10 R f (constructs an)1 537 1 4503 5556 t (instance of)1 435 1 720 5676 t 10 CW f (Date)1215 5676 w 10 R f (;)1455 5676 w 10 CW f (Date.Date\(\))1543 5676 w 10 R f (in turn constructs a)3 763 1 2228 5676 t 10 CW f (Pad)3051 5676 w 10 R f (:)3231 5676 w cleartomark showpage saveobj restore %%EndPage: 4 4 %%Page: 5 5 /saveobj save def mark 5 pagesetup 10 R f (- 5 -)2 166 1 2797 480 t 10 CW f (class Pad {)2 660 1 770 840 t (public:)770 960 w (Pad\(PadRcv *\);)1 840 1 1500 1080 t ( ...\);)1 360(void banner\(char*)1 1200 2 1020 1200 t ( ...\);)1 360(void name\(char*)1 1080 2 1020 1320 t ( Attrib, PadRcv*, Menu&, char* ...\);)5 2160(void insert\(long,)1 1200 2 1020 1440 t ( Attrib, char* ...\);)3 1200(void insert\(long,)1 1200 2 1020 1560 t ( char* ...\);)2 720(void insert\(long,)1 1200 2 1020 1680 t (void makecurrent\(\);)1 1320 1 1020 1800 t (void menu\(Menu&\);)1 1200 1 1020 1920 t (};)770 2040 w 10 S f (_ __________________________________________________________________________\347)1 3710 1 720 2100 t (\347)4430 2020 w (\347)4430 1920 w (\347)4430 1820 w (\347)4430 1720 w (\347)4430 1620 w (\347)4430 1520 w (\347)4430 1420 w (\347)4430 1320 w (\347)4430 1220 w (\347)4430 1120 w (\347)4430 1020 w (\347)4430 920 w (\347)4430 820 w (_ __________________________________________________________________________)1 3710 1 720 720 t (\347)720 820 w (\347)720 900 w (\347)720 1000 w (\347)720 1100 w (\347)720 1200 w (\347)720 1300 w (\347)720 1400 w (\347)720 1500 w (\347)720 1600 w (\347)720 1700 w (\347)720 1800 w (\347)720 1900 w (\347)720 2000 w (\347)720 2100 w 10 R f (Definitions like this from)3 1032 1 720 2340 t 10 CW f (pads.pub)1818 2340 w 10 R f ( Check)1 312( and for simplicity may be incomplete.)6 1588(are shown in boxes,)3 811 3 2329 2340 t 10 CW f (pads.pub)720 2460 w 10 R f (for complete definitions.)2 985 1 1225 2460 t ( argument to)2 515(In order to pass itself as the)6 1122 2 970 2616 t 10 CW f (Pad.Pad\(\))2672 2616 w 10 R f (and become the recipient of operations from)6 1798 1 3242 2616 t ( terminal,)1 386(the pad's window in the)4 976 2 720 2736 t 10 CW f (Date)2145 2736 w 10 R f (is derived from)2 616 1 2413 2736 t 10 CW f (PadRcv)3092 2736 w 10 R f (, a)1 97 1 3452 2736 t 10 CW f (Pads)3612 2736 w 10 R f ( definition of)2 528( The)1 208(base class.)1 424 3 3880 2736 t 10 CW f (PadRcv)720 2856 w 10 R f ( the construction,)2 707( After)1 268( needed yet.)2 495(is not)1 227 4 1112 2856 t 10 CW f (pad)2877 2856 w 10 R f (points to an embryonic pad: empty, anonymous)6 1950 1 3090 2856 t ( The pointer is, of course, to an object in the host process, an agent representing an object in)18 3764(and impotent.)1 556 2 720 2976 t (the terminal.)1 505 1 720 3096 t ( properties.)1 469(Several different functions are called to establish the pad's)8 2491 2 970 3252 t 10 CW f (Pad.banner\(\))4070 3252 w 10 R f (takes)4835 3252 w 10 CW f (printf)720 3372 w 10 R f (arguments producing a string,)3 1229 1 1117 3372 t 10 CW f ('Current Date')1 840 1 2418 3372 t 10 R f (, to appear at the top of the pad's window.)9 1782 1 3258 3372 t (Similarly,)720 3492 w 10 CW f (Pad.name\(\))1179 3492 w 10 R f (defines a string,)2 637 1 1805 3492 t 10 CW f ('date')2503 3492 w 10 R f ( in the list of pads at)6 823(, by which the pad is to be known)8 1354 2 2863 3492 t (the bottom of the button 3 menu.)6 1314 1 720 3612 t (Menus are built using the)4 1016 1 970 3768 t 10 CW f (Pads)2046 3768 w 10 R f (class)2311 3768 w 10 CW f (Menu)2565 3768 w 10 R f (:)2805 3768 w 10 CW f (typedef void \(*Action\) \(...\);)3 1740 1 770 4068 t (class Menu {)2 720 1 770 4308 t (public:)770 4428 w (Menu\(\);)1500 4548 w (\304Menu\(\);)1500 4668 w ( Action, long = 0 \);)5 1200(Menu\( char*,)1 780 2 1500 4788 t ( char*, Action, long = 0 \);)6 1620(void first\()1 840 2 1020 4908 t ( Action, long = 0 \);)5 1200( char*,)1 480(void last\()1 780 3 1020 5028 t ( Action, long = 0 \);)5 1200( char*,)1 480(void sort\()1 780 3 1020 5148 t (};)770 5268 w 10 S f (_________________________________________________________\347)720 5328 w (\347)3570 5248 w (\347)3570 5148 w (\347)3570 5048 w (\347)3570 4948 w (\347)3570 4848 w (\347)3570 4748 w (\347)3570 4648 w (\347)3570 4548 w (\347)3570 4448 w (\347)3570 4348 w (\347)3570 4248 w (\347)3570 4148 w (\347)3570 4048 w (_________________________________________________________)720 3948 w (\347)720 4048 w (\347)720 4128 w (\347)720 4228 w (\347)720 4328 w (\347)720 4428 w (\347)720 4528 w (\347)720 4628 w (\347)720 4728 w (\347)720 4828 w (\347)720 4928 w (\347)720 5028 w (\347)720 5128 w (\347)720 5228 w (\347)720 5328 w 10 R f ( functions in)2 570( The)1 240(The void constructor makes an empty menu.)6 1988 3 720 5568 t 10 CW f (Menu)3613 5568 w 10 R f ( menu.)1 308(add items into the)3 819 2 3913 5568 t 10 CW f (Menu.first\(\))720 5688 w 10 R f ( this example)2 549( In)1 141( menu.)1 280(adds an item to the top of the)7 1226 4 1474 5688 t 10 CW f (Menu.first\(\))3738 5688 w 10 R f (is called only)2 549 1 4491 5688 t ( string,)1 282( The)1 209(once, resulting in a one-element menu.)5 1570 3 720 5808 t 10 CW f ('date')2845 5808 w 10 R f ( to the user, if the menu is)7 1073(, is to be presented)4 762 2 3205 5808 t ( function)1 359(raised. The)1 469 2 720 5928 t 10 CW f (date\(\))1609 5928 w 10 R f (, i.e.)1 173 1 1969 5928 t 10 CW f (Date.date\(\))2263 5928 w 10 R f ( called if the item is selected from the menu.)9 1775(, is to be)3 342 2 2923 5928 t (The third \(optional\) argument of)4 1306 1 720 6048 t 10 CW f (Menu.first\(\))2088 6048 w 10 R f (is a 32-bit argument to be passed along when the func-)10 2205 1 2835 6048 t (tion is called.)2 538 1 720 6168 t 10 CW f (Menu.last\(\))1379 6168 w 10 R f ( the menu.)2 419(adds to the bottom of)4 854 2 2065 6168 t 10 CW f (Menu.sort\(\))3458 6168 w 10 R f (insertion sorts a single)3 897 1 4143 6168 t ( doesn't sort the whole menu.\))5 1245( \(It)1 150(entry into the menu.)3 823 3 720 6288 t 10 CW f (Pad.menu\(\))3064 6288 w 10 R f (binds a menu to a pad; the menu)7 1345 1 3695 6288 t ( pointer passed to)3 708( The)1 207( the pad is selected.)4 787(appears as the top segment of the menu raised by button 3, when)12 2618 4 720 6408 t 10 CW f (Pad)720 6528 w 10 R f ( of the class)3 543('s constructor determines on which instance)5 1865 2 900 6528 t 10 CW f (Date)3391 6528 w 10 R f (the function)1 503 1 3679 6528 t 10 CW f (Date.date\(\))4265 6528 w 10 R f (is)4973 6528 w (invoked.)720 6648 w (The last statement in)3 857 1 970 6804 t 10 CW f (Date.Date\(\))1896 6804 w 10 R f (calls)2590 6804 w 10 CW f (Pad.makecurrent\(\))2842 6804 w 10 R f ( pad to be made)4 672(to force the)2 472 2 3896 6804 t ( pad to the ``front'' of the screen; if not displayed at)11 2131( hidden, this bring a)4 821( If)1 122(visible and selected as current.)4 1246 4 720 6924 t (all \261 the initial state of a pad \261 this requests the user to sweep a rectangle for it.)18 3153 1 720 7044 t (After this initialization)2 925 1 970 7200 t 10 CW f (main\(\))1962 7200 w 10 R f (calls)2354 7200 w 10 CW f (PadsServe\(\))2604 7200 w 10 R f ( until)1 217(, but nothing will happen)4 1031 2 3264 7200 t 10 CW f ('date')4580 7200 w 10 R f (is)4973 7200 w cleartomark showpage saveobj restore %%EndPage: 5 5 %%Page: 6 6 /saveobj save def mark 6 pagesetup 10 R f (- 6 -)2 166 1 2797 480 t ( out of the blue,)4 634( Then,)1 281( the menu.)2 421(selected from)1 542 4 720 840 t 10 CW f (Date.date\(\))2659 840 w 10 R f (is called to determine the time and write it)8 1695 1 3345 840 t ( sequence of lines ordered by a 32-bit key associated with each)11 2568( pad has the default form: a)6 1116( The)1 209(to the pad.)2 427 4 720 960 t ( Key)1 216(inserted line of text.)3 799 2 720 1080 t 10 CW f (1)1795 1080 w 10 R f (is the top line; key)4 739 1 1880 1080 t 10 CW f (2**32-1)2679 1080 w 10 R f ( In)1 133(is the bottom.)2 548 2 3124 1080 t 10 CW f (Date.date\(\))3865 1080 w (pad->insert\( 1, "%s", ctime\(&t\) \);)4 2040 1 1080 1260 t 10 R f (inserts the string constructed from the)5 1617 1 720 1440 t 10 CW f (printf)2418 1440 w 10 R f ( If)1 138( the top \(and only\) line in the pad.)8 1533(arguments as)1 545 3 2824 1440 t 10 CW f (date\(\))720 1560 w 10 R f (is re-invoked, it inserts again with the same key and overwrites the previous date.)13 3253 1 1105 1560 t ( number of pads to present the con-)7 1467( uses an unbounded)3 806( It)1 118(The next program is a toy news browser.)7 1679 4 970 1716 t (tents of)1 302 1 720 1836 t 10 CW f (/usr/news)1087 1836 w 10 R f ( first pad displays a list of file names from)9 1735(. Its)1 180 2 1627 1836 t 10 CW f (/usr/news)3607 1836 w 10 R f ( Select-)1 332(, one per line.)3 561 2 4147 1836 t (ing a line and choosing)4 927 1 720 1956 t 10 CW f ('open')1707 1956 w 10 R f (from its menu creates a new pad, showing the file's contents.)10 2440 1 2092 1956 t cleartomark showpage saveobj restore %%EndPage: 6 6 %%Page: 7 7 /saveobj save def mark 7 pagesetup 10 R f (- 7 -)2 166 1 2797 480 t 10 CW f (#include )1 1140 1 1080 900 t (#include )1 1260 1 1080 1020 t (class Story : public PadRcv {)5 1740 1 1080 1260 t (char file[16];)1 790 1 1330 1380 t (FILE *fp;)1 490 1 1330 1500 t (long lines;)1 610 1 1330 1620 t (Pad *pad;)1 550 1 1330 1740 t (void linereq\(long,Attrib\);)1 1510 1 1330 1860 t (public:)1080 1980 w (void open\(\);)1 670 1 1330 2100 t ( strncpy\( file, f, strlen\(f\)-1 \); })6 2100( {)1 220(Story\(char *f\))1 840 3 1580 2220 t (};)1080 2340 w ( public PadRcv {)3 960( :)1 180(class News)1 600 3 1080 2580 t (Pad *pad;)1 550 1 1330 2700 t (public:)1080 2820 w (News\(\);)1580 2940 w (};)1080 3060 w (void main\(\))1 660 1 1080 3300 t ({)1080 3420 w (if\( chdir\( "/usr/news" \) \) exit\(1\);)5 2100 1 1330 3540 t (char *error = PadsInit\(\);)3 1500 1 1330 3660 t (if\( error \){)2 720 1 1330 3780 t (fprintf\( stderr, "%s", error \);)4 1860 1 1580 3900 t (exit\(1\);)1580 4020 w (})1330 4140 w (new News\(\);)1 660 1 1330 4260 t (PadsServe\(\);)1330 4380 w (})1080 4500 w (News.News\(\))1080 4740 w ({)1080 4860 w (Story *s;)1 540 1 1330 4980 t (FILE *fp, *popen\(char*,char*\);)2 1800 1 1330 5100 t (Menu m\( "open", \(Action\) &Story::open \);)5 2400 1 1330 5220 t (char file[16];)1 840 1 1330 5340 t (long uniq = 0;)3 840 1 1330 5460 t (pad = new Pad\( \(PadRcv *\) this \);)7 1980 1 1330 5580 t (pad->options\(TRUNCATE|SORTED\);)1330 5700 w (pad->banner\( "News:" \);)2 1380 1 1330 5820 t (pad->name\( "News" \);)2 1200 1 1330 5940 t (pad->makecurrent\(\);)1330 6060 w (if\( !\(fp = popen\("ls", "r"\)\) \){)5 1860 1 1330 6180 t (pad->insert\( 1, "can't ls" \);)4 1740 1 1580 6300 t (return;)1580 6420 w (})1330 6540 w (while\( fgets\(file, 16, fp\) \){)4 1740 1 1330 6660 t (s = new Story\( file \);)5 1320 1 1580 6780 t (pad->insert\( ++uniq, \(Attrib\) 0, \(PadRcv*\) s, m, "%s", file \);)9 3720 1 1580 6900 t (})1330 7020 w (pclose\(fp\);)1330 7140 w (})1080 7260 w cleartomark showpage saveobj restore %%EndPage: 7 7 %%Page: 8 8 /saveobj save def mark 8 pagesetup 10 R f (- 8 -)2 166 1 2797 480 t 10 CW f (void Story.open\(\))1 1020 1 1080 840 t ({)1080 960 w (char buf[256];)1 840 1 1330 1080 t (if\( !pad \){)2 660 1 1330 1320 t (pad = new Pad\( \(PadRcv*\) this \);)6 1920 1 1580 1440 t (pad->banner\( "%s:", file \);)3 1620 1 1580 1560 t (pad->name\( file \);)2 1080 1 1580 1680 t (if\( !\(fp = fopen\( file, "r" \)\) \){)7 1980 1 1580 1800 t (pad->insert\( 1, "cannot open file" \);)5 2220 1 1830 1920 t (return;)1830 2040 w (})1580 2160 w (lines = 0;)2 600 1 1580 2280 t (while\( fgets\( buf, 256, fp \) \) ++lines;)7 2340 1 1580 2400 t (pad->lines\(lines\);)1580 2520 w (})1330 2640 w (pad->makecurrent\(\);)1330 2760 w (})1080 2880 w (void Story.linereq\( long i, Attrib a \))6 2280 1 1080 3120 t ({)1080 3240 w (char buf[256];)1 840 1 1330 3360 t (long n;)1 420 1 1330 3480 t (fseek\( fp, 0, 0 \);)4 1080 1 1330 3720 t (for\( n = i; n > 0; --n \))8 1440 1 1330 3840 t (fgets\( buf, 256, fp \);)4 1320 1 1580 3960 t (pad->insert\( i, a, "%s ", buf \);)6 1920 1 1330 4080 t (})1080 4200 w (News.News\(\))970 4416 w 10 R f (calls)1663 4416 w 10 CW f (Pad.options\(\))1914 4416 w 10 R f (to change the properties of its pad.)6 1432 1 2727 4416 t 10 CW f (TRUNCATE)4288 4416 w 10 R f (speci-)4802 4416 w ( current width of the pad.)5 1049(fies that lines in the pad be truncated at the right when their length exceeds the)15 3271 2 720 4536 t 10 CW f (SORTED)720 4656 w 10 R f ( by key.)2 323(specifies that the lines in the pad be ordered by dictionary order rather than)13 3009 2 1106 4656 t 10 CW f (TRUNCATE)4560 4656 w 10 R f (and)720 4776 w 10 CW f (SORTED)924 4776 w 10 R f (are constants of type)3 823 1 1309 4776 t 10 CW f (Attrib)2192 4776 w 10 R f (.)2552 4776 w (For each file in)3 631 1 970 4932 t 10 CW f (/usr/news)1670 4932 w 10 R f (,)2210 4932 w 10 CW f (News.News\(\))2304 4932 w 10 R f (creates a)1 354 1 2998 4932 t 10 CW f (Story)3421 4932 w 10 R f (and inserts the name of the file)6 1285 1 3755 4932 t ( the)1 149( When)1 290(into the pad.)2 501 3 720 5052 t 10 CW f (Story)1722 5052 w 10 R f (is created,)1 406 1 2049 5052 t 10 CW f (Story.Story\(\))2517 5052 w 10 R f ( pri-)1 170(merely copies the name of the file to a)8 1546 2 3324 5052 t ( call to)2 272( The)1 205(vate area.)1 381 3 720 5172 t 10 CW f (Pad.insert\(\))1638 5172 w 10 R f (accomplishes quite a lot:)3 991 1 2383 5172 t 10 CW f (pad->insert\( ++uniq, \(Attrib\) 0, \(PadRcv*\) s, m, "%s", file \);)9 3720 1 1080 5352 t (++uniq)720 5532 w 10 R f ( the pad is)3 444( Since)1 283(generates an increasing sequence of unique keys.)6 2024 3 1116 5532 t 10 CW f (SORTED)3939 5532 w 10 R f (, it doesn't matter)3 741 1 4299 5532 t ( The)1 208( must differ to prevent an earlier story being overwritten.)9 2300(what keys are used, but they)5 1151 3 720 5652 t 10 CW f (Attrib)4442 5652 w 10 R f (argu-)4830 5652 w ( The)1 214( set for the line \261 none in this case.)9 1468(ment is the set of attributes to be)7 1358 3 720 5772 t 10 CW f (PadRcv*)3829 5772 w 10 R f (and)4283 5772 w 10 CW f (Menu&)4496 5772 w 10 R f (argu-)4830 5772 w ( this case a singleton menu is constructed by giving argu-)10 2392( In)1 144(ments bind an object and menu to the line.)8 1784 3 720 5892 t (ments directly to)2 694 1 720 6012 t 10 CW f (Menu.Menu\(\))1485 6012 w 10 R f ( distinguishes the objects and menus that are bound to lines)10 2481(. Nothing)1 414 2 2145 6012 t ( The)1 213(from those that are bound to pads.)6 1410 2 720 6132 t 10 CW f (printf)2411 6132 w 10 R f ( end\) give the text for the)6 1051(arguments \(necessarily at the)3 1185 2 2804 6132 t (line.)720 6252 w (When the)1 394 1 970 6408 t 10 CW f ('open')1433 6408 w 10 R f (operation is selected on one of these lines,)7 1756 1 1827 6408 t 10 CW f (Story.open\(\))3653 6408 w 10 R f (is called on the)3 632 1 4408 6408 t (corresponding)720 6528 w 10 CW f (Story)1361 6528 w 10 R f ( a given)2 336(. For)1 224 2 1661 6528 t 10 CW f (Story)2291 6528 w 10 R f (, only the first call to)5 883 1 2591 6528 t 10 CW f (open\(\))3544 6528 w 10 R f ( If)1 125(is interesting.)1 548 2 3938 6528 t 10 CW f (open\(\))4680 6528 w 10 R f ( reads its file)3 534( the first call it creates a pad,)7 1189( On)1 178(has been called previously, it merely makes its pad current.)9 2419 4 720 6648 t ( creating the pad whether the)5 1190( By)1 174( demand.)1 373(and arranges that the text of the file be sent to the terminal, on)13 2583 4 720 6768 t ( the file is)3 406( If)1 118(file is successfully opened or not, it has somewhere to write an error message if the open fails.)17 3796 3 720 6888 t (opened successfully, the length is counted in)6 1784 1 720 7008 t 10 CW f (lines)2564 7008 w 10 R f (and passed to)2 538 1 2889 7008 t 10 CW f (Pad.lines\(\))3487 7008 w 10 R f (.)4147 7008 w 10 CW f (Pad.lines\(\))970 7164 w 10 R f ( of waiting for lines of text to be)8 1389( Instead)1 350( nature of the pad.)4 771(radically changes the)2 864 4 1666 7164 t ( exact number of lines in the pad and actively requests the)11 2348(inserted by the host, the terminal now knows the)8 1972 2 720 7284 t cleartomark showpage saveobj restore %%EndPage: 8 8 %%Page: 9 9 /saveobj save def mark 9 pagesetup 10 R f (- 9 -)2 166 1 2797 480 t ( scrolls the window and the terminal needs to display a line)11 2389( the user)2 340( As)1 162(lines it needs from the pad's object.)6 1429 4 720 840 t ( receive the request the)4 935( To)1 165( a request for the line is sent to the pad's object in the host.)14 2406(that is doesn't have,)3 814 4 720 960 t (host object must define)3 930 1 720 1080 t 10 CW f (linereq\(\))1710 1080 w 10 R f (, one of the virtual functions in)6 1235 1 2250 1080 t 10 CW f (class PadRcv)1 720 1 3545 1080 t 10 R f (:)4265 1080 w 10 CW f (class PadRcv {)2 840 1 770 1380 t (public:)770 1500 w ( cycle\(\);)1 720(virtual void)1 740 2 770 1620 t ( help\(\);)1 660(virtual void)1 740 2 770 1740 t ( kbd\(char*\);)1 900(virtual void)1 740 2 770 1860 t ( linereq\(long,Attrib=0\);)1 1620(virtual void)1 740 2 770 1980 t ( userclose\(\);)1 960(virtual void)1 740 2 770 2100 t ( usercut\(\);)1 840(virtual void)1 740 2 770 2220 t (};)770 2340 w 10 S f (_ _________________________________________________\347)1 2460 1 720 2400 t (\347)3180 2360 w (\347)3180 2260 w (\347)3180 2160 w (\347)3180 2060 w (\347)3180 1960 w (\347)3180 1860 w (\347)3180 1760 w (\347)3180 1660 w (\347)3180 1560 w (\347)3180 1460 w (\347)3180 1360 w (_ _________________________________________________)1 2460 1 720 1260 t (\347)720 1360 w (\347)720 1400 w (\347)720 1500 w (\347)720 1600 w (\347)720 1700 w (\347)720 1800 w (\347)720 1900 w (\347)720 2000 w (\347)720 2100 w (\347)720 2200 w (\347)720 2300 w (\347)720 2400 w 10 CW f (Story.linereq\(\))720 2640 w 10 R f ( a rectangle in response to the call to)8 1474(will not be called until after the user sweeps out)9 1920 2 1646 2640 t 10 CW f (Pad.makecurrent\(\))720 2760 w 10 R f ( the rectangle is big enough to hold 3 lines, say, then there will be three calls)16 3153(. If)1 147 2 1740 2760 t (to)720 2880 w 10 CW f (linereq\(\))858 2880 w 10 R f (:)1398 2880 w 10 CW f (Story.linereq\( 1, \(Attrib\) 0 \);)4 1860 1 1080 3060 t (Story.linereq\( 2, \(Attrib\) 0 \);)4 1860 1 1080 3180 t (Story.linereq\( 3, \(Attrib\) 0 \);)4 1860 1 1080 3300 t 10 R f ( In)1 136(Host code should make no assumptions about the sequence of calls it will receive from the the terminal.)17 4184 2 720 3480 t ( terminal caches only a bounded number of)7 1741( The)1 207( than once.)2 439(particular, the same line may be requested more)7 1933 4 720 3600 t ( the implementation of the)4 1127( \(However,)1 491( those it has discarded.)4 979(lines for a given pad and may re-request)7 1723 4 720 3720 t 10 CW f (Pads)720 3840 w 10 R f ( the most common pattern, a sequential run of line numbers \261)11 2486(host-terminal protocol is optimized for)4 1565 2 989 3840 t (as this program ought to be!\))5 1157 1 720 3960 t 10 CW f (linereq\(\))970 4116 w 10 R f ('s)1510 4116 w 10 CW f (Attrib)1651 4116 w 10 R f (argument will always be)3 1006 1 2045 4116 t 10 CW f (0)3120 4116 w 10 R f ( argument is)2 514( The)1 215(on calls from the terminal.)4 1097 3 3214 4116 t ( of the attributes for)4 813( Some)1 283(provided so that calls from the host may specify attributes for the inserted line.)13 3224 3 720 4236 t (lines are:)1 363 1 720 4356 t 10 CW f (SELECTLINE)1080 4536 w (FOLD)1080 4656 w (TRUNCATE)1080 4776 w (FOLD)720 4956 w 10 R f (and)1017 4956 w 10 CW f (TRUNCATE)1253 4956 w 10 R f ( line should be truncated, overriding the pad's attribute.)8 2483(specify whether a)2 767 2 1790 4956 t 10 CW f (SELECTLINE)720 5076 w 10 R f ( see)1 152( To)1 161(causes the line to be selected as the current line, as though the user had pointed to it.)17 3381 3 1346 5076 t ( can interact with)3 729(how this)1 354 2 720 5196 t 10 CW f (linereq\(\))1876 5196 w 10 R f (, consider adding a \(silly\) command to display the middle of a)11 2624 1 2416 5196 t ( function)1 364( A)1 128(news story.)1 461 3 720 5316 t 10 CW f (middle\(\))1739 5316 w 10 R f (is added to)2 445 1 2250 5316 t 10 CW f (Story)2761 5316 w 10 R f (:)3061 5316 w 10 B f (/n/seki/usr/tac/pads/doc/story.c)3120 5316 w 10 R f ( menu is)2 349(and a)1 219 2 4472 5316 t (added to the pad in)4 864 1 720 5436 t 10 CW f (Story.open\(\))1670 5436 w 10 R f (:)2390 5436 w 10 B f (/n/seki/usr/tac/pads/doc/storyopen.c)2469 5436 w 10 R f (Now if)1 307 1 4047 5436 t 10 CW f ('middle')4441 5436 w 10 R f (is)4973 5436 w (selected,)720 5556 w 10 CW f (middle\(\))1126 5556 w 10 R f ( a 30-line story, say,)4 810( For)1 189(is called.)1 355 3 1631 5556 t 10 CW f (middle\(\))3045 5556 w 10 R f (calls)3550 5556 w 10 CW f (linereq\( 15, SELECTLINE \))3 1500 1 1080 5736 t 10 R f (The)720 5916 w 10 CW f (SELECTLINE)942 5916 w 10 R f ( the terminal to select the line, as though the user had pointed to it;)14 2774(attribute requests)1 692 2 1574 5916 t ( this the line might not be displayed unless the)9 1862( Without)1 379( the line.)2 349(and therefore forces the terminal to display)6 1730 4 720 6036 t ( fact, the terminal displays a)5 1151( In)1 138(user scrolls to see it.)4 829 3 720 6156 t 10 CW f (SELECTLINE)2903 6156 w 10 R f (line as close to the physical center of)7 1507 1 3533 6156 t ( surrounding lines are needed,)4 1204( the)1 149( If)1 118(the window as possible.)3 961 4 720 6276 t 10 CW f (linereq\(\))3213 6276 w 10 R f (requests will be sent to the host)6 1261 1 3779 6276 t ( code cannot tell the difference between a)7 1665( Host)1 240(to fetch them.)2 554 3 720 6396 t 10 CW f (linereq\(\))3240 6396 w 10 R f (generated by the user scrolling)4 1233 1 3807 6396 t ( and a)2 248(the pad)1 297 2 720 6516 t 10 CW f (linereq\(\))1330 6516 w 10 R f ( that)1 180( Notice)1 321(generated by other host code.)4 1192 3 1900 6516 t 10 CW f (middle\(\))3658 6516 w 10 R f (doesn't need to know)3 872 1 4168 6516 t (anything about the size of the window to get a specific context displayed.)12 2932 1 720 6636 t cleartomark showpage saveobj restore %%EndPage: 9 9 %%Page: 10 10 /saveobj save def mark 10 pagesetup 10 R f (- 10 -)2 216 1 2772 480 t 10 B f ( PadRcv Base Class)3 836(4. The)1 292 2 720 840 t 10 R f (Skip this section on first reading.)5 1322 1 970 996 t ( objects that are to receive operations from the terminal must be instantiations of some)14 3731(All host)1 339 2 970 1152 t (application-defined class derived from)3 1538 1 720 1272 t 10 CW f (class PadRcv)1 720 1 2318 1272 t 10 R f (:)3038 1272 w 10 CW f (class Any : public PadRcv {)5 1620 1 1080 1452 t (...)1330 1572 w (};)1080 1692 w (class PadRcv {)2 840 1 770 1932 t (OBJ_ID obj_id;)1 840 1 1190 2052 t (public:)770 2172 w (PadRcv\(\);)1610 2292 w (\304PadRcv\(\);)1610 2412 w (void invalidate\(\);)1 1140 1 1250 2532 t (};)770 2652 w 10 S f (_ __________________________________\347)1 1720 1 720 2712 t (\347)2440 2612 w (\347)2440 2512 w (\347)2440 2412 w (\347)2440 2312 w (\347)2440 2212 w (\347)2440 2112 w (\347)2440 2012 w (\347)2440 1912 w (_ __________________________________)1 1720 1 720 1812 t (\347)720 1912 w (\347)720 2012 w (\347)720 2112 w (\347)720 2212 w (\347)720 2312 w (\347)720 2412 w (\347)720 2512 w (\347)720 2612 w (\347)720 2712 w 10 CW f (PadRcv.obj_id)970 2988 w 10 R f ( the terminal aren't applied to deleted host)7 1892(guarantees that operations from)3 1345 2 1803 2988 t ( its unique)2 419( object is bound to a pad or line by both its address and)13 2227(objects. An)1 482 3 720 3108 t 10 CW f (obj_id)3909 3108 w 10 R f (; an operation from)3 771 1 4269 3108 t ( may be directed to an object that)7 1349( in-flight operation)2 759( An)1 174(the terminal is applied only if the identifiers agree.)8 2038 4 720 3228 t ( When)1 300( deleting itself and won't exist when the packet arrives.)9 2315(is concurrently removing its pad/line and)5 1705 3 720 3348 t (deleted,)720 3468 w 10 CW f (PadRcv.\304PadRcv\(\))1093 3468 w 10 R f (changes)2078 3468 w 10 CW f (obj_id)2459 3468 w 10 R f (so that the operation is ignored.)5 1260 1 2844 3468 t ( inhibit operations from all the pads and lines to which it is currently bound)14 3043(The object may explicitly)3 1027 2 970 3624 t (by calling)1 397 1 720 3744 t 10 CW f (invalidate\(\))1177 3744 w 10 R f (.)1897 3744 w 10 CW f (class PadRcv {)2 840 1 1020 3960 t (public:)770 4080 w ( return "sorry - no kbd"; })6 1620( {)1 240( *kbd\(char*\))1 900(virtual char)1 720 4 770 4200 t ( return "sorry - no help"; })6 1680( {)1 480( *help\(\))1 660(virtual char)1 720 4 770 4320 t (};)770 4440 w 10 S f (_ ________________________________________________________________________\347)1 3640 1 720 4500 t (\347)4360 4440 w (\347)4360 4340 w (\347)4360 4240 w (\347)4360 4140 w (\347)4360 4040 w (\347)4360 3940 w (_ ________________________________________________________________________)1 3640 1 720 3840 t (\347)720 3940 w (\347)720 4000 w (\347)720 4100 w (\347)720 4200 w (\347)720 4300 w (\347)720 4400 w (\347)720 4500 w 10 R f (If attribute)1 427 1 720 4740 t 10 CW f (ACCEPT_KBD)1210 4740 w 10 R f (is specified for a pad or line,)6 1157 1 1838 4740 t 10 CW f (kbd\(\))3058 4740 w 10 R f ( the user selects the pad or)6 1077(is called when)2 577 2 3386 4740 t ( is no)2 217( There)1 283(line and enters a line of text from the keyboard.)9 1905 3 720 4860 t 10 CW f (\\n)3185 4860 w 10 R f (or)3330 4860 w 10 CW f (\\r)3473 4860 w 10 R f ( non-zero)1 379( A)1 122(at the end of the string.)5 921 3 3618 4860 t (return from)1 508 1 720 4980 t 10 CW f (kbd\(\))1339 4980 w 10 R f (is an error message for the user.)6 1577 1 1715 4980 t 10 CW f (ACCEPT_KBD)3464 4980 w 10 R f (is set implicitly by)3 899 1 4141 4980 t 10 CW f (Pad.Pad\(obj\))720 5100 w 10 R f (, if)1 111 1 1440 5100 t 10 CW f (obj)1611 5100 w 10 R f (defines)1816 5100 w 10 CW f (kbd\(\))2164 5100 w 10 R f (, but must be set explicitly for lines:)7 1439 1 2464 5100 t 10 CW f (pad->insert\(key, ACCEPT_KBD ...\);)2 1980 1 1080 5280 t 10 R f ( exactly)1 320(If the keyboard string is)4 978 2 720 5460 t 10 CW f ('?')2085 5460 w 10 R f (,)2265 5460 w 10 CW f (help\(\))2357 5460 w 10 R f (is called instead of)3 767 1 2749 5460 t 10 CW f (kbd\(\))3583 5460 w 10 R f (.)3883 5460 w 10 CW f (help\(\))4035 5460 w 10 R f (should return a)2 613 1 4427 5460 t (string to be presented to the user in a single line.)10 1934 1 720 5580 t 10 CW f (class PadRcv {)2 840 1 1020 5796 t (public:)770 5916 w ( userclose\(\);)1 900(virtual void)1 720 2 770 6036 t ( usercut\(\);)1 780(virtual void)1 720 2 770 6156 t (};)770 6276 w 10 S f (_ __________________________________\347)1 1720 1 720 6336 t (\347)2440 6276 w (\347)2440 6176 w (\347)2440 6076 w (\347)2440 5976 w (\347)2440 5876 w (\347)2440 5776 w (_ __________________________________)1 1720 1 720 5676 t (\347)720 5776 w (\347)720 5836 w (\347)720 5936 w (\347)720 6036 w (\347)720 6136 w (\347)720 6236 w (\347)720 6336 w 10 R f ( the)1 165( If)1 134(When the user closes a window or cuts a line on the screen, the host object may be informed.)18 4021 3 720 6576 t (attribute)720 6696 w 10 CW f (USERCLOSE\(USERCUT\))1117 6696 w 10 R f (is specified for the pad\(line\),)4 1166 1 2226 6696 t 10 CW f (userclose\(usercut\))3455 6696 w 10 R f (is called for)2 477 1 4563 6696 t ( pad\(line\) in the terminal is removed unless the)8 1905( record of the)3 540( All)1 180(the host object when the user closes\(cuts\).)6 1695 4 720 6816 t 10 CW f (DONT_CLOSE\(DONT_CUT\))720 6936 w 10 R f (attribute is set.)2 624 1 1964 6936 t 10 CW f (USERCLOSE)2727 6936 w 10 R f (is set implicitly by)3 800 1 3311 6936 t 10 CW f (Pad.Pad\(obj\))4190 6936 w 10 R f (, if)1 130 1 4910 6936 t 10 CW f (obj)720 7056 w 10 R f (defines)925 7056 w 10 CW f (userclose\(\))1273 7056 w 10 R f (.)1933 7056 w cleartomark showpage saveobj restore %%EndPage: 10 10 %%Page: 11 11 /saveobj save def mark 11 pagesetup 10 R f (- 11 -)2 216 1 2772 480 t 10 CW f (class PadRcv {)2 840 1 1020 840 t (public:)770 960 w ( see Pad.alarm\(\) */)3 1140( /*)1 1080( cycle\(\);)1 720(virtual void)1 720 4 770 1080 t ( /* see Pad.lines\(\) */)4 1320( linereq\(long,Attrib=0\);)1 1620(virtual void)1 720 3 770 1200 t ( */)1 480( see Pick\(\))2 660( /*)1 660( accept\(Action\);)1 1200(virtual int)1 660 5 770 1320 t (};)770 1440 w 10 S f (_ ___________________________________________________________________________\347)1 3760 1 720 1500 t (\347)4480 1420 w (\347)4480 1320 w (\347)4480 1220 w (\347)4480 1120 w (\347)4480 1020 w (\347)4480 920 w (\347)4480 820 w (_ ___________________________________________________________________________)1 3760 1 720 720 t (\347)720 820 w (\347)720 900 w (\347)720 1000 w (\347)720 1100 w (\347)720 1200 w (\347)720 1300 w (\347)720 1400 w (\347)720 1500 w 10 B f ( Pad)1 192(5. Class)1 353 2 720 1860 t 10 R f (Nearly all communication with the terminal is through class)8 2398 1 970 2016 t 10 CW f (Pad)3428 2016 w 10 R f (:)3608 2016 w 10 CW f (class Pad {)2 660 1 770 2196 t (PadRcv *object;)1 1000 1 1250 2316 t (public:)770 2436 w (Pad\(PadRcv *\);)1 840 1 1730 2556 t (\304Pad\(\);)1730 2676 w ( ...\);)1 360(void banner\(char*)1 1200 2 1250 2796 t ( ...\);)1 360(void name\(char*)1 1080 2 1250 2916 t ( Attrib=0\);)1 660(void options\(Attrib,)1 1380 2 1250 3036 t (void makecurrent\(\);)1 1320 1 1250 3156 t (void menu\(Index\);)1 1200 1 1250 3276 t (void menu\(Menu&\);)1 1200 1 1250 3396 t (};)770 3516 w 10 S f (_ ____________________________________________________\347)1 2620 1 720 3576 t (\347)3340 3476 w (\347)3340 3376 w (\347)3340 3276 w (\347)3340 3176 w (\347)3340 3076 w (\347)3340 2976 w (\347)3340 2876 w (\347)3340 2776 w (\347)3340 2676 w (\347)3340 2576 w (\347)3340 2476 w (\347)3340 2376 w (\347)3340 2276 w (\347)3340 2176 w (_ ____________________________________________________)1 2620 1 720 2076 t (\347)720 2176 w (\347)720 2276 w (\347)720 2376 w (\347)720 2476 w (\347)720 2576 w (\347)720 2676 w (\347)720 2776 w (\347)720 2876 w (\347)720 2976 w (\347)720 3076 w (\347)720 3176 w (\347)720 3276 w (\347)720 3376 w (\347)720 3476 w (\347)720 3576 w 10 CW f (Pad.Pad\(obj\))970 3852 w 10 R f (initializes a pad bound to)4 1005 1 1715 3852 t 10 CW f (obj.)2780 3852 w 10 R f (The default attribute)2 815 1 3070 3852 t 10 CW f (FOLD)3945 3852 w 10 R f ( attributes)1 397( The)1 205(is set.)1 228 3 4210 3852 t 10 CW f (ACCEPT_KBD)720 3972 w 10 R f (and)1364 3972 w 10 CW f (USERCLOSE)1586 3972 w 10 R f (are set, if)2 404 1 2169 3972 t 10 CW f (obj)2651 3972 w 10 R f (defines)2874 3972 w 10 CW f (kbd\(\))3240 3972 w 10 R f (and)3583 3972 w 10 CW f (userclose\(\))3805 3972 w 10 R f (, respectively.)1 575 1 4465 3972 t ( set to)2 245(Default name and banner are)4 1159 2 720 4092 t 10 CW f ('')2187 4092 w 10 R f (and)2695 4092 w 10 CW f ('')2902 4092 w 10 R f ( name appears in the list of pads)7 1305(. The)1 233 2 3502 4092 t ( banner appears at the top of the pad's window.)9 1935( The)1 210( button 3 menu.)3 643(at the bottom of the)4 807 4 720 4212 t 10 CW f (Pad.\304Pad\(\))4440 4212 w 10 R f (removes all record of the pad; the window in the terminal vanishes.)11 3317 1 720 4332 t 10 CW f (Pad.name\(\))4214 4332 w 10 R f (and)4896 4332 w 10 CW f (Pad.banner\(\))720 4452 w 10 R f (take)1601 4452 w 10 CW f (printf)1962 4452 w 10 R f (arguments to redefine the name and banner.)6 2558 1 2482 4452 t 10 CW f (Pad.options\(on, off\))1 1200 1 720 4572 t 10 R f ( the second \(optional\))3 874(switches on the first set attributes and then switches off)9 2220 2 1946 4572 t ( attributes for pads are:)4 920(set. The)1 341 2 720 4692 t 10 CW f (typedef unsigned short Attrib;)3 1800 1 770 4872 t ( 0x.... \))2 540( \(\(Attrib\))1 1260(#define FOLD)1 720 3 770 5112 t ( 0x.... \))2 540( \(\(Attrib\))1 1020(#define TRUNCATE)1 960 3 770 5232 t ( 0x.... \))2 540( \(\(Attrib\))1 1140(#define SORTED)1 840 3 770 5352 t ( 0x.... \))2 540( \(\(Attrib\))1 900(#define ACCEPT_KBD)1 1080 3 770 5472 t ( 0x.... \))2 540( \(\(Attrib\))1 960(#define USERCLOSE)1 1020 3 770 5592 t ( 0x.... \))2 540( \(\(Attrib\))1 900(#define DONT_CLOSE)1 1080 3 770 5712 t 10 S f (_ ____________________________________________________\347)1 2620 1 720 5772 t (\347)3340 5752 w (\347)3340 5652 w (\347)3340 5552 w (\347)3340 5452 w (\347)3340 5352 w (\347)3340 5252 w (\347)3340 5152 w (\347)3340 5052 w (\347)3340 4952 w (\347)3340 4852 w (_ ____________________________________________________)1 2620 1 720 4752 t (\347)720 4852 w (\347)720 4872 w (\347)720 4972 w (\347)720 5072 w (\347)720 5172 w (\347)720 5272 w (\347)720 5372 w (\347)720 5472 w (\347)720 5572 w (\347)720 5672 w (\347)720 5772 w 10 R f ( separate bit; sets are composed by bitwise or.)8 1889(Each is represented by a)4 993 2 720 6012 t 10 CW f (FOLD)3729 6012 w 10 R f (specifies that lines longer)3 1039 1 4001 6012 t ( folded so that the whole text is displayed.)8 1773(than the width of the window be)6 1365 2 720 6132 t 10 CW f (TRUNCATE)3989 6132 w 10 R f (specifies that)1 535 1 4505 6132 t ( can be overridden as individual lines are inserted into the pad.)11 2589( These)1 296( at the right.)3 507(long lines be truncated)3 928 4 720 6252 t ( host setting on pad or line.)6 1110(The user can also override any)5 1246 2 720 6372 t 10 CW f (SORTED)3200 6372 w 10 R f (specifies that the lines in the pad be)7 1451 1 3589 6372 t ( the effect of)3 527( For)1 196( rather by numeric key.)4 956(displayed by dictionary order)3 1191 4 720 6492 t 10 CW f (ACCEPT_KBD)3657 6492 w 10 R f (and)4289 6492 w 10 CW f (USERCLOSE)4500 6492 w 10 R f (see)720 6612 w 10 CW f (PadRcv.kbd\(\))928 6612 w 10 R f (and)1694 6612 w 10 CW f (PadRcv.userclose\(\))1919 6612 w 10 R f (, respectively.)1 577 1 2999 6612 t 10 CW f (DONT_CLOSE)3716 6612 w 10 R f (inhibits the user)2 679 1 4361 6612 t ( are still reported if)4 989(from closing the window; attempts)4 1614 2 720 6732 t 10 CW f (USERCLOSE)3439 6732 w 10 R f ( Combinations:)1 696(is set.)1 284 2 4060 6732 t 10 CW f (DONT_CLOSE|USERCLOSE)720 6852 w 10 R f ( control;)1 336(means the host has complete)4 1147 2 1946 6852 t 10 CW f (USERCLOSE)3489 6852 w 10 R f (means the user can close)4 986 1 4054 6852 t (unilaterally and the host is told it happened;)7 1752 1 720 6972 t 10 CW f (DONT_CLOSE)2532 6972 w 10 R f (means the user can't close and the host doesn't)8 1882 1 3158 6972 t (care; neither means the user can close and the host isn't told.)11 2423 1 720 7092 t 10 CW f (Pad.makecurrent\(\))970 7248 w 10 R f ( and)1 172(forces the terminal to bring the pad's window to the front of the screen)13 2851 2 2017 7248 t cleartomark showpage saveobj restore %%EndPage: 11 11 %%Page: 12 12 /saveobj save def mark 12 pagesetup 10 R f (- 12 -)2 216 1 2772 480 t ( terminal solicits the user \(once\))5 1299( no window exists for the pad \261 the initial state \261 the)12 2141( If)1 120(select it as current.)3 760 4 720 840 t (to sweep out a rectangle.)4 1009 1 720 960 t 10 CW f (Pad.menu\(\))1854 960 w 10 R f (takes a)1 280 1 2485 960 t 10 CW f (Menu)2831 960 w 10 R f (\(or a menu's)2 516 1 3102 960 t 10 CW f (Index)3684 960 w 10 R f (\261 ignore)1 336 1 4015 960 t 10 CW f (Index)4417 960 w 10 R f (on first)1 292 1 4748 960 t (reading\) and binds the corresponding menu to the pad.)8 2177 1 720 1080 t 10 CW f (class Pad {)2 660 1 770 1260 t (public:)770 1380 w ( Attrib, PadRcv*, Index, char* ...\);)5 2160(void insert\(long,)1 1200 2 1250 1500 t ( Attrib, PadRcv*, Menu&, char* ...\);)5 2160(void insert\(long,)1 1200 2 1250 1620 t ( Attrib, char* ...\);)3 1200(void insert\(long,)1 1200 2 1250 1740 t ( char* ...\);)2 720(void insert\(long,)1 1200 2 1250 1860 t (void removeline\(long\);)1 1500 1 1250 1980 t (void clear\(\);)1 960 1 1250 2100 t (void tabs\(short\);)1 1200 1 1250 2220 t (void lines\(long\);)1 1200 1 1250 2340 t ( long\);)1 420(void createline\(long,)1 1440 2 1250 2460 t (void createline\(long\);)1 1500 1 1250 2580 t (};)770 2700 w 10 S f (_ ______________________________________________________________________________\347)1 3940 1 720 2760 t (\347)4660 2740 w (\347)4660 2640 w (\347)4660 2540 w (\347)4660 2440 w (\347)4660 2340 w (\347)4660 2240 w (\347)4660 2140 w (\347)4660 2040 w (\347)4660 1940 w (\347)4660 1840 w (\347)4660 1740 w (\347)4660 1640 w (\347)4660 1540 w (\347)4660 1440 w (\347)4660 1340 w (\347)4660 1240 w (_ ______________________________________________________________________________)1 3940 1 720 1140 t (\347)720 1240 w (\347)720 1260 w (\347)720 1360 w (\347)720 1460 w (\347)720 1560 w (\347)720 1660 w (\347)720 1760 w (\347)720 1860 w (\347)720 1960 w (\347)720 2060 w (\347)720 2160 w (\347)720 2260 w (\347)720 2360 w (\347)720 2460 w (\347)720 2560 w (\347)720 2660 w (\347)720 2760 w 10 CW f (Pad.insert\(\))970 3036 w 10 R f ( The)1 217( non-zero 32-bit key.)3 873( first argument is a)4 793( The)1 216(puts a line of text into a pad.)7 1215 5 1726 3036 t (trailing)720 3156 w 10 CW f (printf)1084 3156 w 10 R f ( lines corre-)2 504( Only)1 264(arguments are the text, which is truncated at about 250 characters.)10 2788 3 1484 3156 t ( Line)1 238( been inserted are displayed.)4 1153(sponding to keys for which strings have)6 1617 3 720 3276 t 10 CW f (1)3793 3276 w 10 R f (is displayed at the top of the)6 1157 1 3883 3276 t (window and line)2 680 1 720 3396 t 10 CW f (2**32-1)1467 3396 w 10 R f ( key over-)2 416( second \(and subsequent\) insertions for a given)7 1926( The)1 212(at the bottom.)2 567 4 1919 3396 t (write the original.)2 719 1 720 3516 t 10 CW f (Pad.removeline\(k\))1562 3516 w 10 R f ( with key)2 380(deletes the line)2 605 2 2610 3516 t 10 CW f (k)3659 3516 w 10 R f ( stops are set every 8 char-)6 1087(. Tab)1 234 2 3719 3516 t ( default is overridden for each pad individually by)8 2090(acters. The)1 474 2 720 3636 t 10 CW f (Pad.tabs\(\))3355 3636 w 10 R f ( characters)1 439(. Non-printable)1 646 2 3955 3636 t (other than tab are replaced by blanks.)6 1493 1 720 3756 t (The attributes that may be set on a line are:)9 1722 1 970 3912 t 10 CW f (typedef unsigned short Attrib;)3 1800 1 770 4092 t ( 0x.... \))2 540( \(\(Attrib\))1 900(#define SELECTLINE)1 1080 3 770 4332 t ( 0x.... \))2 540( \(\(Attrib\))1 900(#define ACCEPT_KBD)1 1080 3 770 4452 t ( 0x.... \))2 540( \(\(Attrib\))1 1260(#define FOLD)1 720 3 770 4572 t ( 0x.... \))2 540( \(\(Attrib\))1 1020(#define TRUNCATE)1 960 3 770 4692 t ( 0x.... \))2 540( \(\(Attrib\))1 1020(#define DONT_CUT)1 960 3 770 4812 t ( 0x.... \))2 540( \(\(Attrib\))1 1080(#define USERCUT)1 900 3 770 4932 t ( 0x.... \))2 540( \(\(Attrib\))1 960(#define FLUSHLINE)1 1020 3 770 5052 t 10 S f (_ ____________________________________________________\347)1 2620 1 720 5112 t (\347)3340 5072 w (\347)3340 4972 w (\347)3340 4872 w (\347)3340 4772 w (\347)3340 4672 w (\347)3340 4572 w (\347)3340 4472 w (\347)3340 4372 w (\347)3340 4272 w (\347)3340 4172 w (\347)3340 4072 w (_ ____________________________________________________)1 2620 1 720 3972 t (\347)720 4072 w (\347)720 4112 w (\347)720 4212 w (\347)720 4312 w (\347)720 4412 w (\347)720 4512 w (\347)720 4612 w (\347)720 4712 w (\347)720 4812 w (\347)720 4912 w (\347)720 5012 w (\347)720 5112 w 10 CW f (SELECTLINE)720 5352 w 10 R f ( had pointed to it.)4 711(causes the line to be selected as though the user)9 1908 2 1346 5352 t 10 CW f (FOLD)4087 5352 w 10 R f (and)4354 5352 w 10 CW f (TRUNCATE)4560 5352 w 10 R f (override the pad.)2 679 1 720 5472 t 10 CW f (DONT_CUT)1522 5472 w 10 R f ( immune to the)3 609(makes the line)2 583 2 2030 5472 t 10 CW f ('cut')3284 5472 w 10 R f (and)3611 5472 w 10 CW f ('sever')3817 5472 w 10 R f (terminal operations)1 776 1 4264 5472 t (that remove lines;)2 798 1 720 5592 t 10 CW f (USERCUT)1619 5592 w 10 R f (calls)2105 5592 w 10 CW f (PadRcv.usercut\(\))2390 5592 w 10 R f (if the line is cut; they behave like)7 1623 1 3417 5592 t 10 CW f (DONT_CLOSE)720 5712 w 10 R f (and)1359 5712 w 10 CW f (USERCLOSE)1576 5712 w 10 R f (on pads.)1 346 1 2154 5712 t 10 CW f (FLUSHLINE)2633 5712 w 10 R f (prevents the line from being buffered in the)7 1829 1 3211 5712 t ( If)1 134(host, but should be needed very rarely.)6 1649 2 720 5832 t 10 CW f (Pads)2581 5832 w 10 R f (' buffering heuristic works, the application shouldn't)6 2219 1 2821 5832 t (know about this.)2 664 1 720 5952 t (An object is bound to a line by the)8 1385 1 970 6108 t 10 CW f (PadRcv*)2416 6108 w 10 R f (and)2862 6108 w 10 CW f (Menu&)3067 6108 w 10 R f (\(or)3393 6108 w 10 CW f (Index)3570 6108 w 10 R f ( like)1 177( is just)2 264( This)1 229(\) arguments.)1 500 4 3870 6108 t (binding to a pad, except that no attributes are set implicitly.)10 2376 1 720 6228 t 10 CW f (Pad.lines\(n\))970 6384 w 10 R f (changes the pad's key space from)5 1343 1 1715 6384 t 10 CW f (1..2**32-1)3118 6384 w 10 R f (to)3744 6384 w 10 CW f (1..n)3883 6384 w 10 R f ( also makes the ter-)4 780(. It)1 137 2 4123 6384 t ( host can still insert lines at will.)7 1309( The)1 207(minal partially responsible for deciding what lines should be inserted.)9 2804 3 720 6504 t ( the window, a call)4 805(As the user scrolls)3 768 2 720 6624 t 10 CW f (linereq\(k,0\))2365 6624 w 10 R f (instructs the pad's object to insert line)6 1593 1 3122 6624 t 10 CW f (k)4787 6624 w 10 R f (. So)1 193 1 4847 6624 t 10 CW f (linereq\(\))720 6744 w 10 R f (should be defined:)2 738 1 1285 6744 t cleartomark showpage saveobj restore %%EndPage: 12 12 %%Page: 13 13 /saveobj save def mark 13 pagesetup 10 R f (- 13 -)2 216 1 2772 480 t 10 CW f (class PadRcv {)2 840 1 770 840 t (public:)770 960 w (virtual void linereq\(long, Attrib=0\) { /* do nothing */ })9 3420 1 770 1080 t (};)770 1200 w 10 S f (_ ______________________________________________________________________\347)1 3520 1 720 1260 t (\347)4240 1220 w (\347)4240 1120 w (\347)4240 1020 w (\347)4240 920 w (\347)4240 820 w (_ ______________________________________________________________________)1 3520 1 720 720 t (\347)720 820 w (\347)720 860 w (\347)720 960 w (\347)720 1060 w (\347)720 1160 w (\347)720 1260 w 10 R f ( assumptions made about the order in which calls to)9 2118(There can be no)3 651 2 720 1536 t 10 CW f (linereq\(\))3554 1536 w 10 R f ( termi-)1 274( The)1 210(will occur.)1 432 3 4124 1536 t ( from the host as the user scrolls the win-)9 1663(nal caches only a bounded number of lines and \(re-\)requests them)10 2657 2 720 1656 t ( a common pattern of calls is)6 1154(dow. However,)1 637 2 720 1776 t 10 CW f (linereq\(m,0\), linereq\(m+1,0\) ... linereq\(n-1,0\), linereq\(n,0\))4 3660 1 1080 1956 t 10 R f ( The)1 216(for which it may be worth optimizing.)6 1590 2 720 2136 t 10 CW f (Attrib)2597 2136 w 10 R f ( for the convenience of calls)5 1187(argument is included)2 860 2 2993 2136 t (from host code.)2 624 1 720 2256 t (In pads for which)3 731 1 970 2412 t 10 CW f (lines\(\))1771 2412 w 10 R f ( called,)1 299(has not been)2 519 2 2226 2412 t 10 CW f (Pad.createline\(i\))3115 2412 w 10 R f (inserts a dummy line)3 869 1 4171 2412 t (with key)1 375 1 720 2532 t 10 CW f (i)1183 2532 w 10 R f (and)1296 2532 w 10 CW f (Pad.createline\(lo,hi\))1528 2532 w 10 R f (inserts a set of dummy lines with keys)7 1726 1 2841 2532 t 10 CW f (lo..hi)4655 2532 w 10 R f (.)5015 2532 w 10 CW f (linereq\(\))720 2652 w 10 R f ( \(Theoretically,)1 643( these lines is to be displayed.)6 1209(is called if any of)4 701 3 1287 2652 t 10 CW f (createline\(\))3903 2652 w 10 R f (subsumes)4651 2652 w 10 CW f (lines\(\))720 2772 w 10 R f (, but the current implementation is inefficient for large key ranges.\))10 2689 1 1140 2772 t 10 CW f (Pad.clear\(\))970 2928 w 10 R f (removes all lines from the pad.)5 1237 1 1655 2928 t (The terminal's real-time clock can be used to invoke host operations periodically.)11 3261 1 970 3084 t 10 CW f (class Pad {)2 660 1 770 3264 t (public:)770 3384 w (void alarm\(short=0\);)1 1380 1 1250 3504 t (};)770 3624 w (class PadRcv {)2 840 1 770 3864 t (public:)770 3984 w ( cycle\(\);)1 720(virtual void)1 720 2 770 4104 t (};)770 4224 w 10 S f (_ _______________________________________\347)1 1960 1 720 4284 t (\347)2680 4244 w (\347)2680 4144 w (\347)2680 4044 w (\347)2680 3944 w (\347)2680 3844 w (\347)2680 3744 w (\347)2680 3644 w (\347)2680 3544 w (\347)2680 3444 w (\347)2680 3344 w (\347)2680 3244 w (_ _______________________________________)1 1960 1 720 3144 t (\347)720 3244 w (\347)720 3284 w (\347)720 3384 w (\347)720 3484 w (\347)720 3584 w (\347)720 3684 w (\347)720 3784 w (\347)720 3884 w (\347)720 3984 w (\347)720 4084 w (\347)720 4184 w (\347)720 4284 w 10 R f (At least n seconds after)4 955 1 720 4524 t 10 CW f (pad->alarm\(n\))1741 4524 w 10 R f (is called,)1 361 1 2552 4524 t 10 CW f (cycle\(\))2979 4524 w 10 R f (is called on)2 467 1 3430 4524 t 10 CW f (pad)3963 4524 w 10 R f ( a given)2 330( For)1 195('s object.)1 372 3 4143 4524 t ( call to)2 306(pad, if there is an outstanding)5 1272 2 720 4644 t 10 CW f (alarm\(\))2375 4644 w 10 R f (, results are undefined for further calls to)7 1748 1 2795 4644 t 10 CW f (alarm\(\))4620 4644 w 10 R f (before)720 4764 w 10 CW f (cycle\(\))1048 4764 w 10 R f (is called.)1 369 1 1507 4764 t 10 CW f (cycle\(\))2010 4764 w 10 R f (is called for)2 499 1 2469 4764 t 10 CW f (alarm\(0\))3042 4764 w 10 R f ( currently outstanding)2 907(as soon as all)3 572 2 3561 4764 t (operations from the user and pending)5 1499 1 720 4884 t 10 CW f (cycle\(\))2280 4884 w 10 R f ( an arbitrary number of host)5 1122( Thus)1 251('s have been completed.)3 967 3 2700 4884 t (objects can use)2 604 1 720 5004 t 10 CW f (alarm\(0\))1384 5004 w 10 R f (for round-robin scheduling, with interleaved user operations.)6 2429 1 1889 5004 t 10 B f ( menu)1 264(6. Class)1 353 2 720 5244 t 10 R f (Class)970 5400 w 10 CW f (Menu)1249 5400 w 10 R f ( to windows and lines by)5 1012( are bound)2 425( Menus)1 324(is used to build menus.)4 928 4 1516 5400 t 10 CW f (Pad.menu\(\))4268 5400 w 10 R f (and)4896 5400 w 10 CW f (Pad.insert\(\))720 5520 w 10 R f (.)1440 5520 w 10 CW f (typedef void \(*Action\) \(...\);)3 1740 1 770 5700 t (class Menu {)2 720 1 770 5940 t (public:)770 6060 w (Menu\(\);)1730 6180 w (\304Menu\(\);)1730 6300 w ( char*, Action, long=0 \);)4 1500(void first\()1 860 2 1020 6420 t ( Action, long=0 \);)3 1080( char*,)1 480(void last\()1 800 3 1020 6540 t ( Action, long=0 \);)3 1080( char*,)1 480(void sort\()1 800 3 1020 6660 t (};)770 6780 w 10 S f (_________________________________________________________\347)720 6840 w (\347)3570 6780 w (\347)3570 6680 w (\347)3570 6580 w (\347)3570 6480 w (\347)3570 6380 w (\347)3570 6280 w (\347)3570 6180 w (\347)3570 6080 w (\347)3570 5980 w (\347)3570 5880 w (\347)3570 5780 w (\347)3570 5680 w (_________________________________________________________)720 5580 w (\347)720 5680 w (\347)720 5740 w (\347)720 5840 w (\347)720 5940 w (\347)720 6040 w (\347)720 6140 w (\347)720 6240 w (\347)720 6340 w (\347)720 6440 w (\347)720 6540 w (\347)720 6640 w (\347)720 6740 w (\347)720 6840 w 10 R f (Objects of type)2 610 1 970 7116 t 10 CW f (Menu)1640 7116 w 10 R f ( lifetime of)2 444( The)1 205(are usually declared as automatic \(stack\) variables.)6 2030 3 1905 7116 t cleartomark showpage saveobj restore %%EndPage: 13 13 %%Page: 14 14 /saveobj save def mark 14 pagesetup 10 R f (- 14 -)2 216 1 2772 480 t 10 CW f (Menu m;)1 420 1 1080 900 t 10 R f (need only be long enough to bind it to a window by)11 2063 1 720 1080 t 10 CW f (pad->menu\( m \);)2 900 1 1080 1260 t 10 R f (or to a line)3 430 1 720 1440 t 10 CW f (pad->insert\( ... m ... \);)4 1500 1 1080 1620 t (Pad.insert\(\))720 1800 w 10 R f (and)1470 1800 w 10 CW f (Pad.menu\(\))1679 1800 w 10 R f (extract the current value of)4 1094 1 2309 1800 t 10 CW f (m)3468 1800 w 10 R f ( not retain a reference to)5 1001(; they do)2 360 2 3528 1800 t 10 CW f (m)4955 1800 w 10 R f (.)5015 1800 w (Subsequent changes to)2 924 1 720 1920 t 10 CW f (m)1711 1920 w 10 R f ( to which it was bound)5 938(are not reflected in the menu presented for those objects)9 2299 2 1803 1920 t (earlier.)720 2040 w ( constructor initializes an empty menu.)5 1779(The void)1 402 2 970 2196 t 10 CW f (Menu.first\(\))3316 2196 w 10 R f (,)4036 2196 w 10 CW f (Menu.last\(\))4166 2196 w 10 R f (and)4896 2196 w 10 CW f (Menu.sort\(\))720 2316 w 10 R f ( Their)1 267(add entries to the menu.)4 961 2 1406 2316 t 10 CW f (char*)2695 2316 w 10 R f (argument is the string to appear as one entry in the)10 2019 1 3021 2316 t ( string can be temporary;)4 1026( The)1 212(menu presented to the user.)4 1123 3 720 2436 t 10 CW f (Menu)3148 2436 w 10 R f ( The)1 213( it.)1 114(takes a copy of)3 622 3 3420 2436 t 10 CW f (Action)4437 2436 w 10 R f (argu-)4830 2436 w ( optional)1 355( The)1 207(ment is the function to be invoked if the entry is selected.)11 2314 3 720 2556 t 10 CW f (long)3658 2556 w 10 R f ( passed on)2 418(argument is to be)3 697 2 3925 2556 t ( arguments)1 441( The)1 205(to that function as an argument.)5 1265 3 720 2676 t 10 CW f (\( "next year", \(Action\) &calendar, 1985 \))6 2460 1 1080 2856 t 10 R f (would result in the call)4 916 1 720 3036 t 10 CW f (object->calendar\(1985\))1080 3216 w 10 R f (which is implemented as the equivalent of the C call)9 2095 1 720 3396 t 10 CW f (calendar\(object,1985\))1080 3576 w 10 R f (The)720 3756 w 10 CW f (object)935 3756 w 10 R f (is the)1 214 1 1320 3756 t 10 CW f (PadRcv*)1594 3756 w 10 R f (pointer passed to either)3 929 1 2039 3756 t 10 CW f (Pad.Pad\(\))3028 3756 w 10 R f (or)3593 3756 w 10 CW f (Pad.insert\(\))3736 3756 w 10 R f (.)4456 3756 w (At any time, a)3 605 1 970 3912 t 10 CW f (Menu)1648 3912 w 10 R f (is a sequence of such entries.)5 1228 1 1926 3912 t 10 CW f (Menu.first\(\))3288 3912 w 10 R f (adds a new entry to the)5 993 1 4047 3912 t ( sequence.)1 435(beginning of the)2 697 2 720 4032 t 10 CW f (Menu.last\(\))1992 4032 w 10 R f (adds a new entry to the end.)6 1237 1 2697 4032 t 10 CW f (Menu.sort\(\))4074 4032 w 10 R f (inserts)4779 4032 w ( The)1 214(before the first string lexically greater than its argument.)8 2318 2 720 4152 t 10 I f (order)3286 4152 w 10 R f (of a set of calls to these functions is)8 1498 1 3542 4152 t ( example,)1 388(important. For)1 603 2 720 4272 t 10 CW f (Menu m1, m2;)2 720 1 1080 4452 t ( z */)2 300( /*)1 170(m1.first\( "z" ... \);)3 1200 3 1080 4692 t ( x, z */)3 480( /*)1 170(m1.first\( "x" ... \);)3 1200 3 1080 4812 t ( x, z, a */)4 660( /*)1 170( ... \);)2 420(m1.last\( "a")1 780 4 1080 4932 t ( q, x, z, a */)5 840( /*)1 170( ... \);)2 420(m1.sort\( "q")1 780 4 1080 5052 t ( p, q, x, z, a */)6 1020( /*)1 170( ... \);)2 420(m1.sort\( "p")1 780 4 1080 5172 t ( q */)2 300( /*)1 170( ... \);)2 420(m2.sort\( "q")1 780 4 1080 5412 t ( p, q */)3 480( /*)1 170( ... \);)2 420(m2.sort\( "p")1 780 4 1080 5532 t ( x, p, q */)4 660( /*)1 170(m1.first\( "x" ... \);)3 1200 3 1080 5652 t ( z, x, p, q */)5 840( /*)1 170(m2.first\( "z" ... \);)3 1200 3 1080 5772 t ( z, x, p, q, a */)6 1020( /*)1 170( ... \);)2 420(m2.last\( "a")1 780 4 1080 5892 t 10 R f (A second constructor initializes a menu to have a single entry:)10 2485 1 970 6108 t 10 CW f (class Menu {)2 720 1 770 6288 t (public:)770 6408 w (Menu\( char*, Action, long=0 \);)4 1800 1 1270 6528 t (};)770 6648 w 10 S f (________________________________________________\347)720 6708 w (\347)3120 6668 w (\347)3120 6568 w (\347)3120 6468 w (\347)3120 6368 w (\347)3120 6268 w (________________________________________________)720 6168 w (\347)720 6268 w (\347)720 6308 w (\347)720 6408 w (\347)720 6508 w (\347)720 6608 w (\347)720 6708 w 10 R f (If an entry string ends with a question mark, e.g.)9 1936 1 970 6984 t 10 CW f (m.first\( "delete all?" ... \);)4 1740 1 1080 7164 t cleartomark showpage saveobj restore %%EndPage: 14 14 %%Page: 15 15 /saveobj save def mark 15 pagesetup 10 R f (- 15 -)2 216 1 2772 480 t (the terminal makes the user confirm the selection before passing it to the host.)13 3118 1 720 840 t ( string with bit)3 593(The leftmost character of the)4 1156 2 970 996 t 10 CW f (0200)2781 996 w 10 R f ( pad-)1 204( The)1 207(set is treated as a ``padding'' character.)6 1581 3 3048 996 t (ding character)1 573 1 720 1116 t 10 CW f (0200|'c')1359 1116 w 10 R f (is replaced by sufficiently many copies of)6 1705 1 1870 1116 t 10 CW f ('c')3641 1116 w 10 R f ( wide as)2 337(to make the string as)4 851 2 3852 1116 t ( example, the strings)3 827( For)1 189(the widest string in the menu.)5 1183 3 720 1236 t 10 CW f ("a\\240reg")1080 1416 w ("table\\240arg")1080 1536 w ("\\255")1080 1656 w ("main\(\)\\25675")1080 1776 w ("f\(\)\\256123")1080 1896 w 10 R f (would appear in a menu as)5 1067 1 720 2076 t 10 CW f (a reg)1 540 1 1080 2256 t (table arg)1 540 1 1080 2376 t (---------)1080 2496 w (main\(\).75)1080 2616 w (f\(\)...123)1080 2736 w (040)720 2916 w 10 R f (,)900 2916 w 10 CW f (055)987 2916 w 10 R f (and)1194 2916 w 10 CW f (056)1400 2916 w 10 R f (are)1607 2916 w 10 CW f (' ')1 180 1 1790 2916 t 10 R f (,)1970 2916 w 10 CW f ('-')2057 2916 w 10 R f (and)2265 2916 w 10 CW f ('.')2472 2916 w 10 R f ( expansion is done by)4 878( \(The)1 241(, respectively.)1 560 3 2652 2916 t 10 CW f (menuhit\(\))4394 2916 w 10 R f (in)4962 2916 w (the terminal .\))2 563 1 720 3036 t 10 B f ( about Menus)2 584(7. More)1 357 2 720 3276 t 10 R f (Skip this section on first reading.)5 1322 1 970 3432 t (Rebuilding a menu every time it is needed does not create a new copy of the menu in the host or ter-)21 4070 1 970 3588 t ( used in the terminal is the size of the string.)10 1808( each distinct menu entry, the incremental memory)7 2065(minal. For)1 447 3 720 3708 t ( memory is used)3 667( More)1 268(For each distinct menu, the incremental memory in the terminal is 2 bytes per entry.)14 3385 3 720 3828 t ( most applications it should not be nec-)7 1576( For)1 190( and menus.)2 482(for host data structures, but linear in distinct entries)8 2072 4 720 3948 t ( programmer's effort ought to go)5 1362( application)1 477( The)1 213(essary to worry about the way menus are implemented.)8 2268 4 720 4068 t ( built-in pad can be instantiated by)6 1412( A)1 127(into composing good menus.)3 1171 3 720 4188 t 10 CW f (NewPadSats\(\))3494 4188 w 10 R f (to report how much)3 797 1 4243 4188 t (memory is being consumed by menus.)5 1538 1 720 4308 t ( on the host by repeatedly building the same)8 1861(If profiling indicates that too much time is consumed)8 2209 2 970 4464 t ( possible to obtain a menu's)5 1204(menu, it is)2 456 2 720 4584 t 10 I f (index)2422 4584 w 10 R f ( Once)1 277(, the key by which it is known internally to Pads.)10 2125 2 2638 4584 t (extracted, this key may be passed repeatedly to)7 1879 1 720 4704 t 10 CW f (Pad.menu\(\))2659 4704 w 10 R f (and)3284 4704 w 10 CW f (Pad.insert\(\))3488 4704 w 10 R f (.)4208 4704 w 10 CW f (class Index {)2 780 1 770 4884 t (public:)770 5004 w (int null\(\);)1 670 1 1020 5124 t (};)770 5244 w (class Menu {)2 720 1 770 5484 t (public:)770 5604 w ( =0, Action=0, long=0\);)3 1380(Index index\(char*)1 1160 2 1020 5724 t (};)770 5844 w (class Pad {)2 660 1 770 6084 t (public:)770 6204 w ( Attrib, Univ*, Index, char* ...\);)5 2040(void insert\(long,)1 1220 2 1020 6324 t (void menu\(Index\);)1 1220 1 1020 6444 t (};)770 6564 w 10 S f (_ ________________________________________________________________________\347)1 3610 1 720 6624 t (\347)4330 6564 w (\347)4330 6464 w (\347)4330 6364 w (\347)4330 6264 w (\347)4330 6164 w (\347)4330 6064 w (\347)4330 5964 w (\347)4330 5864 w (\347)4330 5764 w (\347)4330 5664 w (\347)4330 5564 w (\347)4330 5464 w (\347)4330 5364 w (\347)4330 5264 w (\347)4330 5164 w (\347)4330 5064 w (\347)4330 4964 w (\347)4330 4864 w (_ ________________________________________________________________________)1 3610 1 720 4764 t (\347)720 4864 w (\347)720 4924 w (\347)720 5024 w (\347)720 5124 w (\347)720 5224 w (\347)720 5324 w (\347)720 5424 w (\347)720 5524 w (\347)720 5624 w (\347)720 5724 w (\347)720 5824 w (\347)720 5924 w (\347)720 6024 w (\347)720 6124 w (\347)720 6224 w (\347)720 6324 w (\347)720 6424 w (\347)720 6524 w (\347)720 6624 w 10 R f (The representation of the null)4 1189 1 970 6900 t 10 CW f (Index)2221 6900 w 10 R f ( statically allocated)2 775( A)1 124(is zeros.)1 329 3 2548 6900 t 10 CW f (Index)3838 6900 w 10 R f ( tested)1 261(is initially null,)2 614 2 4165 6900 t (by)720 7020 w 10 CW f (Index.null\(\))885 7020 w 10 R f ( code, in which the menu is built once, but used)10 1944( permits the following style of)5 1233(. This)1 258 3 1605 7020 t (many times.)1 489 1 720 7140 t cleartomark showpage saveobj restore %%EndPage: 15 15 %%Page: 16 16 /saveobj save def mark 16 pagesetup 10 R f (- 16 -)2 216 1 2772 480 t 10 CW f (void Any.linereq\( long k, Attrib a = 0 \))8 2400 1 1080 900 t ({)1080 1020 w (static Index ix;)2 960 1 1330 1140 t (if\( ix.null\(\) \){)2 960 1 1330 1380 t (Menu m;)1 420 1 1580 1500 t (m.first\( ... \);)2 900 1 1580 1740 t (.)1580 1860 w (.)1580 1980 w (.)1580 2100 w (ix = m.index\(\);)2 900 1 1580 2220 t (})1330 2340 w (pad->insert\( k, a ... ix ... \);)6 1860 1 1330 2460 t (})1080 2580 w 10 R f (Reference to a pre-computed menu can also be inserted into another menu.)11 2987 1 970 2796 t 10 CW f (class Menu {)2 720 1 770 2976 t (public:)770 3096 w (void first\(Index\);)1 1280 1 1020 3216 t (void last\(Index\);)1 1220 1 1020 3336 t (};)770 3456 w 10 S f (_ ________________________________\347)1 1630 1 720 3516 t (\347)2350 3456 w (\347)2350 3356 w (\347)2350 3256 w (\347)2350 3156 w (\347)2350 3056 w (\347)2350 2956 w (_ ________________________________)1 1630 1 720 2856 t (\347)720 2956 w (\347)720 3016 w (\347)720 3116 w (\347)720 3216 w (\347)720 3316 w (\347)720 3416 w (\347)720 3516 w 10 R f ( member of the sequence can also)6 1364( Each)1 252( a sequence of atomic entries, as stated above.)8 1858(A menu is more than)4 846 4 720 3756 t ( recursive structure permits arbitrary trees.)5 1695( This)1 228(be another menu.)2 690 3 720 3876 t (If arguments are given to)4 1059 1 970 4032 t 10 CW f (Menu.index\(\))2103 4032 w 10 R f ( differently when incorporated in)4 1379(the menu is treated)3 799 2 2862 4032 t ( The)1 218( string appears in the parent menu as a regular entry with an associated action.)14 3300( The)1 218(another menu.)1 584 4 720 4152 t (sub-menu is only reached if the user explicitly selects it to be displayed.)12 2877 1 720 4272 t 10 CW f (NumericRange\(\))970 4428 w 10 R f (makes it easier to build numeric \(sub-\)menus.)6 1828 1 1835 4428 t 10 CW f (Index NumericRange\(short, short\);)2 1980 1 770 4608 t (class PadRcv {)2 840 1 770 4848 t (public:)770 4968 w ( numeric\(long\);)1 1080(virtual void)1 720 2 770 5088 t (};)770 5208 w 10 S f (_ _________________________________________\347)1 2080 1 720 5268 t (\347)2800 5188 w (\347)2800 5088 w (\347)2800 4988 w (\347)2800 4888 w (\347)2800 4788 w (\347)2800 4688 w (\347)2800 4588 w (_ _________________________________________)1 2080 1 720 4488 t (\347)720 4588 w (\347)720 4668 w (\347)720 4768 w (\347)720 4868 w (\347)720 4968 w (\347)720 5068 w (\347)720 5168 w (\347)720 5268 w 10 CW f (Index ix = NumericRange\(lo, hi\);)4 1920 1 1080 5568 t 10 R f (is \(almost\) equivalent to)3 969 1 720 5748 t 10 CW f (Menu m;)1 420 1 1080 5928 t (for\( long i = lo; i <= hi, ++i \){)9 1980 1 1080 6048 t (char dec[BIG_ENOUGH];)1 1260 1 1560 6168 t (sprintf\( dec, "%d", i \);)4 1440 1 1560 6288 t (m.last\( dec, &numeric, i \);)4 1620 1 1560 6408 t (})1080 6528 w (Index ix = m.index\(\);)3 1260 1 1080 6648 t 10 R f ( the)1 159( Moreover,)1 480( built; the numeric range is represented by the pair of shorts.)11 2539(Of course, no such menu is)5 1142 4 720 6828 t (binding of)1 416 1 720 6948 t 10 CW f (numeric\(\))1198 6948 w 10 R f ( function calling mechanism when the operation)6 1931(occurs through the regular virtual)4 1344 2 1765 6948 t (comes back from the terminal, not in the menu construction.)9 2411 1 720 7068 t cleartomark showpage saveobj restore %%EndPage: 16 16 %%Page: 17 17 /saveobj save def mark 17 pagesetup 10 R f (- 17 -)2 216 1 2772 480 t 10 B f (8. Miscellany)1 586 1 720 840 t 10 CW f (void NewHelp\(\);)1 900 1 770 1020 t (void NewPadStats\(\);)1 1140 1 770 1140 t (long UniqueKey\(\);)1 1020 1 770 1260 t (void PadsWarn\(char* ...\);)2 1500 1 770 1380 t 10 S f (________________________________\347)720 1440 w (\347)2320 1400 w (\347)2320 1300 w (\347)2320 1200 w (\347)2320 1100 w (\347)2320 1000 w (________________________________)720 900 w (\347)720 1000 w (\347)720 1040 w (\347)720 1140 w (\347)720 1240 w (\347)720 1340 w (\347)720 1440 w 10 CW f (NewHelp\(\))970 1716 w 10 R f ( synopsis of the Pads man-)5 1079(instantiates an object that creates a ``help'' pad, presenting a)9 2425 2 1536 1716 t (ual page.)1 360 1 720 1836 t 10 CW f (NewPadStats\(\))970 1992 w 10 R f (creates a pad that shows consumption of host and terminal memory.)10 2716 1 1775 1992 t (Each call of)2 504 1 970 2148 t 10 CW f (UniqueKey\(\))1548 2148 w 10 R f (returns a distinct value, monotonically increasing \(at least to begin)9 2793 1 2247 2148 t (with.\))720 2268 w 10 CW f (PadsWarn\(\))970 2424 w 10 R f (takes)1597 2424 w 10 CW f (printf)1864 2424 w 10 R f ( use is discouraged for)4 910( It)1 113(arguments and writes a message to the user.)7 1766 3 2251 2424 t (routine communication with the user.)4 1496 1 720 2544 t 10 B f (9. References)1 589 1 720 2784 t 10 R f ( Technical Report CSTR-108, AT&T)4 1500( Stroustrup, ``C++ Reference Manual'', Computing Science)6 2397(1. B.S.)1 423 3 720 2940 t (Bell Laboratories, 1984.)2 971 1 970 3060 t cleartomark showpage saveobj restore %%EndPage: 17 17 %%Trailer done %%Pages: 17 %%DocumentFonts: Courier Times-Bold Times-Italic Times-Roman Times-Roman Symbol