# HG changeset patch # User yiyus # Date 1305706736 -7200 # Node ID 84a0aba46d8b3c96898acffd6102c30303b44717 # Parent 2fa97a8c1f3f96cf3f71a848e7665f2d3e9df792 pdf (old stuff) diff -r 2fa97a8c1f3f -r 84a0aba46d8b .hgignore --- a/.hgignore Sat Sep 12 20:56:19 2009 +0200 +++ b/.hgignore Wed May 18 10:18:56 2011 +0200 @@ -1,3 +1,5 @@ syntax: glob + +*/_werc/pages/* *~ diff -r 2fa97a8c1f3f -r 84a0aba46d8b _werc/lib/default_master.tpl --- a/_werc/lib/default_master.tpl Sat Sep 12 20:56:19 2009 +0200 +++ b/_werc/lib/default_master.tpl Wed May 18 10:18:56 2011 +0200 @@ -1,8 +1,3 @@ - - + + +

+ % if(! ~ $#handlers_bar_left 0) {
% for(h in $handlers_bar_left) { @@ -20,7 +22,6 @@
% } -
% run_handlers $handlers_body_head diff -r 2fa97a8c1f3f -r 84a0aba46d8b _werc/lib/top_bar.inc --- a/_werc/lib/top_bar.inc Sat Sep 12 20:56:19 2009 +0200 +++ b/_werc/lib/top_bar.inc Wed May 18 10:18:56 2011 +0200 @@ -3,9 +3,6 @@ A blg cmd + hg src
- -
- hg repo -
diff -r 2fa97a8c1f3f -r 84a0aba46d8b _werc/pub/style.css --- a/_werc/pub/style.css Sat Sep 12 20:56:19 2009 +0200 +++ b/_werc/pub/style.css Wed May 18 10:18:56 2011 +0200 @@ -2,6 +2,7 @@ /* # Header # */ .superHeader { + float: left; color: black; background-color: white; } @@ -19,7 +20,6 @@ color: black; background-color: pink; text-decoration: none; - padding: 0 1em 0 1em; } .superHeader div { @@ -27,15 +27,18 @@ } .superHeader .left { + float:left; left: 0px; padding: 0 0 0 0em; background-color: #333; text-align: left; - word-spacing: -0.7ex; + word-spacing: -0.6ex; + max-width: 50%; } a.anarchy { background-color: white; + padding: 0 1.5em 0 1.5em; } .superHeader .right { @@ -49,6 +52,7 @@ max-width: 800px; margin-left: auto; margin-right: auto; + padding-top: 2em; border: none; } @@ -100,8 +104,8 @@ .side-menu { background-color: white; font-size: 80%; - clear: left; float: left; + padding-top: 2em; padding-left: 0.5em; margin-right: 1.5em; } @@ -213,7 +217,8 @@ } .pathlink { - clear: both; + float: right; + width: 50%; font-size: 65%; text-align: center; } diff -r 2fa97a8c1f3f -r 84a0aba46d8b blg/2009/11/28/0/index.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/blg/2009/11/28/0/index.md Wed May 18 10:18:56 2011 +0200 @@ -0,0 +1,12 @@ +Going Forth +----------------------------------------- + +I have spent the last months discovering Forth: learning about it, [reading](http://thinking-forth.sourceforge.net/) about it, trying 4th, porting pForth to Plan9,... It is a language that I love, since I spent many hours programming my HP49G calculator and I always was a fan of the RPN syntax and simplicity in general. + +My last discovery has been [retroForth](http://retroforth.org/), a minimalistic Forth which runs on a portable virtual machine, Ngaro. When some days ago Google the [Go](http://www.golang.org)-team presented their new language I was watching Rob's talk and could not stop thinking about launching Ngaro virtual machines in goroutines communicated through channels. So... that's what I did: + +- [Gonga: Ngaro virtual machine in Go](http://hg.4l77.com/go/ngaro/) + +With the help of crcx (the original Ngaro author, many thanks!) and after experimenting with a [brainfuck virtual machine](http://hg.4l77.com/go/brainfuck/) the porting process was pretty straightforward. The retroForth image is booting without problems and you can already do some fancy things like launching children VMs and communicate their I/O ports through channels. It is a WIP yet. More to come... + +Have fun! diff -r 2fa97a8c1f3f -r 84a0aba46d8b blg/2010/03/17/0/index.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/blg/2010/03/17/0/index.md Wed May 18 10:18:56 2011 +0200 @@ -0,0 +1,76 @@ +Hello Xgb +----------------------------------------- + +A new "Hello World!" program. This time, it is an X application, which uses the xgb Go package. + +[xh.go](/pub/xh.go): + + // xh.go JGL (yiyus). 2010 + // xgb Hello World + // 8g xh.go && 8l -o xh xh.8 && ./xh + + package main + + import ( + "fmt" + "os" + "xgb" + ) + + func hello(c *xgb.Conn, win, gc xgb.Id) { + c.ImageText8(win, gc, 50, 50, []byte("Hello World!")) + } + + func main() { + c, err := xgb.Dial("") + if err != nil { + fmt.Fprintf(os.Stderr, "cannot connect: %v\n", err) + os.Exit(1) + } + + screen := c.DefaultScreen() + win := c.NewId() + + c.CreateWindow( + screen.RootDepth, win, screen.Root, + 0, 0, 300, 200, 2, + xgb.WindowClassCopyFromParent, + xgb.WindowClassCopyFromParent, + xgb.CWBackPixel|xgb.CWEventMask, + []uint32{screen.BlackPixel, xgb.EventMaskExposure | xgb.EventMaskButtonPress}, + ) + + gc := c.NewId() + font := c.NewId() + + c.OpenFont(font, "7x13") + c.CreateGC(gc, win, + xgb.GCBackground|xgb.GCForeground|xgb.GCFont, + []uint32{screen.WhitePixel, screen.BlackPixel, uint32(font)}, + ) + c.CloseFont(font) + r := xgb.Rectangle{0, 0, 300, 200} + c.PolyFillRectangle(win, gc, []xgb.Rectangle{r}) + hello(c, win, gc) + + c.MapWindow(win) + + Loop: for { + reply, err := c.WaitForEvent() + switch { + case err != nil: + fmt.Printf("error: %v\n", err) + os.Exit(1) + } + switch event := reply.(type) { + case xgb.ExposeEvent: + hello(c, win, gc) + case xgb.ButtonPressEvent: + fmt.Println("Button", event.Detail, "pressed. Bye!") + break Loop + } + } + + c.Close() + } + diff -r 2fa97a8c1f3f -r 84a0aba46d8b pdf/9.intro.pdf Binary file pdf/9.intro.pdf has changed diff -r 2fa97a8c1f3f -r 84a0aba46d8b pdf/_werc/config --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pdf/_werc/config Wed May 18 10:18:56 2011 +0200 @@ -0,0 +1,1 @@ +conf_enable_flip diff -r 2fa97a8c1f3f -r 84a0aba46d8b pdf/index.tpl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pdf/index.tpl Wed May 18 10:18:56 2011 +0200 @@ -0,0 +1,4 @@ +

Flip Demo

+ diff -r 2fa97a8c1f3f -r 84a0aba46d8b pdf/sam.pdf Binary file pdf/sam.pdf has changed diff -r 2fa97a8c1f3f -r 84a0aba46d8b pdf/sam_tut.pdf Binary file pdf/sam_tut.pdf has changed diff -r 2fa97a8c1f3f -r 84a0aba46d8b pdf/unix_prog_design.ps --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pdf/unix_prog_design.ps Wed May 18 10:18:56 2011 +0200 @@ -0,0 +1,1055 @@ +%!PS-Adobe-2.0 +%%Copyright: Copyright (c) 1993 AT&T, All Rights Reserved +%%Version: 3.4 +%%DocumentFonts: (atend) +%%Pages: (atend) +%%BoundingBox: (atend) +%%EndComments +/DpostDict 200 dict def +DpostDict begin +% +% Copyright (c) 1993 AT&T, All Rights Reserved +% +% Version 3.4 prologue for troff files. +% + +/#copies 1 store +/Prologue (dpost.ps) def +/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 + +/landscapepage { + landscape not { + 0 height scaling div neg translate % not quite + 90 rotate + } if +} bind def + +/portraitpage { + landscape { + width scaling div 0 translate % not quite + -90 rotate + } if +} bind 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 +end +%%EndProlog +%%BeginSetup +DpostDict begin +mark +/rotation 1 def +/gotpagebbox true def +/linewidth 0.5 def +/xoffset 0 def +/yoffset 0 def +/#copies 1 store +/magnification 1 def +%%FormsPerPage: 1 +/formsperpage 1 def +%%Patch from lp +%%EndPatch from lp +/landscape false def +/resolution 720 def +setup +2 setdecoding +end +%%EndSetup +%%Page: 1 1 +%%PageBoundingBox: (atend) +DpostDict begin +/saveobj save def +mark +1 pagesetup +12 B f +(Program design in the UNIX\262 environment)5 2217 1 1771 1230 t +10 I f +(Rob Pike)1 363 1 2698 1470 t +(Brian W. Kernighan)2 814 1 2473 1650 t +(ABSTRACT)2643 2090 w +10 R f +( style of program)3 709(Much of the power of the UNIX operating system comes from a)11 2641 2 1330 2386 t +( more important, easy to combine with other)7 1797(design that makes programs easy to use and,)7 1803 2 1080 2506 t +( style has been called the use of)7 1268(programs. This)1 631 2 1080 2626 t +10 I f +(software tools)1 567 1 3005 2626 t +10 R f +(, and depends more on how)5 1108 1 3572 2626 t +( can be used with other)5 953(the programs fit into the programming environment \320 how they)9 2647 2 1080 2746 t +( as the system has become)5 1116( But)1 208( are designed internally.)3 998(programs \320 than on how they)5 1278 4 1080 2866 t +(commercially successful and has spread widely, this style has often been compromised, to)12 3600 1 1080 2986 t +( programs have become encrusted with dubious features.)7 2337( Old)1 209(the detriment of all users.)4 1054 3 1080 3106 t +( are not always written with attention to proper separation of function)11 2919(Newer programs)1 681 2 1080 3226 t +( program design,)2 708( paper discusses the elements of)5 1358( This)1 244(and design for interconnection.)3 1290 4 1080 3346 t +( possible trends for the)4 970(showing by example good and bad design, and indicates some)9 2630 2 1080 3466 t +(future.)1080 3586 w +( a great commercial success, and is likely to be the standard)11 2428(The UNIX operating system has become)5 1642 2 970 3862 t +(operating system for microcomputers and some mainframes in the coming years.)10 3231 1 720 3982 t +( the)1 158( is portability: the operating system kernel and)7 1927( One)1 226(There are good reasons for this popularity.)6 1759 4 970 4138 t +( can be moved from one type of)7 1279(applications programs are written in the programming language C, and thus)10 3041 2 720 4258 t +( another with much less effort than would be involved in recreating them in the assembly lan-)16 3835(computer to)1 485 2 720 4378 t +( of comput-)2 470( the same operating system therefore runs on a wide variety)10 2408( Essentially)1 492(guage of each machine.)3 950 4 720 4498 t +( more important, ven-)3 883( Perhaps)1 370( along.)1 276(ers, and users needn't learn a new system when new hardware comes)11 2791 4 720 4618 t +( sell the UNIX system needn't provide new software for each new machine; instead, their software)15 3970(dors that)1 350 2 720 4738 t +(can be compiled and run without change on any hardware, which makes the system commercially attrac-)15 4320 1 720 4858 t +( element of zealotry: users of the system tend to be enthusiastic and to expect it wher-)16 3454( is also an)3 406(tive. There)1 460 3 720 4978 t +( the UNIX system in university a few years ago are now in the job mar-)15 2888(ever they go; the students who used)6 1432 2 720 5098 t +(ket and often demand it as a condition of employment.)9 2181 1 720 5218 t +( system was popular long before it was even portable, let alone a commercial success.)14 3496(But the UNIX)2 574 2 970 5374 t +(The reasons for that are more interesting.)6 1643 1 720 5494 t +( the UNIX system was written for the a machine that was \(deservedly\))12 2882(Except for the initial version,)4 1188 2 970 5650 t +( powerful enough to do real computing, but small enough to be affordable by small)14 3517( were)1 257(very popular.)1 546 3 720 5770 t +(organizations such as academic departments in universities.)6 2382 1 720 5890 t +( compet-)1 353(The early UNIX system was smaller but more effective and technically more interesting than)13 3717 2 970 6046 t +( provided a number of innovative applications of computer science,)9 2767( It)1 119( the same hardware.)3 821(ing systems on)2 613 4 720 6166 t +( include the)2 496( Examples)1 459( be obtained by a judicious blend of theory and practice.)10 2393(showing the benefits to)3 972 4 720 6286 t +10 CW f +(yacc)720 6406 w +10 R f +(parser-generator, the)1 827 1 988 6406 t +10 CW f +(diff)1843 6406 w +10 R f +( regular expressions to)3 907(file comparison program, and the pervasive use of)7 2022 2 2111 6406 t +( turn to new programming languages and interesting software for)9 2751( led in)2 282( These)1 304(describe string patterns.)2 983 4 720 6526 t +(applications like program development, document preparation and circuit design.)8 3245 1 720 6646 t +( size, and since essentially everything was written in C, the software)11 2781(Since the system was modest in)5 1289 2 970 6802 t +( customize for particular applications or merely to support a view of the world)13 3346(was easy to modify, to)4 974 2 720 6922 t +8 S1 f +(__________________)720 7022 w +8 R f +(\262 UNIX is a trademark of Bell Laboratories.)7 1409 1 720 7122 t +cleartomark +showpage +saveobj restore +end +%%%PageBoundingBox: 61 65 514 691 +%%EndPage: 1 1 +%%Page: 2 2 +%%PageBoundingBox: (atend) +DpostDict begin +/saveobj save def +mark +2 pagesetup +10 R f +(- 2 -)2 166 1 2797 480 t +( the plethora)2 503( ease of change is also a weakness, of course, as evidenced by)12 2482( \(This)1 262(different from the original.)3 1073 4 720 840 t +(of different versions of the system.\))5 1425 1 720 960 t +( new way of thinking of how to attack)8 1528(Finally, the UNIX system provided a new style of computing, a)10 2542 2 970 1116 t +( programs separately or in combina-)5 1474( style was based on the use of using)8 1482( This)1 235(a problem with a computer.)4 1129 4 720 1236 t +(tion to get a job done, rather than doing it by hand, by monolithic self-sufficient subsystems, or by special-)18 4320 1 720 1356 t +( has been much discussed in the literature, so we don't need to repeat it)14 2926( This)1 234(purpose, one-time programs.)2 1160 3 720 1476 t +(here; see [1], for example.)4 1046 1 720 1596 t +( style is still evolving,)4 898( The)1 209( on the system are closely related.)6 1374(The style of use and design of the tools)8 1589 4 970 1752 t +( program fit together, how the)5 1248(and is the subject of this essay: in particular, how the design and use of a)15 3072 2 720 1872 t +( focus of the)3 526( The)1 215( influences solutions to new problems.)5 1588(tools fit into the environment, and how the style)8 1991 4 720 1992 t +(discussion is a single example, the program)6 1758 1 720 2112 t +10 CW f +(cat)2506 2112 w +10 R f +( of files onto its standard output.)6 1309(, which concatenates a set)4 1045 2 2686 2112 t +10 CW f +(cat)720 2232 w +10 R f +( it is essential to the UNIX system; and it is a)11 1852(is a simple program, both in implementation and in use;)9 2260 2 928 2232 t +( a)1 77( \(Often)1 318( of the kinds of decisions that delight both supporters and critics of the system.)14 3257(good illustration)1 668 4 720 2352 t +( an asset or as a fault by different audiences; our audience is)12 2471(single property of the system will be taken as)8 1849 2 720 2472 t +( the)1 167( Even)1 275( programming.\))1 647(programmers, because the UNIX environment is designed fundamentally for)8 3231 4 720 2592 t +(name)720 2712 w +10 CW f +(cat)965 2712 w +10 R f +(is typical of UNIX program names: it is short, pronounceable, but not conventional English for)14 3866 1 1174 2712 t +( though,)1 329( important,)1 441( Most)1 258( an opposing viewpoint, see [2].\))5 1322( \(For)1 224(the job it does.)3 595 6 720 2832 t +10 CW f +(cat)3915 2832 w +10 R f +(in its usages and varia-)4 919 1 4121 2832 t +(tions exemplifies UNIX program design style and how it has been interpreted by different communities.)14 4158 1 720 2952 t +9 CW f +( \(I\))1 216(11/3/71 CAT)1 3888 2 900 3218 t +( -- concatenate and print)4 1350( _a _t _)3 108(NAME c)1 774 3 900 3438 t +( ...)1 216( _i _l _e _1 _)5 216( f)1 108( _a _t _)3 108(SYNOPSIS c)1 774 5 900 3658 t +( reads each file in sequence and writes it on)9 2430( _a _t _)3 108(DESCRIPTION c)1 774 3 900 3878 t +( Thus:)1 378(the standard output stream.)3 1458 2 1620 3988 t +( _i _l _e _)4 162( f)1 108(c _a _t _)3 162 3 1782 4208 t +( Also:)1 378(is about the easiest way to print a file.)8 2214 2 1620 4428 t +( _i _l _e _3 _)5 216( >f)1 162( _i _l _e _2 _)5 216( f)1 108( _i _l _e _1 _)5 216( f)1 108(c _a _t _)3 162 7 1782 4648 t +(is about the easiest way to concatenate files.)7 2484 1 1620 4868 t +( reads from the)3 810( _a _t _)3 108(If no input file is given c)6 1458 3 1620 5088 t +(standard input file.)2 1080 1 1620 5198 t +(FILES --)1 828 1 900 5418 t +( cp)1 162( pr,)1 450(SEE ALSO)1 432 3 900 5638 t +( if a file cannot be found it is ignored.)9 2214(DIAGNOSTICS none;)1 990 2 900 5858 t +(BUGS --)1 828 1 900 6078 t +( dmr)1 216(OWNER ken,)1 936 2 900 6298 t +10 R f +( page for)2 354( Manual)1 355(Figure 1:)1 364 3 1517 6538 t +10 HB f +(cat)2615 6538 w +10 R f +(, UNIX 1st Edition, November, 1971)5 1482 1 2760 6538 t +( is the manual page for)5 917(Figure 1)1 336 2 720 6898 t +10 CW f +(cat)1999 6898 w +10 R f +( Evidently,)1 465(from the UNIX 1st Edition manual.)5 1426 2 2205 6898 t +10 CW f +(cat)4122 6898 w +10 R f +(copies its input to)3 712 1 4328 6898 t +( taken from a sequence of one or more files, but it can come from the stan-)16 2995( input is normally)3 715( The)1 207(its output.)1 403 4 720 7018 t +( manual suggests two uses, the general file copy:)8 1950( The)1 205( output is the standard output.)5 1189( The)1 205(dard input.)1 433 5 720 7138 t +cleartomark +showpage +saveobj restore +end +%%PageBoundingBox: 61 62 514 764 +%%EndPage: 2 2 +%%Page: 3 3 +%%PageBoundingBox: (atend) +DpostDict begin +/saveobj save def +mark +3 pagesetup +10 R f +(- 3 -)2 166 1 2797 480 t +9 CW f +(cat file1 file2 >file3)3 1188 1 1008 830 t +10 R f +(and printing a file on the terminal:)6 1371 1 720 1010 t +9 CW f +(cat file)1 432 1 1008 1180 t +10 R f +( redirection \(provided)2 876( Output)1 331( the design of the program.)5 1091(The general case is certainly what was intended in)8 2022 4 720 1360 t +(by the)1 248 1 720 1480 t +10 CW f +(>)994 1480 w +10 R f +( by the UNIX shell\) makes)5 1073(operator, implemented)1 905 2 1080 1480 t +10 CW f +(cat)3083 1480 w +10 R f +(a fine general-purpose file concatenator and)5 1752 1 3288 1480 t +(a valuable adjunct for other programs, which can use)8 2114 1 720 1600 t +10 CW f +(cat)2859 1600 w +10 R f +(to process filenames, as in:)4 1079 1 3064 1600 t +9 CW f +(cat file file2 ... | other-program)5 1836 1 1008 1770 t +10 R f +(The fact that)2 510 1 720 1950 t +10 CW f +(cat)1258 1950 w +10 R f +( surprisingly, in practice it turns)5 1297( Perhaps)1 370(will also print on the terminal is a special case.)9 1906 3 1467 1950 t +(out that the special case is the main use of the program.\262)11 2263 1 720 2070 t +(The design of)2 553 1 970 2226 t +10 CW f +(cat)1550 2226 w +10 R f +(is typical of most UNIX programs: it implements one simple but general function)12 3283 1 1757 2226 t +( many different applications \(including many not envisioned by the original author\).)11 3517(that can be used in)4 803 2 720 2346 t +( example, there are separate commands for file system)8 2241( For)1 198( functions.)1 431(Other commands are used for other)5 1450 4 720 2466 t +( systems instead lump these into a)6 1361( Other)1 277( them or telling how big they are.)7 1332(tasks like renaming files, deleting)4 1350 4 720 2586 t +( file copy)2 379( \(The)1 239( its own.)2 344(single ``file system'' command with an internal structure and command language of)11 3358 4 720 2706 t +( approach is not necessarily worse or bet-)7 1675( That)1 236( operating systems like or is an example.\))7 1680(program found on)2 729 4 720 2826 t +( are not completely alien)4 999( such programs)2 614( Unfortunately,)1 637(ter, but it is certainly against the UNIX philosophy.)8 2070 4 720 2946 t +( mail-reading programs and text editors, for example, are large self-contained)10 3132(to the UNIX system \320 some)5 1188 2 720 3066 t +( and mesh poorly with the rest of the system.)9 1838(``subsystems'' that provide their own complete environments)6 2482 2 720 3186 t +( however, are usually imported from or inspired by programs on other operating sys-)13 3396(Most such subsystems,)2 924 2 720 3306 t +(tems with markedly different programming environments.)5 2325 1 720 3426 t +( most important)2 638( The)1 207( significant advantages to the traditional UNIX system approach.)8 2609(There are some)2 616 4 970 3582 t +(is that the surrounding environment \320 the shell and the programs it can invoke \320 provides a uniform)17 4320 1 720 3702 t +( expanded by the shell for all programs, without)8 1941( argument patterns are)3 895( Filename)1 424(access to system facilities.)3 1060 4 720 3822 t +( are a natural)3 550( Pipes)1 278( same is true of input and output redirection.)8 1861( The)1 216(prearrangement in each command.)3 1415 5 720 3942 t +( than decorate each command with options for all relevant pre- and post-)12 2983( Rather)1 323( redirection.)1 489(outgrowth of)1 525 4 720 4062 t +( concise and header-free textual data that)6 1633(processing, each program expects as input, and produces as output,)9 2687 2 720 4182 t +( takes some programming discipline)4 1461( It)1 114( with other programs to do the rest of the task at hand.)12 2197(connects well)1 548 4 720 4302 t +( environment \320 primarily, to avoid the temptation to add features)10 2649(to build a program that works well in this)8 1671 2 720 4422 t +(that conflict with or duplicate services provided by other commands \320 but it's well worthwhile.)14 3854 1 720 4542 t +( example, the 7th Edition shell was aug-)7 1660( For)1 197( functions are well separated.)4 1198(Growth is easy when the)4 1015 4 970 4698 t +( program into the arguments to another, as)7 1699(mented with a backquote operator that converts the output of one)10 2621 2 720 4818 t +(in)720 4938 w +9 CW f +(cat `cat filelist`)2 972 1 1008 5108 t +10 R f +( when this operator was invented; because the backquote is)9 2458(No changes were made in any other program)7 1862 2 720 5288 t +( If)1 119( by the shell acquire the feature transparently and uniformly.)9 2444(interpreted by the shell, all programs called)6 1757 3 720 5408 t +( subroutine, by each)3 825(special characters like backquotes were instead interpreted, even by calling a standard)11 3495 2 720 5528 t +( appropriate, every program would require \(at least\) recompilation whenever)9 3085(program that found the feature)4 1235 2 720 5648 t +( but experimentation would be)4 1273( only would uniformity be hard to enforce,)7 1787( Not)1 212(someone had a new idea.)4 1048 4 720 5768 t +(harder because of the effort of installing any changes.)8 2141 1 720 5888 t +( introduced two changes in)4 1124(The UNIX 7th Edition system)4 1249 2 970 6044 t +10 CW f +(cat)3380 6044 w +10 R f +( files that could not be read,)6 1184(. First,)1 296 2 3560 6044 t +( Second,)1 376( permissions or simple non-existence, were reported rather than ignored.)9 2954(either because of denied)3 990 3 720 6164 t +( the addition of a single optional argument)7 1703(and less desirable, was)3 909 2 720 6284 t +10 CW f +(-u)3358 6284 w +10 R f +(, which forced)2 575 1 3478 6284 t +10 CW f +(cat)4079 6284 w +10 R f +(to unbuffer its out-)3 755 1 4285 6284 t +( 8th Edition of the system, are technical)7 1608(put \(the reasons for this option, which has disappeared again in the)11 2712 2 720 6404 t +(and irrelevant here.\))2 805 1 720 6524 t +( of one argument was enough to suggest more, and other versions of the system)14 3358(But the existence)2 712 2 970 6680 t +8 S1 f +(__________________)720 6780 w +8 R f +(\262 The use of)3 402 1 720 6880 t +8 CW f +(cat)1144 6880 w +8 R f +(to feed a single input file to a program has to some degree superseded the shell's)15 2592 1 1310 6880 t +8 CW f +(<)3924 6880 w +8 R f +(operator, which illus-)2 686 1 3994 6880 t +(trates that general-purpose constructs \320 like)5 1482 1 720 6980 t +8 CW f +(cat)2234 6980 w +8 R f +( are often more natural than convenient special-purpose)7 1843(and pipes \320)2 427 2 2410 6980 t +(ones.)720 7080 w +cleartomark +showpage +saveobj restore +end +%%PageBoundingBox: 61 69 514 764 +%%EndPage: 3 3 +%%Page: 4 4 +%%PageBoundingBox: (atend) +DpostDict begin +/saveobj save def +mark +4 pagesetup +10 R f +(- 4 -)2 166 1 2797 480 t +(soon embellished)1 703 1 720 840 t +10 CW f +(cat)1454 840 w +10 R f +( list comes from)3 665( This)1 234(with features.)1 549 3 1665 840 t +10 CW f +(cat)3144 840 w +10 R f +( UNIX)1 281(on the Berkeley distribution of the)5 1404 2 3355 840 t +(system:)720 960 w +9 CW f +(-s)1008 1130 w +9 R f +(strip multiple blank lines to a single instance)7 1611 1 1391 1130 t +9 CW f +(-n)1008 1240 w +9 R f +(number the output lines)3 854 1 1391 1240 t +9 CW f +(-b)1008 1350 w +9 R f +(number only the non-blank lines)4 1172 1 1391 1350 t +9 CW f +(-v)1008 1460 w +9 R f +(make non-printing characters visible)3 1319 1 1391 1460 t +9 CW f +(-ve)1368 1570 w +9 R f +(mark ends of lines)3 664 1 1751 1570 t +9 CW f +(-vt)1368 1680 w +9 R f +(change representation of tab)3 1019 1 1751 1680 t +10 R f +( there are similar options and even a clash of naming:)10 2265(In System V,)2 549 2 970 1896 t +10 CW f +(-s)3822 1896 w +10 R f +(instructs)3980 1896 w +10 CW f +(cat)4357 1896 w +10 R f +(to be silent)2 465 1 4575 1896 t +( none of these options are appropriate additions to)8 2029( But)1 199(about non-existent files.)2 971 3 720 2016 t +10 CW f +(cat)3948 2016 w +10 R f +( reasons get to the)4 733(; the)1 179 2 4128 2016 t +(heart of how UNIX programs are designed and why they work well together.)12 3073 1 720 2136 t +(It's easy to dispose of \(Berkeley\))5 1322 1 970 2292 t +10 CW f +(-s)2317 2292 w +10 R f +(,)2437 2292 w +10 CW f +(-n)2487 2292 w +10 R f +(and)2632 2292 w +10 CW f +(-b)2801 2292 w +10 R f +( done with existing tools)4 988(: all of these jobs are readily)6 1131 2 2921 2292 t +(like)720 2412 w +10 CW f +(sed)895 2412 w +10 R f +(and)1100 2412 w +10 CW f +(awk)1269 2412 w +10 R f +( example, to number lines, this)5 1230(. For)1 214 2 1449 2412 t +10 CW f +(awk)2918 2412 w +10 R f +(invocation suffices:)1 785 1 3123 2412 t +9 CW f +(awk '{ print NR "\\t" $0 }')6 1404 1 1008 2582 t +9 I f +(filenames)2466 2582 w +10 R f +(If line-numbering is needed often, this command can be packaged under a name like)13 3370 1 720 2762 t +10 CW f +(linenumber)4116 2762 w +10 R f +(and put)1 298 1 4742 2762 t +( possibility is to modify the)5 1104( Another)1 378(in a convenient public place.)4 1149 3 720 2882 t +10 CW f +(pr)3377 2882 w +10 R f +( format text)2 466(command, whose job is to)4 1051 2 3523 2882 t +( lines is an appropriate feature in)6 1314( Numbering)1 506( printer.)1 317(such as program source for output on a line)8 1730 4 720 3002 t +10 CW f +(pr)4613 3002 w +10 R f +(; in fact)2 307 1 4733 3002 t +(UNIX System V)2 682 1 720 3122 t +10 CW f +(pr)1435 3122 w +10 R f +(has a)1 210 1 1588 3122 t +10 CW f +(-n)1831 3122 w +10 R f +( never was a need to modify)6 1167( There)1 289(option to do so.)3 644 3 1983 3122 t +10 CW f +(cat)4115 3122 w +10 R f +(; these options are)3 745 1 4295 3122 t +(gratuitous tinkering.)1 811 1 720 3242 t +(But what about)2 623 1 970 3398 t +10 CW f +(-v)1624 3398 w +10 R f +( strange)1 319( Making)1 367( prints non-printing characters in a visible representation.)7 2327(? That)1 283 4 1744 3398 t +( \(``)1 157(characters visible is a genuinely new function, for which no existing program is suitable.)13 3646 2 720 3518 t +10 CW f +(sed -n l)2 426 1 4523 3518 t +10 R f +('',)4949 3518 w +( to occur in)3 470(the closest standard possibility, aborts when given very long input lines, which are more likely)14 3850 2 720 3638 t +( isn't it appropriate to add the)6 1284( So)1 173( characters.\))1 503(files containing non-printing)2 1180 4 720 3758 t +10 CW f +(-v)3902 3758 w +10 R f +(option to)1 376 1 4064 3758 t +10 CW f +(cat)4482 3758 w +10 R f +(to make)1 336 1 4704 3758 t +(strange characters visible when a file is printed?)7 1920 1 720 3878 t +( a modification confuses what)4 1202( Such)1 251(The answer is ``No.'')3 858 3 970 4034 t +10 CW f +(cat)3307 4034 w +10 R f +('s job is \320 concatenating files \320 with)7 1553 1 3487 4034 t +( UNIX program)2 667( A)1 137( a common special case \320 showing a file on the terminal.)11 2478(what it happens to do in)5 1038 4 720 4154 t +( one thing well, and leave unrelated tasks to other programs.)10 2517(should do)1 402 2 720 4274 t +10 CW f +(cat)3700 4274 w +10 R f +('s job is to the data in files.)7 1160 1 3880 4274 t +(Programs that collect data shouldn't the data;)6 1809 1 720 4394 t +10 CW f +(cat)2554 4394 w +10 R f +(therefore shouldn't transform its input.)4 1551 1 2759 4394 t +(The preferred approach in this case is a separate program that deals with non-printable characters.)14 4070 1 970 4550 t +(We called ours)2 602 1 720 4670 t +10 CW f +(vis)1349 4670 w +10 R f +( because its job is to make things vis-)8 1502(\(a suggestive, pronounceable, non-English name\))4 1982 2 1556 4670 t +( visible \320 and as)4 714( usual, the default is to do what most users will want \320 make strange characters)15 3266(ible. As)1 340 3 720 4790 t +( making)1 330( By)1 172(necessary include options for variations on that theme.)7 2215 3 720 4910 t +10 CW f +(vis)3467 4910 w +10 R f +(a separate program, related useful)4 1364 1 3676 4910 t +( example, the option)3 864( For)1 205(functions are easy to provide.)4 1242 3 720 5030 t +10 CW f +(-s)3072 5030 w +10 R f +( characters,)1 470(strips out \(i.e., discards\) strange)4 1337 2 3233 5030 t +( treatment and)2 571( options control the)3 778( Other)1 278(which is handy for dealing with files from other operating systems.)10 2693 4 720 5150 t +( may or may not be considered strange in different situa-)10 2312(format of characters like tabs and backspaces that)7 2008 2 720 5270 t +( options make sense in)4 917(tions. Such)1 473 2 720 5390 t +10 CW f +(vis)2137 5390 w +10 R f +( In)1 135(because its focus is entirely on the treatment of such characters.)10 2561 2 2344 5390 t +10 CW f +(cat)720 5510 w +10 R f +( require an entire sub-language within the)6 1729(, they)1 232 2 900 5510 t +10 CW f +(-v)2897 5510 w +10 R f +(option, and thus get even further away from the)8 1987 1 3053 5510 t +( separate program makes conve-)4 1334( providing the function in a)5 1151( Also,)1 276(fundamental purpose of that program.)4 1559 4 720 5630 t +(nient options such as)3 836 1 720 5750 t +10 CW f +(-s)1581 5750 w +10 R f +(easier to invent, because it isolates the problem as well as the solution.)12 2819 1 1726 5750 t +( example, if we want)4 890( For)1 203( efficiency.)1 462(One possible objection to separate programs for each task is)9 2515 4 970 5906 t +(numbered lines and visible characters it is probably more efficient to run the one command)14 3638 1 720 6026 t +9 CW f +(cat -n -v file)3 756 1 1008 6196 t +10 R f +(than the two-element pipeline)3 1190 1 720 6376 t +9 CW f +(linenumber file | vis)3 1134 1 1008 6546 t +10 R f +(In practice, however,)2 849 1 720 6726 t +10 CW f +(cat)1598 6726 w +10 R f +( common cases be)3 744(is usually used with no options, so it makes sense to have the)12 2489 2 1807 6726 t +( current research version of the)5 1297( The)1 217(the efficient ones.)2 738 3 720 6846 t +10 CW f +(cat)3009 6846 w +10 R f +(command is actually about five times faster)6 1814 1 3226 6846 t +( data in large blocks instead of the byte-at-)8 1734(than the Berkeley and System V versions because it can process)10 2586 2 720 6966 t +( and this is perhaps more important, it)7 1537( Also,)1 267( is enabled.)2 458(time processing that might be required if an option)8 2058 4 720 7086 t +( of the real)3 456( Most)1 265( program.)1 397(is hard to imagine any of these examples being the bottleneck of a production)13 3202 4 720 7206 t +cleartomark +showpage +saveobj restore +end +%%PageBoundingBox: 61 55 514 764 +%%EndPage: 4 4 +%%Page: 5 5 +%%PageBoundingBox: (atend) +DpostDict begin +/saveobj save def +mark +5 pagesetup +10 R f +(- 5 -)2 166 1 2797 480 t +( waiting for the user's terminal to display the characters, or even for the user to read)16 3414(time is probably taken)3 906 2 720 840 t +(them.)720 960 w +( than wider options; which is better depends on the problem.)10 2457(Separate programs are not always better)5 1613 2 970 1116 t +( needs a way to perform a new function, one faces the choice of whether to add a new option)19 3739(Whenever one)1 581 2 720 1236 t +( The)1 209( none of the programmable tools will do the job conveniently\).)10 2546(or write a new program \(assuming that)6 1565 3 720 1356 t +( are appropri-)2 546( Options)1 369( be that each program does one thing.)7 1511(guiding principle for making the choice should)6 1894 4 720 1476 t +( there is no such program, then a new)8 1558( If)1 124( the right functionality.)3 946(ately added to a program that already has)7 1692 4 720 1596 t +( that case, the usual criteria for program design should be used: the program should)14 3325( In)1 133(program is called for.)3 862 3 720 1716 t +( general as possible, its default behavior should match the most common usage, and it should cooper-)16 4115(be as)1 205 2 720 1836 t +(ate with other programs.)3 976 1 720 1956 t +( first)1 187( The)1 206( problem, dealing with fast terminal lines.)6 1677(Let's look at these issues in the context of another)9 2000 4 970 2112 t +( written in the days when 150 baud was ``fast,'' and all terminals used)13 2897(versions of the UNIX system were)5 1423 2 720 2232 t +( should we deal with the fact)6 1202( How)1 253( typical, and hard-copy terminals are rare.)6 1721( 9600 baud is)3 560(paper. Today,)1 584 5 720 2352 t +(that output from programs like)4 1227 1 720 2472 t +10 CW f +(cat)1972 2472 w +10 R f +(scrolls off the top of the screen faster than one can read it?)12 2332 1 2177 2472 t +( is to tell each program about the properties of terminals, so it)12 2461( One)1 216(There are two obvious approaches.)4 1393 3 970 2628 t +( other is to write a command that handles ter-)9 1811( The)1 206(does the right thing \(whether by option or automatically\).)8 2303 3 720 2748 t +(minals, and leave most programs untouched.)5 1784 1 720 2868 t +( Berkeley's version of the)4 1039(An example of the first approach is)6 1414 2 970 3024 t +10 CW f +(ls)3450 3024 w +10 R f +(command, which lists the filenames)4 1443 1 3597 3024 t +( us call it)3 370( Let)1 185(in a directory.)2 561 3 720 3144 t +10 CW f +(lsc)1863 3144 w +10 R f +( 7th Edition)2 475( The)1 206(to avoid confusion.)2 771 3 2070 3144 t +10 CW f +(ls)3548 3144 w +10 R f +(command lists filenames in a sin-)5 1346 1 3694 3144 t +( directory, the list of filenames disappears off the top of the screen at great speed.)15 3290(gle column, so for a large)5 1030 2 720 3264 t +10 CW f +(lsc)720 3384 w +10 R f +( columns across the screen \(which is assumed to be 80 columns wide\), so there are typically)16 3770(prints in)1 338 2 932 3384 t +( option)1 285( The)1 209( as many names on each line, and thus the output usually fits on one screen.)15 3081(four to eight times)3 745 4 720 3504 t +10 CW f +(-1)720 3624 w +10 R f +(can be used to get the old single-column behavior.)8 2011 1 865 3624 t +(Surprisingly,)970 3780 w +10 CW f +(lsc)1515 3780 w +10 R f +(operates differently if its output is a file or pipe:)9 1917 1 1720 3780 t +9 CW f +(lsc)1008 3950 w +10 R f +(produces output different from)3 1228 1 720 4130 t +9 CW f +(lsc | cat)2 486 1 1008 4300 t +10 R f +(The reason is that)3 722 1 720 4480 t +10 CW f +(lsc)1472 4480 w +10 R f +(begins by examining whether or not its output is a terminal, and prints in columns)14 3358 1 1682 4480 t +( to files or pipes,)4 685( retaining single-column output)3 1273( By)1 172(only if it is.)3 477 4 720 4600 t +10 CW f +(lsc)3356 4600 w +10 R f +(ensures compatibility with programs)3 1475 1 3565 4600 t +(like)720 4720 w +10 CW f +(grep)895 4720 w +10 R f +(or)1160 4720 w +10 CW f +(wc)1268 4720 w +10 R f +( adjustment of the output format depend-)6 1643( This)1 228(that expect things to be printed one per line.)8 1756 3 1413 4720 t +(ing on the destination is not only distasteful, it is unique \320 no standard UNIX command has this property.)18 4265 1 720 4840 t +(A more insidious problem with)4 1266 1 970 4996 t +10 CW f +(lsc)2266 4996 w +10 R f +(is that the columnation facility, which is actually a useful, gen-)10 2564 1 2476 4996 t +( Pro-)1 225( is built in and thus inaccessible to other programs that could use a similar compression.)15 3559(eral function,)1 536 3 720 5116 t +( automatic columnation in)3 1050( The)1 206( special solutions to general problems.)5 1537(grams should not attempt)3 1014 4 720 5236 t +10 CW f +(lsc)4553 5236 w +10 R f +(is rem-)1 281 1 4759 5236 t +( the ``wild cards'' found in some systems that provide filename pattern matching only for a par-)16 3896(iniscent of)1 424 2 720 5356 t +( experience with centralized processing of wild cards in the UNIX shell shows over-)13 3458( The)1 212(ticular program.)1 650 3 720 5476 t +(whelmingly how important it is to centralize the function where it can be used by all programs.)16 3798 1 720 5596 t +(One solution for the)3 808 1 970 5752 t +10 CW f +(ls)1805 5752 w +10 R f +( \320 a separate program for columnation, so that columna-)9 2317(problem is obvious)2 771 2 1952 5752 t +(tion into say 5 columns is just)6 1196 1 720 5872 t +9 CW f +(ls | 5)2 324 1 1008 6042 t +10 R f +( the multi-column option of)4 1110(It is easy to build a first-draft version with)8 1687 2 720 6222 t +10 CW f +(pr)3543 6222 w +10 R f +( commands)1 459(. The)1 231 2 3663 6222 t +10 CW f +(2)4379 6222 w +10 R f +(,)4439 6222 w +10 CW f +(3)4490 6222 w +10 R f +(, etc., are all)3 490 1 4550 6222 t +(links to a single file:)4 817 1 720 6342 t +9 CW f +(pr -$0 -t -l1 $*)4 864 1 1008 6512 t +10 CW f +($0)720 6692 w +10 R f +(is the program name \()4 880 1 866 6692 t +10 CW f +(2)1746 6692 w +10 R f +(,)1806 6692 w +10 CW f +(3)1857 6692 w +10 R f +( so)1 116(, etc.\),)1 250 2 1917 6692 t +10 CW f +(-$0)2310 6692 w +10 R f +(becomes)2517 6692 w +10 CW f +(-)2893 6692 w +10 I f +(n)2953 6692 w +10 R f +(where is the number of columns that)6 1471 1 3030 6692 t +10 CW f +(pr)4528 6692 w +10 R f +(is to pro-)2 365 1 4675 6692 t +( normal heading, set the page length to 1 line, and pass the arguments)13 2816( other options suppress the)4 1082(duce. The)1 422 3 720 6812 t +(on to)1 215 1 720 6932 t +10 CW f +(pr)972 6932 w +10 R f +( of the use of tools \320 it takes only a moment to write, and it)15 2605( implementation is typical)3 1078(. This)1 265 3 1092 6932 t +( a more general service is desired, such as automatically)9 2383( If)1 133(serves perfectly well for most applications.)5 1804 3 720 7052 t +( required, but the one-)4 924(selecting the number of columns for optimal compaction, a C program is probably)12 3396 2 720 7172 t +(line implementation above satisfies the immediate need and provides a base for experimentation with the)14 4320 1 720 7292 t +cleartomark +showpage +saveobj restore +end +%%PageBoundingBox: 61 47 514 764 +%%EndPage: 5 5 +%%Page: 6 6 +%%PageBoundingBox: (atend) +DpostDict begin +/saveobj save def +mark +6 pagesetup +10 R f +(- 6 -)2 166 1 2797 480 t +(design of a fancier program, should one become necessary.)8 2360 1 720 840 t +(Similar reasoning suggests a solution for the general problem of data flowing off screens \(colum-)14 4070 1 970 996 t +( programs are by)3 697( Such)1 258( input and print it a screen at a time.)9 1509(nated or not\): a separate program to take any)8 1856 4 720 1116 t +( like)1 178(now widely available, under names)4 1419 2 720 1236 t +10 CW f +(pg)2345 1236 w +10 R f +(and)2493 1236 w +10 CW f +(more)2665 1236 w +10 R f +( solution affects no other programs, but can be)8 1879(. This)1 256 2 2905 1236 t +( be enhanced with options)4 1059( usual, once the basic feature is right, the program can)10 2206( As)1 166(used with all of them.)4 889 4 720 1356 t +( screen size, backing up, searching for patterns, and anything else that proves useful within)14 3755(for specifying)1 565 2 720 1476 t +(that basic job.)2 558 1 720 1596 t +( the user forgets to pipe output into)7 1423( If)1 119(There is still a problem, of course.)6 1388 3 970 1752 t +10 CW f +(pg)3928 1752 w +10 R f +(, the output that goes off)5 992 1 4048 1752 t +( would be desirable if the facilities of)7 1510( It)1 114( is gone.)2 342(the top of the screen)4 825 4 720 1872 t +10 CW f +(pg)3539 1872 w +10 R f +(were always present without hav-)4 1353 1 3687 1872 t +(ing to be requested explicitly.)4 1185 1 720 1992 t +( not)1 156(There are related useful functions that are typically only available as part of a particular program,)15 3914 2 970 2148 t +( the history mechanism provided by some versions of the UNIX shell:)11 2844( example is)2 465( One)1 221(in a central service.)3 790 4 720 2268 t +( why)1 213( But)1 211( with editing.)2 563(commands are remembered, so it's possible to review and repeat them, perhaps)11 3333 4 720 2388 t +( programs called)2 667( not even general enough to pass input to)8 1653( \(It's)1 218(should this facility be restricted to the shell?)7 1782 4 720 2508 t +( well; any interactive)3 849( other programs could profit as)5 1244( Certainly)1 424(the shell; it applies to shell commands only.\))7 1803 4 720 2628 t +( subtly, why should the facility be)6 1412( More)1 275( from the ability to re-execute commands.)6 1726(program could benefit)2 907 4 720 2748 t +( often useful as input to another.)6 1296(restricted to program Pipes have shown that the output from one program is)12 3024 2 720 2868 t +( of commands such as)4 890(With a little editing, the output)5 1249 2 720 2988 t +10 CW f +(ls)2886 2988 w +10 R f +(or)3033 2988 w +10 CW f +(make)3143 2988 w +10 R f +(can be turned into commands or data for)7 1630 1 3410 2988 t +(other programs.)1 632 1 720 3108 t +( com-)1 235(Another facility that could be usefully centralized is typified by the editor escape in some mail)15 3835 2 970 3264 t +( this is all)3 393( But)1 197( is possible to pick up part of a mail message, edit it, and then include it in a reply.)19 3330(mands. It)1 400 4 720 3384 t +(done by special facilities within the)5 1418 1 720 3504 t +10 CW f +(mail)2163 3504 w +10 R f +(command and so its use is restricted.)6 1468 1 2428 3504 t +( by a different program, which usually has its own syntax and seman-)12 2860(Each such service is provided)4 1210 2 970 3660 t +( is in contrast to features such as pagination, which is always the same because it is only done by)19 3924(tics. This)1 396 2 720 3780 t +( output text is more environmental than functional; it is more like the)12 2772( editing of input and)4 811( The)1 205(one program.)1 532 4 720 3900 t +( since the shell)3 597( But)1 197( automatic numbering of lines of text.)6 1519(shell's expansion of filename metacharacters than)5 2007 4 720 4020 t +( The)1 211( see the characters sent as input to the programs, it cannot provide such editing.)14 3251(does not)1 341 3 720 4140 t +10 CW f +(emacs)4554 4140 w +10 R f +(edi-)4885 4140 w +(tor)720 4260 w +8 R f +(3)831 4228 w +10 R f +( capability, by processing all UNIX command input and output, but this)11 2901(provides a limited form of this)5 1239 2 900 4260 t +( the complexities and vagaries of yet another massive subsys-)9 2469(is expensive, clumsy, and subjects the users to)7 1851 2 720 4380 t +(tem \(which isn't to criticize the inventiveness of the idea\).)9 2324 1 720 4500 t +(A potentially simpler solution is to let the terminal or terminal interface do the work, with controlled)16 4070 1 970 4656 t +( have used the)3 574( We)1 190( retransmission of visible text, and review of what has gone before.)11 2703(scrolling, editing and)2 853 4 720 4776 t +(programmability of the Blit terminal)4 1489 1 720 4896 t +8 R f +(4)2209 4864 w +10 R f +( capitalize on this)3 726(\320 a programmable bitmap graphics display \320 to)7 2033 2 2281 4896 t +(possibility, to good effect.)3 1047 1 720 5016 t +( on the display, which can be edited, rearranged and)9 2210(The Blit uses a mouse to point to characters)8 1860 2 970 5172 t +( the terminal)2 505( Because)1 382( keyboard.)1 421(transmitted back to the UNIX system as though they had been typed on the)13 3012 4 720 5292 t +( how the text was created; all the features)8 1659(is essentially simulating typed input, the programs are oblivious to)9 2661 2 720 5412 t +( general editing capabilities of the terminal, with no changes to the)11 2806(discussed above are provided by the)5 1514 2 720 5532 t +(UNIX programs.)1 676 1 720 5652 t +( user's control.)2 600(There are some obvious direct advantages to the Blit's ability to process text under the)14 3470 2 970 5808 t +( is trivial: commands can be selected with the mouse, edited if desired, and retransmitted.)14 3794(Shell history)1 526 2 720 5928 t +( equivalent, history is limited neither to the)7 1799(Since from the terminal's viewpoint all text on the display is)10 2521 2 720 6048 t +( Blit provides editing, most of the interactive features of programs)10 2654( the)1 149( Because)1 384(shell nor to command input.)4 1133 4 720 6168 t +(like)720 6288 w +10 CW f +(mail)895 6288 w +10 R f +(are unnecessary; they are done easily, transparently and uniformly by the terminal.)11 3301 1 1160 6288 t +( interactive fea-)2 639(The most interesting facet of this work, however, is the way it removes the need for)15 3431 2 970 6444 t +( is the place where interaction is provided, much as the shell is the pro-)14 2907(tures in programs; instead, the Blit)5 1413 2 720 6564 t +( course, programming the termi-)4 1327( of)1 115( Unfortunately,)1 642(gram that interprets filename-matching metacharacters.)4 2236 4 720 6684 t +( meshes)1 326(nal demands access to a part of the environment off-limits to most programmers, but the solution)15 3994 2 720 6804 t +( to provide)2 443( the terminal cannot be modified)5 1321( If)1 120(well with the environment and is appealing in its simplicity.)9 2436 4 720 6924 t +( a user-level program or perhaps the UNIX kernel itself could be modified fairly easily to do)16 3692(the capabilities,)1 628 2 720 7044 t +(roughly what the Blit does, with similar results.)7 1903 1 720 7164 t +cleartomark +showpage +saveobj restore +end +%%PageBoundingBox: 61 60 514 764 +%%EndPage: 6 6 +%%Page: 7 7 +%%PageBoundingBox: (atend) +DpostDict begin +/saveobj save def +mark +7 pagesetup +10 R f +(- 7 -)2 166 1 2797 480 t +( to problem-solving on the UNIX system is to identify the right primitive operations and to)15 3740(The key)1 330 2 970 840 t +( a)1 73( In)1 137( tend to solve general problems rather than special cases.)9 2303( programs)1 407( UNIX)1 304(put them at the right place.)5 1096 6 720 960 t +( space of jobs to be done \(although with a fair)10 1890(very loose sense, the programs are orthogonal, spanning the)8 2430 2 720 1080 t +( are placed where they will)5 1092( Functions)1 448( efficiency\).)1 484(amount of overlap for reasons of history, convenience or)8 2296 4 720 1200 t +( any more than there)4 860(do the most good: there shouldn't be a pager in every program that produces output)14 3460 2 720 1320 t +(should be filename pattern matching in every program that uses filenames.)10 2981 1 720 1440 t +( is successful in part because it has a small)9 1772( It)1 119(One thing that UNIX does not need is more features.)9 2179 3 970 1596 t +( make it easier for users to)6 1077( adding features does not)4 1018( Merely)1 343(number of good ideas that work well together.)7 1882 4 720 1716 t +( right solution in the right place is always more effective)10 2278( The)1 207(do things \320 it just makes the manual thicker.)8 1835 3 720 1836 t +(than haphazard hacking.)2 972 1 720 1956 t +( W. Kernighan and Rob Pike,)5 1179(1. B.)1 342 2 720 2148 t +10 I f +(The UNIX Programming Environment,)3 1560 1 2266 2148 t +10 R f +(Prentice-Hall \(1984\).)1 848 1 3851 2148 t +( Norman, ``The Truth about UNIX,'')5 1482(2. D.)1 347 2 720 2304 t +10 I f +(Datamation)2574 2304 w +10 R f +(\(November, 1981\).)1 762 1 3077 2304 t +( Gosling, ``UNIX Emacs,'' CMU internal memorandum \(August, 1982\).)8 2907(3. James)1 494 2 720 2460 t +( Multiplexed Graphics Terminal,'')3 1411( Pike, ``The Blit: A)4 811(4. R.)1 342 3 720 2616 t +10 I f +(Bell System Technical Journal)3 1248 1 3319 2616 t +10 R f +(\(this issue,)1 438 1 4602 2616 t +(1984\).)970 2736 w +cleartomark +showpage +saveobj restore +end +%%PageBoundingBox: 61 502 514 764 +%%EndPage: 7 7 +%%Trailer +DpostDict begin +done +end +%%Pages: 7 +%%DocumentFonts: Courier Times-Bold Times-Italic Times-Roman Times-Roman Helvetica-Bold diff -r 2fa97a8c1f3f -r 84a0aba46d8b pdf/utf.pdf Binary file pdf/utf.pdf has changed diff -r 2fa97a8c1f3f -r 84a0aba46d8b src/index.md --- a/src/index.md Sat Sep 12 20:56:19 2009 +0200 +++ b/src/index.md Wed May 18 10:18:56 2011 +0200 @@ -68,9 +68,9 @@ (see ) - Column mouse actions (see [video](http://4l77.com/pub/acme-growcol.mpeg)): - - B1: increase size. - - B2: swap with left column. - - B3: maximize size. + - B1: increase size + - B2: maximize size + - B3: move to left-most position and hide the other clients - **[Rio](http://plan9.bell-labs.com/sources/contrib/yiyus/cmd/rio/)** ([hg](/hg/patch9/rio/)) - Alternative chording with the mouse wheel instead of B2 and B3.