home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2798 < prev    next >
LaTeX Document  |  1991-02-20  |  60.7 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: 2798

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert LaTeX Document (document/latex) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news or mail text default
99% file LaTeX document text default
98% file LaTeX document, ASCII text default
100% TrID E-Mail message (Var. 2) default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/rfc822 default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 46 72 6f 6d 3a 20 67 75 | 69 64 6f 40 63 77 69 2e |From: gu|ido@cwi.|
|00000010| 6e 6c 20 28 47 75 69 64 | 6f 20 76 61 6e 20 52 6f |nl (Guid|o van Ro|
|00000020| 73 73 75 6d 29 0a 4e 65 | 77 73 67 72 6f 75 70 73 |ssum).Ne|wsgroups|
|00000030| 3a 20 61 6c 74 2e 73 6f | 75 72 63 65 73 0a 53 75 |: alt.so|urces.Su|
|00000040| 62 6a 65 63 74 3a 20 50 | 79 74 68 6f 6e 20 30 2e |bject: P|ython 0.|
|00000050| 39 2e 31 20 70 61 72 74 | 20 30 36 2f 32 31 0a 4d |9.1 part| 06/21.M|
|00000060| 65 73 73 61 67 65 2d 49 | 44 3a 20 3c 32 39 36 38 |essage-I|D: <2968|
|00000070| 40 63 68 61 72 6f 6e 2e | 63 77 69 2e 6e 6c 3e 0a |@charon.|cwi.nl>.|
|00000080| 44 61 74 65 3a 20 31 39 | 20 46 65 62 20 39 31 20 |Date: 19| Feb 91 |
|00000090| 31 37 3a 34 31 3a 33 38 | 20 47 4d 54 0a 0a 3a 20 |17:41:38| GMT..: |
|000000a0| 54 68 69 73 20 69 73 20 | 61 20 73 68 65 6c 6c 20 |This is |a shell |
|000000b0| 61 72 63 68 69 76 65 2e | 0a 3a 20 45 78 74 72 61 |archive.|.: Extra|
|000000c0| 63 74 20 77 69 74 68 20 | 27 73 68 20 74 68 69 73 |ct with |'sh this|
|000000d0| 5f 66 69 6c 65 27 2e 0a | 3a 0a 3a 20 45 78 74 72 |_file'..|:.: Extr|
|000000e0| 61 63 74 20 70 61 72 74 | 20 30 31 20 66 69 72 73 |act part| 01 firs|
|000000f0| 74 20 73 69 6e 63 65 20 | 69 74 20 6d 61 6b 65 73 |t since |it makes|
|00000100| 20 61 6c 6c 20 64 69 72 | 65 63 74 6f 72 69 65 73 | all dir|ectories|
|00000110| 0a 65 63 68 6f 20 27 53 | 74 61 72 74 20 6f 66 20 |.echo 'S|tart of |
|00000120| 70 61 63 6b 2e 6f 75 74 | 2c 20 70 61 72 74 20 30 |pack.out|, part 0|
|00000130| 36 20 6f 75 74 20 6f 66 | 20 32 31 3a 27 0a 69 66 |6 out of| 21:'.if|
|00000140| 20 74 65 73 74 20 2d 73 | 20 27 64 6f 63 2f 4d 61 | test -s| 'doc/Ma|
|00000150| 6b 65 66 69 6c 65 27 0a | 74 68 65 6e 20 65 63 68 |kefile'.|then ech|
|00000160| 6f 20 27 2a 2a 2a 20 49 | 20 77 69 6c 6c 20 6e 6f |o '*** I| will no|
|00000170| 74 20 6f 76 65 72 2d 77 | 72 69 74 65 20 65 78 69 |t over-w|rite exi|
|00000180| 73 74 69 6e 67 20 66 69 | 6c 65 20 64 6f 63 2f 4d |sting fi|le doc/M|
|00000190| 61 6b 65 66 69 6c 65 27 | 0a 65 6c 73 65 0a 65 63 |akefile'|.else.ec|
|000001a0| 68 6f 20 27 78 20 2d 20 | 64 6f 63 2f 4d 61 6b 65 |ho 'x - |doc/Make|
|000001b0| 66 69 6c 65 27 0a 73 65 | 64 20 27 73 2f 5e 58 2f |file'.se|d 's/^X/|
|000001c0| 2f 27 20 3e 20 27 64 6f | 63 2f 4d 61 6b 65 66 69 |/' > 'do|c/Makefi|
|000001d0| 6c 65 27 20 3c 3c 20 27 | 45 4f 46 27 0a 58 23 20 |le' << '|EOF'.X# |
|000001e0| 4d 61 6b 65 66 69 6c 65 | 20 66 6f 72 20 50 79 74 |Makefile| for Pyt|
|000001f0| 68 6f 6e 20 64 6f 63 75 | 6d 65 6e 74 61 74 69 6f |hon docu|mentatio|
|00000200| 6e 2e 0a 58 0a 58 4c 41 | 54 45 58 3d 09 09 6c 61 |n..X.XLA|TEX=..la|
|00000210| 74 65 78 0a 58 44 56 49 | 50 53 3d 09 09 64 76 69 |tex.XDVI|PS=..dvi|
|00000220| 70 73 0a 58 54 45 58 50 | 52 45 56 49 45 57 3d 09 |ps.XTEXP|REVIEW=.|
|00000230| 78 64 76 69 0a 58 0a 58 | 50 52 49 4e 54 3d 09 09 |xdvi.X.X|PRINT=..|
|00000240| 6c 70 72 0a 58 0a 58 74 | 75 74 3a 09 09 74 75 74 |lpr.X.Xt|ut:..tut|
|00000250| 2e 64 76 69 0a 58 09 09 | 24 28 54 45 58 50 52 45 |.dvi.X..|$(TEXPRE|
|00000260| 56 49 45 57 29 20 74 75 | 74 0a 58 0a 58 74 75 74 |VIEW) tu|t.X.Xtut|
|00000270| 2e 64 76 69 20 74 75 74 | 2e 70 73 3a 09 74 75 74 |.dvi tut|.ps:.tut|
|00000280| 2e 74 6f 63 20 74 75 74 | 2e 74 65 78 20 6d 79 66 |.toc tut|.tex myf|
|00000290| 6f 72 6d 61 74 2e 73 74 | 79 0a 58 0a 58 6d 6f 64 |ormat.st|y.X.Xmod|
|000002a0| 3a 09 09 6d 6f 64 2e 64 | 76 69 0a 58 09 09 24 28 |:..mod.d|vi.X..$(|
|000002b0| 54 45 58 50 52 45 56 49 | 45 57 29 20 6d 6f 64 0a |TEXPREVI|EW) mod.|
|000002c0| 58 0a 58 6d 6f 64 2e 64 | 76 69 20 6d 6f 64 2e 70 |X.Xmod.d|vi mod.p|
|000002d0| 73 3a 09 6d 6f 64 2e 74 | 6f 63 20 6d 6f 64 2e 74 |s:.mod.t|oc mod.t|
|000002e0| 65 78 20 6d 6f 64 31 2e | 74 65 78 20 6d 6f 64 32 |ex mod1.|tex mod2|
|000002f0| 2e 74 65 78 20 6d 6f 64 | 33 2e 74 65 78 20 6d 79 |.tex mod|3.tex my|
|00000300| 66 6f 72 6d 61 74 2e 73 | 74 79 0a 58 0a 58 41 4c |format.s|ty.X.XAL|
|00000310| 4c 3d 09 09 74 75 74 2e | 70 73 20 6d 6f 64 2e 70 |L=..tut.|ps mod.p|
|00000320| 73 0a 58 0a 58 61 6c 6c | 3a 09 09 24 28 41 4c 4c |s.X.Xall|:..$(ALL|
|00000330| 29 0a 58 0a 58 70 72 69 | 6e 74 3a 09 09 24 28 41 |).X.Xpri|nt:..$(A|
|00000340| 4c 4c 29 0a 58 09 09 24 | 28 50 52 49 4e 54 29 20 |LL).X..$|(PRINT) |
|00000350| 24 28 41 4c 4c 29 0a 58 | 0a 58 63 6c 65 61 6e 3a |$(ALL).X|.Xclean:|
|00000360| 0a 58 09 09 72 6d 20 2d | 66 20 2a 2e 64 76 69 20 |.X..rm -|f *.dvi |
|00000370| 2a 2e 61 75 78 20 2a 2e | 74 6f 63 20 2a 2e 6c 6f |*.aux *.|toc *.lo|
|00000380| 67 20 2a 2e 70 73 20 63 | 6f 72 65 20 5b 23 40 2c |g *.ps c|ore [#@,|
|00000390| 5d 2a 20 2a 7e 0a 58 0a | 58 2e 53 55 46 46 49 58 |]* *~.X.|X.SUFFIX|
|000003a0| 45 53 3a 09 23 20 52 65 | 6d 6f 76 65 20 64 65 66 |ES:.# Re|move def|
|000003b0| 61 75 6c 74 20 73 75 66 | 66 69 78 65 73 0a 58 0a |ault suf|fixes.X.|
|000003c0| 58 2e 53 55 46 46 49 58 | 45 53 3a 09 2e 74 65 78 |X.SUFFIX|ES:..tex|
|000003d0| 20 2e 61 75 78 20 2e 74 | 6f 63 20 2e 64 76 69 20 | .aux .t|oc .dvi |
|000003e0| 2e 70 73 0a 58 0a 58 2e | 74 65 78 2e 61 75 78 3a |.ps.X.X.|tex.aux:|
|000003f0| 0a 58 09 09 24 28 4c 41 | 54 45 58 29 20 24 2a 0a |.X..$(LA|TEX) $*.|
|00000400| 58 0a 58 2e 74 65 78 2e | 74 6f 63 3a 0a 58 09 09 |X.X.tex.|toc:.X..|
|00000410| 24 28 4c 41 54 45 58 29 | 20 24 2a 0a 58 0a 58 2e |$(LATEX)| $*.X.X.|
|00000420| 74 65 78 2e 64 76 69 3a | 0a 58 09 09 24 28 4c 41 |tex.dvi:|.X..$(LA|
|00000430| 54 45 58 29 20 24 2a 0a | 58 0a 58 2e 64 76 69 2e |TEX) $*.|X.X.dvi.|
|00000440| 70 73 3a 0a 58 09 09 24 | 28 44 56 49 50 53 29 20 |ps:.X..$|(DVIPS) |
|00000450| 24 2a 20 3e 24 2a 2e 70 | 73 0a 58 0a 58 2e 74 65 |$* >$*.p|s.X.X.te|
|00000460| 78 2e 70 73 3a 0a 58 09 | 09 24 28 4c 41 54 45 58 |x.ps:.X.|.$(LATEX|
|00000470| 29 20 24 2a 0a 58 09 09 | 24 28 44 56 49 50 53 29 |) $*.X..|$(DVIPS)|
|00000480| 20 24 2a 20 3e 24 2a 2e | 70 73 0a 45 4f 46 0a 66 | $* >$*.|ps.EOF.f|
|00000490| 69 0a 69 66 20 74 65 73 | 74 20 2d 73 20 27 64 6f |i.if tes|t -s 'do|
|000004a0| 63 2f 6d 6f 64 32 2e 74 | 65 78 27 0a 74 68 65 6e |c/mod2.t|ex'.then|
|000004b0| 20 65 63 68 6f 20 27 2a | 2a 2a 20 49 20 77 69 6c | echo '*|** I wil|
|000004c0| 6c 20 6e 6f 74 20 6f 76 | 65 72 2d 77 72 69 74 65 |l not ov|er-write|
|000004d0| 20 65 78 69 73 74 69 6e | 67 20 66 69 6c 65 20 64 | existin|g file d|
|000004e0| 6f 63 2f 6d 6f 64 32 2e | 74 65 78 27 0a 65 6c 73 |oc/mod2.|tex'.els|
|000004f0| 65 0a 65 63 68 6f 20 27 | 78 20 2d 20 64 6f 63 2f |e.echo '|x - doc/|
|00000500| 6d 6f 64 32 2e 74 65 78 | 27 0a 73 65 64 20 27 73 |mod2.tex|'.sed 's|
|00000510| 2f 5e 58 2f 2f 27 20 3e | 20 27 64 6f 63 2f 6d 6f |/^X//' >| 'doc/mo|
|00000520| 64 32 2e 74 65 78 27 20 | 3c 3c 20 27 45 4f 46 27 |d2.tex' |<< 'EOF'|
|00000530| 0a 58 5c 73 65 63 74 69 | 6f 6e 7b 42 75 69 6c 74 |.X\secti|on{Built|
|00000540| 2d 69 6e 20 4d 6f 64 75 | 6c 65 73 7d 0a 58 0a 58 |-in Modu|les}.X.X|
|00000550| 54 68 65 20 6d 6f 64 75 | 6c 65 73 20 64 65 73 63 |The modu|les desc|
|00000560| 72 69 62 65 64 20 69 6e | 20 74 68 69 73 20 73 65 |ribed in| this se|
|00000570| 63 74 69 6f 6e 20 61 72 | 65 20 62 75 69 6c 74 20 |ction ar|e built |
|00000580| 69 6e 74 6f 20 74 68 65 | 20 69 6e 74 65 72 70 72 |into the| interpr|
|00000590| 65 74 65 72 2e 0a 58 54 | 68 65 79 20 6d 75 73 74 |eter..XT|hey must|
|000005a0| 20 62 65 20 69 6d 70 6f | 72 74 65 64 20 75 73 69 | be impo|rted usi|
|000005b0| 6e 67 0a 58 7b 5c 74 74 | 20 69 6d 70 6f 72 74 7d |ng.X{\tt| import}|
|000005c0| 2e 0a 58 53 6f 6d 65 20 | 6d 6f 64 75 6c 65 73 20 |..XSome |modules |
|000005d0| 61 72 65 20 6e 6f 74 20 | 61 6c 77 61 79 73 20 61 |are not |always a|
|000005e0| 76 61 69 6c 61 62 6c 65 | 3b 20 69 74 20 69 73 20 |vailable|; it is |
|000005f0| 61 20 63 6f 6e 66 69 67 | 75 72 61 74 69 6f 6e 20 |a config|uration |
|00000600| 6f 70 74 69 6f 6e 20 74 | 6f 0a 58 70 72 6f 76 69 |option t|o.Xprovi|
|00000610| 64 65 20 74 68 65 6d 2e | 0a 58 44 65 74 61 69 6c |de them.|.XDetail|
|00000620| 73 20 61 72 65 20 6c 69 | 73 74 65 64 20 77 69 74 |s are li|sted wit|
|00000630| 68 20 74 68 65 20 64 65 | 73 63 72 69 70 74 69 6f |h the de|scriptio|
|00000640| 6e 73 2c 20 62 75 74 20 | 74 68 65 20 62 65 73 74 |ns, but |the best|
|00000650| 20 77 61 79 20 74 6f 20 | 73 65 65 20 69 66 0a 58 | way to |see if.X|
|00000660| 61 20 6d 6f 64 75 6c 65 | 20 65 78 69 73 74 73 20 |a module| exists |
|00000670| 69 6e 20 61 20 70 61 72 | 74 69 63 75 6c 61 72 20 |in a par|ticular |
|00000680| 69 6d 70 6c 65 6d 65 6e | 74 61 74 69 6f 6e 20 69 |implemen|tation i|
|00000690| 73 20 74 6f 20 61 74 74 | 65 6d 70 74 20 74 6f 20 |s to att|empt to |
|000006a0| 69 6d 70 6f 72 74 0a 58 | 69 74 2e 0a 58 0a 58 5c |import.X|it..X.X\|
|000006b0| 73 75 62 73 65 63 74 69 | 6f 6e 7b 42 75 69 6c 74 |subsecti|on{Built|
|000006c0| 2d 69 6e 20 4d 6f 64 75 | 6c 65 20 7b 5c 74 74 20 |-in Modu|le {\tt |
|000006d0| 73 79 73 7d 7d 0a 58 0a | 58 54 68 69 73 20 6d 6f |sys}}.X.|XThis mo|
|000006e0| 64 75 6c 65 20 70 72 6f | 76 69 64 65 73 20 61 63 |dule pro|vides ac|
|000006f0| 63 65 73 73 20 74 6f 20 | 73 6f 6d 65 20 76 61 72 |cess to |some var|
|00000700| 69 61 62 6c 65 73 20 75 | 73 65 64 20 6f 72 20 6d |iables u|sed or m|
|00000710| 61 69 6e 74 61 69 6e 65 | 64 20 62 79 20 74 68 65 |aintaine|d by the|
|00000720| 0a 58 69 6e 74 65 72 70 | 72 65 74 65 72 20 61 6e |.Xinterp|reter an|
|00000730| 64 20 74 6f 20 66 75 6e | 63 74 69 6f 6e 73 20 74 |d to fun|ctions t|
|00000740| 68 61 74 20 69 6e 74 65 | 72 61 63 74 20 73 74 72 |hat inte|ract str|
|00000750| 6f 6e 67 6c 79 20 77 69 | 74 68 20 74 68 65 20 69 |ongly wi|th the i|
|00000760| 6e 74 65 72 70 72 65 74 | 65 72 2e 0a 58 49 74 20 |nterpret|er..XIt |
|00000770| 69 73 20 61 6c 77 61 79 | 73 20 61 76 61 69 6c 61 |is alway|s availa|
|00000780| 62 6c 65 2e 0a 58 5c 62 | 65 67 69 6e 7b 64 65 73 |ble..X\b|egin{des|
|00000790| 63 72 69 70 74 69 6f 6e | 7d 0a 58 5c 66 75 6e 63 |cription|}.X\func|
|000007a0| 69 74 65 6d 7b 61 72 67 | 76 7d 0a 58 54 68 65 20 |item{arg|v}.XThe |
|000007b0| 6c 69 73 74 20 6f 66 20 | 63 6f 6d 6d 61 6e 64 20 |list of |command |
|000007c0| 6c 69 6e 65 20 61 72 67 | 75 6d 65 6e 74 73 20 70 |line arg|uments p|
|000007d0| 61 73 73 65 64 20 74 6f | 20 61 20 7b 5c 50 79 74 |assed to| a {\Pyt|
|000007e0| 68 6f 6e 7d 20 73 63 72 | 69 70 74 2e 0a 58 7b 5c |hon} scr|ipt..X{\|
|000007f0| 74 74 20 73 79 73 2e 61 | 72 67 76 5b 30 5d 7d 0a |tt sys.a|rgv[0]}.|
|00000800| 58 69 73 20 74 68 65 20 | 73 63 72 69 70 74 20 6e |Xis the |script n|
|00000810| 61 6d 65 2e 0a 58 49 66 | 20 6e 6f 20 73 63 72 69 |ame..XIf| no scri|
|00000820| 70 74 20 6e 61 6d 65 20 | 77 61 73 20 70 61 73 73 |pt name |was pass|
|00000830| 65 64 20 74 6f 20 74 68 | 65 20 7b 5c 50 79 74 68 |ed to th|e {\Pyth|
|00000840| 6f 6e 7d 20 69 6e 74 65 | 72 70 72 65 74 65 72 2c |on} inte|rpreter,|
|00000850| 0a 58 7b 5c 74 74 20 73 | 79 73 2e 61 72 67 76 7d |.X{\tt s|ys.argv}|
|00000860| 0a 58 69 73 20 65 6d 70 | 74 79 2e 0a 58 5c 66 75 |.Xis emp|ty..X\fu|
|00000870| 6e 63 69 74 65 6d 7b 65 | 78 69 74 7d 7b 6e 7d 0a |ncitem{e|xit}{n}.|
|00000880| 58 45 78 69 74 73 20 66 | 72 6f 6d 20 7b 5c 50 79 |XExits f|rom {\Py|
|00000890| 74 68 6f 6e 7d 20 77 69 | 74 68 20 6e 75 6d 65 72 |thon} wi|th numer|
|000008a0| 69 63 20 65 78 69 74 20 | 73 74 61 74 75 73 0a 58 |ic exit |status.X|
|000008b0| 7b 5c 74 74 20 6e 7d 2e | 0a 58 54 68 69 73 20 63 |{\tt n}.|.XThis c|
|000008c0| 6c 6f 73 65 73 20 61 6c | 6c 20 6f 70 65 6e 20 66 |loses al|l open f|
|000008d0| 69 6c 65 73 20 61 6e 64 | 20 70 65 72 66 6f 72 6d |iles and| perform|
|000008e0| 73 20 6f 74 68 65 72 20 | 63 6c 65 61 6e 75 70 2d |s other |cleanup-|
|000008f0| 61 63 74 69 6f 6e 73 20 | 72 65 71 75 69 72 65 64 |actions |required|
|00000900| 20 62 79 0a 58 74 68 65 | 20 69 6e 74 65 72 70 72 | by.Xthe| interpr|
|00000910| 65 74 65 72 20 28 62 75 | 74 0a 58 7b 5c 65 6d 20 |eter (bu|t.X{\em |
|00000920| 66 69 6e 61 6c 6c 79 20 | 63 6c 61 75 73 65 73 7d |finally |clauses}|
|00000930| 0a 58 6f 66 0a 58 7b 5c | 74 74 20 74 72 79 7d 0a |.Xof.X{\|tt try}.|
|00000940| 58 73 74 61 74 65 6d 65 | 6e 74 73 20 61 72 65 20 |Xstateme|nts are |
|00000950| 6e 6f 74 20 65 78 65 63 | 75 74 65 64 21 29 2e 0a |not exec|uted!)..|
|00000960| 58 5c 66 75 6e 63 69 74 | 65 6d 7b 6d 6f 64 75 6c |X\funcit|em{modul|
|00000970| 65 73 7d 0a 58 47 69 76 | 65 73 20 74 68 65 20 6c |es}.XGiv|es the l|
|00000980| 69 73 74 20 6f 66 20 6d | 6f 64 75 6c 65 73 20 74 |ist of m|odules t|
|00000990| 68 61 74 20 68 61 76 65 | 20 61 6c 72 65 61 64 79 |hat have| already|
|000009a0| 20 62 65 65 6e 20 6c 6f | 61 64 65 64 2e 0a 58 54 | been lo|aded..XT|
|000009b0| 68 69 73 20 63 61 6e 20 | 62 65 20 6d 61 6e 69 70 |his can |be manip|
|000009c0| 75 6c 61 74 65 64 20 74 | 6f 20 66 6f 72 63 65 20 |ulated t|o force |
|000009d0| 72 65 6c 6f 61 64 69 6e | 67 20 6f 66 20 6d 6f 64 |reloadin|g of mod|
|000009e0| 75 6c 65 73 20 61 6e 64 | 20 6f 74 68 65 72 20 74 |ules and| other t|
|000009f0| 72 69 63 6b 73 2e 0a 58 | 5c 66 75 6e 63 69 74 65 |ricks..X|\funcite|
|00000a00| 6d 7b 70 61 74 68 7d 0a | 58 41 20 6c 69 73 74 20 |m{path}.|XA list |
|00000a10| 6f 66 20 73 74 72 69 6e | 67 73 20 74 68 61 74 20 |of strin|gs that |
|00000a20| 73 70 65 63 69 66 69 65 | 73 20 74 68 65 20 73 65 |specifie|s the se|
|00000a30| 61 72 63 68 20 70 61 74 | 68 20 66 6f 72 20 6d 6f |arch pat|h for mo|
|00000a40| 64 75 6c 65 73 2e 0a 58 | 49 6e 69 74 69 61 6c 69 |dules..X|Initiali|
|00000a50| 7a 65 64 20 66 72 6f 6d | 20 74 68 65 20 65 6e 76 |zed from| the env|
|00000a60| 69 72 6f 6e 6d 65 6e 74 | 20 76 61 72 69 61 62 6c |ironment| variabl|
|00000a70| 65 20 7b 5c 74 74 20 50 | 59 54 48 4f 4e 50 41 54 |e {\tt P|YTHONPAT|
|00000a80| 48 7d 2c 20 6f 72 20 61 | 6e 0a 58 69 6e 73 74 61 |H}, or a|n.Xinsta|
|00000a90| 6c 6c 61 74 69 6f 6e 2d | 64 65 70 65 6e 64 65 6e |llation-|dependen|
|00000aa0| 74 20 64 65 66 61 75 6c | 74 2e 0a 58 5c 66 75 6e |t defaul|t..X\fun|
|00000ab0| 63 69 74 65 6d 7b 70 73 | 31 2c 7e 70 73 32 7d 0a |citem{ps|1,~ps2}.|
|00000ac0| 58 53 74 72 69 6e 67 73 | 20 73 70 65 63 69 66 79 |XStrings| specify|
|00000ad0| 69 6e 67 20 74 68 65 20 | 70 72 69 6d 61 72 79 20 |ing the |primary |
|00000ae0| 61 6e 64 20 73 65 63 6f | 6e 64 61 72 79 20 70 72 |and seco|ndary pr|
|00000af0| 6f 6d 70 74 20 6f 66 20 | 74 68 65 20 69 6e 74 65 |ompt of |the inte|
|00000b00| 72 70 72 65 74 65 72 2e | 0a 58 54 68 65 73 65 20 |rpreter.|.XThese |
|00000b10| 61 72 65 20 6f 6e 6c 79 | 20 64 65 66 69 6e 65 64 |are only| defined|
|00000b20| 20 69 66 20 74 68 65 20 | 69 6e 74 65 72 70 72 65 | if the |interpre|
|00000b30| 74 65 72 20 69 73 20 69 | 6e 20 69 6e 74 65 72 61 |ter is i|n intera|
|00000b40| 63 74 69 76 65 20 6d 6f | 64 65 2e 0a 58 54 68 65 |ctive mo|de..XThe|
|00000b50| 69 72 20 69 6e 69 74 69 | 61 6c 20 76 61 6c 75 65 |ir initi|al value|
|00000b60| 73 20 69 6e 20 74 68 69 | 73 20 63 61 73 65 20 61 |s in thi|s case a|
|00000b70| 72 65 0a 58 7b 5c 74 74 | 20 27 3e 3e 3e 20 27 7d |re.X{\tt| '>>> '}|
|00000b80| 0a 58 61 6e 64 0a 58 7b | 5c 74 74 20 27 2e 2e 2e |.Xand.X{|\tt '...|
|00000b90| 20 27 7d 2e 0a 58 5c 66 | 75 6e 63 69 74 65 6d 7b | '}..X\f|uncitem{|
|00000ba0| 73 74 64 69 6e 2c 20 73 | 74 64 6f 75 74 2c 20 73 |stdin, s|tdout, s|
|00000bb0| 74 64 65 72 72 7d 0a 58 | 25 2e 62 72 0a 58 46 69 |tderr}.X|%.br.XFi|
|00000bc0| 6c 65 20 6f 62 6a 65 63 | 74 73 20 63 6f 72 72 65 |le objec|ts corre|
|00000bd0| 73 70 6f 6e 64 69 6e 67 | 20 74 6f 20 74 68 65 20 |sponding| to the |
|00000be0| 69 6e 74 65 72 70 72 65 | 74 65 72 27 73 20 73 74 |interpre|ter's st|
|00000bf0| 61 6e 64 61 72 64 20 69 | 6e 70 75 74 2c 20 6f 75 |andard i|nput, ou|
|00000c00| 74 70 75 74 0a 58 61 6e | 64 20 65 72 72 6f 72 20 |tput.Xan|d error |
|00000c10| 73 74 72 65 61 6d 73 2e | 0a 58 7b 5c 74 74 20 73 |streams.|.X{\tt s|
|00000c20| 79 73 2e 73 74 64 69 6e | 7d 0a 58 69 73 20 75 73 |ys.stdin|}.Xis us|
|00000c30| 65 64 20 66 6f 72 20 61 | 6c 6c 20 69 6e 74 65 72 |ed for a|ll inter|
|00000c40| 70 72 65 74 65 72 20 69 | 6e 70 75 74 20 65 78 63 |preter i|nput exc|
|00000c50| 65 70 74 20 66 6f 72 20 | 73 63 72 69 70 74 73 20 |ept for |scripts |
|00000c60| 62 75 74 20 69 6e 63 6c | 75 64 69 6e 67 20 63 61 |but incl|uding ca|
|00000c70| 6c 6c 73 0a 58 74 6f 0a | 58 7b 5c 74 74 20 69 6e |lls.Xto.|X{\tt in|
|00000c80| 70 75 74 28 29 7d 0a 58 | 61 6e 64 0a 58 7b 5c 74 |put()}.X|and.X{\t|
|00000c90| 74 20 72 61 77 5c 5f 69 | 6e 70 75 74 28 29 7d 2e |t raw\_i|nput()}.|
|00000ca0| 0a 58 7b 5c 74 74 20 73 | 79 73 2e 73 74 64 6f 75 |.X{\tt s|ys.stdou|
|00000cb0| 74 7d 0a 58 69 73 20 75 | 73 65 64 20 66 6f 72 20 |t}.Xis u|sed for |
|00000cc0| 74 68 65 20 6f 75 74 70 | 75 74 20 6f 66 0a 58 7b |the outp|ut of.X{|
|00000cd0| 5c 74 74 20 70 72 69 6e | 74 7d 20 61 6e 64 20 65 |\tt prin|t} and e|
|00000ce0| 78 70 72 65 73 73 69 6f | 6e 20 73 74 61 74 65 6d |xpressio|n statem|
|00000cf0| 65 6e 74 73 0a 58 61 6e | 64 20 66 6f 72 20 74 68 |ents.Xan|d for th|
|00000d00| 65 20 70 72 6f 6d 70 74 | 73 20 6f 66 0a 58 7b 5c |e prompt|s of.X{\|
|00000d10| 74 74 20 69 6e 70 75 74 | 28 29 7d 0a 58 61 6e 64 |tt input|()}.Xand|
|00000d20| 0a 58 7b 5c 74 74 20 72 | 61 77 5c 5f 69 6e 70 75 |.X{\tt r|aw\_inpu|
|00000d30| 74 28 29 7d 2e 0a 58 54 | 68 65 20 69 6e 74 65 72 |t()}..XT|he inter|
|00000d40| 70 72 65 74 65 72 27 73 | 20 6f 77 6e 20 70 72 6f |preter's| own pro|
|00000d50| 6d 70 74 73 20 61 6e 64 | 20 69 74 73 20 65 72 72 |mpts and| its err|
|00000d60| 6f 72 20 6d 65 73 73 61 | 67 65 73 20 61 72 65 20 |or messa|ges are |
|00000d70| 77 72 69 74 74 65 6e 20 | 74 6f 0a 58 73 74 64 65 |written |to.Xstde|
|00000d80| 72 72 2e 0a 58 41 73 73 | 69 67 6e 69 6e 67 20 74 |rr..XAss|igning t|
|00000d90| 6f 0a 58 7b 5c 74 74 20 | 73 79 73 2e 73 74 64 65 |o.X{\tt |sys.stde|
|00000da0| 72 72 7d 0a 58 68 61 73 | 20 6e 6f 20 65 66 66 65 |rr}.Xhas| no effe|
|00000db0| 63 74 20 6f 6e 20 74 68 | 65 20 69 6e 74 65 72 70 |ct on th|e interp|
|00000dc0| 72 65 74 65 72 3b 20 69 | 74 20 63 61 6e 20 62 65 |reter; i|t can be|
|00000dd0| 20 75 73 65 64 20 74 6f | 20 77 72 69 74 65 20 65 | used to| write e|
|00000de0| 72 72 6f 72 20 6d 65 73 | 73 61 67 65 73 0a 58 74 |rror mes|sages.Xt|
|00000df0| 6f 20 73 74 64 65 72 72 | 20 75 73 69 6e 67 0a 58 |o stderr| using.X|
|00000e00| 7b 5c 74 74 20 70 72 69 | 6e 74 7d 2e 0a 58 5c 65 |{\tt pri|nt}..X\e|
|00000e10| 6e 64 7b 64 65 73 63 72 | 69 70 74 69 6f 6e 7d 0a |nd{descr|iption}.|
|00000e20| 58 0a 58 5c 73 75 62 73 | 65 63 74 69 6f 6e 7b 42 |X.X\subs|ection{B|
|00000e30| 75 69 6c 74 2d 69 6e 20 | 4d 6f 64 75 6c 65 20 7b |uilt-in |Module {|
|00000e40| 5c 74 74 20 6d 61 74 68 | 7d 7d 0a 58 0a 58 54 68 |\tt math|}}.X.XTh|
|00000e50| 69 73 20 6d 6f 64 75 6c | 65 20 69 73 20 61 6c 77 |is modul|e is alw|
|00000e60| 61 79 73 20 61 76 61 69 | 6c 61 62 6c 65 2e 0a 58 |ays avai|lable..X|
|00000e70| 49 74 20 70 72 6f 76 69 | 64 65 73 20 61 63 63 65 |It provi|des acce|
|00000e80| 73 73 20 74 6f 20 74 68 | 65 20 6d 61 74 68 65 6d |ss to th|e mathem|
|00000e90| 61 74 69 63 61 6c 20 66 | 75 6e 63 74 69 6f 6e 73 |atical f|unctions|
|00000ea0| 20 64 65 66 69 6e 65 64 | 20 62 79 20 74 68 65 20 | defined| by the |
|00000eb0| 43 0a 58 73 74 61 6e 64 | 61 72 64 2e 0a 58 54 68 |C.Xstand|ard..XTh|
|00000ec0| 65 79 20 61 72 65 3a 0a | 58 7b 5c 74 74 20 61 63 |ey are:.|X{\tt ac|
|00000ed0| 6f 73 28 78 29 7d 2c 0a | 58 7b 5c 74 74 20 61 73 |os(x)},.|X{\tt as|
|00000ee0| 69 6e 28 78 29 7d 2c 0a | 58 7b 5c 74 74 20 61 74 |in(x)},.|X{\tt at|
|00000ef0| 61 6e 28 78 29 7d 2c 0a | 58 7b 5c 74 74 20 61 74 |an(x)},.|X{\tt at|
|00000f00| 61 6e 32 28 78 2c 79 29 | 7d 2c 0a 58 7b 5c 74 74 |an2(x,y)|},.X{\tt|
|00000f10| 20 63 65 69 6c 28 78 29 | 7d 2c 0a 58 7b 5c 74 74 | ceil(x)|},.X{\tt|
|00000f20| 20 63 6f 73 28 78 29 7d | 2c 0a 58 7b 5c 74 74 20 | cos(x)}|,.X{\tt |
|00000f30| 63 6f 73 68 28 78 29 7d | 2c 0a 58 7b 5c 74 74 20 |cosh(x)}|,.X{\tt |
|00000f40| 65 78 70 28 78 29 7d 2c | 0a 58 7b 5c 74 74 20 66 |exp(x)},|.X{\tt f|
|00000f50| 61 62 73 28 78 29 7d 2c | 0a 58 7b 5c 74 74 20 66 |abs(x)},|.X{\tt f|
|00000f60| 6c 6f 6f 72 28 78 29 7d | 2c 0a 58 25 7b 5c 74 74 |loor(x)}|,.X%{\tt|
|00000f70| 20 66 6d 6f 64 28 2e 2e | 2e 29 7d 20 20 58 58 58 | fmod(..|.)} XXX|
|00000f80| 20 6e 6f 74 20 79 65 74 | 0a 58 25 7b 5c 74 74 20 | not yet|.X%{\tt |
|00000f90| 66 72 65 78 70 28 2e 2e | 2e 29 7d 20 58 58 58 20 |frexp(..|.)} XXX |
|00000fa0| 6e 6f 74 20 79 65 74 0a | 58 25 7b 5c 74 74 20 6c |not yet.|X%{\tt l|
|00000fb0| 64 65 78 70 28 2e 2e 2e | 29 7d 20 58 58 58 20 6e |dexp(...|)} XXX n|
|00000fc0| 6f 74 20 79 65 74 0a 58 | 7b 5c 74 74 20 6c 6f 67 |ot yet.X|{\tt log|
|00000fd0| 28 78 29 7d 2c 0a 58 7b | 5c 74 74 20 6c 6f 67 31 |(x)},.X{|\tt log1|
|00000fe0| 30 28 78 29 7d 2c 0a 58 | 25 7b 5c 74 74 20 6d 6f |0(x)},.X|%{\tt mo|
|00000ff0| 64 66 28 2e 2e 2e 29 7d | 20 20 58 58 58 20 6e 6f |df(...)}| XXX no|
|00001000| 74 20 79 65 74 0a 58 7b | 5c 74 74 20 70 6f 77 28 |t yet.X{|\tt pow(|
|00001010| 78 2c 79 29 7d 2c 0a 58 | 7b 5c 74 74 20 73 69 6e |x,y)},.X|{\tt sin|
|00001020| 28 78 29 7d 2c 0a 58 7b | 5c 74 74 20 73 69 6e 68 |(x)},.X{|\tt sinh|
|00001030| 28 78 29 7d 2c 0a 58 7b | 5c 74 74 20 73 71 72 74 |(x)},.X{|\tt sqrt|
|00001040| 28 78 29 7d 2c 0a 58 7b | 5c 74 74 20 74 61 6e 28 |(x)},.X{|\tt tan(|
|00001050| 78 29 7d 2c 0a 58 7b 5c | 74 74 20 74 61 6e 68 28 |x)},.X{\|tt tanh(|
|00001060| 78 29 7d 2e 0a 58 0a 58 | 49 74 20 61 6c 73 6f 20 |x)}..X.X|It also |
|00001070| 64 65 66 69 6e 65 73 20 | 74 77 6f 20 6d 61 74 68 |defines |two math|
|00001080| 65 6d 61 74 69 63 61 6c | 20 63 6f 6e 73 74 61 6e |ematical| constan|
|00001090| 74 73 3a 0a 58 7b 5c 74 | 74 20 70 69 7d 0a 58 61 |ts:.X{\t|t pi}.Xa|
|000010a0| 6e 64 0a 58 7b 5c 74 74 | 20 65 7d 2e 0a 58 0a 58 |nd.X{\tt| e}..X.X|
|000010b0| 5c 73 75 62 73 65 63 74 | 69 6f 6e 7b 42 75 69 6c |\subsect|ion{Buil|
|000010c0| 74 2d 69 6e 20 4d 6f 64 | 75 6c 65 20 7b 5c 74 74 |t-in Mod|ule {\tt|
|000010d0| 20 74 69 6d 65 7d 7d 0a | 58 0a 58 54 68 69 73 20 | time}}.|X.XThis |
|000010e0| 6d 6f 64 75 6c 65 20 70 | 72 6f 76 69 64 65 73 20 |module p|rovides |
|000010f0| 76 61 72 69 6f 75 73 20 | 74 69 6d 65 2d 72 65 6c |various |time-rel|
|00001100| 61 74 65 64 20 66 75 6e | 63 74 69 6f 6e 73 2e 0a |ated fun|ctions..|
|00001110| 58 49 74 20 69 73 20 61 | 6c 77 61 79 73 20 61 76 |XIt is a|lways av|
|00001120| 61 69 6c 61 62 6c 65 2e | 0a 58 46 75 6e 63 74 69 |ailable.|.XFuncti|
|00001130| 6f 6e 73 20 61 72 65 3a | 0a 58 5c 62 65 67 69 6e |ons are:|.X\begin|
|00001140| 7b 64 65 73 63 72 69 70 | 74 69 6f 6e 7d 0a 58 5c |{descrip|tion}.X\|
|00001150| 66 75 6e 63 69 74 65 6d | 7b 73 6c 65 65 70 7d 7b |funcitem|{sleep}{|
|00001160| 73 65 63 73 7d 0a 58 53 | 75 73 70 65 6e 64 73 20 |secs}.XS|uspends |
|00001170| 65 78 65 63 75 74 69 6f | 6e 20 66 6f 72 20 74 68 |executio|n for th|
|00001180| 65 20 67 69 76 65 6e 20 | 6e 75 6d 62 65 72 20 6f |e given |number o|
|00001190| 66 20 73 65 63 6f 6e 64 | 73 2e 0a 58 5c 66 75 6e |f second|s..X\fun|
|000011a0| 63 69 74 65 6d 7b 74 69 | 6d 65 7d 7b 7d 0a 58 52 |citem{ti|me}{}.XR|
|000011b0| 65 74 75 72 6e 73 20 74 | 68 65 20 74 69 6d 65 20 |eturns t|he time |
|000011c0| 69 6e 20 73 65 63 6f 6e | 64 73 20 73 69 6e 63 65 |in secon|ds since|
|000011d0| 20 74 68 65 20 45 70 6f | 63 68 20 28 54 68 75 72 | the Epo|ch (Thur|
|000011e0| 73 64 61 79 20 4a 61 6e | 75 61 72 79 20 31 2c 0a |sday Jan|uary 1,.|
|000011f0| 58 30 30 3a 30 30 3a 30 | 30 2c 20 31 39 37 30 20 |X00:00:0|0, 1970 |
|00001200| 55 43 54 20 6f 6e 20 5c | 55 4e 49 58 5c 20 6d 61 |UCT on \|UNIX\ ma|
|00001210| 63 68 69 6e 65 73 29 2e | 0a 58 5c 65 6e 64 7b 64 |chines).|.X\end{d|
|00001220| 65 73 63 72 69 70 74 69 | 6f 6e 7d 0a 58 0a 58 5c |escripti|on}.X.X\|
|00001230| 6e 6f 69 6e 64 65 6e 74 | 0a 58 49 6e 20 73 6f 6d |noindent|.XIn som|
|00001240| 65 20 76 65 72 73 69 6f | 6e 73 20 28 41 6d 6f 65 |e versio|ns (Amoe|
|00001250| 62 61 2c 20 4d 61 63 29 | 20 74 68 65 20 66 6f 6c |ba, Mac)| the fol|
|00001260| 6c 6f 77 69 6e 67 20 66 | 75 6e 63 74 69 6f 6e 73 |lowing f|unctions|
|00001270| 20 61 6c 73 6f 20 65 78 | 69 73 74 3a 0a 58 5c 62 | also ex|ist:.X\b|
|00001280| 65 67 69 6e 7b 64 65 73 | 63 72 69 70 74 69 6f 6e |egin{des|cription|
|00001290| 7d 0a 58 5c 66 75 6e 63 | 69 74 65 6d 7b 6d 69 6c |}.X\func|item{mil|
|000012a0| 6c 69 73 6c 65 65 70 7d | 7b 6d 73 65 63 73 7d 0a |lisleep}|{msecs}.|
|000012b0| 58 53 75 73 70 65 6e 64 | 73 20 65 78 65 63 75 74 |XSuspend|s execut|
|000012c0| 69 6f 6e 20 66 6f 72 20 | 74 68 65 20 67 69 76 65 |ion for |the give|
|000012d0| 6e 20 6e 75 6d 62 65 72 | 20 6f 66 20 6d 69 6c 6c |n number| of mill|
|000012e0| 69 73 65 63 6f 6e 64 73 | 2e 0a 58 5c 66 75 6e 63 |iseconds|..X\func|
|000012f0| 69 74 65 6d 7b 6d 69 6c | 6c 69 74 69 6d 65 72 7d |item{mil|litimer}|
|00001300| 7b 7d 0a 58 52 65 74 75 | 72 6e 73 20 74 68 65 20 |{}.XRetu|rns the |
|00001310| 6e 75 6d 62 65 72 20 6f | 66 20 6d 69 6c 6c 69 73 |number o|f millis|
|00001320| 65 63 6f 6e 64 73 20 6f | 66 20 72 65 61 6c 20 74 |econds o|f real t|
|00001330| 69 6d 65 20 65 6c 61 70 | 73 65 64 20 73 69 6e 63 |ime elap|sed sinc|
|00001340| 65 20 73 6f 6d 65 20 70 | 6f 69 6e 74 0a 58 69 6e |e some p|oint.Xin|
|00001350| 20 74 68 65 20 70 61 73 | 74 20 74 68 61 74 20 69 | the pas|t that i|
|00001360| 73 20 66 69 78 65 64 20 | 70 65 72 20 65 78 65 63 |s fixed |per exec|
|00001370| 75 74 69 6f 6e 20 6f 66 | 20 74 68 65 20 70 79 74 |ution of| the pyt|
|00001380| 68 6f 6e 20 69 6e 74 65 | 72 70 72 65 74 65 72 20 |hon inte|rpreter |
|00001390| 28 62 75 74 0a 58 6d 61 | 79 20 63 68 61 6e 67 65 |(but.Xma|y change|
|000013a0| 20 69 6e 20 65 61 63 68 | 20 66 6f 6c 6c 6f 77 69 | in each| followi|
|000013b0| 6e 67 20 72 75 6e 29 2e | 0a 58 5c 65 6e 64 7b 64 |ng run).|.X\end{d|
|000013c0| 65 73 63 72 69 70 74 69 | 6f 6e 7d 0a 58 0a 58 5c |escripti|on}.X.X\|
|000013d0| 6e 6f 69 6e 64 65 6e 74 | 0a 58 54 68 65 20 67 72 |noindent|.XThe gr|
|000013e0| 61 6e 75 6c 61 72 69 74 | 79 20 6f 66 20 74 68 65 |anularit|y of the|
|000013f0| 20 6d 69 6c 6c 69 73 65 | 63 6f 6e 64 73 20 66 75 | millise|conds fu|
|00001400| 6e 63 74 69 6f 6e 73 20 | 6d 61 79 20 62 65 20 6d |nctions |may be m|
|00001410| 6f 72 65 20 74 68 61 6e | 20 61 0a 58 6d 69 6c 6c |ore than| a.Xmill|
|00001420| 69 73 65 63 6f 6e 64 20 | 28 31 30 30 20 6d 73 65 |isecond |(100 mse|
|00001430| 63 73 20 6f 6e 20 41 6d | 6f 65 62 61 2c 20 31 2f |cs on Am|oeba, 1/|
|00001440| 36 30 20 73 65 63 20 6f | 6e 20 74 68 65 20 4d 61 |60 sec o|n the Ma|
|00001450| 63 29 2e 0a 58 0a 58 5c | 73 75 62 73 65 63 74 69 |c)..X.X\|subsecti|
|00001460| 6f 6e 7b 42 75 69 6c 74 | 2d 69 6e 20 4d 6f 64 75 |on{Built|-in Modu|
|00001470| 6c 65 20 7b 5c 74 74 20 | 72 65 67 65 78 70 7d 7d |le {\tt |regexp}}|
|00001480| 0a 58 0a 58 54 68 69 73 | 20 6d 6f 64 75 6c 65 20 |.X.XThis| module |
|00001490| 70 72 6f 76 69 64 65 73 | 20 61 20 72 65 67 75 6c |provides| a regul|
|000014a0| 61 72 20 65 78 70 72 65 | 73 73 69 6f 6e 20 6d 61 |ar expre|ssion ma|
|000014b0| 74 63 68 69 6e 67 20 6f | 70 65 72 61 74 69 6f 6e |tching o|peration|
|000014c0| 2e 0a 58 49 74 20 69 73 | 20 61 6c 77 61 79 73 20 |..XIt is| always |
|000014d0| 61 76 61 69 6c 61 62 6c | 65 2e 0a 58 0a 58 54 68 |availabl|e..X.XTh|
|000014e0| 65 20 6d 6f 64 75 6c 65 | 20 64 65 66 69 6e 65 73 |e module| defines|
|000014f0| 20 61 20 66 75 6e 63 74 | 69 6f 6e 20 61 6e 64 20 | a funct|ion and |
|00001500| 61 6e 20 65 78 63 65 70 | 74 69 6f 6e 3a 0a 58 0a |an excep|tion:.X.|
|00001510| 58 5c 62 65 67 69 6e 7b | 64 65 73 63 72 69 70 74 |X\begin{|descript|
|00001520| 69 6f 6e 7d 0a 58 0a 58 | 5c 66 75 6e 63 69 74 65 |ion}.X.X|\funcite|
|00001530| 6d 7b 63 6f 6d 70 69 6c | 65 7d 7b 70 61 74 74 65 |m{compil|e}{patte|
|00001540| 72 6e 7d 0a 58 0a 58 43 | 6f 6d 70 69 6c 65 20 61 |rn}.X.XC|ompile a|
|00001550| 20 72 65 67 75 6c 61 72 | 20 65 78 70 72 65 73 73 | regular| express|
|00001560| 69 6f 6e 20 67 69 76 65 | 6e 20 61 73 20 61 20 73 |ion give|n as a s|
|00001570| 74 72 69 6e 67 20 69 6e | 74 6f 20 61 20 72 65 67 |tring in|to a reg|
|00001580| 75 6c 61 72 0a 58 65 78 | 70 72 65 73 73 69 6f 6e |ular.Xex|pression|
|00001590| 20 6f 62 6a 65 63 74 2e | 0a 58 54 68 65 20 73 74 | object.|.XThe st|
|000015a0| 72 69 6e 67 20 6d 75 73 | 74 20 62 65 20 61 6e 20 |ring mus|t be an |
|000015b0| 65 67 72 65 70 2d 73 74 | 79 6c 65 20 72 65 67 75 |egrep-st|yle regu|
|000015c0| 6c 61 72 20 65 78 70 72 | 65 73 73 69 6f 6e 3b 0a |lar expr|ession;.|
|000015d0| 58 74 68 69 73 20 6d 65 | 61 6e 73 20 74 68 61 74 |Xthis me|ans that|
|000015e0| 20 74 68 65 20 63 68 61 | 72 61 63 74 65 72 73 0a | the cha|racters.|
|000015f0| 58 7b 5c 74 74 20 27 28 | 27 20 27 29 27 20 27 2a |X{\tt '(|' ')' '*|
|00001600| 27 20 27 2b 27 20 27 3f | 27 5c 20 27 7c 27 20 7d |' '+' '?|'\ '|' }|
|00001610| 5c 76 65 72 62 3d 27 5e | 27 20 27 24 27 3d 0a 58 |\verb='^|' '$'=.X|
|00001620| 61 72 65 20 73 70 65 63 | 69 61 6c 2e 0a 58 28 49 |are spec|ial..X(I|
|00001630| 74 20 69 73 20 69 6d 70 | 6c 65 6d 65 6e 74 65 64 |t is imp|lemented|
|00001640| 20 75 73 69 6e 67 20 48 | 65 6e 72 79 20 53 70 65 | using H|enry Spe|
|00001650| 6e 63 65 72 27 73 20 72 | 65 67 75 6c 61 72 20 65 |ncer's r|egular e|
|00001660| 78 70 72 65 73 73 69 6f | 6e 20 6d 61 74 63 68 69 |xpressio|n matchi|
|00001670| 6e 67 0a 58 66 75 6e 63 | 74 69 6f 6e 73 2e 29 0a |ng.Xfunc|tions.).|
|00001680| 58 0a 58 65 78 63 69 74 | 65 6d 7b 65 72 72 6f 72 |X.Xexcit|em{error|
|00001690| 7d 7b 72 65 67 65 78 70 | 2e 65 72 72 6f 72 7d 0a |}{regexp|.error}.|
|000016a0| 58 0a 58 45 78 63 65 70 | 74 69 6f 6e 20 72 61 69 |X.XExcep|tion rai|
|000016b0| 73 65 64 20 77 68 65 6e | 20 61 20 73 74 72 69 6e |sed when| a strin|
|000016c0| 67 20 70 61 73 73 65 64 | 20 74 6f 20 7b 5c 74 74 |g passed| to {\tt|
|000016d0| 20 63 6f 6d 70 69 6c 65 | 28 29 7d 20 69 73 20 6e | compile|()} is n|
|000016e0| 6f 74 20 61 0a 58 76 61 | 6c 69 64 20 72 65 67 75 |ot a.Xva|lid regu|
|000016f0| 6c 61 72 20 65 78 70 72 | 65 73 73 69 6f 6e 20 28 |lar expr|ession (|
|00001700| 65 2e 67 2e 2c 20 75 6e | 6d 61 74 63 68 65 64 20 |e.g., un|matched |
|00001710| 70 61 72 65 6e 74 68 65 | 73 65 73 29 20 6f 72 20 |parenthe|ses) or |
|00001720| 77 68 65 6e 20 73 6f 6d | 65 20 6f 74 68 65 72 0a |when som|e other.|
|00001730| 58 65 72 72 6f 72 20 6f | 63 63 75 72 73 20 64 75 |Xerror o|ccurs du|
|00001740| 72 69 6e 67 20 63 6f 6d | 70 69 6c 61 74 69 6f 6e |ring com|pilation|
|00001750| 20 6f 72 20 6d 61 74 63 | 68 69 6e 67 0a 58 28 60 | or matc|hing.X(`|
|00001760| 60 6e 6f 20 6d 61 74 63 | 68 20 66 6f 75 6e 64 27 |`no matc|h found'|
|00001770| 27 20 69 73 20 6e 6f 74 | 20 61 6e 20 65 72 72 6f |' is not| an erro|
|00001780| 72 29 2e 0a 58 0a 58 5c | 65 6e 64 7b 64 65 73 63 |r)..X.X\|end{desc|
|00001790| 72 69 70 74 69 6f 6e 7d | 0a 58 0a 58 43 6f 6d 70 |ription}|.X.XComp|
|000017a0| 69 6c 65 64 20 72 65 67 | 75 6c 61 72 20 65 78 70 |iled reg|ular exp|
|000017b0| 72 65 73 73 69 6f 6e 20 | 6f 62 6a 65 63 74 73 20 |ression |objects |
|000017c0| 73 75 70 70 6f 72 74 20 | 61 20 73 69 6e 67 6c 65 |support |a single|
|000017d0| 20 6d 65 74 68 6f 64 3a | 0a 58 0a 58 5c 62 65 67 | method:|.X.X\beg|
|000017e0| 69 6e 7b 64 65 73 63 72 | 69 70 74 69 6f 6e 7d 0a |in{descr|iption}.|
|000017f0| 58 0a 58 5c 66 75 6e 63 | 69 74 65 6d 7b 65 78 65 |X.X\func|item{exe|
|00001800| 63 7d 7b 73 74 72 7d 0a | 58 0a 58 46 69 6e 64 20 |c}{str}.|X.XFind |
|00001810| 74 68 65 20 66 69 72 73 | 74 20 6f 63 63 75 72 72 |the firs|t occurr|
|00001820| 65 6e 63 65 20 6f 66 20 | 74 68 65 20 63 6f 6d 70 |ence of |the comp|
|00001830| 69 6c 65 64 20 72 65 67 | 75 6c 61 72 20 65 78 70 |iled reg|ular exp|
|00001840| 72 65 73 73 69 6f 6e 20 | 69 6e 20 74 68 65 0a 58 |ression |in the.X|
|00001850| 73 74 72 69 6e 67 20 7b | 5c 74 74 20 73 74 72 7d |string {|\tt str}|
|00001860| 2e 0a 58 54 68 65 20 72 | 65 74 75 72 6e 20 76 61 |..XThe r|eturn va|
|00001870| 6c 75 65 20 69 73 20 61 | 20 74 75 70 6c 65 20 6f |lue is a| tuple o|
|00001880| 66 20 70 61 69 72 73 20 | 73 70 65 63 69 66 79 69 |f pairs |specifyi|
|00001890| 6e 67 20 77 68 65 72 65 | 20 61 20 6d 61 74 63 68 |ng where| a match|
|000018a0| 20 77 61 73 0a 58 66 6f | 75 6e 64 20 61 6e 64 20 | was.Xfo|und and |
|000018b0| 77 68 65 72 65 20 6d 61 | 74 63 68 65 73 20 77 65 |where ma|tches we|
|000018c0| 72 65 20 66 6f 75 6e 64 | 20 66 6f 72 20 73 75 62 |re found| for sub|
|000018d0| 70 61 74 74 65 72 6e 73 | 20 73 70 65 63 69 66 69 |patterns| specifi|
|000018e0| 65 64 20 77 69 74 68 0a | 58 7b 5c 74 74 20 27 28 |ed with.|X{\tt '(|
|000018f0| 27 7d 20 61 6e 64 20 7b | 5c 74 74 20 27 29 27 7d |'} and {|\tt ')'}|
|00001900| 20 69 6e 20 74 68 65 20 | 70 61 74 74 65 72 6e 2e | in the |pattern.|
|00001910| 0a 58 49 66 20 6e 6f 20 | 6d 61 74 63 68 20 69 73 |.XIf no |match is|
|00001920| 20 66 6f 75 6e 64 2c 20 | 61 6e 20 65 6d 70 74 79 | found, |an empty|
|00001930| 20 74 75 70 6c 65 20 69 | 73 20 72 65 74 75 72 6e | tuple i|s return|
|00001940| 65 64 3b 20 6f 74 68 65 | 72 77 69 73 65 20 74 68 |ed; othe|rwise th|
|00001950| 65 20 66 69 72 73 74 0a | 58 69 74 65 6d 20 6f 66 |e first.|Xitem of|
|00001960| 20 74 68 65 20 74 75 70 | 6c 65 20 69 73 20 61 20 | the tup|le is a |
|00001970| 70 61 69 72 20 6f 66 20 | 73 6c 69 63 65 20 69 6e |pair of |slice in|
|00001980| 64 69 63 65 73 20 69 6e | 74 6f 20 74 68 65 20 73 |dices in|to the s|
|00001990| 65 61 72 63 68 20 73 74 | 72 69 6e 67 0a 58 67 69 |earch st|ring.Xgi|
|000019a0| 76 69 6e 67 20 74 68 65 | 20 6d 61 74 63 68 20 66 |ving the| match f|
|000019b0| 6f 75 6e 64 2e 0a 58 49 | 66 20 74 68 65 72 65 20 |ound..XI|f there |
|000019c0| 77 65 72 65 20 61 6e 79 | 20 73 75 62 70 61 74 74 |were any| subpatt|
|000019d0| 65 72 6e 73 20 69 6e 20 | 74 68 65 20 70 61 74 74 |erns in |the patt|
|000019e0| 65 72 6e 2c 20 74 68 65 | 20 72 65 74 75 72 6e 65 |ern, the| returne|
|000019f0| 64 20 74 75 70 6c 65 20 | 68 61 73 20 61 6e 0a 58 |d tuple |has an.X|
|00001a00| 61 64 64 69 74 69 6f 6e | 61 6c 20 69 74 65 6d 20 |addition|al item |
|00001a10| 66 6f 72 20 65 61 63 68 | 20 73 75 62 70 61 74 74 |for each| subpatt|
|00001a20| 65 72 6e 2c 20 67 69 76 | 69 6e 67 20 74 68 65 20 |ern, giv|ing the |
|00001a30| 73 6c 69 63 65 20 69 6e | 64 69 63 65 73 20 69 6e |slice in|dices in|
|00001a40| 74 6f 20 74 68 65 0a 58 | 73 65 61 72 63 68 20 73 |to the.X|search s|
|00001a50| 74 72 69 6e 67 20 77 68 | 65 72 65 20 74 68 61 74 |tring wh|ere that|
|00001a60| 20 73 75 62 70 61 74 74 | 65 72 6e 20 77 61 73 20 | subpatt|ern was |
|00001a70| 66 6f 75 6e 64 2e 0a 58 | 0a 58 5c 65 6e 64 7b 64 |found..X|.X\end{d|
|00001a80| 65 73 63 72 69 70 74 69 | 6f 6e 7d 0a 58 0a 58 46 |escripti|on}.X.XF|
|00001a90| 6f 72 20 65 78 61 6d 70 | 6c 65 3a 0a 58 5c 62 63 |or examp|le:.X\bc|
|00001aa0| 6f 64 65 5c 62 65 67 69 | 6e 7b 76 65 72 62 61 74 |ode\begi|n{verbat|
|00001ab0| 69 6d 7d 0a 58 3e 3e 3e | 20 69 6d 70 6f 72 74 20 |im}.X>>>| import |
|00001ac0| 72 65 67 65 78 70 0a 58 | 3e 3e 3e 20 72 20 3d 20 |regexp.X|>>> r = |
|00001ad0| 72 65 67 65 78 70 2e 63 | 6f 6d 70 69 6c 65 28 27 |regexp.c|ompile('|
|00001ae0| 2d 2d 28 2e 2a 29 2d 2d | 27 29 0a 58 3e 3e 3e 20 |--(.*)--|').X>>> |
|00001af0| 73 20 3d 20 27 61 2d 2d | 62 2d 2d 63 27 0a 58 3e |s = 'a--|b--c'.X>|
|00001b00| 3e 3e 20 72 2e 65 78 65 | 63 28 73 29 0a 58 28 28 |>> r.exe|c(s).X((|
|00001b10| 31 2c 20 36 29 2c 20 28 | 33 2c 20 34 29 29 0a 58 |1, 6), (|3, 4)).X|
|00001b20| 3e 3e 3e 20 73 5b 31 3a | 36 5d 20 23 20 54 68 65 |>>> s[1:|6] # The|
|00001b30| 20 65 6e 74 69 72 65 20 | 6d 61 74 63 68 0a 58 27 | entire |match.X'|
|00001b40| 2d 2d 62 2d 2d 27 0a 58 | 3e 3e 3e 20 73 5b 33 3a |--b--'.X|>>> s[3:|
|00001b50| 34 5d 20 23 20 54 68 65 | 20 73 75 62 70 61 74 74 |4] # The| subpatt|
|00001b60| 65 72 6e 0a 58 27 62 27 | 0a 58 3e 3e 3e 20 0a 58 |ern.X'b'|.X>>> .X|
|00001b70| 5c 65 6e 64 7b 76 65 72 | 62 61 74 69 6d 7d 5c 65 |\end{ver|batim}\e|
|00001b80| 63 6f 64 65 0a 58 0a 58 | 5c 73 75 62 73 65 63 74 |code.X.X|\subsect|
|00001b90| 69 6f 6e 7b 42 75 69 6c | 74 2d 69 6e 20 4d 6f 64 |ion{Buil|t-in Mod|
|00001ba0| 75 6c 65 20 7b 5c 74 74 | 20 70 6f 73 69 78 7d 7d |ule {\tt| posix}}|
|00001bb0| 0a 58 0a 58 54 68 69 73 | 20 6d 6f 64 75 6c 65 20 |.X.XThis| module |
|00001bc0| 70 72 6f 76 69 64 65 73 | 20 61 63 63 65 73 73 20 |provides| access |
|00001bd0| 74 6f 20 6f 70 65 72 61 | 74 69 6e 67 20 73 79 73 |to opera|ting sys|
|00001be0| 74 65 6d 20 66 75 6e 63 | 74 69 6f 6e 61 6c 69 74 |tem func|tionalit|
|00001bf0| 79 20 74 68 61 74 20 69 | 73 0a 58 73 74 61 6e 64 |y that i|s.Xstand|
|00001c00| 61 72 64 69 7a 65 64 20 | 62 79 20 74 68 65 20 43 |ardized |by the C|
|00001c10| 20 53 74 61 6e 64 61 72 | 64 20 61 6e 64 20 74 68 | Standar|d and th|
|00001c20| 65 20 50 4f 53 49 58 20 | 73 74 61 6e 64 61 72 64 |e POSIX |standard|
|00001c30| 20 28 61 20 74 68 69 6e | 6c 79 20 64 69 67 75 69 | (a thin|ly digui|
|00001c40| 73 65 64 0a 58 7b 5c 55 | 4e 49 58 7d 20 69 6e 74 |sed.X{\U|NIX} int|
|00001c50| 65 72 66 61 63 65 29 2e | 0a 58 49 74 20 69 73 20 |erface).|.XIt is |
|00001c60| 61 76 61 69 6c 61 62 6c | 65 20 69 6e 20 61 6c 6c |availabl|e in all|
|00001c70| 20 7b 5c 50 79 74 68 6f | 6e 7d 20 76 65 72 73 69 | {\Pytho|n} versi|
|00001c80| 6f 6e 73 20 65 78 63 65 | 70 74 20 6f 6e 20 74 68 |ons exce|pt on th|
|00001c90| 65 20 4d 61 63 69 6e 74 | 6f 73 68 2e 0a 58 45 72 |e Macint|osh..XEr|
|00001ca0| 72 6f 72 73 20 61 72 65 | 20 72 65 70 6f 72 74 65 |rors are| reporte|
|00001cb0| 64 20 65 78 63 65 70 74 | 69 6f 6e 73 2e 0a 58 49 |d except|ions..XI|
|00001cc0| 74 20 64 65 66 69 6e 65 | 73 20 74 68 65 20 66 6f |t define|s the fo|
|00001cd0| 6c 6c 6f 77 69 6e 67 20 | 69 74 65 6d 73 3a 0a 58 |llowing |items:.X|
|00001ce0| 5c 62 65 67 69 6e 7b 64 | 65 73 63 72 69 70 74 69 |\begin{d|escripti|
|00001cf0| 6f 6e 7d 0a 58 5c 66 75 | 6e 63 69 74 65 6d 7b 63 |on}.X\fu|ncitem{c|
|00001d00| 68 64 69 72 7d 7b 70 61 | 74 68 7d 0a 58 43 68 61 |hdir}{pa|th}.XCha|
|00001d10| 6e 67 65 73 20 74 68 65 | 20 63 75 72 72 65 6e 74 |nges the| current|
|00001d20| 20 64 69 72 65 63 74 6f | 72 79 20 74 6f 0a 58 7b | directo|ry to.X{|
|00001d30| 5c 74 74 20 70 61 74 68 | 7d 2e 0a 58 5c 66 75 6e |\tt path|}..X\fun|
|00001d40| 63 69 74 65 6d 7b 63 68 | 6d 6f 64 7d 7b 70 61 74 |citem{ch|mod}{pat|
|00001d50| 68 2c 20 6d 6f 64 65 7d | 0a 58 43 68 61 6e 67 65 |h, mode}|.XChange|
|00001d60| 20 74 68 65 20 6d 6f 64 | 65 20 6f 66 0a 58 7b 5c | the mod|e of.X{\|
|00001d70| 74 74 20 70 61 74 68 7d | 0a 58 74 6f 20 74 68 65 |tt path}|.Xto the|
|00001d80| 20 6e 75 6d 65 72 69 63 | 0a 58 7b 5c 74 74 20 6d | numeric|.X{\tt m|
|00001d90| 6f 64 65 7d 2e 0a 58 5c | 66 75 6e 63 69 74 65 6d |ode}..X\|funcitem|
|00001da0| 7b 65 6e 76 69 72 6f 6e | 7d 0a 58 41 20 64 69 63 |{environ|}.XA dic|
|00001db0| 74 69 6f 6e 61 72 79 20 | 72 65 70 72 65 73 65 6e |tionary |represen|
|00001dc0| 74 69 6e 67 20 74 68 65 | 20 73 74 72 69 6e 67 20 |ting the| string |
|00001dd0| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 20 61 74 20 74 |environm|ent at t|
|00001de0| 68 65 20 74 69 6d 65 0a | 58 74 68 65 20 69 6e 74 |he time.|Xthe int|
|00001df0| 65 72 70 72 65 74 65 72 | 20 77 61 73 20 73 74 61 |erpreter| was sta|
|00001e00| 72 74 65 64 2e 0a 58 28 | 4d 6f 64 69 66 79 69 6e |rted..X(|Modifyin|
|00001e10| 67 20 74 68 69 73 20 64 | 69 63 74 69 6f 6e 61 72 |g this d|ictionar|
|00001e20| 79 20 64 6f 65 73 20 6e | 6f 74 20 61 66 66 65 63 |y does n|ot affec|
|00001e30| 74 20 74 68 65 20 73 74 | 72 69 6e 67 20 65 6e 76 |t the st|ring env|
|00001e40| 69 72 6f 6e 6d 65 6e 74 | 20 6f 66 20 74 68 65 0a |ironment| of the.|
|00001e50| 58 69 6e 74 65 72 70 72 | 65 74 65 72 2e 29 0a 58 |Xinterpr|eter.).X|
|00001e60| 46 6f 72 20 65 78 61 6d | 70 6c 65 2c 0a 58 7b 5c |For exam|ple,.X{\|
|00001e70| 74 74 20 70 6f 73 69 78 | 2e 65 6e 76 69 72 6f 6e |tt posix|.environ|
|00001e80| 5b 27 48 4f 4d 45 27 5d | 7d 0a 58 69 73 20 74 68 |['HOME']|}.Xis th|
|00001e90| 65 20 70 61 74 68 6e 61 | 6d 65 20 6f 66 20 79 6f |e pathna|me of yo|
|00001ea0| 75 72 20 68 6f 6d 65 20 | 64 69 72 65 63 74 6f 72 |ur home |director|
|00001eb0| 79 2c 20 65 71 75 69 76 | 61 6c 65 6e 74 20 74 6f |y, equiv|alent to|
|00001ec0| 0a 58 7b 5c 74 74 20 67 | 65 74 65 6e 76 28 22 48 |.X{\tt g|etenv("H|
|00001ed0| 4f 4d 45 22 29 7d 0a 58 | 69 6e 20 43 2e 0a 58 5c |OME")}.X|in C..X\|
|00001ee0| 65 78 63 69 74 65 6d 7b | 65 72 72 6f 72 7d 7b 70 |excitem{|error}{p|
|00001ef0| 6f 73 69 78 2e 65 72 72 | 6f 72 7d 0a 58 25 2e 62 |osix.err|or}.X%.b|
|00001f00| 72 0a 58 54 68 65 20 65 | 78 63 65 70 74 69 6f 6e |r.XThe e|xception|
|00001f10| 20 72 61 69 73 65 64 20 | 77 68 65 6e 20 61 6e 20 | raised |when an |
|00001f20| 50 4f 53 49 58 20 66 75 | 6e 63 74 69 6f 6e 20 72 |POSIX fu|nction r|
|00001f30| 65 74 75 72 6e 73 20 61 | 6e 20 65 72 72 6f 72 2e |eturns a|n error.|
|00001f40| 0a 58 54 68 65 20 76 61 | 6c 75 65 20 61 63 63 6f |.XThe va|lue acco|
|00001f50| 6d 70 61 6e 79 69 6e 67 | 20 74 68 69 73 20 65 78 |mpanying| this ex|
|00001f60| 63 65 70 74 69 6f 6e 20 | 69 73 20 61 20 70 61 69 |ception |is a pai|
|00001f70| 72 20 63 6f 6e 74 61 69 | 6e 69 6e 67 20 74 68 65 |r contai|ning the|
|00001f80| 20 6e 75 6d 65 72 69 63 | 0a 58 65 72 72 6f 72 20 | numeric|.Xerror |
|00001f90| 63 6f 64 65 20 66 72 6f | 6d 0a 58 7b 5c 74 74 20 |code fro|m.X{\tt |
|00001fa0| 65 72 72 6e 6f 7d 0a 58 | 61 6e 64 20 74 68 65 20 |errno}.X|and the |
|00001fb0| 63 6f 72 72 65 73 70 6f | 6e 64 69 6e 67 20 73 74 |correspo|nding st|
|00001fc0| 72 69 6e 67 2c 20 61 73 | 20 77 6f 75 6c 64 20 62 |ring, as| would b|
|00001fd0| 65 20 70 72 69 6e 74 65 | 64 20 62 79 20 74 68 65 |e printe|d by the|
|00001fe0| 20 43 20 66 75 6e 63 74 | 69 6f 6e 0a 58 7b 5c 74 | C funct|ion.X{\t|
|00001ff0| 74 20 70 65 72 72 6f 72 | 28 29 7d 2e 0a 58 5c 66 |t perror|()}..X\f|
|00002000| 75 6e 63 69 74 65 6d 7b | 67 65 74 63 77 64 7d 7b |uncitem{|getcwd}{|
|00002010| 7d 0a 58 52 65 74 75 72 | 6e 73 20 61 20 73 74 72 |}.XRetur|ns a str|
|00002020| 69 6e 67 20 72 65 70 72 | 65 73 65 6e 74 69 6e 67 |ing repr|esenting|
|00002030| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 77 6f 72 | the cur|rent wor|
|00002040| 6b 69 6e 67 20 64 69 72 | 65 63 74 6f 72 79 2e 0a |king dir|ectory..|
|00002050| 58 5c 66 75 6e 63 69 74 | 65 6d 7b 6c 69 6e 6b 7d |X\funcit|em{link}|
|00002060| 7b 73 72 63 2c 20 64 73 | 74 7d 0a 58 43 72 65 61 |{src, ds|t}.XCrea|
|00002070| 74 65 73 20 61 20 68 61 | 72 64 20 6c 69 6e 6b 20 |tes a ha|rd link |
|00002080| 70 6f 69 6e 74 69 6e 67 | 20 74 6f 0a 58 7b 5c 74 |pointing| to.X{\t|
|00002090| 74 20 73 72 63 7d 0a 58 | 6e 61 6d 65 64 0a 58 7b |t src}.X|named.X{|
|000020a0| 5c 74 74 20 64 73 74 7d | 2e 0a 58 5c 66 75 6e 63 |\tt dst}|..X\func|
|000020b0| 69 74 65 6d 7b 6c 69 73 | 74 64 69 72 7d 7b 70 61 |item{lis|tdir}{pa|
|000020c0| 74 68 7d 0a 58 52 65 74 | 75 72 6e 73 20 61 20 6c |th}.XRet|urns a l|
|000020d0| 69 73 74 20 63 6f 6e 74 | 61 69 6e 69 6e 67 20 74 |ist cont|aining t|
|000020e0| 68 65 20 6e 61 6d 65 73 | 20 6f 66 20 74 68 65 20 |he names| of the |
|000020f0| 65 6e 74 72 69 65 73 20 | 69 6e 20 74 68 65 0a 58 |entries |in the.X|
|00002100| 64 69 72 65 63 74 6f 72 | 79 2e 0a 58 54 68 65 20 |director|y..XThe |
|00002110| 6c 69 73 74 20 69 73 20 | 69 6e 20 61 72 62 69 74 |list is |in arbit|
|00002120| 72 61 72 79 20 6f 72 64 | 65 72 2e 0a 58 49 74 20 |rary ord|er..XIt |
|00002130| 69 6e 63 6c 75 64 65 73 | 20 74 68 65 20 73 70 65 |includes| the spe|
|00002140| 63 69 61 6c 20 65 6e 74 | 72 69 65 73 0a 58 7b 5c |cial ent|ries.X{\|
|00002150| 74 74 20 27 2e 27 7d 0a | 58 61 6e 64 0a 58 7b 5c |tt '.'}.|Xand.X{\|
|00002160| 74 74 20 27 2e 2e 27 7d | 0a 58 69 66 20 74 68 65 |tt '..'}|.Xif the|
|00002170| 79 20 61 72 65 20 70 72 | 65 73 65 6e 74 20 69 6e |y are pr|esent in|
|00002180| 20 74 68 65 20 64 69 72 | 65 63 74 6f 72 79 2e 0a | the dir|ectory..|
|00002190| 58 5c 66 75 6e 63 69 74 | 65 6d 7b 6d 6b 64 69 72 |X\funcit|em{mkdir|
|000021a0| 7d 7b 70 61 74 68 2c 20 | 6d 6f 64 65 7d 0a 58 43 |}{path, |mode}.XC|
|000021b0| 72 65 61 74 65 73 20 61 | 20 64 69 72 65 63 74 6f |reates a| directo|
|000021c0| 72 79 20 6e 61 6d 65 64 | 0a 58 7b 5c 74 74 20 70 |ry named|.X{\tt p|
|000021d0| 61 74 68 7d 0a 58 77 69 | 74 68 20 6e 75 6d 65 72 |ath}.Xwi|th numer|
|000021e0| 69 63 20 6d 6f 64 65 0a | 58 7b 5c 74 74 20 6d 6f |ic mode.|X{\tt mo|
|000021f0| 64 65 7d 2e 0a 58 5c 66 | 75 6e 63 69 74 65 6d 7b |de}..X\f|uncitem{|
|00002200| 72 65 6e 61 6d 65 7d 7b | 73 72 63 2c 20 64 73 74 |rename}{|src, dst|
|00002210| 7d 0a 58 52 65 6e 61 6d | 65 73 20 74 68 65 20 66 |}.XRenam|es the f|
|00002220| 69 6c 65 20 6f 72 20 64 | 69 72 65 63 74 6f 72 79 |ile or d|irectory|
|00002230| 0a 58 7b 5c 74 74 20 73 | 72 63 7d 0a 58 74 6f 0a |.X{\tt s|rc}.Xto.|
|00002240| 58 7b 5c 74 74 20 64 73 | 74 7d 2e 0a 58 5c 66 75 |X{\tt ds|t}..X\fu|
|00002250| 6e 63 69 74 65 6d 7b 72 | 6d 64 69 72 7d 7b 70 61 |ncitem{r|mdir}{pa|
|00002260| 74 68 7d 0a 58 52 65 6d | 6f 76 65 73 20 74 68 65 |th}.XRem|oves the|
|00002270| 20 64 69 72 65 63 74 6f | 72 79 0a 58 7b 5c 74 74 | directo|ry.X{\tt|
|00002280| 20 70 61 74 68 7d 2e 0a | 58 5c 66 75 6e 63 69 74 | path}..|X\funcit|
|00002290| 65 6d 7b 73 74 61 74 7d | 7b 70 61 74 68 7d 0a 58 |em{stat}|{path}.X|
|000022a0| 50 65 72 66 6f 72 6d 73 | 20 61 0a 58 7b 5c 65 6d |Performs| a.X{\em|
|000022b0| 20 73 74 61 74 7d 0a 58 | 73 79 73 74 65 6d 20 63 | stat}.X|system c|
|000022c0| 61 6c 6c 20 6f 6e 20 74 | 68 65 20 67 69 76 65 6e |all on t|he given|
|000022d0| 20 70 61 74 68 2e 0a 58 | 54 68 65 20 72 65 74 75 | path..X|The retu|
|000022e0| 72 6e 20 76 61 6c 75 65 | 20 69 73 20 61 20 74 75 |rn value| is a tu|
|000022f0| 70 6c 65 20 6f 66 20 61 | 74 20 6c 65 61 73 74 20 |ple of a|t least |
|00002300| 31 30 20 69 6e 74 65 67 | 65 72 73 20 67 69 76 69 |10 integ|ers givi|
|00002310| 6e 67 20 74 68 65 20 6d | 6f 73 74 0a 58 69 6d 70 |ng the m|ost.Ximp|
|00002320| 6f 72 74 61 6e 74 20 28 | 61 6e 64 20 70 6f 72 74 |ortant (|and port|
|00002330| 61 62 6c 65 29 20 6d 65 | 6d 62 65 72 73 20 6f 66 |able) me|mbers of|
|00002340| 20 74 68 65 0a 58 7b 5c | 65 6d 20 73 74 61 74 7d | the.X{\|em stat}|
|00002350| 0a 58 73 74 72 75 63 74 | 75 72 65 2c 20 69 6e 20 |.Xstruct|ure, in |
|00002360| 74 68 65 20 6f 72 64 65 | 72 0a 58 7b 5c 74 74 20 |the orde|r.X{\tt |
|00002370| 73 74 5c 5f 6d 6f 64 65 | 7d 2c 0a 58 7b 5c 74 74 |st\_mode|},.X{\tt|
|00002380| 20 73 74 5c 5f 69 6e 6f | 7d 2c 0a 58 7b 5c 74 74 | st\_ino|},.X{\tt|
|00002390| 20 73 74 5c 5f 64 65 76 | 7d 2c 0a 58 7b 5c 74 74 | st\_dev|},.X{\tt|
|000023a0| 20 73 74 5c 5f 6e 6c 69 | 6e 6b 7d 2c 0a 58 7b 5c | st\_nli|nk},.X{\|
|000023b0| 74 74 20 73 74 5c 5f 75 | 69 64 7d 2c 0a 58 7b 5c |tt st\_u|id},.X{\|
|000023c0| 74 74 20 73 74 5c 5f 67 | 69 64 7d 2c 0a 58 7b 5c |tt st\_g|id},.X{\|
|000023d0| 74 74 20 73 74 5c 5f 73 | 69 7a 65 7d 2c 0a 58 7b |tt st\_s|ize},.X{|
|000023e0| 5c 74 74 20 73 74 5c 5f | 61 74 69 6d 65 7d 2c 0a |\tt st\_|atime},.|
|000023f0| 58 7b 5c 74 74 20 73 74 | 5c 5f 6d 74 69 6d 65 7d |X{\tt st|\_mtime}|
|00002400| 2c 0a 58 7b 5c 74 74 20 | 73 74 5c 5f 63 74 69 6d |,.X{\tt |st\_ctim|
|00002410| 65 7d 2e 0a 58 4d 6f 72 | 65 20 69 74 65 6d 73 20 |e}..XMor|e items |
|00002420| 6d 61 79 20 62 65 20 61 | 64 64 65 64 20 61 74 20 |may be a|dded at |
|00002430| 74 68 65 20 65 6e 64 20 | 62 79 20 73 6f 6d 65 20 |the end |by some |
|00002440| 69 6d 70 6c 65 6d 65 6e | 74 61 74 69 6f 6e 73 2e |implemen|tations.|
|00002450| 0a 58 5c 66 75 6e 63 69 | 74 65 6d 7b 73 79 73 74 |.X\funci|tem{syst|
|00002460| 65 6d 7d 7b 63 6f 6d 6d | 61 6e 64 7d 0a 58 45 78 |em}{comm|and}.XEx|
|00002470| 65 63 75 74 65 73 20 74 | 68 65 20 63 6f 6d 6d 61 |ecutes t|he comma|
|00002480| 6e 64 20 28 61 20 73 74 | 72 69 6e 67 29 20 69 6e |nd (a st|ring) in|
|00002490| 20 61 20 73 75 62 73 68 | 65 6c 6c 2e 0a 58 54 68 | a subsh|ell..XTh|
|000024a0| 69 73 20 69 73 20 69 6d | 70 6c 65 6d 65 6e 74 65 |is is im|plemente|
|000024b0| 64 20 62 79 20 63 61 6c | 6c 69 6e 67 20 74 68 65 |d by cal|ling the|
|000024c0| 20 53 74 61 6e 64 61 72 | 64 20 43 20 66 75 6e 63 | Standar|d C func|
|000024d0| 74 69 6f 6e 0a 58 7b 5c | 74 74 20 73 79 73 74 65 |tion.X{\|tt syste|
|000024e0| 6d 28 29 7d 2c 0a 58 61 | 6e 64 20 68 61 73 20 74 |m()},.Xa|nd has t|
|000024f0| 68 65 20 73 61 6d 65 20 | 6c 69 6d 69 74 61 74 69 |he same |limitati|
|00002500| 6f 6e 73 2e 0a 58 43 68 | 61 6e 67 65 73 20 74 6f |ons..XCh|anges to|
|00002510| 0a 58 7b 5c 74 74 20 70 | 6f 73 69 78 2e 65 6e 76 |.X{\tt p|osix.env|
|00002520| 69 72 6f 6e 7d 2c 0a 58 | 7b 5c 74 74 20 73 79 73 |iron},.X|{\tt sys|
|00002530| 2e 73 74 64 69 6e 7d 0a | 58 65 74 63 2e 20 61 72 |.stdin}.|Xetc. ar|
|00002540| 65 20 6e 6f 74 20 72 65 | 66 6c 65 63 74 65 64 20 |e not re|flected |
|00002550| 69 6e 20 74 68 65 20 65 | 6e 76 69 72 6f 6e 6d 65 |in the e|nvironme|
|00002560| 6e 74 20 6f 66 20 74 68 | 65 20 65 78 65 63 75 74 |nt of th|e execut|
|00002570| 65 64 20 63 6f 6d 6d 61 | 6e 64 2e 0a 58 54 68 65 |ed comma|nd..XThe|
|00002580| 20 72 65 74 75 72 6e 20 | 76 61 6c 75 65 20 69 73 | return |value is|
|00002590| 20 74 68 65 20 65 78 69 | 74 20 73 74 61 74 75 73 | the exi|t status|
|000025a0| 20 6f 66 20 74 68 65 20 | 70 72 6f 63 65 73 73 20 | of the |process |
|000025b0| 61 73 20 72 65 74 75 72 | 6e 65 64 20 62 79 0a 58 |as retur|ned by.X|
|000025c0| 53 74 61 6e 64 61 72 64 | 20 43 0a 58 7b 5c 74 74 |Standard| C.X{\tt|
|000025d0| 20 73 79 73 74 65 6d 28 | 29 7d 2e 0a 58 5c 66 75 | system(|)}..X\fu|
|000025e0| 6e 63 69 74 65 6d 7b 75 | 6d 61 73 6b 7d 7b 6d 61 |ncitem{u|mask}{ma|
|000025f0| 73 6b 7d 0a 58 53 65 74 | 73 20 74 68 65 20 63 75 |sk}.XSet|s the cu|
|00002600| 72 72 65 6e 74 20 6e 75 | 6d 65 72 69 63 20 75 6d |rrent nu|meric um|
|00002610| 61 73 6b 20 61 6e 64 20 | 72 65 74 75 72 6e 73 20 |ask and |returns |
|00002620| 74 68 65 20 70 72 65 76 | 69 6f 75 73 20 75 6d 61 |the prev|ious uma|
|00002630| 73 6b 2e 0a 58 5c 66 75 | 6e 63 69 74 65 6d 7b 75 |sk..X\fu|ncitem{u|
|00002640| 6e 6c 69 6e 6b 7d 7b 70 | 61 74 68 7d 0a 58 55 6e |nlink}{p|ath}.XUn|
|00002650| 6c 69 6e 6b 73 20 74 68 | 65 20 66 69 6c 65 0a 58 |links th|e file.X|
|00002660| 7b 5c 74 74 20 70 61 74 | 68 7d 2e 0a 58 5c 66 75 |{\tt pat|h}..X\fu|
|00002670| 6e 63 69 74 65 6d 7b 75 | 74 69 6d 65 73 28 70 61 |ncitem{u|times(pa|
|00002680| 74 68 2c 20 7d 7b 61 74 | 69 6d 65 2c 20 6d 74 69 |th, }{at|ime, mti|
|00002690| 6d 65 29 7d 0a 58 25 2e | 62 72 0a 58 53 65 74 73 |me)}.X%.|br.XSets|
|000026a0| 20 74 68 65 20 61 63 63 | 65 73 73 20 61 6e 64 20 | the acc|ess and |
|000026b0| 6d 6f 64 69 66 69 65 64 | 20 74 69 6d 65 20 6f 66 |modified| time of|
|000026c0| 20 74 68 65 20 66 69 6c | 65 20 74 6f 20 74 68 65 | the fil|e to the|
|000026d0| 20 67 69 76 65 6e 20 76 | 61 6c 75 65 73 2e 0a 58 | given v|alues..X|
|000026e0| 28 54 68 65 20 73 65 63 | 6f 6e 64 20 61 72 67 75 |(The sec|ond argu|
|000026f0| 6d 65 6e 74 20 69 73 20 | 61 20 74 75 70 6c 65 20 |ment is |a tuple |
|00002700| 6f 66 20 74 77 6f 20 69 | 74 65 6d 73 2e 29 0a 58 |of two i|tems.).X|
|00002710| 5c 65 6e 64 7b 64 65 73 | 63 72 69 70 74 69 6f 6e |\end{des|cription|
|00002720| 7d 0a 58 0a 58 54 68 65 | 20 66 6f 6c 6c 6f 77 69 |}.X.XThe| followi|
|00002730| 6e 67 20 66 75 6e 63 74 | 69 6f 6e 73 20 61 72 65 |ng funct|ions are|
|00002740| 20 6f 6e 6c 79 20 61 76 | 61 69 6c 61 62 6c 65 20 | only av|ailable |
|00002750| 6f 6e 20 73 79 73 74 65 | 6d 73 20 74 68 61 74 20 |on syste|ms that |
|00002760| 73 75 70 70 6f 72 74 0a | 58 73 79 6d 62 6f 6c 69 |support.|Xsymboli|
|00002770| 63 20 6c 69 6e 6b 73 3a | 0a 58 5c 62 65 67 69 6e |c links:|.X\begin|
|00002780| 7b 64 65 73 63 72 69 70 | 74 69 6f 6e 7d 0a 58 5c |{descrip|tion}.X\|
|00002790| 66 75 6e 63 69 74 65 6d | 7b 6c 73 74 61 74 7d 7b |funcitem|{lstat}{|
|000027a0| 70 61 74 68 7d 0a 58 4c | 69 6b 65 0a 58 7b 5c 74 |path}.XL|ike.X{\t|
|000027b0| 74 20 73 74 61 74 28 29 | 7d 2c 0a 58 62 75 74 20 |t stat()|},.Xbut |
|000027c0| 64 6f 65 73 20 6e 6f 74 | 20 66 6f 6c 6c 6f 77 20 |does not| follow |
|000027d0| 73 79 6d 62 6f 6c 69 63 | 20 6c 69 6e 6b 73 2e 0a |symbolic| links..|
|000027e0| 58 5c 66 75 6e 63 69 74 | 65 6d 7b 72 65 61 64 6c |X\funcit|em{readl|
|000027f0| 69 6e 6b 7d 7b 70 61 74 | 68 7d 0a 58 52 65 74 75 |ink}{pat|h}.XRetu|
|00002800| 72 6e 73 20 61 20 73 74 | 72 69 6e 67 20 72 65 70 |rns a st|ring rep|
|00002810| 72 65 73 65 6e 74 69 6e | 67 20 74 68 65 20 70 61 |resentin|g the pa|
|00002820| 74 68 20 74 6f 20 77 68 | 69 63 68 20 74 68 65 20 |th to wh|ich the |
|00002830| 73 79 6d 62 6f 6c 69 63 | 20 6c 69 6e 6b 0a 58 70 |symbolic| link.Xp|
|00002840| 6f 69 6e 74 73 2e 0a 58 | 5c 66 75 6e 63 69 74 65 |oints..X|\funcite|
|00002850| 6d 7b 73 79 6d 6c 69 6e | 6b 7d 7b 73 72 63 2c 20 |m{symlin|k}{src, |
|00002860| 64 73 74 7d 0a 58 43 72 | 65 61 74 65 73 20 61 20 |dst}.XCr|eates a |
|00002870| 73 79 6d 62 6f 6c 69 63 | 20 6c 69 6e 6b 20 70 6f |symbolic| link po|
|00002880| 69 6e 74 69 6e 67 20 74 | 6f 0a 58 7b 5c 74 74 20 |inting t|o.X{\tt |
|00002890| 73 72 63 7d 0a 58 6e 61 | 6d 65 64 0a 58 7b 5c 74 |src}.Xna|med.X{\t|
|000028a0| 74 20 64 73 74 7d 2e 0a | 58 5c 65 6e 64 7b 64 65 |t dst}..|X\end{de|
|000028b0| 73 63 72 69 70 74 69 6f | 6e 7d 0a 58 0a 58 5c 73 |scriptio|n}.X.X\s|
|000028c0| 75 62 73 65 63 74 69 6f | 6e 7b 42 75 69 6c 74 2d |ubsectio|n{Built-|
|000028d0| 69 6e 20 4d 6f 64 75 6c | 65 20 7b 5c 74 74 20 73 |in Modul|e {\tt s|
|000028e0| 74 64 77 69 6e 7d 7d 0a | 58 0a 58 54 68 69 73 20 |tdwin}}.|X.XThis |
|000028f0| 6d 6f 64 75 6c 65 20 64 | 65 66 69 6e 65 73 20 73 |module d|efines s|
|00002900| 65 76 65 72 61 6c 20 6e | 65 77 20 6f 62 6a 65 63 |everal n|ew objec|
|00002910| 74 20 74 79 70 65 73 20 | 61 6e 64 20 66 75 6e 63 |t types |and func|
|00002920| 74 69 6f 6e 73 20 74 68 | 61 74 0a 58 70 72 6f 76 |tions th|at.Xprov|
|00002930| 69 64 65 20 61 63 63 65 | 73 73 20 74 6f 20 74 68 |ide acce|ss to th|
|00002940| 65 20 66 75 6e 63 74 69 | 6f 6e 61 6c 69 74 79 20 |e functi|onality |
|00002950| 6f 66 20 74 68 65 20 53 | 74 61 6e 64 61 72 64 20 |of the S|tandard |
|00002960| 57 69 6e 64 6f 77 20 53 | 79 73 74 65 6d 0a 58 49 |Window S|ystem.XI|
|00002970| 6e 74 65 72 66 61 63 65 | 2c 20 53 54 44 57 49 4e |nterface|, STDWIN|
|00002980| 20 5b 43 57 49 20 72 65 | 70 6f 72 74 20 43 52 2d | [CWI re|port CR-|
|00002990| 52 38 38 31 37 5d 2e 0a | 58 49 74 20 69 73 20 61 |R8817]..|XIt is a|
|000029a0| 76 61 69 6c 61 62 6c 65 | 20 6f 6e 20 73 79 73 74 |vailable| on syst|
|000029b0| 65 6d 73 20 74 6f 20 77 | 68 69 63 68 20 53 54 44 |ems to w|hich STD|
|000029c0| 57 49 4e 20 68 61 73 20 | 62 65 65 6e 20 70 6f 72 |WIN has |been por|
|000029d0| 74 65 64 20 28 77 68 69 | 63 68 20 69 73 0a 58 6d |ted (whi|ch is.Xm|
|000029e0| 6f 73 74 20 73 79 73 74 | 65 6d 73 29 2e 0a 58 49 |ost syst|ems)..XI|
|000029f0| 74 20 69 73 20 6f 6e 6c | 79 20 61 76 61 69 6c 61 |t is onl|y availa|
|00002a00| 62 6c 65 20 69 66 20 74 | 68 65 20 7b 5c 74 74 20 |ble if t|he {\tt |
|00002a10| 44 49 53 50 4c 41 59 7d | 20 65 6e 76 69 72 6f 6e |DISPLAY}| environ|
|00002a20| 6d 65 6e 74 20 76 61 72 | 69 61 62 6c 65 20 69 73 |ment var|iable is|
|00002a30| 20 73 65 74 0a 58 6f 72 | 20 61 6e 20 65 78 70 6c | set.Xor| an expl|
|00002a40| 69 63 69 74 20 60 7b 5c | 74 74 20 2d 64 69 73 70 |icit `{\|tt -disp|
|00002a50| 6c 61 79 20 5c 69 74 20 | 64 69 73 70 6c 61 79 6e |lay \it |displayn|
|00002a60| 61 6d 65 7d 27 20 61 72 | 67 75 6d 65 6e 74 20 69 |ame}' ar|gument i|
|00002a70| 73 20 70 61 73 73 65 64 | 20 74 6f 0a 58 74 68 65 |s passed| to.Xthe|
|00002a80| 20 69 6e 74 65 72 70 72 | 65 74 65 72 2e 0a 58 0a | interpr|eter..X.|
|00002a90| 58 46 75 6e 63 74 69 6f | 6e 73 20 68 61 76 65 20 |XFunctio|ns have |
|00002aa0| 6e 61 6d 65 73 20 74 68 | 61 74 20 75 73 75 61 6c |names th|at usual|
|00002ab0| 6c 79 20 72 65 73 65 6d | 62 6c 65 20 74 68 65 69 |ly resem|ble thei|
|00002ac0| 72 20 43 20 53 54 44 57 | 49 4e 20 63 6f 75 6e 74 |r C STDW|IN count|
|00002ad0| 65 72 70 61 72 74 73 0a | 58 77 69 74 68 20 74 68 |erparts.|Xwith th|
|00002ae0| 65 20 69 6e 69 74 69 61 | 6c 20 60 77 27 20 64 72 |e initia|l `w' dr|
|00002af0| 6f 70 70 65 64 2e 0a 58 | 50 6f 69 6e 74 73 20 61 |opped..X|Points a|
|00002b00| 72 65 20 72 65 70 72 65 | 73 65 6e 74 65 64 20 62 |re repre|sented b|
|00002b10| 79 20 70 61 69 72 73 20 | 6f 66 20 69 6e 74 65 67 |y pairs |of integ|
|00002b20| 65 72 73 3b 20 72 65 63 | 74 61 6e 67 6c 65 73 0a |ers; rec|tangles.|
|00002b30| 58 62 79 20 70 61 69 72 | 73 20 6f 66 20 70 6f 69 |Xby pair|s of poi|
|00002b40| 6e 74 73 2e 0a 58 46 6f | 72 20 61 20 63 6f 6d 70 |nts..XFo|r a comp|
|00002b50| 6c 65 74 65 20 64 65 73 | 63 72 69 70 74 69 6f 6e |lete des|cription|
|00002b60| 20 6f 66 20 53 54 44 57 | 49 4e 20 70 6c 65 61 73 | of STDW|IN pleas|
|00002b70| 65 20 72 65 66 65 72 20 | 74 6f 20 74 68 65 20 64 |e refer |to the d|
|00002b80| 6f 63 75 6d 65 6e 74 61 | 74 69 6f 6e 0a 58 6f 66 |ocumenta|tion.Xof|
|00002b90| 20 53 54 44 57 49 4e 20 | 66 6f 72 20 43 20 70 72 | STDWIN |for C pr|
|00002ba0| 6f 67 72 61 6d 6d 65 72 | 73 20 28 61 66 6f 72 65 |ogrammer|s (afore|
|00002bb0| 6d 65 6e 74 69 6f 6e 65 | 64 20 43 57 49 20 72 65 |mentione|d CWI re|
|00002bc0| 70 6f 72 74 29 2e 0a 58 | 5c 73 75 62 73 75 62 73 |port)..X|\subsubs|
|00002bd0| 65 63 74 69 6f 6e 7b 46 | 75 6e 63 74 69 6f 6e 73 |ection{F|unctions|
|00002be0| 20 44 65 66 69 6e 65 64 | 20 69 6e 20 4d 6f 64 75 | Defined| in Modu|
|00002bf0| 6c 65 20 7b 5c 74 74 20 | 73 74 64 77 69 6e 7d 7d |le {\tt |stdwin}}|
|00002c00| 0a 58 0a 58 54 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |.X.XThe |followin|
|00002c10| 67 20 66 75 6e 63 74 69 | 6f 6e 73 20 61 72 65 20 |g functi|ons are |
|00002c20| 64 65 66 69 6e 65 64 20 | 69 6e 20 74 68 65 20 7b |defined |in the {|
|00002c30| 5c 74 74 20 73 74 64 77 | 69 6e 7d 20 6d 6f 64 75 |\tt stdw|in} modu|
|00002c40| 6c 65 3a 0a 58 5c 62 65 | 67 69 6e 7b 64 65 73 63 |le:.X\be|gin{desc|
|00002c50| 72 69 70 74 69 6f 6e 7d | 0a 58 5c 66 75 6e 63 69 |ription}|.X\funci|
|00002c60| 74 65 6d 7b 6f 70 65 6e | 7d 7b 74 69 74 6c 65 7d |tem{open|}{title}|
|00002c70| 0a 58 25 2e 62 72 0a 58 | 4f 70 65 6e 73 20 61 20 |.X%.br.X|Opens a |
|00002c80| 6e 65 77 20 77 69 6e 64 | 6f 77 20 77 68 6f 73 65 |new wind|ow whose|
|00002c90| 20 69 6e 69 74 69 61 6c | 20 74 69 74 6c 65 20 69 | initial| title i|
|00002ca0| 73 20 67 69 76 65 6e 20 | 62 79 20 74 68 65 20 73 |s given |by the s|
|00002cb0| 74 72 69 6e 67 20 61 72 | 67 75 6d 65 6e 74 2e 0a |tring ar|gument..|
|00002cc0| 58 52 65 74 75 72 6e 73 | 20 61 20 77 69 6e 64 6f |XReturns| a windo|
|00002cd0| 77 20 6f 62 6a 65 63 74 | 3b 20 77 69 6e 64 6f 77 |w object|; window|
|00002ce0| 20 6f 62 6a 65 63 74 20 | 6d 65 74 68 6f 64 73 20 | object |methods |
|00002cf0| 61 72 65 20 64 65 73 63 | 72 69 62 65 64 20 62 65 |are desc|ribed be|
|00002d00| 6c 6f 77 2e 25 0a 58 5c | 66 6f 6f 74 6e 6f 74 65 |low.%.X\|footnote|
|00002d10| 7b 0a 58 54 68 65 20 7b | 5c 50 79 74 68 6f 6e 7d |{.XThe {|\Python}|
|00002d20| 20 76 65 72 73 69 6f 6e | 20 6f 66 20 53 54 44 57 | version| of STDW|
|00002d30| 49 4e 20 64 6f 65 73 20 | 6e 6f 74 20 73 75 70 70 |IN does |not supp|
|00002d40| 6f 72 74 20 64 72 61 77 | 20 70 72 6f 63 65 64 75 |ort draw| procedu|
|00002d50| 72 65 73 3b 20 61 6c 6c | 0a 58 64 72 61 77 69 6e |res; all|.Xdrawin|
|00002d60| 67 20 72 65 71 75 65 73 | 74 73 20 61 72 65 20 72 |g reques|ts are r|
|00002d70| 65 70 6f 72 74 65 64 20 | 61 73 20 64 72 61 77 20 |eported |as draw |
|00002d80| 65 76 65 6e 74 73 2e 0a | 58 7d 0a 58 5c 66 75 6e |events..|X}.X\fun|
|00002d90| 63 69 74 65 6d 7b 67 65 | 74 65 76 65 6e 74 7d 7b |citem{ge|tevent}{|
|00002da0| 7d 0a 58 25 2e 62 72 0a | 58 57 61 69 74 73 20 66 |}.X%.br.|XWaits f|
|00002db0| 6f 72 20 61 6e 64 20 72 | 65 74 75 72 6e 73 20 74 |or and r|eturns t|
|00002dc0| 68 65 20 6e 65 78 74 20 | 65 76 65 6e 74 2e 0a 58 |he next |event..X|
|00002dd0| 41 6e 20 65 76 65 6e 74 | 20 69 73 20 72 65 74 75 |An event| is retu|
|00002de0| 72 6e 65 64 20 61 73 20 | 61 20 74 72 69 70 6c 65 |rned as |a triple|
|00002df0| 3a 20 74 68 65 20 66 69 | 72 73 74 20 65 6c 65 6d |: the fi|rst elem|
|00002e00| 65 6e 74 20 69 73 20 74 | 68 65 20 65 76 65 6e 74 |ent is t|he event|
|00002e10| 0a 58 74 79 70 65 2c 20 | 61 20 73 6d 61 6c 6c 20 |.Xtype, |a small |
|00002e20| 69 6e 74 65 67 65 72 3b | 20 74 68 65 20 73 65 63 |integer;| the sec|
|00002e30| 6f 6e 64 20 65 6c 65 6d | 65 6e 74 20 69 73 20 74 |ond elem|ent is t|
|00002e40| 68 65 20 77 69 6e 64 6f | 77 20 6f 62 6a 65 63 74 |he windo|w object|
|00002e50| 20 74 6f 20 77 68 69 63 | 68 0a 58 74 68 65 20 65 | to whic|h.Xthe e|
|00002e60| 76 65 6e 74 20 61 70 70 | 6c 69 65 73 2c 20 6f 72 |vent app|lies, or|
|00002e70| 0a 58 7b 5c 74 74 20 4e | 6f 6e 65 7d 0a 58 69 66 |.X{\tt N|one}.Xif|
|00002e80| 20 69 74 20 61 70 70 6c | 69 65 73 20 74 6f 20 6e | it appl|ies to n|
|00002e90| 6f 20 77 69 6e 64 6f 77 | 20 69 6e 20 70 61 72 74 |o window| in part|
|00002ea0| 69 63 75 6c 61 72 3b 0a | 58 74 68 65 20 74 68 69 |icular;.|Xthe thi|
|00002eb0| 72 64 20 65 6c 65 6d 65 | 6e 74 20 69 73 20 74 79 |rd eleme|nt is ty|
|00002ec0| 70 65 2d 64 65 70 65 6e | 64 65 6e 74 2e 0a 58 4e |pe-depen|dent..XN|
|00002ed0| 61 6d 65 73 20 66 6f 72 | 20 65 76 65 6e 74 20 74 |ames for| event t|
|00002ee0| 79 70 65 73 20 61 6e 64 | 20 63 6f 6d 6d 61 6e 64 |ypes and| command|
|00002ef0| 20 63 6f 64 65 73 20 61 | 72 65 20 64 65 66 69 6e | codes a|re defin|
|00002f00| 65 64 20 69 6e 20 74 68 | 65 20 73 74 61 6e 64 61 |ed in th|e standa|
|00002f10| 72 64 0a 58 6d 6f 64 75 | 6c 65 0a 58 7b 5c 74 74 |rd.Xmodu|le.X{\tt|
|00002f20| 20 73 74 64 77 69 6e 65 | 76 65 6e 74 7d 2e 0a 58 | stdwine|vent}..X|
|00002f30| 5c 66 75 6e 63 69 74 65 | 6d 7b 73 65 74 64 65 66 |\funcite|m{setdef|
|00002f40| 77 69 6e 70 6f 73 7d 7b | 68 2c 20 76 7d 0a 58 25 |winpos}{|h, v}.X%|
|00002f50| 2e 62 72 0a 58 53 65 74 | 73 20 74 68 65 20 64 65 |.br.XSet|s the de|
|00002f60| 66 61 75 6c 74 20 77 69 | 6e 64 6f 77 20 70 6f 73 |fault wi|ndow pos|
|00002f70| 69 74 69 6f 6e 2e 0a 58 | 5c 66 75 6e 63 69 74 65 |ition..X|\funcite|
|00002f80| 6d 7b 73 65 74 64 65 66 | 77 69 6e 73 69 7a 65 7d |m{setdef|winsize}|
|00002f90| 7b 77 69 64 74 68 2c 20 | 68 65 69 67 68 74 7d 0a |{width, |height}.|
|00002fa0| 58 25 2e 62 72 0a 58 53 | 65 74 73 20 74 68 65 20 |X%.br.XS|ets the |
|00002fb0| 64 65 66 61 75 6c 74 20 | 77 69 6e 64 6f 77 20 73 |default |window s|
|00002fc0| 69 7a 65 2e 0a 58 5c 66 | 75 6e 63 69 74 65 6d 7b |ize..X\f|uncitem{|
|00002fd0| 6d 65 6e 75 63 72 65 61 | 74 65 7d 7b 74 69 74 6c |menucrea|te}{titl|
|00002fe0| 65 7d 0a 58 25 2e 62 72 | 0a 58 43 72 65 61 74 65 |e}.X%.br|.XCreate|
|00002ff0| 73 20 61 20 6d 65 6e 75 | 20 6f 62 6a 65 63 74 20 |s a menu| object |
|00003000| 72 65 66 65 72 72 69 6e | 67 20 74 6f 20 61 20 67 |referrin|g to a g|
|00003010| 6c 6f 62 61 6c 20 6d 65 | 6e 75 20 28 61 20 6d 65 |lobal me|nu (a me|
|00003020| 6e 75 20 74 68 61 74 20 | 61 70 70 65 61 72 73 20 |nu that |appears |
|00003030| 69 6e 0a 58 61 6c 6c 20 | 77 69 6e 64 6f 77 73 29 |in.Xall |windows)|
|00003040| 2e 0a 58 4d 65 74 68 6f | 64 73 20 6f 66 20 6d 65 |..XMetho|ds of me|
|00003050| 6e 75 20 6f 62 6a 65 63 | 74 73 20 61 72 65 20 64 |nu objec|ts are d|
|00003060| 65 73 63 72 69 62 65 64 | 20 62 65 6c 6f 77 2e 0a |escribed| below..|
|00003070| 58 5c 66 75 6e 63 69 74 | 65 6d 7b 66 6c 65 65 70 |X\funcit|em{fleep|
|00003080| 7d 7b 7d 0a 58 25 2e 62 | 72 0a 58 43 61 75 73 65 |}{}.X%.b|r.XCause|
|00003090| 73 20 61 20 62 65 65 70 | 20 6f 72 20 62 65 6c 6c |s a beep| or bell|
|000030a0| 20 28 6f 72 20 70 65 72 | 68 61 70 73 20 61 20 60 | (or per|haps a `|
|000030b0| 76 69 73 75 61 6c 20 62 | 65 6c 6c 27 20 6f 72 20 |visual b|ell' or |
|000030c0| 66 6c 61 73 68 2c 20 68 | 65 6e 63 65 20 74 68 65 |flash, h|ence the|
|000030d0| 0a 58 6e 61 6d 65 29 2e | 0a 58 5c 66 75 6e 63 69 |.Xname).|.X\funci|
|000030e0| 74 65 6d 7b 6d 65 73 73 | 61 67 65 7d 7b 73 74 72 |tem{mess|age}{str|
|000030f0| 69 6e 67 7d 0a 58 25 2e | 62 72 0a 58 44 69 73 70 |ing}.X%.|br.XDisp|
|00003100| 6c 61 79 73 20 61 20 64 | 69 61 6c 6f 67 20 62 6f |lays a d|ialog bo|
|00003110| 78 20 63 6f 6e 74 61 69 | 6e 69 6e 67 20 74 68 65 |x contai|ning the|
|00003120| 20 73 74 72 69 6e 67 2e | 0a 58 54 68 65 20 75 73 | string.|.XThe us|
|00003130| 65 72 20 6d 75 73 74 20 | 63 6c 69 63 6b 20 4f 4b |er must |click OK|
|00003140| 20 62 65 66 6f 72 65 20 | 74 68 65 20 66 75 6e 63 | before |the func|
|00003150| 74 69 6f 6e 20 72 65 74 | 75 72 6e 73 2e 0a 58 5c |tion ret|urns..X\|
|00003160| 66 75 6e 63 69 74 65 6d | 7b 61 73 6b 79 6e 63 7d |funcitem|{askync}|
|00003170| 7b 70 72 6f 6d 70 74 2c | 20 64 65 66 61 75 6c 74 |{prompt,| default|
|00003180| 7d 0a 58 25 2e 62 72 0a | 58 44 69 73 70 6c 61 79 |}.X%.br.|XDisplay|
|00003190| 73 20 61 20 64 69 61 6c | 6f 67 20 74 68 61 74 20 |s a dial|og that |
|000031a0| 70 72 6f 6d 70 74 73 20 | 74 68 65 20 75 73 65 72 |prompts |the user|
|000031b0| 20 74 6f 20 61 6e 73 77 | 65 72 20 61 20 71 75 65 | to answ|er a que|
|000031c0| 73 74 69 6f 6e 20 77 69 | 74 68 20 79 65 73 20 6f |stion wi|th yes o|
|000031d0| 72 0a 58 6e 6f 2e 0a 58 | 54 68 65 20 66 75 6e 63 |r.Xno..X|The func|
|000031e0| 74 69 6f 6e 20 72 65 74 | 75 72 6e 73 20 30 20 66 |tion ret|urns 0 f|
|000031f0| 6f 72 20 6e 6f 2c 20 31 | 20 66 6f 72 20 79 65 73 |or no, 1| for yes|
|00003200| 2e 0a 58 49 66 20 74 68 | 65 20 75 73 65 72 20 68 |..XIf th|e user h|
|00003210| 69 74 73 20 74 68 65 20 | 52 65 74 75 72 6e 20 6b |its the |Return k|
|00003220| 65 79 2c 20 74 68 65 20 | 64 65 66 61 75 6c 74 20 |ey, the |default |
|00003230| 28 77 68 69 63 68 20 6d | 75 73 74 20 62 65 20 30 |(which m|ust be 0|
|00003240| 20 6f 72 20 31 29 20 69 | 73 0a 58 72 65 74 75 72 | or 1) i|s.Xretur|
|00003250| 6e 65 64 2e 0a 58 49 66 | 20 74 68 65 20 75 73 65 |ned..XIf| the use|
|00003260| 72 20 63 61 6e 63 65 6c | 73 20 74 68 65 20 64 69 |r cancel|s the di|
|00003270| 61 6c 6f 67 2c 20 74 68 | 65 0a 58 7b 5c 74 74 20 |alog, th|e.X{\tt |
|00003280| 4b 65 79 62 6f 61 72 64 | 49 6e 74 65 72 72 75 70 |Keyboard|Interrup|
|00003290| 74 7d 0a 58 65 78 63 65 | 70 74 69 6f 6e 20 69 73 |t}.Xexce|ption is|
|000032a0| 20 72 61 69 73 65 64 2e | 0a 58 5c 66 75 6e 63 69 | raised.|.X\funci|
|000032b0| 74 65 6d 7b 61 73 6b 73 | 74 72 7d 7b 70 72 6f 6d |tem{asks|tr}{prom|
|000032c0| 70 74 2c 20 64 65 66 61 | 75 6c 74 7d 0a 58 25 2e |pt, defa|ult}.X%.|
|000032d0| 62 72 0a 58 44 69 73 70 | 6c 61 79 73 20 61 20 64 |br.XDisp|lays a d|
|000032e0| 69 61 6c 6f 67 20 74 68 | 61 74 20 70 72 6f 6d 70 |ialog th|at promp|
|000032f0| 74 73 20 74 68 65 20 75 | 73 65 72 20 66 6f 72 20 |ts the u|ser for |
|00003300| 61 20 73 74 72 69 6e 67 | 2e 0a 58 49 66 20 74 68 |a string|..XIf th|
|00003310| 65 20 75 73 65 72 20 68 | 69 74 73 20 74 68 65 20 |e user h|its the |
|00003320| 52 65 74 75 72 6e 20 6b | 65 79 2c 20 74 68 65 20 |Return k|ey, the |
|00003330| 64 65 66 61 75 6c 74 20 | 73 74 72 69 6e 67 20 69 |default |string i|
|00003340| 73 20 72 65 74 75 72 6e | 65 64 2e 0a 58 49 66 20 |s return|ed..XIf |
|00003350| 74 68 65 20 75 73 65 72 | 20 63 61 6e 63 65 6c 73 |the user| cancels|
|00003360| 20 74 68 65 20 64 69 61 | 6c 6f 67 2c 20 74 68 65 | the dia|log, the|
|00003370| 0a 58 7b 5c 74 74 20 4b | 65 79 62 6f 61 72 64 49 |.X{\tt K|eyboardI|
|00003380| 6e 74 65 72 72 75 70 74 | 7d 0a 58 65 78 63 65 70 |nterrupt|}.Xexcep|
|00003390| 74 69 6f 6e 20 69 73 20 | 72 61 69 73 65 64 2e 0a |tion is |raised..|
|000033a0| 58 5c 66 75 6e 63 69 74 | 65 6d 7b 61 73 6b 66 69 |X\funcit|em{askfi|
|000033b0| 6c 65 7d 7b 70 72 6f 6d | 70 74 2c 20 64 65 66 61 |le}{prom|pt, defa|
|000033c0| 75 6c 74 2c 20 6e 65 77 | 7d 0a 58 25 2e 62 72 0a |ult, new|}.X%.br.|
|000033d0| 58 41 73 6b 73 20 74 68 | 65 20 75 73 65 72 20 74 |XAsks th|e user t|
|000033e0| 6f 20 73 70 65 63 69 66 | 79 20 61 20 66 69 6c 65 |o specif|y a file|
|000033f0| 6e 61 6d 65 2e 0a 58 49 | 66 0a 58 7b 5c 74 74 20 |name..XI|f.X{\tt |
|00003400| 6e 65 77 7d 0a 58 69 73 | 20 7a 65 72 6f 20 69 74 |new}.Xis| zero it|
|00003410| 20 6d 75 73 74 20 62 65 | 20 61 6e 20 65 78 69 73 | must be| an exis|
|00003420| 74 69 6e 67 20 66 69 6c | 65 3b 20 6f 74 68 65 72 |ting fil|e; other|
|00003430| 77 69 73 65 2c 20 69 74 | 20 6d 75 73 74 20 62 65 |wise, it| must be|
|00003440| 20 61 20 6e 65 77 20 66 | 69 6c 65 2e 0a 58 49 66 | a new f|ile..XIf|
|00003450| 20 74 68 65 20 75 73 65 | 72 20 63 61 6e 63 65 6c | the use|r cancel|
|00003460| 73 20 74 68 65 20 64 69 | 61 6c 6f 67 2c 20 74 68 |s the di|alog, th|
|00003470| 65 0a 58 7b 5c 74 74 20 | 4b 65 79 62 6f 61 72 64 |e.X{\tt |Keyboard|
|00003480| 49 6e 74 65 72 72 75 70 | 74 7d 0a 58 65 78 63 65 |Interrup|t}.Xexce|
|00003490| 70 74 69 6f 6e 20 69 73 | 20 72 61 69 73 65 64 2e |ption is| raised.|
|000034a0| 0a 58 5c 66 75 6e 63 69 | 74 65 6d 7b 73 65 74 63 |.X\funci|tem{setc|
|000034b0| 75 74 62 75 66 66 65 72 | 7d 7b 69 2c 20 73 74 72 |utbuffer|}{i, str|
|000034c0| 69 6e 67 7d 0a 58 25 2e | 62 72 0a 58 53 74 6f 72 |ing}.X%.|br.XStor|
|000034d0| 65 73 20 74 68 65 20 73 | 74 72 69 6e 67 20 69 6e |es the s|tring in|
|000034e0| 20 74 68 65 20 73 79 73 | 74 65 6d 27 73 20 63 75 | the sys|tem's cu|
|000034f0| 74 20 62 75 66 66 65 72 | 20 6e 75 6d 62 65 72 0a |t buffer| number.|
|00003500| 58 7b 5c 74 74 20 69 7d | 2c 0a 58 77 68 65 72 65 |X{\tt i}|,.Xwhere|
|00003510| 20 69 74 20 63 61 6e 20 | 62 65 20 66 6f 75 6e 64 | it can |be found|
|00003520| 20 28 66 6f 72 20 70 61 | 73 74 69 6e 67 29 20 62 | (for pa|sting) b|
|00003530| 79 20 6f 74 68 65 72 20 | 61 70 70 6c 69 63 61 74 |y other |applicat|
|00003540| 69 6f 6e 73 2e 0a 58 4f | 6e 20 58 31 31 2c 20 74 |ions..XO|n X11, t|
|00003550| 68 65 72 65 20 61 72 65 | 20 38 20 63 75 74 20 62 |here are| 8 cut b|
|00003560| 75 66 66 65 72 73 20 28 | 6e 75 6d 62 65 72 65 64 |uffers (|numbered|
|00003570| 20 30 2e 2e 37 29 2e 0a | 58 43 75 74 20 62 75 66 | 0..7)..|XCut buf|
|00003580| 66 65 72 20 6e 75 6d 62 | 65 72 20 30 20 69 73 20 |fer numb|er 0 is |
|00003590| 74 68 65 20 60 63 6c 69 | 70 62 6f 61 72 64 27 20 |the `cli|pboard' |
|000035a0| 6f 6e 20 74 68 65 20 4d | 61 63 69 6e 74 6f 73 68 |on the M|acintosh|
|000035b0| 2e 0a 58 5c 66 75 6e 63 | 69 74 65 6d 7b 67 65 74 |..X\func|item{get|
|000035c0| 63 75 74 62 75 66 66 65 | 72 7d 7b 69 7d 0a 58 25 |cutbuffe|r}{i}.X%|
|000035d0| 2e 62 72 0a 58 52 65 74 | 75 72 6e 73 20 74 68 65 |.br.XRet|urns the|
|000035e0| 20 63 6f 6e 74 65 6e 74 | 73 20 6f 66 20 74 68 65 | content|s of the|
|000035f0| 20 73 79 73 74 65 6d 27 | 73 20 63 75 74 20 62 75 | system'|s cut bu|
|00003600| 66 66 65 72 20 6e 75 6d | 62 65 72 0a 58 7b 5c 74 |ffer num|ber.X{\t|
|00003610| 74 20 69 7d 2e 0a 58 5c | 66 75 6e 63 69 74 65 6d |t i}..X\|funcitem|
|00003620| 7b 72 6f 74 61 74 65 62 | 75 74 62 75 66 66 65 72 |{rotateb|utbuffer|
|00003630| 73 7d 7b 6e 7d 0a 58 25 | 2e 62 72 0a 58 4f 6e 20 |s}{n}.X%|.br.XOn |
|00003640| 58 31 31 2c 20 74 68 69 | 73 20 72 6f 74 61 74 65 |X11, thi|s rotate|
|00003650| 73 20 74 68 65 20 38 20 | 63 75 74 20 62 75 66 66 |s the 8 |cut buff|
|00003660| 65 72 73 20 62 79 0a 58 | 7b 5c 74 74 20 6e 7d 2e |ers by.X|{\tt n}.|
|00003670| 0a 58 49 67 6e 6f 72 65 | 64 20 6f 6e 20 74 68 65 |.XIgnore|d on the|
|00003680| 20 4d 61 63 69 6e 74 6f | 73 68 2e 0a 58 5c 66 75 | Macinto|sh..X\fu|
|00003690| 6e 63 69 74 65 6d 7b 67 | 65 74 73 65 6c 65 63 74 |ncitem{g|etselect|
|000036a0| 69 6f 6e 7d 7b 69 7d 0a | 58 25 2e 62 72 0a 58 52 |ion}{i}.|X%.br.XR|
|000036b0| 65 74 75 72 6e 73 20 58 | 31 31 20 73 65 6c 65 63 |eturns X|11 selec|
|000036c0| 74 69 6f 6e 20 6e 75 6d | 62 65 72 0a 58 7b 5c 74 |tion num|ber.X{\t|
|000036d0| 74 20 69 2e 7d 0a 58 53 | 65 6c 65 63 74 69 6f 6e |t i.}.XS|election|
|000036e0| 73 20 61 72 65 20 6e 6f | 74 20 63 75 74 20 62 75 |s are no|t cut bu|
|000036f0| 66 66 65 72 73 2e 0a 58 | 53 65 6c 65 63 74 69 6f |ffers..X|Selectio|
|00003700| 6e 20 6e 75 6d 62 65 72 | 73 20 61 72 65 20 64 65 |n number|s are de|
|00003710| 66 69 6e 65 64 20 69 6e | 20 6d 6f 64 75 6c 65 0a |fined in| module.|
|00003720| 58 7b 5c 74 74 20 73 74 | 64 77 69 6e 65 76 65 6e |X{\tt st|dwineven|
|00003730| 74 73 7d 2e 0a 58 53 65 | 6c 65 63 74 69 6f 6e 20 |ts}..XSe|lection |
|00003740| 7b 5c 74 74 20 57 53 5c | 5f 50 52 49 4d 41 52 59 |{\tt WS\|_PRIMARY|
|00003750| 7d 20 69 73 20 74 68 65 | 0a 58 7b 5c 65 6d 20 70 |} is the|.X{\em p|
|00003760| 72 69 6d 61 72 79 7d 0a | 58 73 65 6c 65 63 74 69 |rimary}.|Xselecti|
|00003770| 6f 6e 20 28 75 73 65 64 | 20 62 79 0a 58 78 74 65 |on (used| by.Xxte|
|00003780| 72 6d 2c 0a 58 66 6f 72 | 20 69 6e 73 74 61 6e 63 |rm,.Xfor| instanc|
|00003790| 65 29 3b 0a 58 73 65 6c | 65 63 74 69 6f 6e 20 7b |e);.Xsel|ection {|
|000037a0| 5c 74 74 20 57 53 5c 5f | 53 45 43 4f 4e 44 41 52 |\tt WS\_|SECONDAR|
|000037b0| 59 7d 20 69 73 20 74 68 | 65 0a 58 7b 5c 65 6d 20 |Y} is th|e.X{\em |
|000037c0| 73 65 63 6f 6e 64 61 72 | 79 7d 0a 58 73 65 6c 65 |secondar|y}.Xsele|
|000037d0| 63 74 69 6f 6e 3b 20 73 | 65 6c 65 63 74 69 6f 6e |ction; s|election|
|000037e0| 20 7b 5c 74 74 20 57 53 | 5c 5f 43 4c 49 50 42 4f | {\tt WS|\_CLIPBO|
|000037f0| 41 52 44 7d 20 69 73 20 | 74 68 65 0a 58 7b 5c 65 |ARD} is |the.X{\e|
|00003800| 6d 20 63 6c 69 70 62 6f | 61 72 64 7d 0a 58 73 65 |m clipbo|ard}.Xse|
|00003810| 6c 65 63 74 69 6f 6e 20 | 28 75 73 65 64 20 62 79 |lection |(used by|
|00003820| 0a 58 78 63 6c 69 70 62 | 6f 61 72 64 29 2e 0a 58 |.Xxclipb|oard)..X|
|00003830| 4f 6e 20 74 68 65 20 4d | 61 63 69 6e 74 6f 73 68 |On the M|acintosh|
|00003840| 2c 20 74 68 69 73 20 61 | 6c 77 61 79 73 20 72 65 |, this a|lways re|
|00003850| 74 75 72 6e 73 20 61 6e | 20 65 6d 70 74 79 20 73 |turns an| empty s|
|00003860| 74 72 69 6e 67 2e 0a 58 | 5c 66 75 6e 63 69 74 65 |tring..X|\funcite|
|00003870| 6d 7b 72 65 73 65 74 73 | 65 6c 65 63 74 69 6f 6e |m{resets|election|
|00003880| 7d 7b 69 7d 0a 58 25 2e | 62 72 0a 58 52 65 73 65 |}{i}.X%.|br.XRese|
|00003890| 74 73 20 73 65 6c 65 63 | 74 69 6f 6e 20 6e 75 6d |ts selec|tion num|
|000038a0| 62 65 72 0a 58 7b 5c 74 | 74 20 69 7d 2c 0a 58 69 |ber.X{\t|t i},.Xi|
|000038b0| 66 20 74 68 69 73 20 70 | 72 6f 63 65 73 73 20 6f |f this p|rocess o|
|000038c0| 77 6e 73 20 69 74 2e 0a | 58 28 53 65 65 20 77 69 |wns it..|X(See wi|
|000038d0| 6e 64 6f 77 20 6d 65 74 | 68 6f 64 0a 58 7b 5c 74 |ndow met|hod.X{\t|
|000038e0| 74 20 73 65 74 73 65 6c | 65 63 74 69 6f 6e 28 29 |t setsel|ection()|
|000038f0| 7d 29 2e 0a 58 5c 66 75 | 6e 63 69 74 65 6d 7b 62 |})..X\fu|ncitem{b|
|00003900| 61 73 65 6c 69 6e 65 7d | 7b 7d 0a 58 25 2e 62 72 |aseline}|{}.X%.br|
|00003910| 0a 58 52 65 74 75 72 6e | 20 74 68 65 20 62 61 73 |.XReturn| the bas|
|00003920| 65 6c 69 6e 65 20 6f 66 | 20 74 68 65 20 63 75 72 |eline of| the cur|
|00003930| 72 65 6e 74 20 66 6f 6e | 74 20 28 64 65 66 69 6e |rent fon|t (defin|
|00003940| 65 64 20 62 79 20 53 54 | 44 57 49 4e 20 61 73 20 |ed by ST|DWIN as |
|00003950| 74 68 65 0a 58 76 65 72 | 74 69 63 61 6c 20 64 69 |the.Xver|tical di|
|00003960| 73 74 61 6e 63 65 20 62 | 65 74 77 65 65 6e 20 74 |stance b|etween t|
|00003970| 68 65 20 62 61 73 65 6c | 69 6e 65 20 61 6e 64 20 |he basel|ine and |
|00003980| 74 68 65 20 74 6f 70 20 | 6f 66 20 74 68 65 0a 58 |the top |of the.X|
|00003990| 63 68 61 72 61 63 74 65 | 72 73 29 2e 25 0a 58 5c |characte|rs).%.X\|
|000039a0| 66 6f 6f 74 6e 6f 74 65 | 7b 0a 58 54 68 65 72 65 |footnote|{.XThere|
|000039b0| 20 69 73 20 6e 6f 20 77 | 61 79 20 79 65 74 20 74 | is no w|ay yet t|
|000039c0| 6f 20 73 65 74 20 74 68 | 65 20 63 75 72 72 65 6e |o set th|e curren|
|000039d0| 74 20 66 6f 6e 74 2e 0a | 58 54 68 69 73 20 77 69 |t font..|XThis wi|
|000039e0| 6c 6c 20 63 68 61 6e 67 | 65 20 69 6e 20 61 20 66 |ll chang|e in a f|
|000039f0| 75 74 75 72 65 20 76 65 | 72 73 69 6f 6e 2e 0a 58 |uture ve|rsion..X|
|00003a00| 7d 0a 58 5c 66 75 6e 63 | 69 74 65 6d 7b 6c 69 6e |}.X\func|item{lin|
|00003a10| 65 68 65 69 67 68 74 7d | 7b 7d 0a 58 25 2e 62 72 |eheight}|{}.X%.br|
|00003a20| 0a 58 52 65 74 75 72 6e | 20 74 68 65 20 74 6f 74 |.XReturn| the tot|
|00003a30| 61 6c 20 6c 69 6e 65 20 | 68 65 69 67 68 74 20 6f |al line |height o|
|00003a40| 66 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 66 6f |f the cu|rrent fo|
|00003a50| 6e 74 2e 0a 58 5c 66 75 | 6e 63 69 74 65 6d 7b 74 |nt..X\fu|ncitem{t|
|00003a60| 65 78 74 62 72 65 61 6b | 7d 7b 73 74 72 2c 20 77 |extbreak|}{str, w|
|00003a70| 69 64 74 68 7d 0a 58 25 | 2e 62 72 0a 58 52 65 74 |idth}.X%|.br.XRet|
|00003a80| 75 72 6e 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f |urn the |number o|
|00003a90| 66 20 63 68 61 72 61 63 | 74 65 72 73 20 6f 66 20 |f charac|ters of |
|00003aa0| 74 68 65 20 73 74 72 69 | 6e 67 20 74 68 61 74 20 |the stri|ng that |
|00003ab0| 66 69 74 20 69 6e 74 6f | 20 61 20 73 70 61 63 65 |fit into| a space|
|00003ac0| 20 6f 66 0a 58 7b 5c 74 | 74 20 77 69 64 74 68 7d | of.X{\t|t width}|
|00003ad0| 0a 58 62 69 74 73 20 77 | 69 64 65 20 77 68 65 6e |.Xbits w|ide when|
|00003ae0| 20 64 72 61 77 6e 20 69 | 6e 20 74 68 65 20 63 75 | drawn i|n the cu|
|00003af0| 72 65 6e 74 20 66 6f 6e | 74 2e 0a 58 5c 66 75 6e |rent fon|t..X\fun|
|00003b00| 63 69 74 65 6d 7b 74 65 | 78 74 77 69 64 74 68 7d |citem{te|xtwidth}|
|00003b10| 7b 73 74 72 7d 0a 58 25 | 2e 62 72 0a 58 52 65 74 |{str}.X%|.br.XRet|
|00003b20| 75 72 6e 20 74 68 65 20 | 77 69 64 74 68 20 69 6e |urn the |width in|
|00003b30| 20 62 69 74 73 20 6f 66 | 20 74 68 65 20 73 74 72 | bits of| the str|
|00003b40| 69 6e 67 20 77 68 65 6e | 20 64 72 61 77 6e 20 69 |ing when| drawn i|
|00003b50| 6e 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 66 6f |n the cu|rrent fo|
|00003b60| 6e 74 2e 0a 58 5c 65 6e | 64 7b 64 65 73 63 72 69 |nt..X\en|d{descri|
|00003b70| 70 74 69 6f 6e 7d 0a 58 | 0a 58 5c 73 75 62 73 75 |ption}.X|.X\subsu|
|00003b80| 62 73 65 63 74 69 6f 6e | 7b 57 69 6e 64 6f 77 20 |bsection|{Window |
|00003b90| 4f 62 6a 65 63 74 20 4d | 65 74 68 6f 64 73 7d 0a |Object M|ethods}.|
|00003ba0| 58 0a 58 57 69 6e 64 6f | 77 20 6f 62 6a 65 63 74 |X.XWindo|w object|
|00003bb0| 73 20 61 72 65 20 63 72 | 65 61 74 65 64 20 62 79 |s are cr|eated by|
|00003bc0| 0a 58 7b 5c 74 74 20 73 | 74 64 77 69 6e 2e 6f 70 |.X{\tt s|tdwin.op|
|00003bd0| 65 6e 28 29 7d 2e 0a 58 | 54 68 65 72 65 20 69 73 |en()}..X|There is|
|00003be0| 20 6e 6f 20 65 78 70 6c | 69 63 69 74 20 66 75 6e | no expl|icit fun|
|00003bf0| 63 74 69 6f 6e 20 74 6f | 20 63 6c 6f 73 65 20 61 |ction to| close a|
|00003c00| 20 77 69 6e 64 6f 77 3b | 20 77 69 6e 64 6f 77 73 | window;| windows|
|00003c10| 20 61 72 65 20 63 6c 6f | 73 65 64 20 77 68 65 6e | are clo|sed when|
|00003c20| 0a 58 74 68 65 79 20 61 | 72 65 20 67 61 72 62 61 |.Xthey a|re garba|
|00003c30| 67 65 2d 63 6f 6c 6c 65 | 63 74 65 64 2e 0a 58 57 |ge-colle|cted..XW|
|00003c40| 69 6e 64 6f 77 20 6f 62 | 6a 65 63 74 73 20 68 61 |indow ob|jects ha|
|00003c50| 76 65 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |ve the f|ollowing|
|00003c60| 20 6d 65 74 68 6f 64 73 | 3a 0a 58 5c 62 65 67 69 | methods|:.X\begi|
|00003c70| 6e 7b 64 65 73 63 72 69 | 70 74 69 6f 6e 7d 0a 58 |n{descri|ption}.X|
|00003c80| 5c 66 75 6e 63 69 74 65 | 6d 7b 62 65 67 69 6e 64 |\funcite|m{begind|
|00003c90| 72 61 77 69 6e 67 7d 7b | 7d 0a 58 52 65 74 75 72 |rawing}{|}.XRetur|
|00003ca0| 6e 73 20 61 20 64 72 61 | 77 69 6e 67 20 6f 62 6a |ns a dra|wing obj|
|00003cb0| 65 63 74 2c 20 77 68 6f | 73 65 20 6d 65 74 68 6f |ect, who|se metho|
|00003cc0| 64 73 20 28 64 65 73 63 | 72 69 62 65 64 20 62 65 |ds (desc|ribed be|
|00003cd0| 6c 6f 77 29 20 61 6c 6c | 6f 77 20 64 72 61 77 69 |low) all|ow drawi|
|00003ce0| 6e 67 0a 58 69 6e 20 74 | 68 65 20 77 69 6e 64 6f |ng.Xin t|he windo|
|00003cf0| 77 2e 0a 58 5c 66 75 6e | 63 69 74 65 6d 7b 63 68 |w..X\fun|citem{ch|
|00003d00| 61 6e 67 65 7d 7b 72 65 | 63 74 7d 0a 58 49 6e 76 |ange}{re|ct}.XInv|
|00003d10| 61 6c 69 64 61 74 65 73 | 20 74 68 65 20 67 69 76 |alidates| the giv|
|00003d20| 65 6e 20 72 65 63 74 61 | 6e 67 6c 65 3b 20 74 68 |en recta|ngle; th|
|00003d30| 69 73 20 6d 61 79 20 63 | 61 75 73 65 20 61 20 64 |is may c|ause a d|
|00003d40| 72 61 77 20 65 76 65 6e | 74 2e 0a 58 5c 66 75 6e |raw even|t..X\fun|
|00003d50| 63 69 74 65 6d 7b 67 65 | 74 74 69 74 6c 65 7d 7b |citem{ge|ttitle}{|
|00003d60| 7d 0a 58 52 65 74 75 72 | 6e 73 20 74 68 65 20 77 |}.XRetur|ns the w|
|00003d70| 69 6e 64 6f 77 27 73 20 | 74 69 74 6c 65 20 73 74 |indow's |title st|
|00003d80| 72 69 6e 67 2e 0a 58 5c | 66 75 6e 63 69 74 65 6d |ring..X\|funcitem|
|00003d90| 7b 67 65 74 64 6f 63 73 | 69 7a 65 7d 7b 7d 0a 58 |{getdocs|ize}{}.X|
|00003da0| 5c 62 65 67 69 6e 7b 73 | 6c 6f 70 70 79 70 61 72 |\begin{s|loppypar|
|00003db0| 7d 0a 58 52 65 74 75 72 | 6e 73 20 61 20 70 61 69 |}.XRetur|ns a pai|
|00003dc0| 72 20 6f 66 20 69 6e 74 | 65 67 65 72 73 20 67 69 |r of int|egers gi|
|00003dd0| 76 69 6e 67 20 74 68 65 | 20 73 69 7a 65 20 6f 66 |ving the| size of|
|00003de0| 20 74 68 65 20 64 6f 63 | 75 6d 65 6e 74 20 61 73 | the doc|ument as|
|00003df0| 20 73 65 74 20 62 79 0a | 58 7b 5c 74 74 20 73 65 | set by.|X{\tt se|
|00003e00| 74 64 6f 63 73 69 7a 65 | 28 29 7d 2e 0a 58 5c 65 |tdocsize|()}..X\e|
|00003e10| 6e 64 7b 73 6c 6f 70 70 | 79 70 61 72 7d 0a 58 5c |nd{slopp|ypar}.X\|
|00003e20| 66 75 6e 63 69 74 65 6d | 7b 67 65 74 6f 72 69 67 |funcitem|{getorig|
|00003e30| 69 6e 7d 7b 7d 0a 58 52 | 65 74 75 72 6e 73 20 61 |in}{}.XR|eturns a|
|00003e40| 20 70 61 69 72 20 6f 66 | 20 69 6e 74 65 67 65 72 | pair of| integer|
|00003e50| 73 20 67 69 76 69 6e 67 | 20 74 68 65 20 6f 72 69 |s giving| the ori|
|00003e60| 67 69 6e 20 6f 66 20 74 | 68 65 20 77 69 6e 64 6f |gin of t|he windo|
|00003e70| 77 20 77 69 74 68 20 72 | 65 73 70 65 63 74 0a 58 |w with r|espect.X|
|00003e80| 74 6f 20 74 68 65 20 64 | 6f 63 75 6d 65 6e 74 2e |to the d|ocument.|
|00003e90| 0a 58 5c 66 75 6e 63 69 | 74 65 6d 7b 67 65 74 77 |.X\funci|tem{getw|
|00003ea0| 69 6e 73 69 7a 65 7d 7b | 7d 0a 58 52 65 74 75 72 |insize}{|}.XRetur|
|00003eb0| 6e 73 20 61 20 70 61 69 | 72 20 6f 66 20 69 6e 74 |ns a pai|r of int|
|00003ec0| 65 67 65 72 73 20 67 69 | 76 69 6e 67 20 74 68 65 |egers gi|ving the|
|00003ed0| 20 73 69 7a 65 20 6f 66 | 20 74 68 65 20 77 69 6e | size of| the win|
|00003ee0| 64 6f 77 2e 0a 58 5c 66 | 75 6e 63 69 74 65 6d 7b |dow..X\f|uncitem{|
|00003ef0| 6d 65 6e 75 63 72 65 61 | 74 65 7d 7b 74 69 74 6c |menucrea|te}{titl|
|00003f00| 65 7d 0a 58 43 72 65 61 | 74 65 73 20 61 20 6d 65 |e}.XCrea|tes a me|
|00003f10| 6e 75 20 6f 62 6a 65 63 | 74 20 72 65 66 65 72 72 |nu objec|t referr|
|00003f20| 69 6e 67 20 74 6f 20 61 | 20 6c 6f 63 61 6c 20 6d |ing to a| local m|
|00003f30| 65 6e 75 20 28 61 20 6d | 65 6e 75 20 74 68 61 74 |enu (a m|enu that|
|00003f40| 20 61 70 70 65 61 72 73 | 0a 58 6f 6e 6c 79 20 69 | appears|.Xonly i|
|00003f50| 6e 20 74 68 69 73 20 77 | 69 6e 64 6f 77 29 2e 0a |n this w|indow)..|
|00003f60| 58 4d 65 74 68 6f 64 73 | 20 6d 65 6e 75 20 6f 62 |XMethods| menu ob|
|00003f70| 6a 65 63 74 73 20 61 72 | 65 20 64 65 73 63 72 69 |jects ar|e descri|
|00003f80| 62 65 64 20 62 65 6c 6f | 77 2e 0a 58 5c 66 75 6e |bed belo|w..X\fun|
|00003f90| 63 69 74 65 6d 7b 73 63 | 72 6f 6c 6c 7d 7b 72 65 |citem{sc|roll}{re|
|00003fa0| 63 74 2c 7e 70 6f 69 6e | 74 7d 0a 58 53 63 72 6f |ct,~poin|t}.XScro|
|00003fb0| 6c 6c 73 20 74 68 65 20 | 67 69 76 65 6e 20 72 65 |lls the |given re|
|00003fc0| 63 74 61 6e 67 6c 65 20 | 62 79 20 74 68 65 20 76 |ctangle |by the v|
|00003fd0| 65 63 74 6f 72 20 67 69 | 76 65 6e 20 62 79 20 74 |ector gi|ven by t|
|00003fe0| 68 65 20 70 6f 69 6e 74 | 2e 0a 58 5c 66 75 6e 63 |he point|..X\func|
|00003ff0| 69 74 65 6d 7b 73 65 74 | 77 69 6e 63 75 72 73 6f |item{set|wincurso|
|00004000| 72 7d 7b 6e 61 6d 65 7d | 0a 58 5c 62 65 67 69 6e |r}{name}|.X\begin|
|00004010| 7b 73 6c 6f 70 70 79 70 | 61 72 7d 0a 58 53 65 74 |{sloppyp|ar}.XSet|
|00004020| 73 20 74 68 65 20 77 69 | 6e 64 6f 77 20 63 75 72 |s the wi|ndow cur|
|00004030| 73 6f 72 20 74 6f 20 61 | 20 63 75 72 73 6f 72 20 |sor to a| cursor |
|00004040| 6f 66 20 74 68 65 20 67 | 69 76 65 6e 20 6e 61 6d |of the g|iven nam|
|00004050| 65 2e 0a 58 49 74 20 72 | 61 69 73 65 73 20 74 68 |e..XIt r|aises th|
|00004060| 65 0a 58 7b 5c 74 74 20 | 52 75 6e 74 69 6d 65 5c |e.X{\tt |Runtime\|
|00004070| 2d 45 72 72 6f 72 7d 0a | 58 65 78 63 65 70 74 69 |-Error}.|Xexcepti|
|00004080| 6f 6e 20 69 66 20 6e 6f | 20 63 75 72 73 6f 72 20 |on if no| cursor |
|00004090| 6f 66 20 74 68 65 20 67 | 69 76 65 6e 20 6e 61 6d |of the g|iven nam|
|000040a0| 65 20 65 78 69 73 74 73 | 2e 0a 58 53 75 69 74 61 |e exists|..XSuita|
|000040b0| 62 6c 65 20 6e 61 6d 65 | 73 20 61 72 65 0a 58 7b |ble name|s are.X{|
|000040c0| 5c 74 74 20 27 69 62 65 | 61 6d 27 7d 2c 0a 58 7b |\tt 'ibe|am'},.X{|
|000040d0| 5c 74 74 20 27 61 72 72 | 6f 77 27 7d 2c 0a 58 7b |\tt 'arr|ow'},.X{|
|000040e0| 5c 74 74 20 27 63 72 6f | 73 73 27 7d 2c 0a 58 7b |\tt 'cro|ss'},.X{|
|000040f0| 5c 74 74 20 27 77 61 74 | 63 68 27 7d 0a 58 61 6e |\tt 'wat|ch'}.Xan|
|00004100| 64 0a 58 7b 5c 74 74 20 | 27 70 6c 75 73 27 7d 2e |d.X{\tt |'plus'}.|
|00004110| 0a 58 4f 6e 20 58 31 31 | 2c 20 74 68 65 72 65 20 |.XOn X11|, there |
|00004120| 61 72 65 20 6d 61 6e 79 | 20 6d 6f 72 65 20 28 73 |are many| more (s|
|00004130| 65 65 0a 58 7b 5c 74 74 | 20 3c 58 31 31 2f 63 75 |ee.X{\tt| <X11/cu|
|00004140| 72 73 6f 72 66 6f 6e 74 | 2e 68 3e 7d 29 2e 0a 58 |rsorfont|.h>})..X|
|00004150| 5c 65 6e 64 7b 73 6c 6f | 70 70 79 70 61 72 7d 0a |\end{slo|ppypar}.|
|00004160| 58 5c 66 75 6e 63 69 74 | 65 6d 7b 73 65 74 64 6f |X\funcit|em{setdo|
|00004170| 63 73 69 7a 65 7d 7b 70 | 6f 69 6e 74 7d 0a 58 53 |csize}{p|oint}.XS|
|00004180| 65 74 73 20 74 68 65 20 | 73 69 7a 65 20 6f 66 20 |ets the |size of |
|00004190| 74 68 65 20 64 72 61 77 | 69 6e 67 20 64 6f 63 75 |the draw|ing docu|
|000041a0| 6d 65 6e 74 2e 0a 58 5c | 66 75 6e 63 69 74 65 6d |ment..X\|funcitem|
|000041b0| 7b 73 65 74 6f 72 69 67 | 69 6e 7d 7b 70 6f 69 6e |{setorig|in}{poin|
|000041c0| 74 7d 0a 58 4d 6f 76 65 | 73 20 74 68 65 20 6f 72 |t}.XMove|s the or|
|000041d0| 69 67 69 6e 20 6f 66 20 | 74 68 65 20 77 69 6e 64 |igin of |the wind|
|000041e0| 6f 77 20 74 6f 20 74 68 | 65 20 67 69 76 65 6e 20 |ow to th|e given |
|000041f0| 70 6f 69 6e 74 20 69 6e | 20 74 68 65 20 64 6f 63 |point in| the doc|
|00004200| 75 6d 65 6e 74 2e 0a 58 | 5c 66 75 6e 63 69 74 65 |ument..X|\funcite|
|00004210| 6d 7b 73 65 74 73 65 6c | 65 63 74 69 6f 6e 7d 7b |m{setsel|ection}{|
|00004220| 69 2c 20 73 74 72 7d 0a | 58 41 74 74 65 6d 70 74 |i, str}.|XAttempt|
|00004230| 73 20 74 6f 20 73 65 74 | 20 58 31 31 20 73 65 6c |s to set| X11 sel|
|00004240| 65 63 74 69 6f 6e 20 6e | 75 6d 62 65 72 0a 58 7b |ection n|umber.X{|
|00004250| 5c 74 74 20 69 7d 0a 58 | 74 6f 20 74 68 65 20 73 |\tt i}.X|to the s|
|00004260| 74 72 69 6e 67 0a 58 7b | 5c 74 74 20 73 74 72 7d |tring.X{|\tt str}|
|00004270| 2e 0a 58 28 53 65 65 20 | 73 74 64 77 69 6e 20 6d |..X(See |stdwin m|
|00004280| 65 74 68 6f 64 0a 58 7b | 5c 74 74 20 67 65 74 73 |ethod.X{|\tt gets|
|00004290| 65 6c 65 63 74 69 6f 6e | 28 29 7d 0a 58 66 6f 72 |election|()}.Xfor|
|000042a0| 20 74 68 65 20 6d 65 61 | 6e 69 6e 67 20 6f 66 0a | the mea|ning of.|
|000042b0| 58 7b 5c 74 74 20 69 7d | 2e 29 0a 58 52 65 74 75 |X{\tt i}|.).XRetu|
|000042c0| 72 6e 73 20 74 72 75 65 | 20 69 66 20 69 74 20 73 |rns true| if it s|
|000042d0| 75 63 63 65 65 64 73 2e | 0a 58 49 66 20 69 74 20 |ucceeds.|.XIf it |
|000042e0| 73 75 63 63 65 65 64 73 | 2c 20 74 68 65 20 77 69 |succeeds|, the wi|
|000042f0| 6e 64 6f 77 20 60 60 6f | 77 6e 73 27 27 20 74 68 |ndow ``o|wns'' th|
|00004300| 65 20 73 65 6c 65 63 74 | 69 6f 6e 20 75 6e 74 69 |e select|ion unti|
|00004310| 6c 0a 58 28 61 29 20 61 | 6e 6f 74 68 65 72 20 61 |l.X(a) a|nother a|
|00004320| 70 70 6c 69 63 61 74 69 | 6f 6e 73 20 74 61 6b 65 |pplicati|ons take|
|00004330| 73 20 6f 77 6e 65 72 73 | 68 69 70 20 6f 66 20 74 |s owners|hip of t|
|00004340| 68 65 20 73 65 6c 65 63 | 74 69 6f 6e 3b 20 6f 72 |he selec|tion; or|
|00004350| 0a 58 28 62 29 20 74 68 | 65 20 77 69 6e 64 6f 77 |.X(b) th|e window|
|00004360| 20 69 73 20 64 65 6c 65 | 74 65 64 3b 20 6f 72 0a | is dele|ted; or.|
|00004370| 58 28 63 29 20 74 68 65 | 20 61 70 70 6c 69 63 61 |X(c) the| applica|
|00004380| 74 69 6f 6e 20 63 6c 65 | 61 72 73 20 6f 77 6e 65 |tion cle|ars owne|
|00004390| 72 73 68 69 70 20 62 79 | 20 63 61 6c 6c 69 6e 67 |rship by| calling|
|000043a0| 0a 58 7b 5c 74 74 20 73 | 74 64 77 69 6e 2e 72 65 |.X{\tt s|tdwin.re|
|000043b0| 73 65 74 73 65 6c 65 63 | 74 69 6f 6e 28 69 29 7d |setselec|tion(i)}|
|000043c0| 2e 0a 58 57 68 65 6e 20 | 61 6e 6f 74 68 65 72 20 |..XWhen |another |
|000043d0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 74 61 6b 65 |applicat|ion take|
|000043e0| 73 20 6f 77 6e 65 72 73 | 68 69 70 20 6f 66 20 74 |s owners|hip of t|
|000043f0| 68 65 20 73 65 6c 65 63 | 74 69 6f 6e 2c 20 61 0a |he selec|tion, a.|
|00004400| 58 7b 5c 74 74 20 57 45 | 5c 5f 4c 4f 53 54 5c 5f |X{\tt WE|\_LOST\_|
|00004410| 53 45 4c 7d 0a 58 65 76 | 65 6e 74 20 69 73 20 72 |SEL}.Xev|ent is r|
|00004420| 65 63 65 69 76 65 64 20 | 66 6f 72 20 6e 6f 20 70 |eceived |for no p|
|00004430| 61 72 74 69 63 75 6c 61 | 72 20 77 69 6e 64 6f 77 |articula|r window|
|00004440| 20 61 6e 64 20 77 69 74 | 68 20 74 68 65 20 73 65 | and wit|h the se|
|00004450| 6c 65 63 74 69 6f 6e 20 | 6e 75 6d 62 65 72 0a 58 |lection |number.X|
|00004460| 61 73 20 64 65 74 61 69 | 6c 2e 0a 58 49 67 6e 6f |as detai|l..XIgno|
|00004470| 72 65 64 20 6f 6e 20 74 | 68 65 20 4d 61 63 69 6e |red on t|he Macin|
|00004480| 74 6f 73 68 2e 0a 58 5c | 66 75 6e 63 69 74 65 6d |tosh..X\|funcitem|
|00004490| 7b 73 65 74 74 69 74 6c | 65 7d 7b 74 69 74 6c 65 |{settitl|e}{title|
|000044a0| 7d 0a 58 53 65 74 73 20 | 74 68 65 20 77 69 6e 64 |}.XSets |the wind|
|000044b0| 6f 77 27 73 20 74 69 74 | 6c 65 20 73 74 72 69 6e |ow's tit|le strin|
|000044c0| 67 2e 0a 58 5c 66 75 6e | 63 69 74 65 6d 7b 73 65 |g..X\fun|citem{se|
|000044d0| 74 74 69 6d 65 72 7d 7b | 64 73 65 63 73 7d 0a 58 |ttimer}{|dsecs}.X|
|000044e0| 53 63 68 65 64 75 6c 65 | 73 20 61 20 74 69 6d 65 |Schedule|s a time|
|000044f0| 72 20 65 76 65 6e 74 20 | 66 6f 72 20 74 68 65 20 |r event |for the |
|00004500| 77 69 6e 64 6f 77 20 69 | 6e 0a 58 7b 5c 74 74 20 |window i|n.X{\tt |
|00004510| 64 73 65 63 73 2f 31 30 | 7d 0a 58 73 65 63 6f 6e |dsecs/10|}.Xsecon|
|00004520| 64 73 2e 0a 58 5c 66 75 | 6e 63 69 74 65 6d 7b 73 |ds..X\fu|ncitem{s|
|00004530| 68 6f 77 7d 7b 72 65 63 | 74 7d 0a 58 54 72 69 65 |how}{rec|t}.XTrie|
|00004540| 73 20 74 6f 20 65 6e 73 | 75 72 65 20 74 68 61 74 |s to ens|ure that|
|00004550| 20 74 68 65 20 67 69 76 | 65 6e 20 72 65 63 74 61 | the giv|en recta|
|00004560| 6e 67 6c 65 20 6f 66 20 | 74 68 65 20 64 6f 63 75 |ngle of |the docu|
|00004570| 6d 65 6e 74 20 69 73 20 | 76 69 73 69 62 6c 65 20 |ment is |visible |
|00004580| 69 6e 0a 58 74 68 65 20 | 77 69 6e 64 6f 77 2e 0a |in.Xthe |window..|
|00004590| 58 5c 66 75 6e 63 69 74 | 65 6d 7b 74 65 78 74 63 |X\funcit|em{textc|
|000045a0| 72 65 61 74 65 7d 7b 72 | 65 63 74 7d 0a 58 43 72 |reate}{r|ect}.XCr|
|000045b0| 65 61 74 65 73 20 61 20 | 74 65 78 74 2d 65 64 69 |eates a |text-edi|
|000045c0| 74 20 6f 62 6a 65 63 74 | 20 69 6e 20 74 68 65 20 |t object| in the |
|000045d0| 64 6f 63 75 6d 65 6e 74 | 20 61 74 20 74 68 65 20 |document| at the |
|000045e0| 67 69 76 65 6e 20 72 65 | 63 74 61 6e 67 6c 65 2e |given re|ctangle.|
|000045f0| 0a 58 4d 65 74 68 6f 64 | 73 20 6f 66 20 74 65 78 |.XMethod|s of tex|
|00004600| 74 2d 65 64 69 74 20 6f | 62 6a 65 63 74 73 20 61 |t-edit o|bjects a|
|00004610| 72 65 20 64 65 73 63 72 | 69 62 65 64 20 62 65 6c |re descr|ibed bel|
|00004620| 6f 77 2e 0a 58 5c 65 6e | 64 7b 64 65 73 63 72 69 |ow..X\en|d{descri|
|00004630| 70 74 69 6f 6e 7d 0a 58 | 0a 58 5c 73 75 62 73 75 |ption}.X|.X\subsu|
|00004640| 62 73 65 63 74 69 6f 6e | 7b 44 72 61 77 69 6e 67 |bsection|{Drawing|
|00004650| 20 4f 62 6a 65 63 74 20 | 4d 65 74 68 6f 64 73 7d | Object |Methods}|
|00004660| 0a 58 0a 58 44 72 61 77 | 69 6e 67 20 6f 62 6a 65 |.X.XDraw|ing obje|
|00004670| 63 74 73 20 61 72 65 20 | 63 72 65 61 74 65 64 20 |cts are |created |
|00004680| 65 78 63 6c 75 73 69 76 | 65 6c 79 20 62 79 20 74 |exclusiv|ely by t|
|00004690| 68 65 20 77 69 6e 64 6f | 77 20 6d 65 74 68 6f 64 |he windo|w method|
|000046a0| 0a 58 7b 5c 74 74 20 62 | 65 67 69 6e 64 72 61 77 |.X{\tt b|egindraw|
|000046b0| 69 6e 67 28 29 7d 2e 0a | 58 4f 6e 6c 79 20 6f 6e |ing()}..|XOnly on|
|000046c0| 65 20 64 72 61 77 69 6e | 67 20 6f 62 6a 65 63 74 |e drawin|g object|
|000046d0| 20 63 61 6e 20 65 78 69 | 73 74 20 61 74 20 61 6e | can exi|st at an|
|000046e0| 79 20 67 69 76 65 6e 20 | 74 69 6d 65 3b 20 74 68 |y given |time; th|
|000046f0| 65 20 64 72 61 77 69 6e | 67 20 6f 62 6a 65 63 74 |e drawin|g object|
|00004700| 0a 58 6d 75 73 74 20 62 | 65 20 64 65 6c 65 74 65 |.Xmust b|e delete|
|00004710| 64 20 74 6f 20 66 69 6e | 69 73 68 20 64 72 61 77 |d to fin|ish draw|
|00004720| 69 6e 67 2e 0a 58 4e 6f | 20 64 72 61 77 69 6e 67 |ing..XNo| drawing|
|00004730| 20 6f 62 6a 65 63 74 20 | 6d 61 79 20 65 78 69 73 | object |may exis|
|00004740| 74 20 77 68 65 6e 0a 58 | 7b 5c 74 74 20 73 74 64 |t when.X|{\tt std|
|00004750| 77 69 6e 2e 67 65 74 65 | 76 65 6e 74 28 29 7d 0a |win.gete|vent()}.|
|00004760| 58 69 73 20 63 61 6c 6c | 65 64 2e 0a 58 44 72 61 |Xis call|ed..XDra|
|00004770| 77 69 6e 67 20 6f 62 6a | 65 63 74 73 20 68 61 76 |wing obj|ects hav|
|00004780| 65 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |e the fo|llowing |
|00004790| 6d 65 74 68 6f 64 73 3a | 0a 58 5c 62 65 67 69 6e |methods:|.X\begin|
|000047a0| 7b 64 65 73 63 72 69 70 | 74 69 6f 6e 7d 0a 58 5c |{descrip|tion}.X\|
|000047b0| 66 75 6e 63 69 74 65 6d | 7b 62 6f 78 7d 7b 72 65 |funcitem|{box}{re|
|000047c0| 63 74 7d 0a 58 44 72 61 | 77 73 20 61 20 62 6f 78 |ct}.XDra|ws a box|
|000047d0| 20 61 72 6f 75 6e 64 20 | 61 20 72 65 63 74 61 6e | around |a rectan|
|000047e0| 67 6c 65 2e 0a 58 5c 66 | 75 6e 63 69 74 65 6d 7b |gle..X\f|uncitem{|
|000047f0| 63 69 72 63 6c 65 7d 7b | 63 65 6e 74 65 72 2c 20 |circle}{|center, |
|00004800| 72 61 64 69 75 73 7d 0a | 58 25 2e 62 72 0a 58 44 |radius}.|X%.br.XD|
|00004810| 72 61 77 73 20 61 20 63 | 69 72 63 6c 65 20 77 69 |raws a c|ircle wi|
|00004820| 74 68 20 67 69 76 65 6e | 20 63 65 6e 74 65 72 20 |th given| center |
|00004830| 70 6f 69 6e 74 20 61 6e | 64 20 72 61 64 69 75 73 |point an|d radius|
|00004840| 2e 0a 58 5c 66 75 6e 63 | 69 74 65 6d 7b 65 6c 61 |..X\func|item{ela|
|00004850| 72 63 28 63 65 6e 74 65 | 72 2c 20 28 72 68 2c 20 |rc(cente|r, (rh, |
|00004860| 72 76 29 2c 20 7d 7b 61 | 31 2c 20 61 32 29 7d 0a |rv), }{a|1, a2)}.|
|00004870| 58 25 2e 62 72 0a 58 44 | 72 61 77 73 20 61 6e 20 |X%.br.XD|raws an |
|00004880| 65 6c 6c 69 70 74 69 63 | 61 6c 20 61 72 63 20 77 |elliptic|al arc w|
|00004890| 69 74 68 20 67 69 76 65 | 6e 20 63 65 6e 74 65 72 |ith give|n center|
|000048a0| 20 70 6f 69 6e 74 2e 0a | 58 7b 5c 74 74 20 28 72 | point..|X{\tt (r|
|000048b0| 68 2c 20 72 76 29 7d 0a | 58 67 69 76 65 73 20 74 |h, rv)}.|Xgives t|
|000048c0| 68 65 20 68 61 6c 66 20 | 73 69 7a 65 73 20 6f 66 |he half |sizes of|
|000048d0| 20 74 68 65 20 68 6f 72 | 69 7a 6f 6e 74 61 6c 20 | the hor|izontal |
|000048e0| 61 6e 64 20 76 65 72 74 | 69 63 61 6c 20 72 61 64 |and vert|ical rad|
|000048f0| 69 69 2e 0a 58 7b 5c 74 | 74 20 28 61 31 2c 20 61 |ii..X{\t|t (a1, a|
|00004900| 32 29 7d 0a 58 67 69 76 | 65 73 20 74 68 65 20 61 |2)}.Xgiv|es the a|
|00004910| 6e 67 6c 65 73 20 28 69 | 6e 20 64 65 67 72 65 65 |ngles (i|n degree|
|00004920| 73 29 20 6f 66 20 74 68 | 65 20 62 65 67 69 6e 20 |s) of th|e begin |
|00004930| 61 6e 64 20 65 6e 64 20 | 70 6f 69 6e 74 73 2e 0a |and end |points..|
|00004940| 58 30 20 64 65 67 72 65 | 65 73 20 69 73 20 61 74 |X0 degre|es is at|
|00004950| 20 33 20 6f 27 63 6c 6f | 63 6b 2c 20 39 30 20 64 | 3 o'clo|ck, 90 d|
|00004960| 65 67 72 65 65 73 20 69 | 73 20 61 74 20 31 32 20 |egrees i|s at 12 |
|00004970| 6f 27 63 6c 6f 63 6b 2e | 0a 58 5c 66 75 6e 63 69 |o'clock.|.X\funci|
|00004980| 74 65 6d 7b 65 72 61 73 | 65 7d 7b 72 65 63 74 7d |tem{eras|e}{rect}|
|00004990| 0a 58 45 72 61 73 65 73 | 20 61 20 72 65 63 74 61 |.XErases| a recta|
|000049a0| 6e 67 6c 65 2e 0a 58 5c | 66 75 6e 63 69 74 65 6d |ngle..X\|funcitem|
|000049b0| 7b 69 6e 76 65 72 74 7d | 7b 72 65 63 74 7d 0a 58 |{invert}|{rect}.X|
|000049c0| 49 6e 76 65 72 74 73 20 | 61 20 72 65 63 74 61 6e |Inverts |a rectan|
|000049d0| 67 6c 65 2e 0a 58 5c 66 | 75 6e 63 69 74 65 6d 7b |gle..X\f|uncitem{|
|000049e0| 6c 69 6e 65 7d 7b 70 31 | 2c 20 70 32 7d 0a 58 44 |line}{p1|, p2}.XD|
|000049f0| 72 61 77 73 20 61 20 6c | 69 6e 65 20 66 72 6f 6d |raws a l|ine from|
|00004a00| 20 70 6f 69 6e 74 0a 58 | 7b 5c 74 74 20 70 31 7d | point.X|{\tt p1}|
|00004a10| 0a 58 74 6f 0a 58 7b 5c | 74 74 20 70 32 7d 2e 0a |.Xto.X{\|tt p2}..|
|00004a20| 58 5c 66 75 6e 63 69 74 | 65 6d 7b 70 61 69 6e 74 |X\funcit|em{paint|
|00004a30| 7d 7b 72 65 63 74 7d 0a | 58 46 69 6c 6c 73 20 61 |}{rect}.|XFills a|
|00004a40| 20 72 65 63 74 61 6e 67 | 6c 65 2e 0a 58 5c 66 75 | rectang|le..X\fu|
|00004a50| 6e 63 69 74 65 6d 7b 74 | 65 78 74 7d 7b 70 2c 20 |ncitem{t|ext}{p, |
|00004a60| 73 74 72 7d 0a 58 44 72 | 61 77 73 20 61 20 73 74 |str}.XDr|aws a st|
|00004a70| 72 69 6e 67 20 73 74 61 | 72 74 69 6e 67 20 61 74 |ring sta|rting at|
|00004a80| 20 70 6f 69 6e 74 20 70 | 20 28 74 68 65 20 70 6f | point p| (the po|
|00004a90| 69 6e 74 20 73 70 65 63 | 69 66 69 65 73 20 74 68 |int spec|ifies th|
|00004aa0| 65 0a 58 74 6f 70 20 6c | 65 66 74 20 63 6f 6f 72 |e.Xtop l|eft coor|
|00004ab0| 64 69 6e 61 74 65 20 6f | 66 20 74 68 65 20 73 74 |dinate o|f the st|
|00004ac0| 72 69 6e 67 29 2e 0a 58 | 5c 66 75 6e 63 69 74 65 |ring)..X|\funcite|
|00004ad0| 6d 7b 73 68 61 64 65 7d | 7b 72 65 63 74 2c 20 70 |m{shade}|{rect, p|
|00004ae0| 65 72 63 65 6e 74 7d 0a | 58 25 2e 62 72 0a 58 46 |ercent}.|X%.br.XF|
|00004af0| 69 6c 6c 73 20 61 20 72 | 65 63 74 61 6e 67 6c 65 |ills a r|ectangle|
|00004b00| 20 77 69 74 68 20 61 20 | 73 68 61 64 69 6e 67 20 | with a |shading |
|00004b10| 70 61 74 74 65 72 6e 20 | 74 68 61 74 20 69 73 20 |pattern |that is |
|00004b20| 61 62 6f 75 74 0a 58 7b | 5c 74 74 20 70 65 72 63 |about.X{|\tt perc|
|00004b30| 65 6e 74 7d 0a 58 70 65 | 72 63 65 6e 74 20 66 69 |ent}.Xpe|rcent fi|
|00004b40| 6c 6c 65 64 2e 0a 58 5c | 66 75 6e 63 69 74 65 6d |lled..X\|funcitem|
|00004b50| 7b 78 6f 72 6c 69 6e 65 | 7d 7b 70 31 2c 20 70 32 |{xorline|}{p1, p2|
|00004b60| 7d 0a 58 44 72 61 77 73 | 20 61 20 6c 69 6e 65 20 |}.XDraws| a line |
|00004b70| 69 6e 20 58 4f 52 20 6d | 6f 64 65 2e 0a 58 5c 66 |in XOR m|ode..X\f|
|00004b80| 75 6e 63 69 74 65 6d 7b | 62 61 73 65 6c 69 6e 65 |uncitem{|baseline|
|00004b90| 28 29 2c 20 6c 69 6e 65 | 68 65 69 67 68 74 28 29 |(), line|height()|
|00004ba0| 2c 20 74 65 78 74 62 72 | 65 61 6b 28 29 2c 20 74 |, textbr|eak(), t|
|00004bb0| 65 78 74 77 69 64 74 68 | 7d 7b 7d 0a 58 25 2e 62 |extwidth|}{}.X%.b|
|00004bc0| 72 0a 58 54 68 65 73 65 | 20 66 75 6e 63 74 69 6f |r.XThese| functio|
|00004bd0| 6e 73 20 61 72 65 20 73 | 69 6d 69 6c 61 72 20 74 |ns are s|imilar t|
|00004be0| 6f 20 74 68 65 20 63 6f | 72 72 65 73 70 6f 6e 64 |o the co|rrespond|
|00004bf0| 69 6e 67 20 66 75 6e 63 | 74 69 6f 6e 73 20 64 65 |ing func|tions de|
|00004c00| 73 63 72 69 62 65 64 0a | 58 61 62 6f 76 65 20 66 |scribed.|Xabove f|
|00004c10| 6f 72 20 74 68 65 0a 58 | 7b 5c 74 74 20 73 74 64 |or the.X|{\tt std|
|00004c20| 77 69 6e 7d 0a 58 6d 6f | 64 75 6c 65 2c 20 62 75 |win}.Xmo|dule, bu|
|00004c30| 74 20 75 73 65 20 74 68 | 65 20 63 75 72 72 65 6e |t use th|e curren|
|00004c40| 74 20 66 6f 6e 74 20 6f | 66 20 74 68 65 20 77 69 |t font o|f the wi|
|00004c50| 6e 64 6f 77 20 69 6e 73 | 74 65 61 64 20 6f 66 20 |ndow ins|tead of |
|00004c60| 74 68 65 20 28 67 6c 6f | 62 61 6c 29 0a 58 64 65 |the (glo|bal).Xde|
|00004c70| 66 61 75 6c 74 20 66 6f | 6e 74 2e 0a 58 5c 65 6e |fault fo|nt..X\en|
|00004c80| 64 7b 64 65 73 63 72 69 | 70 74 69 6f 6e 7d 0a 58 |d{descri|ption}.X|
|00004c90| 0a 58 5c 73 75 62 73 75 | 62 73 65 63 74 69 6f 6e |.X\subsu|bsection|
|00004ca0| 7b 4d 65 6e 75 20 4f 62 | 6a 65 63 74 20 4d 65 74 |{Menu Ob|ject Met|
|00004cb0| 68 6f 64 73 7d 0a 58 0a | 58 41 20 6d 65 6e 75 20 |hods}.X.|XA menu |
|00004cc0| 6f 62 6a 65 63 74 20 72 | 65 70 72 65 73 65 6e 74 |object r|epresent|
|00004cd0| 73 20 61 20 6d 65 6e 75 | 2e 0a 58 54 68 65 20 6d |s a menu|..XThe m|
|00004ce0| 65 6e 75 20 69 73 20 64 | 65 73 74 72 6f 79 65 64 |enu is d|estroyed|
|00004cf0| 20 77 68 65 6e 20 74 68 | 65 20 6d 65 6e 75 20 6f | when th|e menu o|
|00004d00| 62 6a 65 63 74 20 69 73 | 20 64 65 6c 65 74 65 64 |bject is| deleted|
|00004d10| 2e 0a 58 54 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |..XThe f|ollowing|
|00004d20| 20 6d 65 74 68 6f 64 73 | 20 61 72 65 20 64 65 66 | methods| are def|
|00004d30| 69 6e 65 64 3a 0a 58 5c | 62 65 67 69 6e 7b 64 65 |ined:.X\|begin{de|
|00004d40| 73 63 72 69 70 74 69 6f | 6e 7d 0a 58 5c 66 75 6e |scriptio|n}.X\fun|
|00004d50| 63 69 74 65 6d 7b 61 64 | 64 69 74 65 6d 7d 7b 74 |citem{ad|ditem}{t|
|00004d60| 65 78 74 2c 20 73 68 6f | 72 74 63 75 74 7d 0a 58 |ext, sho|rtcut}.X|
|00004d70| 25 2e 62 72 0a 58 41 64 | 64 73 20 61 20 6d 65 6e |%.br.XAd|ds a men|
|00004d80| 75 20 69 74 65 6d 20 77 | 69 74 68 20 67 69 76 65 |u item w|ith give|
|00004d90| 6e 20 74 65 78 74 2e 0a | 58 54 68 65 20 73 68 6f |n text..|XThe sho|
|00004da0| 72 74 63 75 74 20 6d 75 | 73 74 20 62 65 20 61 20 |rtcut mu|st be a |
|00004db0| 73 74 72 69 6e 67 20 6f | 66 20 6c 65 6e 67 74 68 |string o|f length|
|00004dc0| 20 31 2c 20 6f 72 20 6f | 6d 69 74 74 65 64 20 28 | 1, or o|mitted (|
|00004dd0| 74 6f 20 73 70 65 63 69 | 66 79 20 6e 6f 0a 58 73 |to speci|fy no.Xs|
|00004de0| 68 6f 72 74 63 75 74 29 | 2e 0a 58 5c 66 75 6e 63 |hortcut)|..X\func|
|00004df0| 69 74 65 6d 7b 73 65 74 | 69 74 65 6d 7d 7b 69 2c |item{set|item}{i,|
|00004e00| 20 74 65 78 74 7d 0a 58 | 53 65 74 73 20 74 68 65 | text}.X|Sets the|
|00004e10| 20 74 65 78 74 20 6f 66 | 20 69 74 65 6d 20 6e 75 | text of| item nu|
|00004e20| 6d 62 65 72 0a 58 7b 5c | 74 74 20 69 7d 2e 0a 58 |mber.X{\|tt i}..X|
|00004e30| 5c 66 75 6e 63 69 74 65 | 6d 7b 65 6e 61 62 6c 65 |\funcite|m{enable|
|00004e40| 7d 7b 69 2c 20 66 6c 61 | 67 7d 0a 58 45 6e 61 62 |}{i, fla|g}.XEnab|
|00004e50| 6c 65 73 20 6f 72 20 64 | 69 73 61 62 6c 65 73 20 |les or d|isables |
|00004e60| 69 74 65 6d 0a 58 7b 5c | 74 74 20 69 7d 2e 0a 58 |item.X{\|tt i}..X|
|00004e70| 5c 66 75 6e 63 69 74 65 | 6d 7b 63 68 65 63 6b 7d |\funcite|m{check}|
|00004e80| 7b 69 2c 20 66 6c 61 67 | 7d 0a 58 53 65 74 73 20 |{i, flag|}.XSets |
|00004e90| 6f 72 20 63 6c 65 61 72 | 73 20 74 68 65 0a 58 7b |or clear|s the.X{|
|00004ea0| 5c 65 6d 20 63 68 65 63 | 6b 20 6d 61 72 6b 7d 0a |\em chec|k mark}.|
|00004eb0| 58 66 6f 72 20 69 74 65 | 6d 0a 58 7b 5c 74 74 20 |Xfor ite|m.X{\tt |
|00004ec0| 69 7d 2e 0a 58 5c 65 6e | 64 7b 64 65 73 63 72 69 |i}..X\en|d{descri|
|00004ed0| 70 74 69 6f 6e 7d 0a 58 | 0a 58 5c 73 75 62 73 75 |ption}.X|.X\subsu|
|00004ee0| 62 73 65 63 74 69 6f 6e | 7b 54 65 78 74 2d 65 64 |bsection|{Text-ed|
|00004ef0| 69 74 20 4f 62 6a 65 63 | 74 20 4d 65 74 68 6f 64 |it Objec|t Method|
|00004f00| 73 7d 0a 58 0a 58 41 20 | 74 65 78 74 2d 65 64 69 |s}.X.XA |text-edi|
|00004f10| 74 20 6f 62 6a 65 63 74 | 20 72 65 70 72 65 73 65 |t object| represe|
|00004f20| 6e 74 73 20 61 20 74 65 | 78 74 2d 65 64 69 74 20 |nts a te|xt-edit |
|00004f30| 62 6c 6f 63 6b 2e 0a 58 | 46 6f 72 20 73 65 6d 61 |block..X|For sema|
|00004f40| 6e 74 69 63 73 2c 20 73 | 65 65 20 74 68 65 20 53 |ntics, s|ee the S|
|00004f50| 54 44 57 49 4e 20 64 6f | 63 75 6d 65 6e 74 61 74 |TDWIN do|cumentat|
|00004f60| 69 6f 6e 20 66 6f 72 20 | 43 20 70 72 6f 67 72 61 |ion for |C progra|
|00004f70| 6d 6d 65 72 73 2e 0a 58 | 54 68 65 20 66 6f 6c 6c |mmers..X|The foll|
|00004f80| 6f 77 69 6e 67 20 6d 65 | 74 68 6f 64 73 20 65 78 |owing me|thods ex|
|00004f90| 69 73 74 3a 0a 58 5c 62 | 65 67 69 6e 7b 64 65 73 |ist:.X\b|egin{des|
|00004fa0| 63 72 69 70 74 69 6f 6e | 7d 0a 58 5c 66 75 6e 63 |cription|}.X\func|
|00004fb0| 69 74 65 6d 7b 61 72 72 | 6f 77 7d 7b 63 6f 64 65 |item{arr|ow}{code|
|00004fc0| 7d 0a 58 50 61 73 73 65 | 73 20 61 6e 20 61 72 72 |}.XPasse|s an arr|
|00004fd0| 6f 77 20 65 76 65 6e 74 | 20 74 6f 20 74 68 65 20 |ow event| to the |
|00004fe0| 74 65 78 74 2d 65 64 69 | 74 20 62 6c 6f 63 6b 2e |text-edi|t block.|
|00004ff0| 0a 58 54 68 65 0a 58 7b | 5c 74 74 20 63 6f 64 65 |.XThe.X{|\tt code|
|00005000| 7d 0a 58 6d 75 73 74 20 | 62 65 20 6f 6e 65 20 6f |}.Xmust |be one o|
|00005010| 66 0a 58 7b 5c 74 74 20 | 57 43 5c 5f 4c 45 46 54 |f.X{\tt |WC\_LEFT|
|00005020| 7d 2c 0a 58 7b 5c 74 74 | 20 57 43 5c 5f 52 49 47 |},.X{\tt| WC\_RIG|
|00005030| 48 54 7d 2c 0a 58 7b 5c | 74 74 20 57 43 5c 5f 55 |HT},.X{\|tt WC\_U|
|00005040| 50 7d 0a 58 6f 72 0a 58 | 7b 5c 74 74 20 57 43 5c |P}.Xor.X|{\tt WC\|
|00005050| 5f 44 4f 57 4e 7d 0a 58 | 28 73 65 65 20 6d 6f 64 |_DOWN}.X|(see mod|
|00005060| 75 6c 65 0a 58 7b 5c 74 | 74 20 73 74 64 77 69 6e |ule.X{\t|t stdwin|
|00005070| 65 76 65 6e 74 73 7d 29 | 2e 0a 58 5c 66 75 6e 63 |events})|..X\func|
|00005080| 69 74 65 6d 7b 64 72 61 | 77 7d 7b 72 65 63 74 7d |item{dra|w}{rect}|
|00005090| 0a 58 50 61 73 73 65 73 | 20 61 20 64 72 61 77 20 |.XPasses| a draw |
|000050a0| 65 76 65 6e 74 20 74 6f | 20 74 68 65 20 74 65 78 |event to| the tex|
|000050b0| 74 2d 65 64 69 74 20 62 | 6c 6f 63 6b 2e 0a 58 54 |t-edit b|lock..XT|
|000050c0| 68 65 20 72 65 63 74 61 | 6e 67 6c 65 20 73 70 65 |he recta|ngle spe|
|000050d0| 63 69 66 69 65 73 20 74 | 68 65 20 72 65 64 72 61 |cifies t|he redra|
|000050e0| 77 20 61 72 65 61 2e 0a | 58 5c 66 75 6e 63 69 74 |w area..|X\funcit|
|000050f0| 65 6d 7b 65 76 65 6e 74 | 7d 7b 74 79 70 65 2c 20 |em{event|}{type, |
|00005100| 77 69 6e 64 6f 77 2c 20 | 64 65 74 61 69 6c 7d 0a |window, |detail}.|
|00005110| 58 25 2e 62 72 0a 58 50 | 61 73 73 65 73 20 61 6e |X%.br.XP|asses an|
|00005120| 20 65 76 65 6e 74 20 67 | 6f 74 74 65 6e 20 66 72 | event g|otten fr|
|00005130| 6f 6d 0a 58 7b 5c 74 74 | 20 73 74 64 77 69 6e 2e |om.X{\tt| stdwin.|
|00005140| 67 65 74 65 76 65 6e 74 | 28 29 7d 0a 58 74 6f 20 |getevent|()}.Xto |
|00005150| 74 68 65 20 74 65 78 74 | 2d 65 64 69 74 20 62 6c |the text|-edit bl|
|00005160| 6f 63 6b 2e 0a 58 52 65 | 74 75 72 6e 73 20 74 72 |ock..XRe|turns tr|
|00005170| 75 65 20 69 66 20 74 68 | 65 20 65 76 65 6e 74 20 |ue if th|e event |
|00005180| 77 61 73 20 68 61 6e 64 | 6c 65 64 2e 0a 58 5c 66 |was hand|led..X\f|
|00005190| 75 6e 63 69 74 65 6d 7b | 67 65 74 66 6f 63 75 73 |uncitem{|getfocus|
|000051a0| 7d 7b 7d 0a 58 52 65 74 | 75 72 6e 73 20 32 20 69 |}{}.XRet|urns 2 i|
|000051b0| 6e 74 65 67 65 72 73 20 | 72 65 70 72 65 73 65 6e |ntegers |represen|
|000051c0| 74 69 6e 67 20 74 68 65 | 20 73 74 61 72 74 20 61 |ting the| start a|
|000051d0| 6e 64 20 65 6e 64 20 70 | 6f 73 69 74 69 6f 6e 73 |nd end p|ositions|
|000051e0| 20 6f 66 20 74 68 65 0a | 58 66 6f 63 75 73 2c 20 | of the.|Xfocus, |
|000051f0| 75 73 61 62 6c 65 20 61 | 73 20 73 6c 69 63 65 20 |usable a|s slice |
|00005200| 69 6e 64 69 63 65 73 20 | 6f 6e 20 74 68 65 20 73 |indices |on the s|
|00005210| 74 72 69 6e 67 20 72 65 | 74 75 72 6e 65 64 20 62 |tring re|turned b|
|00005220| 79 0a 58 7b 5c 74 74 20 | 67 65 74 66 6f 63 75 73 |y.X{\tt |getfocus|
|00005230| 74 65 78 74 28 29 7d 2e | 0a 58 5c 66 75 6e 63 69 |text()}.|.X\funci|
|00005240| 74 65 6d 7b 67 65 74 66 | 6f 63 75 73 74 65 78 74 |tem{getf|ocustext|
|00005250| 7d 7b 7d 0a 58 52 65 74 | 75 72 6e 73 20 74 68 65 |}{}.XRet|urns the|
|00005260| 20 74 65 78 74 20 69 6e | 20 74 68 65 20 66 6f 63 | text in| the foc|
|00005270| 75 73 2e 0a 58 5c 66 75 | 6e 63 69 74 65 6d 7b 67 |us..X\fu|ncitem{g|
|00005280| 65 74 72 65 63 74 7d 7b | 7d 0a 58 52 65 74 75 72 |etrect}{|}.XRetur|
|00005290| 6e 73 20 61 20 72 65 63 | 74 61 6e 67 6c 65 20 67 |ns a rec|tangle g|
|000052a0| 69 76 69 6e 67 20 74 68 | 65 20 61 63 74 75 61 6c |iving th|e actual|
|000052b0| 20 70 6f 73 69 74 69 6f | 6e 20 6f 66 20 74 68 65 | positio|n of the|
|000052c0| 20 74 65 78 74 2d 65 64 | 69 74 20 62 6c 6f 63 6b | text-ed|it block|
|000052d0| 2e 0a 58 28 54 68 65 20 | 62 6f 74 74 6f 6d 20 63 |..X(The |bottom c|
|000052e0| 6f 6f 72 64 69 6e 61 74 | 65 20 6d 61 79 20 64 69 |oordinat|e may di|
|000052f0| 66 66 65 72 20 66 72 6f | 6d 20 74 68 65 20 69 6e |ffer fro|m the in|
|00005300| 69 74 69 61 6c 20 70 6f | 73 69 74 69 6f 6e 20 62 |itial po|sition b|
|00005310| 65 63 61 75 73 65 0a 58 | 74 68 65 20 62 6c 6f 63 |ecause.X|the bloc|
|00005320| 6b 20 61 75 74 6f 6d 61 | 74 69 63 61 6c 6c 79 20 |k automa|tically |
|00005330| 73 68 72 69 6e 6b 73 20 | 6f 72 20 67 72 6f 77 73 |shrinks |or grows|
|00005340| 20 74 6f 20 66 69 74 2e | 29 0a 58 5c 66 75 6e 63 | to fit.|).X\func|
|00005350| 69 74 65 6d 7b 67 65 74 | 74 65 78 74 7d 7b 7d 0a |item{get|text}{}.|
|00005360| 58 52 65 74 75 72 6e 73 | 20 74 68 65 20 65 6e 74 |XReturns| the ent|
|00005370| 69 72 65 20 74 65 78 74 | 20 62 75 66 66 65 72 2e |ire text| buffer.|
|00005380| 0a 58 5c 66 75 6e 63 69 | 74 65 6d 7b 6d 6f 76 65 |.X\funci|tem{move|
|00005390| 7d 7b 72 65 63 74 7d 0a | 58 53 70 65 63 69 66 69 |}{rect}.|XSpecifi|
|000053a0| 65 73 20 61 20 6e 65 77 | 20 70 6f 73 69 74 69 6f |es a new| positio|
|000053b0| 6e 20 66 6f 72 20 74 68 | 65 20 74 65 78 74 2d 65 |n for th|e text-e|
|000053c0| 64 69 74 20 62 6c 6f 63 | 6b 20 69 6e 20 74 68 65 |dit bloc|k in the|
|000053d0| 20 64 6f 63 75 6d 65 6e | 74 2e 0a 58 5c 66 75 6e | documen|t..X\fun|
|000053e0| 63 69 74 65 6d 7b 72 65 | 70 6c 61 63 65 7d 7b 73 |citem{re|place}{s|
|000053f0| 74 72 7d 0a 58 52 65 70 | 6c 61 63 65 73 20 74 68 |tr}.XRep|laces th|
|00005400| 65 20 66 6f 63 75 73 20 | 62 79 20 74 68 65 20 67 |e focus |by the g|
|00005410| 69 76 65 6e 20 73 74 72 | 69 6e 67 2e 0a 58 54 68 |iven str|ing..XTh|
|00005420| 65 20 6e 65 77 20 66 6f | 63 75 73 20 69 73 20 61 |e new fo|cus is a|
|00005430| 6e 20 69 6e 73 65 72 74 | 20 70 6f 69 6e 74 20 61 |n insert| point a|
|00005440| 74 20 74 68 65 20 65 6e | 64 20 6f 66 20 74 68 65 |t the en|d of the|
|00005450| 20 73 74 72 69 6e 67 2e | 0a 58 5c 66 75 6e 63 69 | string.|.X\funci|
|00005460| 74 65 6d 7b 73 65 74 66 | 6f 63 75 73 7d 7b 69 2c |tem{setf|ocus}{i,|
|00005470| 7e 6a 7d 0a 58 53 70 65 | 63 69 66 69 65 73 20 74 |~j}.XSpe|cifies t|
|00005480| 68 65 20 6e 65 77 20 66 | 6f 63 75 73 2e 0a 58 4f |he new f|ocus..XO|
|00005490| 75 74 2d 6f 66 2d 62 6f | 75 6e 64 73 20 76 61 6c |ut-of-bo|unds val|
|000054a0| 75 65 73 20 61 72 65 20 | 73 69 6c 65 6e 74 6c 79 |ues are |silently|
|000054b0| 20 63 6c 69 70 70 65 64 | 2e 0a 58 5c 65 6e 64 7b | clipped|..X\end{|
|000054c0| 64 65 73 63 72 69 70 74 | 69 6f 6e 7d 0a 58 0a 58 |descript|ion}.X.X|
|000054d0| 5c 73 75 62 73 75 62 73 | 65 63 74 69 6f 6e 7b 45 |\subsubs|ection{E|
|000054e0| 78 61 6d 70 6c 65 7d 0a | 58 0a 58 48 65 72 65 20 |xample}.|X.XHere |
|000054f0| 69 73 20 61 20 73 69 6d | 70 6c 65 20 65 78 61 6d |is a sim|ple exam|
|00005500| 70 6c 65 20 6f 66 20 75 | 73 69 6e 67 20 53 54 44 |ple of u|sing STD|
|00005510| 57 49 4e 20 69 6e 20 50 | 79 74 68 6f 6e 2e 0a 58 |WIN in P|ython..X|
|00005520| 49 74 20 63 72 65 61 74 | 65 73 20 61 20 77 69 6e |It creat|es a win|
|00005530| 64 6f 77 20 61 6e 64 20 | 64 72 61 77 73 20 74 68 |dow and |draws th|
|00005540| 65 20 73 74 72 69 6e 67 | 20 60 60 48 65 6c 6c 6f |e string| ``Hello|
|00005550| 20 77 6f 72 6c 64 27 27 | 20 69 6e 20 74 68 65 20 | world''| in the |
|00005560| 74 6f 70 0a 58 6c 65 66 | 74 20 63 6f 72 6e 65 72 |top.Xlef|t corner|
|00005570| 20 6f 66 20 74 68 65 20 | 77 69 6e 64 6f 77 2e 0a | of the |window..|
|00005580| 58 54 68 65 20 77 69 6e | 64 6f 77 20 77 69 6c 6c |XThe win|dow will|
|00005590| 20 62 65 20 63 6f 72 72 | 65 63 74 6c 79 20 72 65 | be corr|ectly re|
|000055a0| 64 72 61 77 6e 20 77 68 | 65 6e 20 63 6f 76 65 72 |drawn wh|en cover|
|000055b0| 65 64 20 61 6e 64 20 72 | 65 2d 65 78 70 6f 73 65 |ed and r|e-expose|
|000055c0| 64 2e 0a 58 54 68 65 20 | 70 72 6f 67 72 61 6d 20 |d..XThe |program |
|000055d0| 71 75 69 74 73 20 77 68 | 65 6e 20 74 68 65 20 63 |quits wh|en the c|
|000055e0| 6c 6f 73 65 20 69 63 6f | 6e 20 6f 72 20 6d 65 6e |lose ico|n or men|
|000055f0| 75 20 69 74 65 6d 20 69 | 73 20 72 65 71 75 65 73 |u item i|s reques|
|00005600| 74 65 64 2e 0a 58 5c 62 | 63 6f 64 65 5c 62 65 67 |ted..X\b|code\beg|
|00005610| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0a 58 69 6d |in{verba|tim}.Xim|
|00005620| 70 6f 72 74 20 73 74 64 | 77 69 6e 0a 58 66 72 6f |port std|win.Xfro|
|00005630| 6d 20 73 74 64 77 69 6e | 65 76 65 6e 74 73 20 69 |m stdwin|events i|
|00005640| 6d 70 6f 72 74 20 2a 0a | 58 0a 58 64 65 66 20 6d |mport *.|X.Xdef m|
|00005650| 61 69 6e 28 29 3a 0a 58 | 20 20 20 20 6d 79 77 69 |ain():.X| mywi|
|00005660| 6e 20 3d 20 73 74 64 77 | 69 6e 2e 6f 70 65 6e 28 |n = stdw|in.open(|
|00005670| 27 48 65 6c 6c 6f 27 29 | 0a 58 20 20 20 20 23 0a |'Hello')|.X #.|
|00005680| 58 20 20 20 20 77 68 69 | 6c 65 20 31 3a 0a 58 20 |X whi|le 1:.X |
|00005690| 20 20 20 20 20 20 20 28 | 74 79 70 65 2c 20 77 69 | (|type, wi|
|000056a0| 6e 2c 20 64 65 74 61 69 | 6c 29 20 3d 20 73 74 64 |n, detai|l) = std|
|000056b0| 77 69 6e 2e 67 65 74 65 | 76 65 6e 74 28 29 0a 58 |win.gete|vent().X|
|000056c0| 20 20 20 20 20 20 20 20 | 69 66 20 74 79 70 65 20 | |if type |
|000056d0| 3d 20 57 45 5f 44 52 41 | 57 3a 0a 58 20 20 20 20 |= WE_DRA|W:.X |
|000056e0| 20 20 20 20 20 20 20 20 | 64 72 61 77 20 3d 20 77 | |draw = w|
|000056f0| 69 6e 2e 62 65 67 69 6e | 64 72 61 77 69 6e 67 28 |in.begin|drawing(|
|00005700| 29 0a 58 20 20 20 20 20 | 20 20 20 20 20 20 20 64 |).X | d|
|00005710| 72 61 77 2e 74 65 78 74 | 28 28 30 2c 20 30 29 2c |raw.text|((0, 0),|
|00005720| 20 27 48 65 6c 6c 6f 2c | 20 77 6f 72 6c 64 27 29 | 'Hello,| world')|
|00005730| 0a 58 20 20 20 20 20 20 | 20 20 20 20 20 20 64 65 |.X | de|
|00005740| 6c 20 64 72 61 77 0a 58 | 20 20 20 20 20 20 20 20 |l draw.X| |
|00005750| 65 6c 69 66 20 74 79 70 | 65 20 3d 20 57 45 5f 43 |elif typ|e = WE_C|
|00005760| 4c 4f 53 45 3a 0a 58 20 | 20 20 20 20 20 20 20 20 |LOSE:.X | |
|00005770| 20 20 20 62 72 65 61 6b | 0a 58 0a 58 6d 61 69 6e | break|.X.Xmain|
|00005780| 28 29 0a 58 5c 65 6e 64 | 7b 76 65 72 62 61 74 69 |().X\end|{verbati|
|00005790| 6d 7d 5c 65 63 6f 64 65 | 0a 58 0a 58 5c 73 75 62 |m}\ecode|.X.X\sub|
|000057a0| 73 65 63 74 69 6f 6e 7b | 42 75 69 6c 74 2d 69 6e |section{|Built-in|
|000057b0| 20 4d 6f 64 75 6c 65 20 | 7b 5c 74 74 20 61 6d 6f | Module |{\tt amo|
|000057c0| 65 62 61 7d 7d 0a 58 0a | 58 54 68 69 73 20 6d 6f |eba}}.X.|XThis mo|
|000057d0| 64 75 6c 65 20 70 72 6f | 76 69 64 65 73 20 73 6f |dule pro|vides so|
|000057e0| 6d 65 20 6f 62 6a 65 63 | 74 20 74 79 70 65 73 20 |me objec|t types |
|000057f0| 61 6e 64 20 6f 70 65 72 | 61 74 69 6f 6e 73 20 75 |and oper|ations u|
|00005800| 73 65 66 75 6c 20 66 6f | 72 0a 58 41 6d 6f 65 62 |seful fo|r.XAmoeb|
|00005810| 61 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 73 2e 0a |a applic|ations..|
|00005820| 58 49 74 20 69 73 20 6f | 6e 6c 79 20 61 76 61 69 |XIt is o|nly avai|
|00005830| 6c 61 62 6c 65 20 6f 6e | 20 73 79 73 74 65 6d 73 |lable on| systems|
|00005840| 20 74 68 61 74 20 73 75 | 70 70 6f 72 74 20 41 6d | that su|pport Am|
|00005850| 6f 65 62 61 20 6f 70 65 | 72 61 74 69 6f 6e 73 2e |oeba ope|rations.|
|00005860| 0a 58 52 50 43 20 65 72 | 72 6f 72 73 20 61 6e 64 |.XRPC er|rors and|
|00005870| 20 6f 74 68 65 72 20 41 | 6d 6f 65 62 61 20 65 72 | other A|moeba er|
|00005880| 72 6f 72 73 20 61 72 65 | 20 72 65 70 6f 72 74 65 |rors are| reporte|
|00005890| 64 20 61 73 20 74 68 65 | 20 65 78 63 65 70 74 69 |d as the| excepti|
|000058a0| 6f 6e 0a 58 7b 5c 74 74 | 20 61 6d 6f 65 62 61 2e |on.X{\tt| amoeba.|
|000058b0| 65 72 72 6f 72 20 3d 20 | 27 61 6d 6f 65 62 61 2e |error = |'amoeba.|
|000058c0| 65 72 72 6f 72 27 7d 2e | 0a 58 54 68 65 20 6d 6f |error'}.|.XThe mo|
|000058d0| 64 75 6c 65 0a 58 7b 5c | 74 74 20 61 6d 6f 65 62 |dule.X{\|tt amoeb|
|000058e0| 61 7d 0a 58 64 65 66 69 | 6e 65 73 20 74 68 65 20 |a}.Xdefi|nes the |
|000058f0| 66 6f 6c 6c 6f 77 69 6e | 67 20 69 74 65 6d 73 3a |followin|g items:|
|00005900| 0a 58 5c 62 65 67 69 6e | 7b 64 65 73 63 72 69 70 |.X\begin|{descrip|
|00005910| 74 69 6f 6e 7d 0a 58 5c | 66 75 6e 63 69 74 65 6d |tion}.X\|funcitem|
|00005920| 7b 6e 61 6d 65 5c 5f 61 | 70 70 65 6e 64 7d 7b 70 |{name\_a|ppend}{p|
|00005930| 61 74 68 2c 7e 63 61 70 | 7d 0a 58 25 2e 62 72 0a |ath,~cap|}.X%.br.|
|00005940| 58 53 74 6f 72 65 73 20 | 61 20 63 61 70 61 62 69 |XStores |a capabi|
|00005950| 6c 69 74 79 20 69 6e 20 | 74 68 65 20 41 6d 6f 65 |lity in |the Amoe|
|00005960| 62 61 20 64 69 72 65 63 | 74 6f 72 79 20 74 72 65 |ba direc|tory tre|
|00005970| 65 2e 0a 58 41 72 67 75 | 6d 65 6e 74 73 20 61 72 |e..XArgu|ments ar|
|00005980| 65 20 74 68 65 20 70 61 | 74 68 6e 61 6d 65 20 28 |e the pa|thname (|
|00005990| 61 20 73 74 72 69 6e 67 | 29 20 61 6e 64 20 74 68 |a string|) and th|
|000059a0| 65 20 63 61 70 61 62 69 | 6c 69 74 79 20 28 61 20 |e capabi|lity (a |
|000059b0| 63 61 70 61 62 69 6c 69 | 74 79 0a 58 6f 62 6a 65 |capabili|ty.Xobje|
|000059c0| 63 74 20 61 73 20 72 65 | 74 75 72 6e 65 64 20 62 |ct as re|turned b|
|000059d0| 79 0a 58 7b 5c 74 74 20 | 6e 61 6d 65 5c 5f 6c 6f |y.X{\tt |name\_lo|
|000059e0| 6f 6b 75 70 28 29 7d 29 | 2e 0a 58 5c 66 75 6e 63 |okup()})|..X\func|
|000059f0| 69 74 65 6d 7b 6e 61 6d | 65 5c 5f 64 65 6c 65 74 |item{nam|e\_delet|
|00005a00| 65 7d 7b 70 61 74 68 7d | 0a 58 25 2e 62 72 0a 58 |e}{path}|.X%.br.X|
|00005a10| 44 65 6c 65 74 65 73 20 | 61 20 63 61 70 61 62 69 |Deletes |a capabi|
|00005a20| 6c 69 74 79 20 66 72 6f | 6d 20 74 68 65 20 41 6d |lity fro|m the Am|
|00005a30| 6f 65 62 61 20 64 69 72 | 65 63 74 6f 72 79 20 74 |oeba dir|ectory t|
|00005a40| 72 65 65 2e 0a 58 41 72 | 67 75 6d 65 6e 74 20 69 |ree..XAr|gument i|
|00005a50| 73 20 74 68 65 20 70 61 | 74 68 6e 61 6d 65 2e 0a |s the pa|thname..|
|00005a60| 58 5c 66 75 6e 63 69 74 | 65 6d 7b 6e 61 6d 65 5c |X\funcit|em{name\|
|00005a70| 5f 6c 6f 6f 6b 75 70 7d | 7b 70 61 74 68 7d 0a 58 |_lookup}|{path}.X|
|00005a80| 25 2e 62 72 0a 58 4c 6f | 6f 6b 73 20 75 70 20 61 |%.br.XLo|oks up a|
|00005a90| 20 63 61 70 61 62 69 6c | 69 74 79 2e 0a 58 41 72 | capabil|ity..XAr|
|00005aa0| 67 75 6d 65 6e 74 20 69 | 73 20 74 68 65 20 70 61 |gument i|s the pa|
|00005ab0| 74 68 6e 61 6d 65 2e 0a | 58 52 65 74 75 72 6e 73 |thname..|XReturns|
|00005ac0| 20 61 0a 58 7b 5c 65 6d | 20 63 61 70 61 62 69 6c | a.X{\em| capabil|
|00005ad0| 69 74 79 7d 0a 58 6f 62 | 6a 65 63 74 2c 20 74 6f |ity}.Xob|ject, to|
|00005ae0| 20 77 68 69 63 68 20 76 | 61 72 69 6f 75 73 20 69 | which v|arious i|
|00005af0| 6e 74 65 72 65 73 74 69 | 6e 67 20 6f 70 65 72 61 |nteresti|ng opera|
|00005b00| 74 69 6f 6e 73 20 61 70 | 70 6c 79 2c 20 64 65 73 |tions ap|ply, des|
|00005b10| 63 72 69 62 65 64 20 62 | 65 6c 6f 77 2e 0a 58 5c |cribed b|elow..X\|
|00005b20| 66 75 6e 63 69 74 65 6d | 7b 6e 61 6d 65 5c 5f 72 |funcitem|{name\_r|
|00005b30| 65 70 6c 61 63 65 7d 7b | 70 61 74 68 2c 7e 63 61 |eplace}{|path,~ca|
|00005b40| 70 7d 0a 58 25 2e 62 72 | 0a 58 52 65 70 6c 61 63 |p}.X%.br|.XReplac|
|00005b50| 65 73 20 61 20 63 61 70 | 61 62 69 6c 69 74 79 20 |es a cap|ability |
|00005b60| 69 6e 20 74 68 65 20 41 | 6d 6f 65 62 61 20 64 69 |in the A|moeba di|
|00005b70| 72 65 63 74 6f 72 79 20 | 74 72 65 65 2e 0a 58 41 |rectory |tree..XA|
|00005b80| 72 67 75 6d 65 6e 74 73 | 20 61 72 65 20 74 68 65 |rguments| are the|
|00005b90| 20 70 61 74 68 6e 61 6d | 65 20 61 6e 64 20 74 68 | pathnam|e and th|
|00005ba0| 65 20 6e 65 77 20 63 61 | 70 61 62 69 6c 69 74 79 |e new ca|pability|
|00005bb0| 2e 0a 58 28 54 68 69 73 | 20 64 69 66 66 65 72 73 |..X(This| differs|
|00005bc0| 20 66 72 6f 6d 0a 58 7b | 5c 74 74 20 6e 61 6d 65 | from.X{|\tt name|
|00005bd0| 5c 5f 61 70 70 65 6e 64 | 28 29 7d 0a 58 69 6e 20 |\_append|()}.Xin |
|00005be0| 74 68 65 20 62 65 68 61 | 76 69 6f 72 20 77 68 65 |the beha|vior whe|
|00005bf0| 6e 20 74 68 65 20 70 61 | 74 68 6e 61 6d 65 20 61 |n the pa|thname a|
|00005c00| 6c 72 65 61 64 79 20 65 | 78 69 73 74 73 3a 0a 58 |lready e|xists:.X|
|00005c10| 7b 5c 74 74 20 6e 61 6d | 65 5c 5f 61 70 70 65 6e |{\tt nam|e\_appen|
|00005c20| 64 28 29 7d 0a 58 66 69 | 6e 64 73 20 74 68 69 73 |d()}.Xfi|nds this|
|00005c30| 20 61 6e 20 65 72 72 6f | 72 20 77 68 69 6c 65 0a | an erro|r while.|
|00005c40| 58 7b 5c 74 74 20 6e 61 | 6d 65 5c 5f 72 65 70 6c |X{\tt na|me\_repl|
|00005c50| 61 63 65 28 29 7d 0a 58 | 61 6c 6c 6f 77 73 20 69 |ace()}.X|allows i|
|00005c60| 74 2c 20 61 73 20 69 74 | 73 20 6e 61 6d 65 20 73 |t, as it|s name s|
|00005c70| 75 67 67 65 73 74 73 2e | 29 0a 58 5c 66 75 6e 63 |uggests.|).X\func|
|00005c80| 69 74 65 6d 7b 63 61 70 | 76 7d 0a 58 41 20 74 61 |item{cap|v}.XA ta|
|00005c90| 62 6c 65 20 72 65 70 72 | 65 73 65 6e 74 69 6e 67 |ble repr|esenting|
|00005ca0| 20 74 68 65 20 63 61 70 | 61 62 69 6c 69 74 79 20 | the cap|ability |
|00005cb0| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 20 61 74 20 74 |environm|ent at t|
|00005cc0| 68 65 20 74 69 6d 65 20 | 74 68 65 0a 58 69 6e 74 |he time |the.Xint|
|00005cd0| 65 72 70 72 65 74 65 72 | 20 77 61 73 20 73 74 61 |erpreter| was sta|
|00005ce0| 72 74 65 64 2e 0a 58 28 | 41 6c 61 73 2c 20 6d 6f |rted..X(|Alas, mo|
|00005cf0| 64 69 66 79 69 6e 67 20 | 74 68 69 73 20 74 61 62 |difying |this tab|
|00005d00| 6c 65 20 64 6f 65 73 20 | 6e 6f 74 20 61 66 66 65 |le does |not affe|
|00005d10| 63 74 20 74 68 65 20 63 | 61 70 61 62 69 6c 69 74 |ct the c|apabilit|
|00005d20| 79 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 0a 58 6f |y enviro|nment.Xo|
|00005d30| 66 20 74 68 65 20 69 6e | 74 65 72 70 72 65 74 65 |f the in|terprete|
|00005d40| 72 2e 29 0a 58 46 6f 72 | 20 65 78 61 6d 70 6c 65 |r.).XFor| example|
|00005d50| 2c 0a 58 7b 5c 74 74 20 | 61 6d 6f 65 62 61 2e 63 |,.X{\tt |amoeba.c|
|00005d60| 61 70 76 5b 27 52 4f 4f | 54 27 5d 7d 0a 58 69 73 |apv['ROO|T']}.Xis|
|00005d70| 20 74 68 65 20 63 61 70 | 61 62 69 6c 69 74 79 20 | the cap|ability |
|00005d80| 6f 66 20 79 6f 75 72 20 | 72 6f 6f 74 20 64 69 72 |of your |root dir|
|00005d90| 65 63 74 6f 72 79 2c 20 | 73 69 6d 69 6c 61 72 20 |ectory, |similar |
|00005da0| 74 6f 0a 58 7b 5c 74 74 | 20 67 65 74 63 61 70 28 |to.X{\tt| getcap(|
|00005db0| 22 52 4f 4f 54 22 29 7d | 0a 58 69 6e 20 43 2e 0a |"ROOT")}|.Xin C..|
|00005dc0| 58 5c 65 78 63 69 74 65 | 6d 7b 65 72 72 6f 72 7d |X\excite|m{error}|
|00005dd0| 7b 61 6d 6f 65 62 61 2e | 65 72 72 6f 72 7d 0a 58 |{amoeba.|error}.X|
|00005de0| 25 2e 62 72 0a 58 54 68 | 65 20 65 78 63 65 70 74 |%.br.XTh|e except|
|00005df0| 69 6f 6e 20 72 61 69 73 | 65 64 20 77 68 65 6e 20 |ion rais|ed when |
|00005e00| 61 6e 20 41 6d 6f 65 62 | 61 20 66 75 6e 63 74 69 |an Amoeb|a functi|
|00005e10| 6f 6e 20 72 65 74 75 72 | 6e 73 20 61 6e 20 65 72 |on retur|ns an er|
|00005e20| 72 6f 72 2e 0a 58 54 68 | 65 20 76 61 6c 75 65 20 |ror..XTh|e value |
|00005e30| 61 63 63 6f 6d 70 61 6e | 79 69 6e 67 20 74 68 69 |accompan|ying thi|
|00005e40| 73 20 65 78 63 65 70 74 | 69 6f 6e 20 69 73 20 61 |s except|ion is a|
|00005e50| 20 70 61 69 72 20 63 6f | 6e 74 61 69 6e 69 6e 67 | pair co|ntaining|
|00005e60| 20 74 68 65 20 6e 75 6d | 65 72 69 63 0a 58 65 72 | the num|eric.Xer|
|00005e70| 72 6f 72 20 63 6f 64 65 | 20 61 6e 64 20 74 68 65 |ror code| and the|
|00005e80| 20 63 6f 72 72 65 73 70 | 6f 6e 64 69 6e 67 20 73 | corresp|onding s|
|00005e90| 74 72 69 6e 67 2c 20 61 | 73 20 72 65 74 75 72 6e |tring, a|s return|
|00005ea0| 65 64 20 62 79 20 74 68 | 65 20 43 20 66 75 6e 63 |ed by th|e C func|
|00005eb0| 74 69 6f 6e 0a 58 7b 5c | 74 74 20 65 72 72 5c 5f |tion.X{\|tt err\_|
|00005ec0| 77 68 79 28 29 7d 2e 0a | 58 5c 66 75 6e 63 69 74 |why()}..|X\funcit|
|00005ed0| 65 6d 7b 74 69 6d 65 6f | 75 74 7d 7b 6d 73 65 63 |em{timeo|ut}{msec|
|00005ee0| 73 7d 0a 58 25 2e 62 72 | 0a 58 53 65 74 73 20 74 |s}.X%.br|.XSets t|
|00005ef0| 68 65 20 74 72 61 6e 73 | 61 63 74 69 6f 6e 20 74 |he trans|action t|
|00005f00| 69 6d 65 6f 75 74 2c 20 | 69 6e 20 6d 69 6c 6c 69 |imeout, |in milli|
|00005f10| 73 65 63 6f 6e 64 73 2e | 0a 58 52 65 74 75 72 6e |seconds.|.XReturn|
|00005f20| 73 20 74 68 65 20 70 72 | 65 76 69 6f 75 73 20 74 |s the pr|evious t|
|00005f30| 69 6d 65 6f 75 74 2e 0a | 58 49 6e 69 74 69 61 6c |imeout..|XInitial|
|00005f40| 6c 79 2c 20 74 68 65 20 | 74 69 6d 65 6f 75 74 20 |ly, the |timeout |
|00005f50| 69 73 20 73 65 74 20 74 | 6f 20 32 20 73 65 63 6f |is set t|o 2 seco|
|00005f60| 6e 64 73 20 62 79 20 74 | 68 65 20 7b 5c 50 79 74 |nds by t|he {\Pyt|
|00005f70| 68 6f 6e 7d 20 69 6e 74 | 65 72 70 72 65 74 65 72 |hon} int|erpreter|
|00005f80| 2e 0a 58 5c 65 6e 64 7b | 64 65 73 63 72 69 70 74 |..X\end{|descript|
|00005f90| 69 6f 6e 7d 0a 58 0a 58 | 5c 73 75 62 73 75 62 73 |ion}.X.X|\subsubs|
|00005fa0| 65 63 74 69 6f 6e 7b 43 | 61 70 61 62 69 6c 69 74 |ection{C|apabilit|
|00005fb0| 79 20 4f 70 65 72 61 74 | 69 6f 6e 73 7d 0a 58 0a |y Operat|ions}.X.|
|00005fc0| 58 43 61 70 61 62 69 6c | 69 74 69 65 73 20 61 72 |XCapabil|ities ar|
|00005fd0| 65 20 77 72 69 74 74 65 | 6e 20 69 6e 20 61 20 63 |e writte|n in a c|
|00005fe0| 6f 6e 76 65 6e 69 65 6e | 74 20 41 53 43 49 49 20 |onvenien|t ASCII |
|00005ff0| 66 6f 72 6d 61 74 2c 20 | 61 6c 73 6f 20 75 73 65 |format, |also use|
|00006000| 64 20 62 79 20 74 68 65 | 0a 58 41 6d 6f 65 62 61 |d by the|.XAmoeba|
|00006010| 20 75 74 69 6c 69 74 69 | 65 73 0a 58 7b 5c 65 6d | utiliti|es.X{\em|
|00006020| 20 63 32 61 7d 28 55 29 | 0a 58 61 6e 64 0a 58 7b | c2a}(U)|.Xand.X{|
|00006030| 5c 65 6d 20 61 32 63 7d | 28 55 29 2e 0a 58 46 6f |\em a2c}|(U)..XFo|
|00006040| 72 20 65 78 61 6d 70 6c | 65 3a 0a 58 5c 62 63 6f |r exampl|e:.X\bco|
|00006050| 64 65 5c 62 65 67 69 6e | 7b 76 65 72 62 61 74 69 |de\begin|{verbati|
|00006060| 6d 7d 0a 58 3e 3e 3e 20 | 61 6d 6f 65 62 61 2e 6e |m}.X>>> |amoeba.n|
|00006070| 61 6d 65 5f 6c 6f 6f 6b | 75 70 28 27 2f 70 72 6f |ame_look|up('/pro|
|00006080| 66 69 6c 65 2f 63 61 70 | 27 29 0a 58 61 61 3a 31 |file/cap|').Xaa:1|
|00006090| 63 3a 39 35 3a 35 32 3a | 36 61 3a 66 61 2f 31 34 |c:95:52:|6a:fa/14|
|000060a0| 28 66 66 29 2f 38 65 3a | 62 61 3a 35 62 3a 38 3a |(ff)/8e:|ba:5b:8:|
|000060b0| 31 31 3a 31 61 0a 58 3e | 3e 3e 20 0a 58 5c 65 6e |11:1a.X>|>> .X\en|
|000060c0| 64 7b 76 65 72 62 61 74 | 69 6d 7d 5c 65 63 6f 64 |d{verbat|im}\ecod|
|000060d0| 65 0a 58 54 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |e.XThe f|ollowing|
|000060e0| 20 6d 65 74 68 6f 64 73 | 20 61 72 65 20 64 65 66 | methods| are def|
|000060f0| 69 6e 65 64 20 66 6f 72 | 20 63 61 70 61 62 69 6c |ined for| capabil|
|00006100| 69 74 79 20 6f 62 6a 65 | 63 74 73 2e 0a 58 5c 62 |ity obje|cts..X\b|
|00006110| 65 67 69 6e 7b 64 65 73 | 63 72 69 70 74 69 6f 6e |egin{des|cription|
|00006120| 7d 0a 58 5c 66 75 6e 63 | 69 74 65 6d 7b 64 69 72 |}.X\func|item{dir|
|00006130| 5c 5f 6c 69 73 74 7d 7b | 7d 0a 58 52 65 74 75 72 |\_list}{|}.XRetur|
|00006140| 6e 73 20 61 20 6c 69 73 | 74 20 6f 66 20 74 68 65 |ns a lis|t of the|
|00006150| 20 6e 61 6d 65 73 20 6f | 66 20 74 68 65 20 65 6e | names o|f the en|
|00006160| 74 72 69 65 73 20 69 6e | 20 61 6e 20 41 6d 6f 65 |tries in| an Amoe|
|00006170| 62 61 20 64 69 72 65 63 | 74 6f 72 79 2e 0a 58 5c |ba direc|tory..X\|
|00006180| 66 75 6e 63 69 74 65 6d | 7b 62 5c 5f 72 65 61 64 |funcitem|{b\_read|
|00006190| 7d 7b 6f 66 66 73 65 74 | 2c 20 6d 61 78 73 69 7a |}{offset|, maxsiz|
|000061a0| 65 7d 0a 58 25 2e 62 72 | 0a 58 52 65 61 64 73 20 |e}.X%.br|.XReads |
|000061b0| 28 61 74 20 6d 6f 73 74 | 29 0a 58 7b 5c 74 74 20 |(at most|).X{\tt |
|000061c0| 6d 61 78 73 69 7a 65 7d | 0a 58 62 79 74 65 73 20 |maxsize}|.Xbytes |
|000061d0| 66 72 6f 6d 20 61 20 62 | 75 6c 6c 65 74 20 66 69 |from a b|ullet fi|
|000061e0| 6c 65 20 61 74 20 6f 66 | 66 73 65 74 0a 58 7b 5c |le at of|fset.X{\|
|000061f0| 74 74 20 6f 66 66 73 65 | 74 2e 7d 0a 58 54 68 65 |tt offse|t.}.XThe|
|00006200| 20 64 61 74 61 20 69 73 | 20 72 65 74 75 72 6e 65 | data is| returne|
|00006210| 64 20 61 73 20 61 20 73 | 74 72 69 6e 67 2e 0a 58 |d as a s|tring..X|
|00006220| 45 4f 46 20 69 73 20 72 | 65 70 6f 72 74 65 64 20 |EOF is r|eported |
|00006230| 61 73 20 61 6e 20 65 6d | 70 74 79 20 73 74 72 69 |as an em|pty stri|
|00006240| 6e 67 2e 0a 58 5c 66 75 | 6e 63 69 74 65 6d 7b 62 |ng..X\fu|ncitem{b|
|00006250| 5c 5f 73 69 7a 65 7d 7b | 7d 0a 58 52 65 74 75 72 |\_size}{|}.XRetur|
|00006260| 6e 73 20 74 68 65 20 73 | 69 7a 65 20 6f 66 20 61 |ns the s|ize of a|
|00006270| 20 62 75 6c 6c 65 74 20 | 66 69 6c 65 2e 0a 58 5c | bullet |file..X\|
|00006280| 66 75 6e 63 69 74 65 6d | 7b 64 69 72 5c 5f 61 70 |funcitem|{dir\_ap|
|00006290| 70 65 6e 64 28 29 2c 20 | 64 69 72 5c 5f 64 65 6c |pend(), |dir\_del|
|000062a0| 65 74 65 28 29 2c 20 64 | 69 72 5c 5f 6c 6f 6f 6b |ete(), d|ir\_look|
|000062b0| 75 70 28 29 2c 20 64 69 | 72 5c 5f 72 65 70 6c 61 |up(), di|r\_repla|
|000062c0| 63 65 7d 7b 7d 0a 58 25 | 2e 62 72 0a 58 5c 69 74 |ce}{}.X%|.br.X\it|
|000062d0| 65 6d 62 72 65 61 6b 0a | 58 4c 69 6b 65 20 74 68 |embreak.|XLike th|
|000062e0| 65 20 63 6f 72 72 65 73 | 70 6f 6e 64 69 6e 67 0a |e corres|ponding.|
|000062f0| 58 7b 5c 74 74 20 6e 61 | 6d 65 5c 5f 2a 7d 0a 58 |X{\tt na|me\_*}.X|
|00006300| 66 75 6e 63 74 69 6f 6e | 73 2c 20 62 75 74 20 77 |function|s, but w|
|00006310| 69 74 68 20 61 20 70 61 | 74 68 20 72 65 6c 61 74 |ith a pa|th relat|
|00006320| 69 76 65 20 74 6f 20 74 | 68 65 20 63 61 70 61 62 |ive to t|he capab|
|00006330| 69 6c 69 74 79 2e 0a 58 | 28 46 6f 72 20 70 61 74 |ility..X|(For pat|
|00006340| 68 73 20 62 65 67 69 6e | 6e 69 6e 67 20 77 69 74 |hs begin|ning wit|
|00006350| 68 20 61 20 73 6c 61 73 | 68 20 74 68 65 20 63 61 |h a slas|h the ca|
|00006360| 70 61 62 69 6c 69 74 79 | 20 69 73 20 69 67 6e 6f |pability| is igno|
|00006370| 72 65 64 2c 20 73 69 6e | 63 65 20 74 68 69 73 0a |red, sin|ce this.|
|00006380| 58 69 73 20 74 68 65 20 | 64 65 66 69 6e 65 64 20 |Xis the |defined |
|00006390| 73 65 6d 61 6e 74 69 63 | 73 20 66 6f 72 20 41 6d |semantic|s for Am|
|000063a0| 6f 65 62 61 2e 29 0a 58 | 5c 66 75 6e 63 69 74 65 |oeba.).X|\funcite|
|000063b0| 6d 7b 73 74 64 5c 5f 69 | 6e 66 6f 7d 7b 7d 0a 58 |m{std\_i|nfo}{}.X|
|000063c0| 52 65 74 75 72 6e 73 20 | 74 68 65 20 73 74 61 6e |Returns |the stan|
|000063d0| 64 61 72 64 20 69 6e 66 | 6f 20 73 74 72 69 6e 67 |dard inf|o string|
|000063e0| 20 6f 66 20 74 68 65 20 | 6f 62 6a 65 63 74 2e 0a | of the |object..|
|000063f0| 58 5c 66 75 6e 63 69 74 | 65 6d 7b 74 6f 64 5c 5f |X\funcit|em{tod\_|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.