From 5e85d401b9b25627176f85fd2b4ad5228200b6e3 Mon Sep 17 00:00:00 2001 From: shivers Date: Tue, 11 Mar 1997 02:49:52 +0000 Subject: [PATCH] Updated manual. --- doc/scsh-manual.ps | 19214 +++++++++++++++-------------- doc/scsh-manual/man.tex | 2 + doc/scsh-manual/procnotation.tex | 8 +- doc/scsh-manual/rdelim.tex | 13 +- doc/scsh-manual/running.tex | 34 +- doc/scsh-manual/strings.tex | 26 +- doc/scsh-manual/syscalls.tex | 424 +- doc/scsh-manual/tty.tex | 38 +- doc/scsh-manual/xman.tex | 2 +- 9 files changed, 10298 insertions(+), 9463 deletions(-) diff --git a/doc/scsh-manual.ps b/doc/scsh-manual.ps index 7841071..715e34d 100644 --- a/doc/scsh-manual.ps +++ b/doc/scsh-manual.ps @@ -1,1489 +1,934 @@ %!PS-Adobe-2.0 -%%Creator: dvips 5.51 Copyright 1986, 1993 Radical Eye Software +%%Creator: dvipsk 5.58f Copyright 1986, 1994 Radical Eye Software %%Title: man.dvi -%%CreationDate: Wed Nov 1 15:58:40 1995 -%%Pages: 159 +%%Pages: 164 %%PageOrder: Ascend %%BoundingBox: 0 0 612 792 %%DocumentFonts: Palatino-Bold Palatino-Roman Palatino-Italic %%EndComments %DVIPSCommandLine: dvips -o man.ps man.dvi -%DVIPSSource: TeX output 1995.11.01:1558 -%%BeginProcSet: tex.pro -/TeXDict 250 dict def TeXDict begin /N{def}def /B{bind def}N /S{exch}N /X{S N} -B /TR{translate}N /isls false N /vsize 11 72 mul N /@rigin{isls{[0 -1 1 0 0 0] -concat}if 72 Resolution div 72 VResolution div neg scale isls{Resolution hsize --72 div mul 0 TR}if Resolution VResolution vsize -72 div 1 add mul TR matrix -currentmatrix dup dup 4 get round 4 exch put dup dup 5 get round 5 exch put -setmatrix}N /@landscape{/isls true N}B /@manualfeed{statusdict /manualfeed -true put}B /@copies{/#copies X}B /FMat[1 0 0 -1 0 0]N /FBB[0 0 0 0]N /nn 0 N -/IE 0 N /ctr 0 N /df-tail{/nn 8 dict N nn begin /FontType 3 N /FontMatrix -fntrx N /FontBBox FBB N string /base X array /BitMaps X /BuildChar{ -CharBuilder}N /Encoding IE N end dup{/foo setfont}2 array copy cvx N load 0 nn -put /ctr 0 N[}B /df{/sf 1 N /fntrx FMat N df-tail}B /dfs{div /sf X /fntrx[sf 0 -0 sf neg 0 0]N df-tail}B /E{pop nn dup definefont setfont}B /ch-width{ch-data -dup length 5 sub get}B /ch-height{ch-data dup length 4 sub get}B /ch-xoff{128 -ch-data dup length 3 sub get sub}B /ch-yoff{ch-data dup length 2 sub get 127 -sub}B /ch-dx{ch-data dup length 1 sub get}B /ch-image{ch-data dup type -/stringtype ne{ctr get /ctr ctr 1 add N}if}B /id 0 N /rw 0 N /rc 0 N /gp 0 N -/cp 0 N /G 0 N /sf 0 N /CharBuilder{save 3 1 roll S dup /base get 2 index get -S /BitMaps get S get /ch-data X pop /ctr 0 N ch-dx 0 ch-xoff ch-yoff ch-height -sub ch-xoff ch-width add ch-yoff setcachedevice ch-width ch-height true[1 0 0 --1 -.1 ch-xoff sub ch-yoff .1 add]{ch-image}imagemask restore}B /D{/cc X dup -type /stringtype ne{]}if nn /base get cc ctr put nn /BitMaps get S ctr S sf 1 -ne{dup dup length 1 sub dup 2 index S get sf div put}if put /ctr ctr 1 add N} -B /I{cc 1 add D}B /bop{userdict /bop-hook known{bop-hook}if /SI save N @rigin -0 0 moveto /V matrix currentmatrix dup 1 get dup mul exch 0 get dup mul add -.99 lt{/QV}{/RV}ifelse load def pop pop}N /eop{SI restore showpage userdict -/eop-hook known{eop-hook}if}N /@start{userdict /start-hook known{start-hook} -if pop /VResolution X /Resolution X 1000 div /DVImag X /IE 256 array N 0 1 255 -{IE S 1 string dup 0 3 index put cvn put}for 65781.76 div /vsize X 65781.76 -div /hsize X}N /p{show}N /RMat[1 0 0 -1 0 0]N /BDot 260 string N /rulex 0 N -/ruley 0 N /v{/ruley X /rulex X V}B /V{}B /RV statusdict begin /product where{ -pop product dup length 7 ge{0 7 getinterval dup(Display)eq exch 0 4 -getinterval(NeXT)eq or}{pop false}ifelse}{false}ifelse end{{gsave TR -.1 -.1 -TR 1 1 scale rulex ruley false RMat{BDot}imagemask grestore}}{{gsave TR -.1 --.1 TR rulex ruley scale 1 1 false RMat{BDot}imagemask grestore}}ifelse B /QV{ -gsave transform round exch round exch itransform moveto rulex 0 rlineto 0 -ruley neg rlineto rulex neg 0 rlineto fill grestore}B /a{moveto}B /delta 0 N -/tail{dup /delta X 0 rmoveto}B /M{S p delta add tail}B /b{S p tail}B /c{-4 M} -B /d{-3 M}B /e{-2 M}B /f{-1 M}B /g{0 M}B /h{1 M}B /i{2 M}B /j{3 M}B /k{4 M}B -/w{0 rmoveto}B /l{p -4 w}B /m{p -3 w}B /n{p -2 w}B /o{p -1 w}B /q{p 1 w}B /r{ -p 2 w}B /s{p 3 w}B /t{p 4 w}B /x{0 S rmoveto}B /y{3 2 roll p a}B /bos{/SS save -N}B /eos{SS restore}B end +%DVIPSParameters: dpi=600, compressed, comments removed +%DVIPSSource: TeX output 1997.03.10:2147 +%%BeginProcSet: texc.pro +/TeXDict 250 dict def TeXDict begin /N{def}def /B{bind def}N /S{exch}N +/X{S N}B /TR{translate}N /isls false N /vsize 11 72 mul N /hsize 8.5 72 +mul N /landplus90{false}def /@rigin{isls{[0 landplus90{1 -1}{-1 1} +ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale +isls{landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div +hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul +TR[matrix currentmatrix{dup dup round sub abs 0.00001 lt{round}if} +forall round exch round exch]setmatrix}N /@landscape{/isls true N}B +/@manualfeed{statusdict /manualfeed true put}B /@copies{/#copies X}B +/FMat[1 0 0 -1 0 0]N /FBB[0 0 0 0]N /nn 0 N /IE 0 N /ctr 0 N /df-tail{ +/nn 8 dict N nn begin /FontType 3 N /FontMatrix fntrx N /FontBBox FBB N +string /base X array /BitMaps X /BuildChar{CharBuilder}N /Encoding IE N +end dup{/foo setfont}2 array copy cvx N load 0 nn put /ctr 0 N[}B /df{ +/sf 1 N /fntrx FMat N df-tail}B /dfs{div /sf X /fntrx[sf 0 0 sf neg 0 0] +N df-tail}B /E{pop nn dup definefont setfont}B /ch-width{ch-data dup +length 5 sub get}B /ch-height{ch-data dup length 4 sub get}B /ch-xoff{ +128 ch-data dup length 3 sub get sub}B /ch-yoff{ch-data dup length 2 sub +get 127 sub}B /ch-dx{ch-data dup length 1 sub get}B /ch-image{ch-data +dup type /stringtype ne{ctr get /ctr ctr 1 add N}if}B /id 0 N /rw 0 N +/rc 0 N /gp 0 N /cp 0 N /G 0 N /sf 0 N /CharBuilder{save 3 1 roll S dup +/base get 2 index get S /BitMaps get S get /ch-data X pop /ctr 0 N ch-dx +0 ch-xoff ch-yoff ch-height sub ch-xoff ch-width add ch-yoff +setcachedevice ch-width ch-height true[1 0 0 -1 -.1 ch-xoff sub ch-yoff +.1 sub]/id ch-image N /rw ch-width 7 add 8 idiv string N /rc 0 N /gp 0 N +/cp 0 N{rc 0 ne{rc 1 sub /rc X rw}{G}ifelse}imagemask restore}B /G{{id +gp get /gp gp 1 add N dup 18 mod S 18 idiv pl S get exec}loop}B /adv{cp +add /cp X}B /chg{rw cp id gp 4 index getinterval putinterval dup gp add +/gp X adv}B /nd{/cp 0 N rw exit}B /lsh{rw cp 2 copy get dup 0 eq{pop 1}{ +dup 255 eq{pop 254}{dup dup add 255 and S 1 and or}ifelse}ifelse put 1 +adv}B /rsh{rw cp 2 copy get dup 0 eq{pop 128}{dup 255 eq{pop 127}{dup 2 +idiv S 128 and or}ifelse}ifelse put 1 adv}B /clr{rw cp 2 index string +putinterval adv}B /set{rw cp fillstr 0 4 index getinterval putinterval +adv}B /fillstr 18 string 0 1 17{2 copy 255 put pop}for N /pl[{adv 1 chg} +{adv 1 chg nd}{1 add chg}{1 add chg nd}{adv lsh}{adv lsh nd}{adv rsh}{ +adv rsh nd}{1 add adv}{/rc X nd}{1 add set}{1 add clr}{adv 2 chg}{adv 2 +chg nd}{pop nd}]dup{bind pop}forall N /D{/cc X dup type /stringtype ne{] +}if nn /base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{dup dup +length 1 sub dup 2 index S get sf div put}if put /ctr ctr 1 add N}B /I{ +cc 1 add D}B /bop{userdict /bop-hook known{bop-hook}if /SI save N @rigin +0 0 moveto /V matrix currentmatrix dup 1 get dup mul exch 0 get dup mul +add .99 lt{/QV}{/RV}ifelse load def pop pop}N /eop{SI restore userdict +/eop-hook known{eop-hook}if showpage}N /@start{userdict /start-hook +known{start-hook}if pop /VResolution X /Resolution X 1000 div /DVImag X +/IE 256 array N 0 1 255{IE S 1 string dup 0 3 index put cvn put}for +65781.76 div /vsize X 65781.76 div /hsize X}N /p{show}N /RMat[1 0 0 -1 0 +0]N /BDot 260 string N /rulex 0 N /ruley 0 N /v{/ruley X /rulex X V}B /V +{}B /RV statusdict begin /product where{pop product dup length 7 ge{0 7 +getinterval dup(Display)eq exch 0 4 getinterval(NeXT)eq or}{pop false} +ifelse}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale rulex ruley false +RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR rulex ruley scale 1 1 +false RMat{BDot}imagemask grestore}}ifelse B /QV{gsave newpath transform +round exch round exch itransform moveto rulex 0 rlineto 0 ruley neg +rlineto rulex neg 0 rlineto fill grestore}B /a{moveto}B /delta 0 N /tail +{dup /delta X 0 rmoveto}B /M{S p delta add tail}B /b{S p tail}B /c{-4 M} +B /d{-3 M}B /e{-2 M}B /f{-1 M}B /g{0 M}B /h{1 M}B /i{2 M}B /j{3 M}B /k{ +4 M}B /w{0 rmoveto}B /l{p -4 w}B /m{p -3 w}B /n{p -2 w}B /o{p -1 w}B /q{ +p 1 w}B /r{p 2 w}B /s{p 3 w}B /t{p 4 w}B /x{0 S rmoveto}B /y{3 2 roll p +a}B /bos{/SS save N}B /eos{SS restore}B end %%EndProcSet +%%BeginFont: Palatino-Bold +% @psencodingfile{ +% author = "P. MacKay, Alan Jeffrey, S. Rahtz, K. Berry, B. Horn", +% version = "0.2", +% date = "7 September 94", +% filename = "8r.enc", +% email = "kb@cs.umb.edu", +% address = "135 Center Hill Rd. // Plymouth, MA 02360", +% codetable = "ISO/ASCII", +% checksum = "xx", +% docstring = "Encoding for TrueType or Type 1 fonts to be used with TeX." +% } +% +% Idea is to have all the characters normally included in Type 1 fonts +% available for typesetting. This is effectively the characters in Adobe +% Standard Encoding + ISO Latin 1 + extra characters from Lucida. +% +% Character code assignments were made as follows: +% +% (1) the Windows ANSI characters are in their Windows ANSI positions, +% because Windows users cannot easily reencode the fonts, and it makes +% no difference on other systems. The only Windows ANSI characters not +% available are those that make no sense for typesetting -- rubout +% (127 decimal), nobreakspace (160), softhyphen (173). +% +% (2) The caron and dotlessi characters are in the positions used by +% Y&Y for their modified ATM encoding. +% +% (3) Remaining characters are assigned arbitrarily to the first few +% positions. +% +% (4) (Y&Y) Lucida Bright includes some extra text characters; in the +% hopes that other PostScript fonts, perhaps created for public +% consumption, will include them, they are included starting at 0x10. +% +% (5) Remaining positions left undefined are for use in (hopefully) +% upward-compatible revisions, if someday more characters are generally +% available in the Type 1 fonts. +% +% Ligatures are omitted, since this encoding is intended for use at the +% driver end. Including ligatures and kerns would make the TFM files +% much larger, to no particular purpose. If someone actually wants to +% typeset in this encoding, they can pick a different name, and regenerate +% the fonts. + +/TeXBase1Encoding [ +% 0x00 (encoded characters from Adobe Standard not in Windows 3.1) + /breve /dotaccent /fi /fl + /fraction /hungarumlaut /Lslash /lslash + /ogonek /ring /tilde /minus + % These are the only two remaining unencoded characters, so may as + % well include them. + /Zcaron /zcaron /.notdef /.notdef +% 0x10 (TeX characters from, e.g., Lucida Bright) + /dotlessj /ff /ffi /ffl /.notdef /.notdef /.notdef /.notdef + /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +% 0x20 (ASCII begins) + /space /exclam /quotedbl /numbersign + /dollar /percent /ampersand /quotesingle + /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash +% 0x30 + /zero /one /two /three /four /five /six /seven + /eight /nine /colon /semicolon /less /equal /greater /question +% 0x40 + /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O +% 0x50 + /P /Q /R /S /T /U /V /W + /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore +% 0x60 + /grave /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o +% 0x70 + /p /q /r /s /t /u /v /w + /x /y /z /braceleft /bar /braceright /asciitilde + /.notdef % rubout; ASCII ends +% 0x80 + /.notdef /.notdef /quotesinglbase /florin + /quotedblbase /ellipsis /dagger /daggerdbl + /circumflex /perthousand /Scaron /guilsinglleft + /OE + /caron % Y&Y + /.notdef + /.notdef +% 0x90 + /.notdef /quoteleft /quoteright /quotedblleft + /quotedblright /bullet /endash /emdash + /tildeaccent /trademark /scaron /guilsinglright + /oe + /dotlessi % Y&Y + /.notdef + /Ydieresis +% 0xA0 + /.notdef % nobreakspace + /exclamdown /cent /sterling + /currency /yen /brokenbar /section + /dieresis /copyright /ordfeminine /guillemotleft + /logicalnot + /hyphen % Y&Y (also at 45); Windows' softhyphen + /registered + /macron +% 0xD0 + /degree /plusminus /twosuperior /threesuperior + /acute /mu /paragraph /periodcentered + /cedilla /onesuperior /ordmasculine /guillemotright + /onequarter /onehalf /threequarters /questiondown +% 0xC0 + /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla + /Egrave /Eacute /Ecircumflex /Edieresis + /Igrave /Iacute /Icircumflex /Idieresis +% 0xD0 + /Eth /Ntilde /Ograve /Oacute + /Ocircumflex /Otilde /Odieresis /multiply + /Oslash /Ugrave /Uacute /Ucircumflex + /Udieresis /Yacute /Thorn /germandbls +% 0xE0 + /agrave /aacute /acircumflex /atilde + /adieresis /aring /ae /ccedilla + /egrave /eacute /ecircumflex /edieresis + /igrave /iacute /icircumflex /idieresis +% 0xF0 + /eth /ntilde /ograve /oacute + /ocircumflex /otilde /odieresis /divide + /oslash /ugrave /uacute /ucircumflex + /udieresis /yacute /thorn /ydieresis +] def +%%EndFont %%BeginProcSet: texps.pro -TeXDict begin /rf{findfont dup length 1 add dict begin{1 index /FID ne 2 index -/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll exec 0 exch 5 --1 roll VResolution Resolution div mul neg 0 0]/Metrics exch def dict begin -Encoding{exch dup type /integertype ne{pop pop 1 sub dup 0 le{pop}{[}ifelse}{ -FontMatrix 0 get div Metrics 0 get div def}ifelse}forall Metrics /Metrics -currentdict end def[2 index currentdict end definefont 3 -1 roll makefont -/setfont load]cvx def}def /ObliqueSlant{dup sin S cos div neg}B /SlantFont{4 -index mul add}def /ExtendFont{3 -1 roll mul exch}def /ReEncodeFont{/Encoding -exch def}def end +TeXDict begin /rf{findfont dup length 1 add dict begin{1 index /FID ne 2 +index /UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll +exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]/Metrics +exch def dict begin Encoding{exch dup type /integertype ne{pop pop 1 sub +dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get div def} +ifelse}forall Metrics /Metrics currentdict end def[2 index currentdict +end definefont 3 -1 roll makefont /setfont load]cvx def}def +/ObliqueSlant{dup sin S cos div neg}B /SlantFont{4 index mul add}def +/ExtendFont{3 -1 roll mul exch}def /ReEncodeFont{/Encoding exch def}def +end %%EndProcSet -TeXDict begin 40258431 52099146 1000 600 600 -(/clark1/users/shivers/vc/text/scshman/man.dvi) @start /Fa -190[45 65[{}1 58.333334 /Palatino-Roman rf /Fb 1 42 df<0000000000F00000000000 -000000F000000000000000007800000000000000007800000000000000003C0000000000000000 -3C00000000000000001E00000000000000000F000000000000000007800000000000000007C000 -00000000000003E000007FFFFFFFFFFFF00000FFFFFFFFFFFFF80000FFFFFFFFFFFFFC00007FFF -FFFFFFFFFE00000000000000001F800000000000000007C00000000000000003F0000000000000 -0001FE00000000000000007F80000000000000001FF0000000000000001FF0000000000000007F -8000000000000001FE0000000000000003F00000000000000007C0000000000000001F80007FFF -FFFFFFFFFE0000FFFFFFFFFFFFFC0000FFFFFFFFFFFFF800007FFFFFFFFFFFF000000000000000 -03E00000000000000007C0000000000000000780000000000000000F00000000000000001E0000 -0000000000003C00000000000000003C0000000000000000780000000000000000780000000000 -000000F00000000000000000F0000000442A7CA74D>41 D E /Fc 1 62 -df<7FFFFFFFFFFFC0FFFFFFFFFFFFE0FFFFFFFFFFFFE07FFFFFFFFFFFC0000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000007FFFFF -FFFFFFC0FFFFFFFFFFFFE0FFFFFFFFFFFFE07FFFFFFFFFFFC033147C9C3C>61 -D E /Fd 1 16 df<007F800001FFE00007FFF8000FFFFC001FFFFE003FFFFF003FFFFF007FFFFF -807FFFFF807FFFFF80FFFFFFC0FFFFFFC0FFFFFFC0FFFFFFC0FFFFFFC0FFFFFFC0FFFFFFC07FFF -FF807FFFFF807FFFFF803FFFFF003FFFFF001FFFFE000FFFFC0007FFF80001FFE000007F80001A -1B7C9D23>15 D E /Fe 2 59 df<007C000000007F000000000F8000000007C000000007E00000 -0003E000000003F000000001F000000001F800000001F800000000F800000000FC000000007C00 -0000007C000000007E000000003E000000003F000000003F000000001F000000001F800000001F -800000000F800000000FC000000007C000000007C000000007E000000003E000000003F0000000 -03F000000007F00000000FF80000001CF800000038F800000070FC000000E07C000001C07E0000 -03807E000007003E00001E003F00003E003F00007C001F0000F8001F8001F0000F8003E0000F80 -07C0000FC00F800007C01F000007E03E000007E07E000003E0FC000003F0F8000001F870000000 -F825347CB32D>21 D<3C7EFFFFFFFF7E3C08087A8715>58 D E /Ff 167[40 -4[31 3[47 5[20 73[{}4 59.999974 /Palatino-Roman rf /Fg 134[37 -2[37 42 25 29 29 1[37 33 42 58 1[33 1[21 37 37 21 29 37 30 -1[33 7[50 5[42 19[37 16[19 46[{}23 75.000000 /Palatino-Italic -rf /Fh 9 119 df<7FFFFF80FFFFFFC0FFFFFFC0FFFFFFC0FFFFFFC07FFFFF801A067C9623>45 -D<3000000078000000FE000000FF000000FF8000007FE000003FF000000FF8000007FE000003FF -000000FFC000007FE000003FF000000FFC000007FE000001FF800000FFC000007FC000007FC000 -00FFC00001FF800007FE00000FFC00003FF000007FE00000FFC00003FF000007FE00000FF80000 -3FF000007FE00000FF800000FF000000FE00000078000000300000001A247CA523>62 -D<00007F800000FFC00000FFC000007FC0000007C0000007C0000007C0000007C0000007C00000 -07C0000007C0000007C0003F87C000FFE7C003FFFFC007FFFFC00FE0FFC01F803FC03F001FC03E -000FC07E000FC07C0007C0FC0007C0F80007C0F80007C0F80007C0F80007C0F80007C0F80007C0 -F80007C0FC0007C07C000FC07C000FC03E001FC03F001FC01F803FC00FE0FFC007FFFFFC03FFF7 -FE01FFE7FE003F83FC1F297EA823>100 D<003FC00000FFF80003FFFC0007FFFE000FF07F001F -C01F803F000FC03E0007C07E0007C07C0007E0FC0003E0F80003E0FFFFFFE0FFFFFFE0FFFFFFE0 -FFFFFFC0F8000000F80000007C0000007C0000007E0000003E0001C01F0003E00FC007E007F01F -C003FFFFC001FFFF80007FFE00001FF8001B1D7D9C23>I<0000FF000003FFC00007FFE0000FFF -E0001FC7E0003F07E0003E03C0003E0000003E0000003E0000003E0000003E00007FFFFF80FFFF -FFC0FFFFFFC07FFFFF80003E0000003E0000003E0000003E0000003E0000003E0000003E000000 -3E0000003E0000003E0000003E0000003E0000003E0000003E0000003E0000003E0000003E0000 -003E0000003E0000003E0000003E00003FFFFE007FFFFF007FFFFF003FFFFE001B297EA823>I< -7E1F01F000FF7F87F800FFFFCFFC007FFFFFFE000FF1FF1F000FC0FC0F000FC0FC0F000F80F80F -000F80F80F000F00F00F000F00F00F000F00F00F000F00F00F000F00F00F000F00F00F000F00F0 -0F000F00F00F000F00F00F000F00F00F000F00F00F000F00F00F000F00F00F000F00F00F000F00 -F00F000F00F00F007FE1FE1FE0FFF3FF3FF0FFF3FF3FF07FE1FE1FE0241D819C23>109 -D<003F000001FFE00003FFF00007FFF8000FE1FC001F807E003F003F003E001F007C000F807C00 -0F80F80007C0F80007C0F80007C0F80007C0F80007C0F80007C0F80007C0F80007C0FC000FC07C -000F807E001F803E001F003F003F001F807E000FE1FC0007FFF80003FFF00001FFE000003F0000 -1A1D7C9C23>111 D<01FF8C0FFFFE1FFFFE3FFFFE7F01FEF8007EF0003EF0003EF0003EF8001C -7E00007FF0003FFF800FFFE003FFF8003FFC0001FE00003E70001FF8000FF8000FFC000FFC001F -FE001EFF80FEFFFFFCFFFFF8F7FFE060FF80181D7B9C23>115 D<7FE01FF8FFF03FFCFFF03FFC -7FE01FF80F0003C00F8007C0078007800780078007C00F8003C00F0003C00F0003E01F0001E01E -0001E01E0001F03E0000F03C0000F03C0000F87C000078780000787800007CF800003CF000003C -F000003FF000001FE000001FE000001FE000000FC000000780001E1D7E9C23>118 -D E /Fi 76 125 df<3C7EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7E7E7E7E7E7E7E7E7E7E7E7E7E -3C000000000000003C7EFFFFFFFF7E3C082E71AD27>33 D<1000207C00F8FE01FCFE01FCFE01FC -FE01FCFE01FCFE01FCFE01FCFE01FCFE01FCFE01FCFC00FC7C00F87C00F87C00F87C00F87C00F8 -7C00F87C00F87C00F87C00F8100020161778AE27>I<003C03C0007E07E0007E07E0007E07E000 -7E07E0007E07E0007E07E0007E07E000FE0FE000FC0FC000FC0FC03FFFFFFC7FFFFFFEFFFFFFFF -FFFFFFFFFFFFFFFF7FFFFFFE01F81F8001F81F8001F81F8001F81F8001F81F8001F81F8001F81F -8001F81F8001F81F8001F81F8001F81F8001F81F807FFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7FFF -FFFE3FFFFFFC03F03F0003F03F0007F07F0007E07E0007E07E0007E07E0007E07E0007E07E0007 -E07E0007E07E0003C03C00202E7DAD27>I<000380000007C0000007C0000007C0000007C00000 -07C000001FF00000FFFE0003FFFF8007FFFFC01FFFFFE01FE7DFF03F87C7F07E07C3F87C07C1F8 -FC07C0FCF807C0FCF807C1FCF807C1FCF807C1FCFC07C0F8FE07C0707F07C0007F87C0003FF7C0 -001FFFC0000FFFF80007FFFE0003FFFF80007FFFC0000FFFE00007FFE00007CFF00007C3F80007 -C1F81007C0FC7C07C0FCFE07C07CFE07C07CFE07C07CFC07C07CFC07C07CFE07C0F87E07C1F87F -07C3F03F87C7F01FE7DFE01FFFFFC00FFFFF8003FFFF0000FFFC00001FE0000007C0000007C000 -0007C0000007C0000007C000000380001E3A7CB327>I<0001C00003E0000FE0001FE0003FC000 -7F8000FE0001FC0001F80003F00007F00007E0000FC0000FC0001F80001F80003F00003F00003F -00007E00007E00007E00007E0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC -0000FC0000FC0000FC00007E00007E00007E00007E00003F00003F00003F00001F80001F80000F -C0000FC00007E00007F00003F00001F80001FC0000FE00007F80003FC0001FE0000FE00003E000 -01C0133A73B327>40 D<700000F80000FE0000FF00007F80003FC0000FE00007F00003F00001F8 -0001FC0000FC00007E00007E00003F00003F00001F80001F80001F80000FC0000FC0000FC0000F -C00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E0000F -C0000FC0000FC0000FC0001F80001F80001F80003F00003F00007E00007E0000FC0001FC0001F8 -0003F00007F0000FE0003FC0007F8000FF0000FE0000F80000700000133A7AB327>I<000F0000 -001F8000001F8000001F8000001F8000001F8000001F8000781F81E0FE1F87F0FF1F8FF0FFDFBF -F07FFFFFE03FFFFFC00FFFFF0003FFFC0000FFF00000FFF00003FFFC000FFFFF003FFFFFC07FFF -FFE0FFDFBFF0FF1F8FF0FE1F87F0781F81E0001F8000001F8000001F8000001F8000001F800000 -1F8000000F00001C207BA627>I<0003C0000007E0000007E0000007E0000007E0000007E00000 -07E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0007FFFFFFEFFFFFFFF -FFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFE0007E0000007E0000007E0000007E0000007E0000007E0 -000007E0000007E0000007E0000007E0000007E0000007E0000007E0000003C00020227DA727> -I<0F003FC03FE07FF07FF07FF87FF83FF83FF80FF801F801F003F007E00FE07FC0FF80FF00FE00 -70000D14738927>I<7FFFFFF8FFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC7FFFFFF81E067C9927>I< -1E007F807F80FFC0FFC0FFC0FFC07F807F801E000A0A728927>I<000000380000007C000000FC -000000FC000001FC000001F8000003F8000003F0000007F0000007E000000FE000000FC000001F -C000001F8000003F8000003F0000003F0000007F0000007E000000FE000000FC000001FC000001 -F8000003F8000003F0000007F0000007E000000FE000000FC000000FC000001FC000001F800000 -3F8000003F0000007F0000007E000000FE000000FC000001FC000001F8000003F8000003F00000 -03F0000007F0000007E000000FE000000FC000001FC000001F8000003F8000003F0000007F0000 -007E000000FE000000FC000000FC000000F8000000780000001E3A7CB327>I<0007E000003FFC -00007FFE0000FFFF0001FFFF8003FC3FC007F00FE00FE007F00FC003F01F8001F81F8001F83F00 -00FC3F0000FC7E00007E7E00007E7E00007E7E00007EFC00003FFC00003FFC00003FFC00003FFC -00003FFC00003FFC00003FFC00003FFC00003FFC00003FFC00003FFE00007F7E00007E7E00007E -7E00007E7F0000FE3F0000FC3F0000FC1F8001F81FC003F80FC003F00FE007F007F00FE003FC3F -C001FFFF8000FFFF00007FFE00003FFC000007E000202E7DAD27>I<000E0000001F0000001F00 -00003F0000003F0000007F000000FF000001FF000003FF00003FFF00007FFF0000FFFF0000FFBF -00007C3F0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F000000 -3F0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000 -003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F00003FFFFF -807FFFFF807FFFFFC07FFFFF807FFFFF801A2E79AD27>I<003FC00001FFF80007FFFE000FFFFF -801FFFFFC03FE03FE03F800FF07F0007F07E0003F8FC0001F8FE0001FCFE0000FCFE0000FC7C00 -00FC7C0000FC000000FC000000FC000001FC000001F8000001F8000003F8000003F0000007F000 -000FE000001FC000003FC000007F800000FF000001FE000003FC000007F800000FF000001FE000 -003FC000007F800000FE000001FC000007F800780FF000FC1FE000FC3FC000FC7FFFFFFCFFFFFF -FCFFFFFFFCFFFFFFFC7FFFFFF81E2E7CAD27>I<003FF00001FFFE0007FFFF800FFFFFE01FFFFF -E03FE00FF03F8003F83F8001F83F8001FC3F8000FC1F0000FC040000FC000000FC000001FC0000 -01F8000001F8000003F000000FF000003FE0001FFFC0003FFF80003FFF80003FFFE0001FFFF000 -000FF8000003FC000001FC000000FE0000007E0000007F0000003F0000003F3800003F7C00003F -FE00003FFE00007FFE00007EFC0000FEFE0001FC7F8003FC3FE00FF83FFFFFF01FFFFFE007FFFF -8001FFFE00001FF000202E7DAD27>I<78000000FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -FEFC0001FCFC0003F8FC0007F0780007E000000FC000001FC000003F8000003F0000007F000000 -7E000000FC000001FC000001F8000003F8000003F0000003F0000007E0000007E000000FE00000 -0FC000000FC000001FC000001F8000001F8000001F8000003F8000003F0000003F0000003F0000 -003F0000007F0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E00 -00003C0000003C0000202F7DAE27>55 D<1E007F807F80FFC0FFC0FFC0FFC07F807F801E000000 -000000000000000000000000000000000000000000001E007F807F80FFC0FFC0FFC0FFC07F807F -801E000A20729F27>58 D<0F003FC03FC07FE07FE07FE07FE03FC03FC00F000000000000000000 -000000000000000000000000000000000F003F803FC07FC07FE07FE07FE03FE03FE00FE007E007 -C007C00FC03F807F00FF00FE00F80070000B2A739F27>I<3000000078000000FE000000FF0000 -00FFC000007FE000003FF800000FFC000007FE000001FF800000FFC000003FF000001FF800000F -FE000003FF000001FFC000007FE000003FF800000FFC000007FC000007FC00000FFC00003FF800 -007FE00001FFC00003FF00000FFE00001FF800003FF00000FFC00001FF800007FE00000FFC0000 -3FF800007FE00000FFC00000FF000000FE00000078000000300000001E287CAA27>62 -D<007FF00003FFFF000FFFFFC03FFFFFE03FFFFFF07FC00FF8FF0003FCFE0001FCFE0000FCFE00 -00FCFE0001FC7C0003FC00000FF800001FF000007FE00000FFC00001FF000003FC000003F80000 -07F000000FE000000FC000001FC000001F8000001F8000001F8000001F8000001F8000001F8000 -001F8000000F000000000000000000000000000000000000000000000000000000000000000F00 -00001F8000003FC000003FC000003FC000003FC000001F8000000F00001E2E7CAD27>I<0000FC -000007FF80001FFFC0007FFFE000FFFFF001FF03F803FC01F807F000FC07E01F7C0FC07FFE1F80 -FFFE1F01FFFE3F03FFFE3E07F1FF7E07E0FF7C0FC07F7C0F803F7C0F803FFC1F803FF81F001FF8 -1F001FF81F001FF81F001FF81F001FF81F001FF81F001FF81F001FFC1F803F7C0F803E7C0F803E -7C0FC07E7E07E0FC3E07F1FC3F03FFF81F01FFF01F80FFE00FC07FC007E01F1E07F0003F03FC00 -7F01FF01FF00FFFFFE007FFFFC001FFFF00007FFC00000FE00202E7DAD27>I<0003F000000007 -F800000007F80000000FFC0000000FFC0000000FFC0000000F3C0000000F3C0000001F3E000000 -1F3E0000001F3E0000001F3E0000001F3E0000003F3F0000003F3F0000003E1F0000003E1F0000 -007E1F8000007E1F8000007E1F8000007E1F8000007C0F800000FC0FC00000FC0FC00000FC0FC0 -0000FC0FC00000FC0FC00001F807E00001F807E00001FFFFE00001FFFFE00003FFFFF00003FFFF -F00003FFFFF00003F003F00003F003F00007E001F80007E001F80007E001F80007E001F8000FE0 -01FC007FFC0FFF80FFFC0FFFC0FFFE1FFFC0FFFC0FFFC07FFC0FFF80222E7EAD27>I<7FFFFF00 -00FFFFFFC000FFFFFFE000FFFFFFF8007FFFFFF80007E003FC0007E000FE0007E0007E0007E000 -7F0007E0003F0007E0003F0007E0003F0007E0003F0007E0003F0007E0003F0007E0007E0007E0 -007E0007E000FC0007E003FC0007E00FF80007FFFFF00007FFFFC00007FFFFF00007FFFFF80007 -FFFFFC0007E000FE0007E0007F0007E0003F8007E0001F8007E0001F8007E0000FC007E0000FC0 -07E0000FC007E0000FC007E0000FC007E0000FC007E0001FC007E0001F8007E0003F8007E0007F -0007E001FF007FFFFFFE00FFFFFFFC00FFFFFFF800FFFFFFE0007FFFFF8000222E7FAD27>I<00 -03F80E001FFF1F007FFFFF00FFFFFF01FFFFFF03FE0FFF07F803FF07F001FF0FE000FF1FC0007F -1F80007F3F80007F3F00003F7F00003F7E00003F7E00001E7E000000FE000000FC000000FC0000 -00FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FE0000007E00 -00007E0000007E00001E7F00003F3F00003F3F80003F1F80003F1FC0007F0FE0007E07F000FE07 -F801FC03FE07F801FFFFF800FFFFF0007FFFC0001FFF000003F800202E7DAD27>I<7FFFFC0000 -7FFFFF0000FFFFFFC0007FFFFFE0007FFFFFF00007E00FF80007E007F80007E001FC0007E000FE -0007E000FE0007E0007E0007E0007F0007E0003F0007E0003F8007E0001F8007E0001F8007E000 -1F8007E0001FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0 -000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0001F8007E0001F8007E0001F8007 -E0003F8007E0003F0007E0003F0007E0007F0007E000FE0007E000FE0007E001FC0007E003F800 -07E00FF8007FFFFFF0007FFFFFE000FFFFFFC0007FFFFF00007FFFFC0000222E7FAD27>I<7FFF -FFFF80FFFFFFFFC0FFFFFFFFC0FFFFFFFFC07FFFFFFFC007E0000FC007E0000FC007E0000FC007 -E0000FC007E0000FC007E0000FC007E000078007E000000007E000000007E000000007E0000000 -07E007800007E00FC00007E00FC00007E00FC00007FFFFC00007FFFFC00007FFFFC00007FFFFC0 -0007FFFFC00007E00FC00007E00FC00007E00FC00007E007800007E000000007E000000007E000 -000007E000000007E00003C007E00007E007E00007E007E00007E007E00007E007E00007E007E0 -0007E007E00007E07FFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE07FFFFFFFC0232E7FAD27> -I<7FFFFFFF80FFFFFFFFC0FFFFFFFFC0FFFFFFFFC07FFFFFFFC007E0000FC007E0000FC007E000 -0FC007E0000FC007E0000FC007E0000FC007E000078007E000000007E000000007E000000007E0 -00000007E007800007E00FC00007E00FC00007E00FC00007FFFFC00007FFFFC00007FFFFC00007 -FFFFC00007FFFFC00007E00FC00007E00FC00007E00FC00007E007800007E000000007E0000000 -07E000000007E000000007E000000007E000000007E000000007E000000007E000000007E00000 -0007E000000007E00000007FFF800000FFFF800000FFFFC00000FFFF8000007FFF800000222E7E -AD27>I<0007E03800003FFC7C00007FFFFC0000FFFFFC0001FFFFFC0003FC1FFC0007F00FFC00 -0FE007FC000FC003FC001F8001FC001F8001FC003F0000FC003F0000FC007F0000FC007E0000FC -007E000078007E00000000FE00000000FC00000000FC00000000FC00000000FC00000000FC0000 -0000FC00000000FC00000000FC001FFF00FC003FFF80FC003FFF80FE003FFF807E001FFF007E00 -00FC007E0000FC007F0001FC003F0001FC003F0001FC001F8001FC001F8003FC000FC003FC000F -E007FC0007F00FFC0003FC1FFC0001FFFFFC0000FFFFFC00007FFEFC00003FFCFC000007E07800 -212E7DAD27>I<7FFE07FFE07FFE07FFE0FFFF0FFFF07FFE07FFE07FFE07FFE007E0007E0007E0 -007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007 -E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007FFFFFE0007FFFFFE00 -07FFFFFE0007FFFFFE0007FFFFFE0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E -0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E000 -7E0007E0007E0007E0007E0007E0007E007FFE07FFE07FFE07FFE0FFFF0FFFF07FFE07FFE07FFE -07FFE0242E7FAD27>I<7FFFFFE0FFFFFFF0FFFFFFF0FFFFFFF07FFFFFE0001F8000001F800000 -1F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000 -001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F80 -00001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F -8000001F8000001F8000001F8000001F80007FFFFFE0FFFFFFF0FFFFFFF0FFFFFFF07FFFFFE01C -2E7BAD27>I<7FFC07FF807FFC07FF80FFFE0FFFC07FFC07FF807FFC07FF8007C001F80007C001 -F80007C003F00007C007E00007C00FC00007C00FC00007C01F800007C03F000007C07E000007C0 -7E000007C0FC000007C1F8000007C3F0000007C3F0000007C7E0000007CFF0000007DFF0000007 -DFF8000007FFFC000007FE7C000007FC7E000007FC3E000007F83F000007F01F000007E01F8000 -07E00F800007C00FC00007C007C00007C007E00007C003E00007C003F00007C001F80007C000F8 -0007C000FC0007C0007C0007C0007E007FFC01FFC07FFC01FFC0FFFE03FFE07FFC01FFC07FFC01 -FFC0232E7FAD27>75 D<7FFFC000007FFFE00000FFFFE000007FFFE000007FFFC0000003F00000 -0003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F000 -000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F0 -00000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003 -F000000003F000000003F000000003F000000003F000078003F0000FC003F0000FC003F0000FC0 -03F0000FC003F0000FC003F0000FC003F0000FC07FFFFFFFC07FFFFFFFC0FFFFFFFFC07FFFFFFF -C07FFFFFFF80222E7FAD27>I<7FE0007FE0FFF000FFF0FFF000FFF0FFF801FFF07FF801FFE00F -F801FF000FB801DF000FBC03DF000FBC03DF000FBC03DF000FBE07DF000F9E079F000F9E079F00 -0F9E079F000F9F0F9F000F9F0F9F000F8F0F1F000F8F0F1F000F8F9F1F000F8F9F1F000F879E1F -000F879E1F000F879E1F000F879E1F000F839C1F000F83FC1F000F83FC1F000F83FC1F000F81F8 -1F000F81F81F000F80F01F000F80001F000F80001F000F80001F000F80001F000F80001F000F80 -001F000F80001F000F80001F000F80001F000F80001F007FF000FFE0FFF801FFF0FFF801FFF0FF -F801FFF07FF000FFE0242E7FAD27>I<7FF003FFE07FF803FFE0FFF807FFF07FFC03FFE07FFC03 -FFE007FC003E0007DE003E0007DE003E0007DE003E0007CF003E0007CF003E0007CF003E0007CF -803E0007C7803E0007C7C03E0007C7C03E0007C3C03E0007C3E03E0007C3E03E0007C1E03E0007 -C1F03E0007C1F03E0007C1F03E0007C0F83E0007C0F83E0007C0F83E0007C0783E0007C07C3E00 -07C07C3E0007C03C3E0007C03E3E0007C03E3E0007C01E3E0007C01F3E0007C00F3E0007C00F3E -0007C00F3E0007C007BE0007C007BE0007C007BE0007C003FE007FFC03FE007FFC03FE00FFFE01 -FE007FFC01FE007FFC00FC00242E7FAD27>I<00FFFC0007FFFF801FFFFFE03FFFFFF03FFFFFF0 -3FC00FF07F0003F87F0003F87E0001F87E0001F8FE0001FCFC0000FCFC0000FCFC0000FCFC0000 -FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC00 -00FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFE -0001FCFE0001FC7E0001F87E0001F87F0003F87F8007F83FE01FF03FFFFFF03FFFFFF01FFFFFE0 -07FFFF8000FFFC001E2E7CAD27>I<7FFFFF0000FFFFFFE000FFFFFFF000FFFFFFF8007FFFFFFC -0007E003FE0007E000FF0007E0007F0007E0003F8007E0001F8007E0001FC007E0000FC007E000 -0FC007E0000FC007E0000FC007E0000FC007E0000FC007E0001FC007E0001F8007E0003F8007E0 -007F0007E000FF0007E003FE0007FFFFFC0007FFFFF80007FFFFF00007FFFFE00007FFFF000007 -E000000007E000000007E000000007E000000007E000000007E000000007E000000007E0000000 -07E000000007E000000007E000000007E000000007E00000007FFE000000FFFF000000FFFF0000 -00FFFF0000007FFE000000222E7FAD27>I<7FFFF000007FFFFE0000FFFFFF80007FFFFFC0007F -FFFFE00007E01FF00007E007F00007E003F80007E001F80007E001FC0007E000FC0007E000FC00 -07E000FC0007E000FC0007E000FC0007E001FC0007E001F80007E003F80007E007F00007E01FF0 -0007FFFFE00007FFFFC00007FFFF800007FFFF800007FFFFC00007E01FC00007E00FE00007E007 -E00007E003F00007E003F00007E003F00007E003F00007E003F00007E003F00007E003F00007E0 -03F00007E003F0F007E003F1F807E003F1F807E003F1F807E001F9F87FFE01FFF07FFE00FFF0FF -FF00FFE07FFE007FC07FFE000F00252E7FAD27>82 D<003FC0E001FFF9F007FFFFF00FFFFFF01F -FFFFF03FC07FF03F801FF07E000FF07E0007F0FC0007F0FC0003F0FC0003F0FC0003F0FC0001E0 -FE000000FE0000007F0000007FC000003FF800001FFF80000FFFF80007FFFE0003FFFF80007FFF -C00007FFE000007FF000000FF0000007F8000003F8000001FC000001FC000000FC780000FCFC00 -00FCFC0000FCFC0000FCFC0001FCFE0001F8FF0003F8FF8007F0FFF00FE0FFFFFFE0FFFFFFC0FF -FFFF80F9FFFE00701FF0001E2E7CAD27>I<7FFFFFFF80FFFFFFFFC0FFFFFFFFC0FFFFFFFFC0FF -FFFFFFC0FC03F00FC0FC03F00FC0FC03F00FC0FC03F00FC0FC03F00FC0FC03F00FC07803F00780 -0003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F000 -000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F0 -00000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003 -F000000003F000000003F000000003F000000003F000000003F0000000FFFFC00000FFFFC00001 -FFFFE00000FFFFC00000FFFFC000222E7EAD27>I<7FFE01FFF8FFFF03FFFCFFFF03FFFCFFFF03 -FFFC7FFE01FFF807E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0 -001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007 -E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F80 -07E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007F0003F -8003F0003F0003F0003F0003F8007F0001FC00FE0000FE01FC0000FF03FC00007FFFF800003FFF -F000001FFFE0000007FF80000000FC0000262E80AD27>I<7FFC03FFE07FFC03FFE0FFFE07FFF0 -7FFC03FFE07FFC03FFE007E0007E0007E0007E0007E0007E0007F000FE0003F000FC0003F000FC -0003F000FC0003F000FC0001F801F80001F801F80001F801F80001F801F80001FC03F80000FC03 -F00000FC03F00000FC03F00000FC03F000007E07E000007E07E000007E07E000007E07E000003E -07C000003F0FC000003F0FC000003F0FC000001F0F8000001F0F8000001F9F8000001F9F800000 -1F9F8000000F9F0000000F9F0000000F9F0000000F9F000000079E00000007FE00000007FE0000 -0007FE00000003FC00000003FC00000001F80000242E7FAD27>I<7FE0007FE0FFF000FFF0FFF0 -00FFF0FFF000FFF07FE0007FE01F00000F801F00000F801F00000F801F00000F801F00000F801F -00000F801F00000F800F80001F000F80001F000F80001F000F80001F000F80001F000F80001F00 -0F80F01F000F81F81F0007C3FC3E0007C3FC3E0007C3FC3E0007C3FC3E0007C39C3E0007C79E3E -0007C79E3E0003C79E3C0003C79E3C0003C79E3C0003E79E7C0003E79E7C0003EF9F7C0003EF9F -7C0003EF0F7C0001EF0F780001EF0F780001EF0F780001EF0F780001EE07780001FE07F80001FE -07F80001FE07F80000FE07F00000FC03F000007801E000242E7FAD27>I<3FFC1FFE007FFE3FFE -007FFE3FFF007FFE3FFE003FFC1FFE0003F00FE00003F80FC00001F80FC00001FC1FC00000FC1F -800000FE3F8000007E3F0000007F7F0000003F7E0000003FFE0000001FFC0000001FFC0000000F -F80000000FF800000007F000000007F000000003F000000007F000000007F80000000FF8000000 -0FFC0000001FFC0000001FFE0000003F7E0000003F7F0000007F3F0000007E3F8000007E1F8000 -00FC1FC00000FC0FC00001F80FE00001F807E00003F807E00003F003F00007F003F00007E003F8 -007FFC0FFF80FFFC0FFF80FFFE1FFFC0FFFC0FFF807FFC0FFF80222E7EAD27>I<7FFC03FFE07F -FE07FFE0FFFE07FFF07FFE07FFE07FFC03FFE007F000FE0003F000FC0003F801FC0001F801F800 -01F801F80001FC03F80000FC03F00000FE07F000007E07E000007E07E000003F0FC000003F0FC0 -00001F9F8000001F9F8000001F9F8000000F9F0000000F9F00000007FE00000007FE00000003FC -00000003FC00000001F800000001F800000001F800000001F800000001F800000001F800000001 -F800000001F800000001F800000001F800000001F800000001F800000001F800000001F8000000 -01F80000001FFF8000001FFF8000003FFFC000001FFF8000001FFF8000242E7FAD27>I<7FFFF0 -FFFFF8FFFFF8FFFFF8FFFFF0FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000 -FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000 -FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000 -FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000 -FFFFF0FFFFF8FFFFF8FFFFF87FFFF0153A71B327>91 D<78000000F8000000FC000000FC000000 -FE0000007E0000007F0000003F0000003F8000001F8000001FC000000FC000000FE0000007E000 -0007F0000003F0000003F0000003F8000001F8000001FC000000FC000000FE0000007E0000007F -0000003F0000003F8000001F8000001FC000000FC000000FC000000FE0000007E0000007F00000 -03F0000003F8000001F8000001FC000000FC000000FE0000007E0000007F0000003F0000003F00 -00003F8000001F8000001FC000000FC000000FE0000007E0000007F0000003F0000003F8000001 -F8000001FC000000FC000000FC0000007C000000381E3A7CB327>I<7FFFF0FFFFF8FFFFF8FFFF -F87FFFF80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001 -F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001 -F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001 -F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F87FFFF8FFFFF8FFFF -F8FFFFF87FFFF0153A7EB327>I<001C00007E0001FF8007FFE01FFFF83FFFFCFFE7FFFFC3FFFF -00FFFC003F78001E180B79AD27>I<00E001F007F00FF00FE01FC03F003E007E007C00FC00F800 -F800F800F800FF00FF80FFC07FC07FC03FC03F800F000C1773B227>96 D<01FF8000000FFFF000 -001FFFFC00003FFFFF00003FFFFF80003F807F80003F801FC0001F000FC000040007E000000007 -E000000007E0000007FFE000007FFFE00003FFFFE0000FFFFFE0001FFFFFE0003FF807E0007FC0 -07E0007F0007E000FE0007E000FC0007E000FC0007E000FC0007E000FC0007E000FE000FE0007F -001FE0003F807FE0003FFFFFFF801FFFFFFFC00FFFFFFFC003FFF1FFC0007F807F8022207C9F27 ->I<7FE0000000FFF0000000FFF0000000FFF00000007FF000000003F000000003F000000003F0 -00000003F000000003F000000003F000000003F000000003F000000003F000000003F07E000003 -F3FFC00003FFFFF00003FFFFF80003FFFFFC0003FF81FE0003FE00FF0003FC003F8003F8001F80 -03F8001FC003F0000FC003F0000FC003F0000FE003F00007E003F00007E003F00007E003F00007 -E003F00007E003F00007E003F0000FE003F0000FC003F8000FC003F8001FC003FC003F8003FC00 -7F0003FE00FF0003FF83FE0003FFFFFC0003FFFFF80003FFFFF00003F3FFC00001E0FE0000232E -7FAD27>I<000FFE00007FFFC001FFFFE003FFFFF007FFFFF00FF807F01FE007F01FC003E03F80 -00807F0000007E0000007E000000FE000000FC000000FC000000FC000000FC000000FC000000FC -000000FE0000007E0000007E0000007F0000F03F8001F81FC001F81FE003F80FF80FF007FFFFF0 -03FFFFE001FFFFC0007FFF00000FF8001D207B9F27>I<00003FF00000007FF80000007FF80000 -007FF80000003FF800000001F800000001F800000001F800000001F800000001F800000001F800 -000001F800000001F800000001F800000FE1F800007FFDF80001FFFFF80003FFFFF80007FFFFF8 -000FF81FF8001FE00FF8001FC007F8003F8003F8007F0003F8007E0001F8007E0001F800FE0001 -F800FC0001F800FC0001F800FC0001F800FC0001F800FC0001F800FC0001F800FE0001F8007E00 -03F8007E0003F8007F0003F8003F0007F8003F800FF8001FE01FF8000FF03FF80007FFFFFFC003 -FFFFFFE001FFFDFFE0007FF9FFE0000FC0FFC0232E7EAD27>I<0007F000003FFE0000FFFF8003 -FFFFC007FFFFE00FF80FF01FE003F81FC001F83F8000FC7F0000FC7E0000FC7E00007EFE00007E -FFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFCFC000000FE0000007E0000007E0000003F0000 -3C3F80007E1FC0007E0FF000FE0FFC03FC07FFFFF801FFFFF800FFFFF0003FFFC00003FC001F20 -7D9F27>I<00001FE00000FFF80001FFFC0003FFFE0007FFFE000FF0FE000FC07C001FC07C001F -8000001F8000001F8000001F8000001F8000001F80007FFFFFF0FFFFFFF8FFFFFFF8FFFFFFF87F -FFFFF0001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000 -001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F80 -00001F8000001F8000001F80003FFFFFC07FFFFFE07FFFFFE07FFFFFE03FFFFFC01F2E7EAD27> -I<001FC03F00007FF1FFC001FFFFFFE003FFFFFFE007FFFFFFE00FF07FC7E01FC01FC3C01F800F -C0001F800FC0003F0007E0003F0007E0003F0007E0003F0007E0003F0007E0003F0007E0001F80 -0FC0001F800FC0001FC01FC0000FF07F80000FFFFF00000FFFFE00001FFFFC00001F7FF000001F -1FC000001F000000001F000000001F800000000FFFFF000007FFFFE0000FFFFFF8001FFFFFFE00 -3FFFFFFE003F8000FF007E00003F807C00000F80FC00000FC0F8000007C0F8000007C0F8000007 -C0F8000007C0FC00000FC07C00000F807F00003F803F80007F001FF003FE001FFFFFFE0007FFFF -F80003FFFFF000007FFF8000000FFC000023327E9F27>I<7FE0000000FFF0000000FFF0000000 -FFF00000007FF000000003F000000003F000000003F000000003F000000003F000000003F00000 -0003F000000003F000000003F000000003F03F000003F1FFC00003F7FFE00003FFFFF00003FFFF -F80003FFC1F80003FF01FC0003FE00FC0003FC00FC0003F800FC0003F800FC0003F000FC0003F0 -00FC0003F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003 -F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003F000FC007FFF83FFE0 -FFFFC7FFF0FFFFC7FFF0FFFFC7FFF07FFF83FFE0242E7FAD27>I<000F0000001F8000003FC000 -003FC000003FC000003FC000001F8000000F000000000000000000000000000000000000000000 -0000000000000000003FFF80007FFFC0007FFFC0007FFFC0003FFFC000000FC000000FC000000F -C000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC00000 -0FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000 -7FFFFFF07FFFFFF0FFFFFFF87FFFFFF07FFFFFF01D2F7BAE27>I<7FE00000007FF0000000FFF0 -0000007FF00000007FF000000001F000000001F000000001F000000001F000000001F000000001 -F000000001F000000001F000000001F000000001F03FFFC001F07FFFE001F07FFFE001F07FFFE0 -01F03FFFC001F003F80001F007F00001F00FE00001F01FC00001F03F800001F0FF000001F1FE00 -0001F3FC000001F7F8000001FFFC000001FFFE000001FFFE000001FF3F000001FE1F800001FC0F -C00001F80FE00001F007E00001F003F00001F001F80001F000FC0001F000FC0001F0007E007FFF -C1FFF07FFFC3FFF8FFFFE3FFF87FFFC3FFF87FFFC3FFF0252E80AD27>107 -D<7FFF8000FFFFC000FFFFC000FFFFC0007FFFC000000FC000000FC000000FC000000FC000000F -C000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC00000 -0FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000 -000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC0 -00000FC000000FC0007FFFFFF8FFFFFFFCFFFFFFFCFFFFFFFC7FFFFFF81E2E7CAD27>I<7F07C0 -1F0000FF9FF07FC000FFFFF9FFE000FFFFFFFFF0007FFFFFFFF0000FFC7FF1F8000FF03FC0F800 -0FE03F80F8000FC03F00F8000FC03F00F8000FC03F00F8000F803E00F8000F803E00F8000F803E -00F8000F803E00F8000F803E00F8000F803E00F8000F803E00F8000F803E00F8000F803E00F800 -0F803E00F8000F803E00F8000F803E00F8000F803E00F8000F803E00F8000F803E00F8000F803E -00F8007FF0FFC3FF00FFF8FFE3FF80FFF9FFE7FF80FFF8FFE3FF807FF0FFC3FF002920819F27> -I<7FE03F0000FFF1FFC000FFF7FFE000FFFFFFF0007FFFFFF80003FFC1F80003FF01FC0003FE00 -FC0003FC00FC0003F800FC0003F800FC0003F000FC0003F000FC0003F000FC0003F000FC0003F0 -00FC0003F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003 -F000FC0003F000FC0003F000FC0003F000FC007FFF83FFE0FFFFC7FFF0FFFFC7FFF0FFFFC7FFF0 -7FFF83FFE024207F9F27>I<001FE000007FF80001FFFE0003FFFF0007FFFF800FF03FC01FC00F -E03F8007F03F0003F07F0003F87E0001F87E0001F8FC0000FCFC0000FCFC0000FCFC0000FCFC00 -00FCFC0000FCFC0000FCFE0001FC7E0001F87E0001F87F0003F83F8007F03F8007F01FE01FE00F -F03FC007FFFF8003FFFF0001FFFE00007FF800001FE0001E207C9F27>I<7FE07E0000FFF3FFC0 -00FFFFFFF000FFFFFFF8007FFFFFFC0003FF81FE0003FE00FF0003FC003F8003F8001F8003F800 -1FC003F0000FC003F0000FC003F0000FE003F00007E003F00007E003F00007E003F00007E003F0 -0007E003F00007E003F0000FE003F0000FC003F8000FC003F8001FC003FC003F8003FC007F0003 -FE00FF0003FF83FE0003FFFFFC0003FFFFF80003FFFFF00003F3FFC00003F0FE000003F0000000 -03F000000003F000000003F000000003F000000003F000000003F000000003F000000003F00000 -0003F000000003F000000003F00000007FFF800000FFFFC00000FFFFC00000FFFFC000007FFF80 -000023317F9F27>I<0007F03C00003FFE7E0000FFFF7E0003FFFFFE0007FFFFFE000FF80FFE00 -1FE007FE001FC003FE003F8001FE007F0000FE007E0000FE007E0000FE00FE00007E00FC00007E -00FC00007E00FC00007E00FC00007E00FC00007E00FC00007E00FE00007E007E0000FE007E0000 -FE007F0000FE003F8001FE001FC003FE001FE007FE000FF81FFE0007FFFFFE0003FFFFFE0001FF -FF7E00007FFC7E00000FE07E000000007E000000007E000000007E000000007E000000007E0000 -00007E000000007E000000007E000000007E000000007E000000007E000000007E0000001FFFF8 -00001FFFF800003FFFFC00001FFFF800001FFFF826317E9F27>I<7FFC01FC00FFFE0FFF00FFFE -3FFF80FFFE7FFFC07FFEFFFFC0007FFE1FC0007FF81FC0007FF00F80007FE00200007FC0000000 -7F800000007F800000007F000000007F000000007E000000007E000000007E000000007E000000 -007E000000007E000000007E000000007E000000007E000000007E000000007E000000007E0000 -00007E0000007FFFFF8000FFFFFFC000FFFFFFC000FFFFFFC0007FFFFF800022207E9F27>I<00 -7FF38007FFFFC01FFFFFC03FFFFFC03FFFFFC07F801FC0FC000FC0F8000FC0F8000FC0F8000780 -FC0000007F8000007FFC00003FFFE0001FFFFC0007FFFF0000FFFF80000FFFC000003FE0000007 -E0780003F0FC0001F0FC0001F0FE0001F0FE0003F0FF0007E0FFC01FE0FFFFFFC0FFFFFF80FFFF -FF00FBFFFC00707FE0001C207B9F27>I<003C0000007E0000007E0000007E0000007E0000007E -0000007E0000007E0000007E00007FFFFFF0FFFFFFF8FFFFFFF8FFFFFFF87FFFFFF0007E000000 -7E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000 -007E0000007E0000007E0000007E0018007E003C007E007E007E007E007E007E007E00FE003F00 -FC003F83FC001FFFF8001FFFF0000FFFE00003FFC00000FE001F297EA827>I<7FE01FF800FFF0 -3FFC00FFF03FFC00FFF03FFC007FF01FFC0003F000FC0003F000FC0003F000FC0003F000FC0003 -F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003F000FC00 -03F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003F000FC0003F001FC0003F001FC -0003F003FC0003F80FFC0001FFFFFFE000FFFFFFF000FFFFFFF0003FFEFFF0000FF07FE024207F -9F27>I<7FFC0FFF80FFFE1FFFC0FFFE1FFFC0FFFE1FFFC07FFC0FFF8007C000F80007E001F800 -03E001F00003E001F00003F003F00001F003E00001F003E00001F807E00000F807C00000F807C0 -0000F807C000007C0F8000007C0F8000007C0F8000003E1F0000003E1F0000003E1F0000003F3F -0000001F3E0000001F3E0000001F3E0000000FFC0000000FFC0000000FFC00000007F800000007 -F800000003F0000022207E9F27>I<7FFE07FFE07FFE07FFE0FFFF0FFFF07FFE07FFE07FFE07FF -E00F80001F000F80001F000F80001F000FC0003F0007C0003E0007C0003E0007C0003E0007C000 -3E0007C0F03E0007C1F83E0003E3FC7C0003E3FC7C0003E3FC7C0003E3FC7C0003E79E7C0003E7 -9E7C0001E79E780001E79E780001E79E780001F79EF80001F79EF80001FF0FF80000FF0FF00000 -FF0FF00000FF0FF00000FE07F000007C03E00024207F9F27>I<3FFC1FFF007FFE3FFF007FFE3F -FF807FFE3FFF003FFC1FFF0001F807E00000FC0FC00000FC1F8000007E1F0000003F3F0000001F -7E0000001FFC0000000FF800000007F800000003F000000003E000000003F000000007F8000000 -0FF80000001FFC0000001F3E0000003E3F0000007E1F0000007C0F800000F80FC00001F807E000 -03F003E0007FFE1FFF807FFE1FFF80FFFF3FFFC07FFE1FFF807FFE1FFF8022207E9F27>I<7FFC -0FFF80FFFE1FFFC0FFFE1FFFC0FFFE1FFFC07FFC0FFF8007E000F80003E001F80003E001F00003 -F001F00001F001F00001F803E00000F803E00000F803E00000FC07C000007C07C000007C07C000 -007E0F8000003E0F8000003E0F8000001F0F0000001F1F0000001F1F0000000F1F0000000F9E00 -00000FBE00000007BE00000007FC00000003FC00000003FC00000003F800000001F800000001F8 -00000001F000000001F000000003F000000003E000000003E000000007E000000007C000000807 -C000003E0FC000007F0F8000007F1F8000007E7F0000007FFE0000003FFC0000003FF80000001F -F000000007C000000022317E9F27>I<1FFFFFFE3FFFFFFF3FFFFFFF3FFFFFFF3FFFFFFF3F0001 -FE3F0003FC3F0007F83F000FF01E001FE000003FC000007F800000FF000001FE000003FC000007 -F800001FE000003FC000007F800000FF000001FE000003FC001E07F8003F0FF0003F1FE0003F3F -C0003F7F80003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFE20207E9F27>I<78FCFCFCFC -FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC -FCFCFCFCFCFCFCFCFCFCFCFCFC78063A70B327>124 D E /Fj 47[75 21[37 -10[45 45 3[37 48[42 39 62 42 45 24 32 30 42 45 41 43 66 22 -42 17 22 43 42 25 36 46 33 41 37 6[50 50 50 75 54 58 46 39 -50 1[45 59 62 71 46 2[25 62 57 42 46 58 53 46 58 1[33 3[19 -19 1[37 3[37 37 2[37 45 19 25 19 45 1[25 25 21 39[{}68 75.000000 -/Palatino-Roman rf /Fk 1 4 df<003800003800003800003800003800403804F0381EF8103E -7E10FC0F11E003938000FE0000380000FE000393800F11E07E10FCF8103EF0381E403804003800 -00380000380000380000380017197B9A22>3 D E /Fl 7 94 df<800000C00000E00000700000 -3800001C00000E00000F000007000003800003C00001C00001E00000F00000F000007800007800 -007800003C00003C00003E00001E00001E00001F00001F00000F00000F00000F80000F80000F80 -000F80000F800007800007C00007C00007C00007C00007C00007C00007C00007C00007C00007C0 -0007C00007C00007C00007C00007C00007C0000780000F80000F80000F80000F80000F80000F00 -000F00001F00001F00001E00001E00003E00003C00003C0000780000780000780000F00000F000 -01E00001C00003C0000380000700000F00000E00001C0000380000700000E00000C00000800000 -12527BBD20>41 D<00000030000000000000780000000000007800000000000078000000000000 -780000000000007800000000000078000000000000780000000000007800000000000078000000 -000000780000000000007800000000000078000000000000780000000000007800000000000078 -000000000000780000000000007800000000000078000000000000780000000000007800000000 -0000780000000000007800000000000078000000000000780000007FFFFFFFFFFFF8FFFFFFFFFF -FFFCFFFFFFFFFFFFFC7FFFFFFFFFFFF80000007800000000000078000000000000780000000000 -007800000000000078000000000000780000000000007800000000000078000000000000780000 -000000007800000000000078000000000000780000000000007800000000000078000000000000 -780000000000007800000000000078000000000000780000000000007800000000000078000000 -000000780000000000007800000000000078000000000000780000000000003000000036367BAF -41>43 D<0003F80000001FFF0000007E0FC00000F803E00003E000F80003C000780007C0007C00 -0F80003E000F80003E001F00001F001F00001F003F00001F803F00001F803F00001F807E00000F -C07E00000FC07E00000FC07E00000FC07E00000FC0FE00000FE0FE00000FE0FE00000FE0FE0000 -0FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00 -000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE07E00000FC07E -00000FC07E00000FC07E00000FC07F00001FC03F00001F803F00001F803F00001F801F00001F00 -1F00001F000F80003E000F80003E0007C0007C0003E000F80003E000F80000F803E000007E0FC0 -00001FFF00000007FC000023387DB62A>48 D<0001800000078000000F8000003F800001FF8000 -FFFF8000FFDF8000FE1F8000001F8000001F8000001F8000001F8000001F8000001F8000001F80 -00001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F -8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F800000 -1F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000 -001F8000001F8000001F8000001F8000001F8000001F8000001F8000003FC0007FFFFFE07FFFFF -E07FFFFFE01B3779B62A>I<7FFFFFFFFFFFF8FFFFFFFFFFFFFCFFFFFFFFFFFFFCFFFFFFFFFFFF -FC0000000000000000000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000FFFFFFFFFFFFFCFFFFFFFFFFFFFCFFFFFFFF -FFFFFC7FFFFFFFFFFFF836167B9F41>61 D91 -D93 D E /Fm 3 111 df<0078000007FC000007F80000 -00780000007800000078000000F0000000F0000000F0000000F0000001E0000001E0000001E000 -0001E0000003C0000003C1FC0003C7FE0003CE0F000798078007B0078007E0078007C007800F80 -07800F8007800F0007800F0007801E000F001E000F001E000F001E001E003C001E003C001E063C -003C063C003C0C7800780C780078187800783878003C70F0001FE060000F801F287CA727>104 -D<000E00001F00001F00001E00000C000000000000000000000000000000000000000000000000 -0000000003E0000FF0001C7800387800307800607800607800C07800C0F00000F00001E00001E0 -0001E00003C00003C0000780000781800781800F03000F03000F06000F06000F1C0007F80001E0 -0011277DA617>I<07C01FC0000FE07FE00018F0E0F0003079807800207B007800607E00780060 -7C007800C0F8007800C0F800780000F000780000F000780001E000F00001E000F00001E000F000 -01E001E00003C001E00003C001E06003C003C06003C003C0C007800780C0078007818007800783 -80078003C7000F0001FE00060000F80023197D9829>110 D E /Fn 167[35 -4[28 3[42 5[18 73[{}4 53.333281 /Palatino-Roman rf /Fo 4 53 -df<00E00001E00007E000FFE000F9E00001E00001E00001E00001E00001E00001E00001E00001 -E00001E00001E00001E00001E00001E00001E00001E00001E00001E00001E00001E00001E00001 -E00001E00001E00001E00001E00003F000FFFFC0FFFFC012217AA01E>49 -D<01FC0007FF801C0FC03003E06001F06000F8F800F8FC00FCFC00FCFC007C78007C3000FC0000 -FC0000F80000F80001F00003E00003C0000780000F00001E0000380000700000E00001C00C0380 -0C0600180C00181800183FFFF87FFFF8FFFFF0FFFFF016217CA01E>I<00FF0003FFC00F03E01C -00F01C00F83E00FC3E007C3E007C1E00FC0C00FC0000F80000F80001F00003E0000FC001FF0001 -FF000003E00000F000007800007C00003E00003F30003F78003FFC003FFC003FFC003EF8007E60 -007C3800F81E03F00FFFC001FF0018227DA01E>I<0000E00001E00001E00003E00007E0000FE0 -000DE00019E00039E00071E00061E000C1E001C1E00381E00301E00601E00E01E01C01E01801E0 -3001E07001E0E001E0FFFFFFFFFFFF0001E00001E00001E00001E00001E00001E00003F0003FFF -003FFF18217DA01E>I E /Fp 9 115 df<3FFFFFFFFC7FFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF -FFFFFF7FFFFFFFFE3FFFFFFFFC28077BA133>45 D<00007FFC000007FFFF80001FFFFFC0007FFF -FFE000FFFFFFF001FFFFFFF003FF800FF007FC000FF00FF80007E00FE00003C01FC00000003F80 -0000003F800000007F000000007F000000007E000000007E00000000FE00000000FC00000000FC -00000000FC00000000FC00000000FC00000000FC00000000FC00000000FE000000007E00000000 -7E000000007F000000007F000000003F800000F03FC00001F81FE00001F80FF00003F80FF80007 -F007FE000FF003FFC03FE001FFFFFFC000FFFFFFC0007FFFFF00001FFFFE000007FFF80000007F -8000252B79AA33>99 D<0000007FF000000000FFF800000001FFF800000001FFF800000000FFF8 -000000007FF80000000001F80000000001F80000000001F80000000001F80000000001F8000000 -0001F80000000001F80000000001F80000000001F80000000001F80000000001F80000000001F8 -000001FC01F800000FFF81F800003FFFE1F80000FFFFF9F80001FFFFFDF80003FFFFFFF80007FF -01FFF80007FC007FF8000FF0001FF8001FE0000FF8001FC00007F8003F800007F8003F000003F8 -007F000003F8007E000001F8007E000001F800FE000001F800FE000001F800FC000001F800FC00 -0001F800FC000001F800FC000001F800FC000001F800FC000001F800FC000001F800FC000001F8 -00FE000001F8007E000003F8007E000003F8007F000007F8003F000007F8003F80000FF8001FC0 -000FF8001FE0001FF8000FF0007FF8000FF800FFF80007FE03FFF80003FFFFFDFFE001FFFFF9FF -F000FFFFF1FFF8007FFFC1FFF8001FFF01FFF00003F800FFE02D3D7CBC33>I<0000FF80000007 -FFF000001FFFFC00007FFFFF0000FFFFFF8001FFFFFFC003FF80FFE007FC001FE00FF00007F00F -E00003F81FC00003F83F800001F83F800001FC7F000000FC7E000000FC7E000000FE7E0000007E -FE0000007EFFFFFFFFFEFFFFFFFFFEFFFFFFFFFEFFFFFFFFFEFFFFFFFFFEFFFFFFFFFCFC000000 -00FE000000007E000000007E000000007F000000003F000000003F8000003C1FC000007E1FC000 -007E0FF00000FE07F80001FE07FE0003FC03FFC01FF801FFFFFFF8007FFFFFF0003FFFFFC0000F -FFFF800003FFFE0000007FF000272B7BAA33>I<0000001FE0000001FFFC000007FFFE00000FFF -FE00001FFFFF00003FFFFF00007FC0FF0000FF00FF0000FE007E0001FC00180001F800000001F8 -00000001F800000001F800000001F800000001F800000001F800000001F800003FFFFFFFF87FFF -FFFFFCFFFFFFFFFCFFFFFFFFFCFFFFFFFFFC7FFFFFFFF80001F800000001F800000001F8000000 -01F800000001F800000001F800000001F800000001F800000001F800000001F800000001F80000 -0001F800000001F800000001F800000001F800000001F800000001F800000001F800000001F800 -000001F800000001F800000001F800000001F800000001F800000001F800000001F800000001F8 -00000001F800000001F800000001F800000001F800001FFFFFFF803FFFFFFFC03FFFFFFFC03FFF -FFFFC03FFFFFFFC01FFFFFFF80283D7DBC33>I<0001C000000007F000000007F00000000FF800 -00000FF80000000FF800000007F000000007F000000001C0000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000003FFF -F000007FFFF800007FFFF800007FFFF800007FFFF800003FFFF800000001F800000001F8000000 -01F800000001F800000001F800000001F800000001F800000001F800000001F800000001F80000 -0001F800000001F800000001F800000001F800000001F800000001F800000001F800000001F800 -000001F800000001F800000001F800000001F800000001F800000001F800000001F800000001F8 -00000001F800000001F800000001F800000001F800000001F800007FFFFFFF80FFFFFFFFC0FFFF -FFFFE0FFFFFFFFE0FFFFFFFFC07FFFFFFF80233E78BD33>105 D<3FF803FC00007FFC1FFF0000 -FFFC7FFFC000FFFCFFFFE0007FFDFFFFF0003FFFFFFFF00000FFFC07F80000FFF003F80000FFC0 -01F80000FF8001FC0000FF0000FC0000FF0000FC0000FE0000FC0000FE0000FC0000FE0000FC00 -00FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC00 -00FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC00 -00FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC00 -00FC0000FC0000FC0000FC0000FC003FFFF01FFFF07FFFF83FFFF8FFFFFC7FFFFCFFFFFC7FFFFC -7FFFF83FFFF83FFFF01FFFF02E2B7EAA33>110 D<0001FE0000000FFFC000003FFFF000007FFF -F80001FFFFFE0003FFFFFF0007FF03FF8007F8007F800FF0003FC01FE0001FE01FC0000FE03F80 -0007F03F000003F07F000003F87E000001F87E000001F87E000001F8FC000000FCFC000000FCFC -000000FCFC000000FCFC000000FCFC000000FCFC000000FCFC000000FCFE000001FC7E000001F8 -7E000001F87F000003F87F000003F83F800007F03F800007F01FC0000FE01FE0001FE00FF0003F -C007FC00FF8007FF03FF8003FFFFFF0001FFFFFE00007FFFF800003FFFF000000FFFC0000001FE -0000262B7AAA33>I<7FFF0007FC00FFFF803FFF00FFFF80FFFFC0FFFF83FFFFC0FFFF87FFFFE0 -7FFF8FFFFFE0001F9FF81FE0001FBFE01FE0001FFF800FC0001FFF000780001FFC000000001FF8 -000000001FF8000000001FF0000000001FE0000000001FE0000000001FC0000000001FC0000000 -001FC0000000001FC0000000001F80000000001F80000000001F80000000001F80000000001F80 -000000001F80000000001F80000000001F80000000001F80000000001F80000000001F80000000 -001F80000000001F80000000001F80000000001F80000000001F80000000001F800000007FFFFF -FC0000FFFFFFFE0000FFFFFFFE0000FFFFFFFE0000FFFFFFFE00007FFFFFFC00002B2B7CAA33> -114 D E /Fq 14 121 df<00000038000000FC000001FC000007FC00000FF800001FE000007FC0 -0000FF000001FE000003FC000007F800000FF000000FE000001FC000003F8000007F0000007E00 -0000FE000001FC000001F8000003F8000003F0000007E0000007E000000FC000000FC000001FC0 -00001F8000003F8000003F0000003F0000003F0000007F0000007E0000007E0000007E000000FE -000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000 -FC000000FC0000007C0000007E0000007E0000007E0000003E0000003F0000003F0000001F8000 -001F8000000FC000000FE0000007E0000003F0000001FC000001FC000000FE0000007C0000001C -00001E426DB92C>40 D<0000E0000001F0000001F8000001FC000000FE0000007F0000003F0000 -001F8000000FC000000FC0000007E0000007E0000003F0000003F0000003F0000001F8000001F8 -000001F8000001F8000001F8000001F8000000F8000000F8000000F8000001F8000001F8000001 -F8000001F8000001F8000001F8000001F8000003F8000003F0000003F0000003F0000007F00000 -07E0000007E000000FE000000FC000001FC000001F8000001F8000003F0000003F0000007E0000 -00FE000000FC000001F8000003F8000007F0000007E000000FE000001FC000003F8000007F0000 -00FE000003FC000007F800000FF000003FE000007FC00000FF000000FE000000F8000000700000 -001D427AB92C>I<0F003F807FC07FC0FFC0FFC0FFC07F807F001E000A0A6F892C>46 -D<0007FFFE00000FFFFF00000FFFFF00000FFFFF000007FFFE0000007F000000007E000000007E -00000000FE00000000FE00000000FC00000000FC00000001FC00000001FC00000001F800000001 -F800000003F800000003F800000003F000000003F000000007F000000007F000000007E0000000 -07E00000000FE00000000FE00000000FC00000000FC00000001FC00000001FC00000001F800000 -001F800000003F800000003F800000003F000000003F000000007F000000007F00001E007E0000 -3F007E00003F00FE00007F00FE00007E00FC00007E00FC00007E01FC0000FE01FC0000FC7FFFFF -FFFC7FFFFFFFFCFFFFFFFFFC7FFFFFFFF87FFFFFFFF828337EB22C>76 D<0001F00000000FFC38 -00003FFF7C00007FFFFC0000FFFFFC0001FE1FFC0003FC0FF80007F80FF80007F007F8000FE007 -F8001FC007F0001F8007F0003F8007F0003F0007F0007F0007E0007E0007E0007E0007E0007E00 -0FE000FE000FE000FC000FC000FC000FC000FC001FC180FC001F83C0FC003F87E0FC003F87E0FC -007F8FE0FC00FF0FC0FC01FF0FC0FE03FF0FC07E07FF1F807F0FFF1F803FFFFFFF001FFFDFFF00 -1FFF8FFE0007FE07FC0001F001F000232476A32C>97 D<00007F000003FFE0000FFFF8003FFFF8 -007FFFFC00FF81FE01FE007E03FC00FE07F800FE0FE000FE0FE000FC1FC000783F8000003F0000 -003F0000007E0000007E0000007E000000FE000000FC000000FC000000FC000000FC000000FC00 -0000FC000000FC000000FE0000007E00001C7F00003E3F8000FE3FC007FE1FFFFFFE0FFFFFFC07 -FFFFF001FFFFC0003FFC001F2475A32C>99 D<00007F000003FFC0000FFFF0003FFFF8007FFFF8 -00FF81FC01FE00FC03FC007E07F8007E0FE000FE0FC000FC1FC000FC3F8001FC3F0007F87F003F -F07FFFFFF07FFFFFE07FFFFF80FFFFFE00FFFFE000FC000000FC000000FC000000FC000000FC00 -0000FC0000007E0000007E00001C7F00003E3F8000FE1FC007FE1FFFFFFE0FFFFFFC07FFFFF001 -FFFFC0003FFC001F2475A32C>101 D<07FF0000000FFF8000000FFF8000000FFF80000007FF80 -0000003F800000003F000000003F000000007F000000007F000000007E000000007E00000000FE -00000000FE00000000FC00000000FC1F800001FCFFF00001FFFFF80001FFFFFC0001FFFFFC0003 -FFE0FE0003FFC07E0003FF007E0003FE007E0007FC007E0007FC007E0007F8007E0007F8007E00 -0FF000FE000FF000FC000FE000FC000FE000FC001FC001FC001FC001F8001FC001F8001F8003F8 -003F8003F0303F8003F0783F0007F0FC3F0007E0FC7F0007E1FC7F000FE1F87E000FC1F87E000F -C3F0FE000FC7F0FE000FCFE0FC000FFFE0FC0007FFC0FC0007FF80F80003FE00700000F8002633 -79B22C>104 D<00703E003E000079FF81FF8000FFFFC7FFC000FFFFCFFFC000FFFFFFFFE000FF -C3FFC3E001FF83FF83E001FF03FF03F001FE03FE03F001FC03FC03E003FC03FC03E003F803F803 -E003F803F803E003F007F007E007F007F007C007F007F007C007E007E007C00FE00FE00FC00FC0 -0FC00F800FC00FC00F801FC01FC01F801F801F801F001F801F801F001F801F803F003F803F803E -003F003F003E003F003F007E003F003F007C007F007F007C007E007E007C007E007E007C007E00 -7E007F00FE00FE007F00FC00FC003F80FC00FC003F00780078000F002C247DA32C>109 -D<01E003F00007F81FFC000FFC7FFE001FFEFFFF001FFFFFFF803F3FFE1F803F3FF81F807E3FF0 -1F807E3FE01F807E7FC01F80FE7F801F80FC7F801F80FC7F001F8078FF003F8000FE003F0000FE -003F0000FE003F0001FC007F0001FC007E0001FC007E0001F800FE0003F800FC1803F800FC3C03 -F001FC7E03F001F87E07F001F8FE07F003F8FC07E003F0FC07E003F1FC0FE003F1F80FE003F3F0 -0FC003FFF00FC001FFE00FC001FFC00F8000FF800700003E0027247AA32C>I<0000FC000007FF -80001FFFE0003FFFF000FFFFF001FF83F803FE01FC03F800FC07F000FC0FE0007E0FC0007E1F80 -007E3F80007E3F00007E7F00007E7E00007E7E00007E7E0000FEFE0000FEFC0000FCFC0000FCFC -0001FCFC0001F8FC0003F8FC0003F0FC0007E0FC000FE07E001FC07E003F807F00FF803F83FF00 -1FFFFE001FFFF8000FFFF00003FFC000007E00001F2476A32C>I<00007FC0000007FFFC00001F -FFFE00003FFFFF00007FFFFF8000FF803F8000FC001F8001F8003F8001F0003F8001F0003F0003 -F0001F0003F000000001F800000001FE00000000FFF0000000FFFF0000007FFFC000001FFFF000 -0003FFF80000001FFC00000001FC000000007E000000003E000000003E007C00003E007E00007E -00FE00007C00FE0000FC00FE0001F800FE0003F800FF801FF0007FFFFFE0003FFFFFC0001FFFFF -800007FFFC000000FFE00000212478A32C>115 D<0000E0000001F0000003F0000003F0000007 -F0000007F0000007E0000007E000000FE000000FE000000FC000000FC000001FC000001FC00000 -1F80007FFFFF807FFFFFC0FFFFFFC07FFFFFC07FFFFF80007F0000007F0000007E0000007E0000 -00FE000000FE000000FC000000FC000001FC000001FC000001F8000001F8000003F8000003F800 -0003F0000003F0000007F000C007F001E007E003F007E003F00FE007F00FE00FE00FC01FC00FC0 -3FC00FC07F800FE1FF0007FFFE0007FFFC0003FFF80001FFE000003F00001C3374B22C>I<001F -801F8000FFF07FE001FFF9FFF807FFFFFFF80FFFFFFFFC1FF0FFF0FE1FC03FE07E3F803FC07E7F -003F80FE7E003F80FEFE003F00FCFC003F00FCFC003F007878007F000000007F000000007E0000 -00007E00000000FE00000000FE00000000FC00000000FC00000001FC00180001FC003C3C01F800 -7E7E01F8007E7E03F800FEFE03F800FCFE03F801FCFC07F803F8FC0FF807F0FE1FFE1FF07FFFFF -FFE03FFFFFFFC03FFF3FFF000FFC1FFE0003F003F00027247AA32C>120 -D E /Fr 69[33 11[40 3[33 48[37 34 55 38 40 22 28 26 1[40 36 -39 59 19 37 1[19 39 37 22 32 41 29 37 33 8[44 66 48 52 41 35 -44 1[40 52 55 63 3[22 55 1[37 1[51 47 41 52 1[29 3[17 17 1[33 -33 2[33 33 1[33 2[17 22 17 2[22 22 18 39[{}58 66.666667 /Palatino-Roman -rf /Fs 12 107 df<7FFFFFFFFFFF80FFFFFFFFFFFFC0FFFFFFFFFFFFC07FFFFFFFFFFF803204 -799641>0 D<001FF000007FFC0001FFFF0003FFFF8007F01FC00FC007E01F0001F03E0000F83C -0000787C00007C7800003C7800003CF800003EF000001EF000001EF000001EF000001EF000001E -F000001EF800003E7800003C7800003C7C00007C3C0000783E0000F81F0001F00FC007E007F01F -C003FFFF8001FFFF00007FFC00001FF0001F207BA42A>14 D<001FF000007FFC0001FFFF0003FF -FF8007FFFFC00FFFFFE01FFFFFF03FFFFFF83FFFFFF87FFFFFFC7FFFFFFC7FFFFFFCFFFFFFFEFF -FFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFE7FFFFFFC7FFFFFFC7FFFFFFC -3FFFFFF83FFFFFF81FFFFFF00FFFFFE007FFFFC003FFFF8001FFFF00007FFC00001FF0001F207B -A42A>I<7FFFFFFFFFFFF8FFFFFFFFFFFFFCFFFFFFFFFFFFFC7FFFFFFFFFFFF800000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000007FFFFFFFFFFFF8FFFFFFFFFFFFFCFFFFFFFFFFFFFC7FFFFFFFFFFFF80000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000007FFFFFFFFFFFF8FFFFFFFFFFFFFCFFFFFFFFFFFFFC7FFFFFFFFFFFF836267B -A741>17 D<0000000000038000000000000FC000000000003FC00000000000FF800000000003FE -00000000000FF800000000003FE00000000000FF800000000003FE00000000000FF80000000000 -3FE00000000000FF800000000003FE00000000000FF800000000003FE00000000000FF80000000 -0003FE00000000000FF800000000003FE00000000000FF800000000003FE00000000000FF80000 -0000003FE00000000000FF800000000000FE000000000000FF8000000000007FE000000000000F -F8000000000003FE000000000000FF8000000000003FE000000000000FF8000000000003FE0000 -00000000FF8000000000003FE000000000000FF8000000000003FE000000000000FF8000000000 -003FE000000000000FF8000000000003FE000000000000FF8000000000003FE000000000000FF8 -000000000003FE000000000000FF8000000000003FC000000000000FC000000000000380000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000 -000000000000000000007FFFFFFFFFFF80FFFFFFFFFFFFC0FFFFFFFFFFFFC07FFFFFFFFFFF8032 -4279B441>20 D<0000000000001C00000000000000001E00000000000000001E00000000000000 -001E00000000000000000F00000000000000000F00000000000000000F00000000000000000780 -0000000000000007800000000000000003C00000000000000003C00000000000000001E0000000 -0000000001F00000000000000000F000000000000000007800000000000000003C000000000000 -00001E00000000000000001F800000000000000007C00000000000000003F07FFFFFFFFFFFFFFF -FCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFC0000000000000003F00000 -000000000007C0000000000000001F80000000000000001E00000000000000003C000000000000 -0000780000000000000000F00000000000000001F00000000000000001E00000000000000003C0 -0000000000000003C0000000000000000780000000000000000780000000000000000F00000000 -000000000F00000000000000000F00000000000000001E00000000000000001E00000000000000 -001E00000000000000001C0000482C7BAA53>33 D<000010000000003000000000300000000030 -00000000780000000078000000007800000000FC00000000FC00000001FE00000001FF00000003 -FF00000007FF8000000F7BC000001F7BE000003E79F000007C78F80001F8787E0007F0783F803F -C0780FF0FF807807FCFE007801FCF80078007CC00078000C000078000000007800000000780000 -000078000000007800000000780000000078000000007800000000780000000078000000007800 -000000780000000078000000007800000000780000000078000000007800000000780000000078 -000000007800000000780000000078000000007800000000780000000078000000007800000000 -780000000078000000007800000000780000000078000000007800000000780000000078000000 -007800000000780000000078000000007800000000780000000078000000007800000000780000 -000078000000007800000000780000000078000000007800000000780000000078000000003000 -00264A7EB92A>I<00000000003C00000000000000003C00000000000000001E00000000000000 -001E00000000000000000F00000000000000000F000000000000000007800000000000000003C0 -0000000000000003C00000000000000001E00000000000000000F000000000000000007800007F -FFFFFFFFFFFC0000FFFFFFFFFFFFFE0000FFFFFFFFFFFFFF0000FFFFFFFFFFFFFFC00000000000 -000003E00000000000000001F80000000000000000FC00000000000000003F0000000000000000 -1FE00000000000000007F80000000000000001FF0000000000000001FF0000000000000007F800 -0000000000001FE0000000000000003F0000000000000000FC0000000000000001F80000000000 -000003E000FFFFFFFFFFFFFFC000FFFFFFFFFFFFFF0000FFFFFFFFFFFFFE00007FFFFFFFFFFFFC -0000000000000000780000000000000000F00000000000000001E00000000000000003C0000000 -0000000003C0000000000000000780000000000000000F00000000000000000F00000000000000 -001E00000000000000001E00000000000000003C00000000000000003C000000482E7BAB53>41 -D<00001FFFFE0000FFFFFF0007FFFFFF000FFFFFFE003FF00000007F80000000FC00000001F800 -000003E000000007C00000000F800000000F000000001F000000001E000000003E000000003C00 -0000007C0000000078000000007800000000F800000000F000000000F000000000F000000000FF -FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF000000000F000000000F000000000F800000000 -780000000078000000007C000000003C000000003E000000001E000000001F000000000F000000 -000F8000000007C000000003E000000001F800000000FC000000007F800000003FF00000000FFF -FFFE0007FFFFFF0000FFFFFF00001FFFFE283279AD37>50 D<000001F800000FF800003F800000 -FC000001F8000003F0000007E0000007E000000FC000000FC000000FC000000FC000000FC00000 -0FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000 -000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC0 -00000FC000001F8000001F8000003F0000003E000000FC000003F800007FE00000FF0000007FE0 -000003F8000000FC0000003E0000003F0000001F8000001F8000000FC000000FC000000FC00000 -0FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000 -000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC0 -00000FC000000FC000000FC0000007E0000007E0000003F0000001F8000000FC0000003F800000 -0FF8000001F81D537ABD2A>102 D<7C000000FFC0000007F0000001FC0000007E0000003F0000 -001F8000001F8000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC0 -00000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000F -C000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC0000007E00000 -07E0000003E0000001F0000000F80000007E0000001FF0000007F800001FF000007E000000F800 -0001F0000003E0000007E0000007E000000FC000000FC000000FC000000FC000000FC000000FC0 -00000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000F -C000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC00000 -0FC000001F8000001F8000003F0000007E000001FC000007F00000FFC000007C0000001D537ABD -2A>I<60F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0 -F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0 -F0F0F0F0F0F0F060045377BD17>106 D E /Ft 8 117 df<00000E00000000000E00000000000E -00000000000E00000000000E00000000000E00000000000E00000000000E00000000000E000000 -00000E00000000000E00000000000E00000000000E00000000000E00000000000E00000000000E -00000000000E00000000000E00000000000E00000000000E000000FFFFFFFFFFE0FFFFFFFFFFE0 -FFFFFFFFFFE000000E00000000000E00000000000E00000000000E00000000000E00000000000E -00000000000E00000000000E00000000000E00000000000E00000000000E00000000000E000000 -00000E00000000000E00000000000E00000000000E00000000000E00000000000E00000000000E -00000000000E0000002B2B7DA333>43 D<00380000780001F8001FF800FEF800E0F80000F80000 -F80000F80000F80000F80000F80000F80000F80000F80000F80000F80000F80000F80000F80000 -F80000F80000F80000F80000F80000F80000F80000F80000F80000F80000F80000F80000F80000 -F80000F80001FC00FFFFF8FFFFF815267BA521>49 D<00FF000003FFE0000E03F0001800F80030 -007C0060003E0078001F00FC001F00FE001F80FE001F80FE000F80FE000F807C000F8000001F80 -00001F0000001F0000003F0000003E0000007C00000078000000F0000001E0000003C000000780 -00000F0000001C0000003800000070018000E0018001C0018003800300060003000C0003001FFF -FF003FFFFF007FFFFE00FFFFFE00FFFFFE0019267DA521>I<00FF000003FFE0000F01F8001C00 -7C0030003E003C003E007E003F007E001F007E001F007E003F003C003F0000003E0000003E0000 -007C000000F8000001F0000007E00001FF800001FF00000001E0000000F00000007C0000003E00 -00003F0000001F0000001F8000001F8038001F807C001F80FE001F80FE001F80FE001F00FC003F -0078003E0070007C003800F8001F01F00007FFC00000FF000019277DA521>I<00003800000078 -00000078000000F8000001F8000001F8000003F8000007F800000EF800000CF800001CF8000038 -F8000030F8000060F80000E0F80001C0F8000180F8000380F8000700F8000600F8000C00F8001C -00F8003800F8003000F8007000F800E000F800FFFFFFE0FFFFFFE00000F8000000F8000000F800 -0000F8000000F8000000F8000000F8000001FC00003FFFE0003FFFE01B267EA521>I<18000C00 -1F007C001FFFF8001FFFF0001FFFE0001FFF800019FC0000180000001800000018000000180000 -00180000001800000018000000187F000019FFE0001B81F0001E0078001C003C0008003E000000 -3E0000001F0000001F0000001F8000001F8030001F807C001F80FC001F80FC001F80FC001F80FC -001F00F0001F0060003E0070003E0030007C001C00F8000F03E00003FFC00000FE000019277DA5 -21>I<0F800000FF800000FF8000001F8000000F8000000F8000000F8000000F8000000F800000 -0F8000000F8000000F8000000F8000000F8000000F8000000F81FC000F87FF000F9C0F800FB007 -C00FA003E00FC003E00FC003E00F8003E00F8003E00F8003E00F8003E00F8003E00F8003E00F80 -03E00F8003E00F8003E00F8003E00F8003E00F8003E00F8003E00F8003E00F8003E01FC007F0FF -F83FFEFFF83FFE1F287EA725>104 D<00C00000C00000C00000C00001C00001C00001C00003C0 -0007C0000FC0001FC000FFFFE0FFFFE007C00007C00007C00007C00007C00007C00007C00007C0 -0007C00007C00007C00007C00007C03007C03007C03007C03007C03007C03007C03003E06001F0 -C000FF80003F0014247FA31A>116 D E /Fu 81[61 52[55 50 83 55 61 -33 44 39 61 61 55 61 89 33 61 1[33 61 55 39 50 61 44 61 50 -11[78 66 61 72 1[61 83 83 100 61 2[39 83 1[55 61 83 72 66 78 -7[50 50 50 50 50 50 50 50 50 50 29 25 33 45[{}55 100.000003 -/Palatino-Bold rf /Fv 139[57 1[67 1[105 7[105 2[86 3[86 29[124 -9[86 86 86 86 86 86 86 86 86 86 48[{}17 172.833377 /Palatino-Bold -rf /Fw 94 127 df<3C7EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7E7E7E7E7E7E7E7E7E7E7E -7E7E7E7E7E3C00000000000000003C7EFFFFFFFF7E3C08346EB32C>33 D<1000107C007CFC007E -FE00FEFE00FEFE00FEFE00FEFE00FEFE00FEFC007EFC007EFC007EFC007EFC007EFC007EFC007E -FC007EFC007EFC007E7C007C7C007C7C007C7C007C78003C300018171976B32C>I<000F003C00 -001F807E00001F807E00001F807E00001F807E00001F807E00001F807E00001F807E00001F807E -00003F80FE00003F00FC00003F00FC00003F00FC00003F00FC007FFFFFFFF0FFFFFFFFF8FFFFFF -FFF8FFFFFFFFF8FFFFFFFFF83FFFFFFFF0007E01F800007E01F800007E01F800007E01F800007E -01F80000FE03F80000FC03F00000FC03F00000FC03F00000FC03F00000FC03F00000FC03F0003F -FFFFFFF0FFFFFFFFF8FFFFFFFFF8FFFFFFFFF8FFFFFFFFF87FFFFFFFF001F807E00001F807E000 -01F807E00003F80FE00003F00FC00003F00FC00003F00FC00003F00FC00003F00FC00003F00FC0 -0003F00FC00003F00FC00001E007800025337DB22C>I<0001C000000003E000000003E0000000 -03E000000003E000000003E000000003E00000000FF80000007FFF800001FFFFE00007FFFFF000 -0FFFFFF8001FF3E7FC001FC3E1FE003F03E07F007E03E03F007C03E03F00FC03E01F80F803E01F -80F803E03F80F803E03F80F803E03F80FC03E01F00FC03E00E007E03E000007F03E000003FC3E0 -00003FF3E000001FFFE000000FFFF8000007FFFF000001FFFFC000007FFFE000000FFFF8000003 -FFF8000003E7FC000003E1FE000003E07F000003E03F000003E01F003803E01F807C03E00F80FE -03E00F80FE03E00F80FE03E00F80FC03E00F80FC03E01F80FE03E01F007E03E01F007F03E03E00 -3F83E0FE003FC3E1FC001FF3E7F8000FFFFFF00007FFFFE00003FFFFC000007FFF0000000FF800 -000003E000000003E000000003E000000003E000000003E000000003E000000001C0000021417B -B92C>I<07800007001FE0000F801FE0001F803FF0001F807FF8003F807CF8003F007CF8007F00 -FCFC007E00F87C007E00F87C00FE00F87C00FC00F87C01FC00F87C01F800F87C01F800F87C03F8 -00FCFC03F0007CF803F0007CF807F0007FF807E0003FF00FE0001FE00FC0001FE00FC00007801F -C00000001F800000003F800000003F000000003F000000007F000000007E00000000FE00000000 -FC00000000FC00000001FC00000001F800000001F800000003F800000003F000000007F0000000 -07E000000007E00000000FE00000000FC00000001FC00000001F800F00001F803FC0003F803FC0 -003F007FE0007F00FFF0007E00F9F0007E00F9F000FE01F9F800FC01F0F800FC01F0F801FC01F0 -F801F801F0F803F801F0F803F001F0F803F001F9F807F000F9F007E000F9F00FE000FFF00FC000 -7FE00FC0003FC007C0003FC00380000F0025417DB92C>I<0007800000003FE00000007FF00000 -007FF8000000FFFC000001F8FC000001F07C000001F07E000003F03E000003E03E000003E03E00 -0003E03E000003E03E000003E03E000003E07E000003E07C000003E0FC3FF803F0F87FFC01F1F8 -7FFC01F3F07FFC01F7E03FF801F7E01F0001FFC03F0000FF803E0000FF003E0000FF007E0000FE -007C0001FC007C0003FE00FC0003FE00F80007FF01F8000FDF01F0001F9F81F0003F8F83F0003F -0FC3E0007E07C7E0007E07E7C000FC03F7C000FC01FFC000FC01FF8000FC00FF8010FC00FF0038 -FC007E007CFC007F007CFE00FF807C7E01FFC07C7F03FFE0FC3F87F7F1F83FFFE3FFF81FFFC1FF -F00FFF80FFE007FF007FC000F8000F0026357EB32C>I<07800FE01FE01FF01FF01FF80FF807F8 -00F800F800F800F800F801F801F001F003F003E007E00FC01F807F807F00FE007C0070000D1A71 -B22C>I<0000380000FC0001FC0003FC0007F8000FF0001FC0003F80007F0000FE0001FC0001F8 -0003F00007F00007E0000FC0000FC0001F80001F80003F80003F00003F00007F00007E00007E00 -007E0000FE0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC00 -00FC0000FE00007E00007E00007E00007F00003F00003F00003F80001F80001F80000FC0000FC0 -0007E00007F00003F00001F80001FC0000FE00007F00003F80001FC0000FF00007F80003FC0001 -FC0000FC000038164272B92C>I<700000FC0000FE0000FF00007F80003FC0000FE00007F00003 -F80001FC0000FE00007E00003F00003F80001F80000FC0000FC00007E00007E00007F00003F000 -03F00003F80001F80001F80001F80001FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC00 -00FC0000FC0000FC0000FC0000FC0001FC0001F80001F80001F80003F80003F00003F00007F000 -07E00007E0000FC0000FC0001F80003F80003F00007E0000FE0001FC0003F80007F0000FE0003F -C0007F8000FF0000FE0000FC0000700000164279B92C>I<000380000007C0000007C0000007C0 -000007C0000007C0000007C0002007C008F807C03EFE07C0FEFF07C1FEFFC7C7FEFFE7CFFE3FFF -FFF80FFFFFE003FFFF8001FFFF00007FFC00007FFC0001FFFF0003FFFF800FFFFFE03FFFFFF8FF -E7CFFEFFC7C7FEFF07C1FEFE07C0FEF807C03E2007C0080007C0000007C0000007C0000007C000 -0007C0000007C000000380001F247AAA2C>I<00007800000000FC00000000FC00000000FC0000 -0000FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC00 -000000FC00000000FC00000000FC00000000FC00007FFFFFFFF0FFFFFFFFF8FFFFFFFFF8FFFFFF -FFF8FFFFFFFFF87FFFFFFFF00000FC00000000FC00000000FC00000000FC00000000FC00000000 -FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC000000 -00FC00000000FC0000000078000025267DAB2C>I<07801FE01FF03FF83FF83FFC3FFC1FFC1FFC -07FC007C00FC00F801F801F007F00FE07FC07FC0FF007E0070000E1671892C>I<7FFFFFFF00FF -FFFFFF80FFFFFFFF80FFFFFFFF80FFFFFFFF807FFFFFFF0021067B9B2C>I<1E007F807F80FFC0 -FFC0FFC0FFC07F807F801E000A0A6F892C>I<00000007000000000F800000001F800000001F80 -0000003F800000003F000000007F000000007E00000000FE00000000FC00000001FC00000001F8 -00000003F800000003F000000003F000000007F000000007E00000000FE00000000FC00000001F -C00000001F800000003F800000003F000000007F000000007E00000000FE00000000FC00000000 -FC00000001FC00000001F800000003F800000003F000000007F000000007E00000000FE0000000 -0FC00000001FC00000001F800000001F800000003F800000003F000000007F000000007E000000 -00FE00000000FC00000001FC00000001F800000003F800000003F000000007F000000007E00000 -0007E00000000FE00000000FC00000001FC00000001F800000003F800000003F000000007F0000 -00007E00000000FE00000000FC00000000FC00000000F800000000780000000021417BB92C>I< -0003F80000000FFE0000003FFF8000007FFFC00000FFFFE00001FE0FF00003F803F80007F001FC -0007E000FC000FC0007E000FC0007E001F80003F001F80003F003F00001F803F00001F803E0000 -0F807E00000FC07E00000FC07E00000FC07C000007C0FC000007E0FC000007E0FC000007E0FC00 -0007E0FC000007E0FC000007E0FC000007E0FC000007E0FC000007E0FC000007E0FC000007E0FC -000007E0FE00000FE07E00000FC07E00000FC07E00000FC07E00000FC03F00001F803F00001F80 -3F00001F801F80003F001F80003F000FC0007E000FE000FE0007E000FC0007F001FC0003F803F8 -0001FE0FF00000FFFFE000007FFFC000003FFF8000000FFE00000003F8000023357CB32C>I<00 -070000000F8000000F8000001F8000001F8000003F8000007F800000FF800001FF800003FF8000 -7FFF8000FFFF8000FFDF8000FF9F80007C1F8000001F8000001F8000001F8000001F8000001F80 -00001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F -8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F800000 -1F8000001F8000001F8000001F8000001F8000001F8000001F8000001F80007FFFFFE07FFFFFE0 -FFFFFFF07FFFFFE07FFFFFE01C3477B32C>I<000FF80000007FFF000001FFFFE00003FFFFF000 -0FFFFFFC000FF807FE001FE001FE003F80007F007F00003F807E00001F807E00000FC0FE00000F -C0FC00000FE0FE000007E0FE000007E0FE000007E07C000007E038000007E000000007E0000000 -07E00000000FE00000000FC00000001FC00000001F800000003F800000003F000000007F000000 -00FE00000001FC00000003FC00000007F80000000FF00000001FE00000003FC0000000FF800000 -01FE00000003FC00000007F80000000FF00000003FE00000007F80000000FF00000001FE000000 -03FC0003C007F80007E01FE00007E03FC00007E07FFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFF -E07FFFFFFFC023347CB32C>I<000FFC0000007FFF800001FFFFE00007FFFFF8000FFFFFFC000F -F803FE001FE000FE003F80007F003F00003F003F80003F803F80001F803F80001F801F00001F80 -0400001F800000001F800000003F800000003F000000007F00000000FE00000001FC00000003FC -0000001FF800001FFFF000003FFFE000003FFFE000003FFFF800001FFFFC00000007FE00000000 -FF000000007F000000003F800000001FC00000000FC00000000FC00000000FE000000007E00000 -0007E07C000007E07C000007E0FE000007E0FE00000FE0FE00000FC0FC00000FC0FE00001FC07F -00003F803F80007F003FE000FF001FF807FE000FFFFFFC0007FFFFF80001FFFFE000007FFF8000 -0007FC000023357CB32C>I<000007F00000000FF80000001FF80000003FF80000003FF8000000 -7EF8000000FCF8000000FCF8000001F8F8000003F0F8000003F0F8000007E0F800000FC0F80000 -0FC0F800001F80F800003F00F800003F00F800007E00F80000FC00F80000FC00F80001F800F800 -03F000F80003F000F80007E000F8000FC000F8000FC000F8001F8000F8003F0000F8003F0000F8 -007E0000F800FC0000F800FFFFFFFFFCFFFFFFFFFEFFFFFFFFFEFFFFFFFFFE7FFFFFFFFC000000 -F800000000F800000000F800000000F800000000F800000000F800000000F800000000F8000000 -00F800000000F80000007FFFF00000FFFFF80000FFFFF80000FFFFF800007FFFF027337EB22C> -I<0FFFFFFE001FFFFFFF001FFFFFFF001FFFFFFF001FFFFFFE001F800000001F800000001F8000 -00001F800000001F800000001F800000001F800000001F800000001F800000001F800000001F80 -0000001F800000001F800000001F83FE00001F9FFF80001FFFFFE0001FFFFFF8001FFFFFFC001F -FC03FE001FF000FE001FC0007F001F80003F801F00001F800F00001FC00000000FC00000000FC0 -00000007E000000007E000000007E000000007E010000007E07C000007E0FE000007E0FE00000F -E0FE00000FC0FC00000FC0FE00001FC07E00003F807F00007F003F8000FF003FC001FE001FF00F -FC000FFFFFF80007FFFFF00001FFFFC000007FFF0000000FF8000023347CB22C>I<00003FC000 -0001FFF8000007FFFC00001FFFFE00003FFFFF00007FC07F0000FF003F8001FE003F8003F8003F -8007F0003F8007E0003F800FE0001F001FC00000001F800000003F800000003F000000003F0000 -00007F000000007E000000007E03FC00007E1FFF8000FC7FFFE000FDFFFFF000FFFFFFF800FFFC -03FC00FFF001FE00FFC0007F00FF80003F80FF00001F80FF00001FC0FE00000FC0FE00000FE0FE -000007E0FE000007E0FE000007E07E000007E07E000007E07E000007E07E000007E03F000007E0 -3F00000FE03F80000FC01F80001FC01FC0001F800FC0003F800FE0007F0007F801FE0003FC07FC -0001FFFFF80000FFFFF000007FFFE000001FFF80000003FC000023357CB32C>I<7800000000FF -FFFFFFC0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFC0FC00003F80FC00007F00FC0000FE00 -780000FC00000001FC00000003F800000003F000000007E00000000FE00000000FC00000001F80 -0000003F800000003F000000007F000000007E00000000FE00000000FC00000001FC00000001F8 -00000001F800000003F000000003F000000007F000000007E000000007E000000007E00000000F -C00000000FC00000000FC00000000FC00000001F800000001F800000001F800000001F80000000 -1F800000003F800000003F000000003F000000003F000000003F000000003F000000003F000000 -003F000000003F000000003F000000001E000000001E00000023357CB32C>I<0007FC0000003F -FF800000FFFFE00003FFFFF80007FFFFFC000FFC07FE001FF001FF001FC0007F003F80003F803F -00001F807F00001FC07E00000FC07E00000FC07E00000FC07E00000FC07E00000FC03F00001F80 -3F00001F801F80003F001FC0007F000FF001FE0003FC07F80001FFFFF000007FFFC0000007FC00 -00007FFFC00001FFFFF00003FC07F8000FF001FE001FC0007F001F80003F003F00001F807E0000 -0FC07E00000FC0FC000007E0FC000007E0FC000007E0FC000007E0FC000007E0FC000007E0FC00 -0007E07E00000FC07E00000FC07F00001FC03F80003F801FC0007F001FF001FF000FFC07FE0007 -FFFFFC0003FFFFF80000FFFFE000003FFF80000007FC000023357CB32C>I<0003F80000003FFF -000000FFFFC00001FFFFE00003FFFFF00007FC07F8000FF001FC001FE000FE003F80007E003F80 -003F007F00003F007E00001F80FE00001F80FC00001F80FC00000FC0FC00000FC0FC00000FC0FC -00000FC0FC00000FE0FC00000FE0FC00000FE0FE00000FE07E00000FE07F00001FE03F00001FE0 -3F80003FE01FC0007FE00FF001FFE007F807FFE003FFFFFFE001FFFFF7E000FFFFC7E0003FFF0F -E00007F80FC00000000FC00000000FC00000001FC00000001F800000003F800000003F00000000 -7F001F00007E003F8000FE003F8001FC003F8003F8003F8007F8003F801FF0001FC07FE0001FFF -FFC0000FFFFF000007FFFE000001FFF80000003FC0000023357CB32C>I<1E007F807F80FFC0FF -C0FFC0FFC07F807F801E0000000000000000000000000000000000000000000000000000000000 -000000001E007F807F80FFC0FFC0FFC0FFC07F807F801E000A246FA32C>I<07801FE01FE03FF0 -3FF03FF03FF01FE01FE00780000000000000000000000000000000000000000000000000000000 -000000000007801FC01FE03FE03FF03FF03FF01FF01FF007F001F003F003E003E007E00FC01F80 -7F807F00FE007C0070000C3071A32C>I<00000007000000001F800000003F80000000FF800000 -03FF80000007FF0000001FFC0000003FF8000000FFE0000001FF80000007FF0000000FFC000000 -3FF80000007FE0000001FFC0000003FF0000000FFE0000001FF80000007FF0000000FFC0000000 -FF80000000FF80000000FFC00000007FF00000001FF80000000FFE00000003FF00000001FFC000 -00007FE00000003FF80000000FFC00000007FF00000001FF80000000FFE00000003FF80000001F -FC00000007FF00000003FF80000000FF800000003F800000001F800000000700212A7BAD2C>I< -3FFFFFFFE07FFFFFFFF0FFFFFFFFF8FFFFFFFFF8FFFFFFFFF87FFFFFFFF0000000000000000000 -000000000000000000000000000000000000000000000000000000000000007FFFFFFFF0FFFFFF -FFF8FFFFFFFFF8FFFFFFFFF87FFFFFFFF03FFFFFFFE025147DA22C>I<7000000000FC00000000 -FE00000000FF80000000FFE00000007FF00000001FFC0000000FFE00000003FF80000000FFC000 -00007FF00000001FF80000000FFE00000003FF00000001FFC00000007FE00000003FF80000000F -FC00000007FF00000001FF80000000FF80000000FF80000001FF80000007FF0000000FFC000000 -3FF80000007FE0000001FFC0000003FF0000000FFE0000001FF80000007FF0000000FFC0000003 -FF8000000FFE0000001FFC0000007FF0000000FFE0000000FF80000000FE00000000FC00000000 -7000000000212A7BAD2C>I<003FFC000001FFFF80000FFFFFF0001FFFFFFC003FFFFFFE007FE0 -07FE007F0000FF00FE00003F80FE00001F80FE00001F80FE00001F80FE00001F807C00003F8000 -0000FF00000003FE00000007FE0000001FFC0000003FF00000007FC0000000FF80000001FE0000 -0001FC00000003F800000007F000000007E000000007E00000000FE00000000FC00000000FC000 -00000FC00000000FC00000000FC00000000FC00000000FC0000000078000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000007800000000F -C00000001FE00000001FE00000001FE00000001FE00000000FC00000000780000021337BB22C> -I<00007F00000003FFE000000FFFF000003FFFF800007FFFFC0000FF80FE0001FE007F0003F800 -3F0007F0001F8007E00FCF800FC03FFF800F807FFFC01F80FFFFC03F01FFFFC03E03F87FC03E03 -F03FE07E07E01FE07C0FC00FE07C0F8007E07C0F8007E0FC1F8007E0F81F0003E0F81F0003E0F8 -1F0003E0F81F0003E0F81F0003E0F81F0003E0F81F0003E0F81F0003E0F81F0003E0FC1F8007E0 -7C0F8007C07C0F8007C07C0FC00FC07E07E01F803E03F03F003E03F87F003F01FFFE001F80FFFC -000F807FF8000FC03FF00007E00FC00007F00003C003F80007E001FE001FE000FF807FE0007FFF -FFC0003FFFFF80000FFFFE000003FFF80000007F800023337CB22C>I<0000FE00000001FF0000 -0001FF00000001FF00000001FF00000003FF80000003EF80000003EF80000003EF80000007EFC0 -000007EFC0000007C7C0000007C7C0000007C7C000000FC7E000000FC7E000000FC7E000000F83 -E000001F83F000001F83F000001F83F000001F83F000003F01F800003F01F800003F01F800003F -01F800003F01F800007E00FC00007E00FC00007E00FC00007E00FC0000FE00FE0000FFFFFE0000 -FFFFFE0000FFFFFE0001FFFFFF0001FFFFFF0001F8003F0001F8003F0001F8003F0003F0001F80 -03F0001F8003F0001F8003F0001F8007F0001FC007E0000FC07FFE00FFFC7FFF01FFFCFFFF01FF -FE7FFF01FFFC7FFE00FFFC27337EB22C>I<7FFFFFE0007FFFFFF800FFFFFFFE007FFFFFFF007F -FFFFFFC003F0003FC003F0000FE003F00007F003F00003F003F00003F003F00001F803F00001F8 -03F00001F803F00001F803F00001F803F00001F803F00003F003F00003F003F00007F003F0000F -E003F0001FC003F000FF8003FFFFFF0003FFFFFE0003FFFFFC0003FFFFFF0003FFFFFFC003F000 -1FE003F00007F003F00003F803F00001F803F00000FC03F00000FC03F00000FE03F000007E03F0 -00007E03F000007E03F000007E03F000007E03F000007E03F00000FE03F00000FC03F00001FC03 -F00003F803F0000FF803F0003FF07FFFFFFFE07FFFFFFFC0FFFFFFFF807FFFFFFE007FFFFFF000 -27337FB22C>I<00007F00700003FFE0F8000FFFF9F8003FFFFDF8007FFFFFF800FF81FFF801FE -007FF803FC001FF807F0000FF807E00007F80FE00007F80FC00003F81F800003F81F800001F83F -000001F83F000001F87F000001F87E000000F07E000000007E00000000FE00000000FC00000000 -FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC000000 -00FC00000000FC00000000FE000000007E000000007E000000007E000000007F000000F03F0000 -01F83F000001F81F800001F81F800001F80FC00003F80FE00003F007E00003F007F00007E003FC -001FE001FE003FC000FF80FF80007FFFFF00003FFFFE00000FFFFC000003FFE00000007F000025 -357DB32C>I<7FFFFF0000FFFFFFC000FFFFFFF000FFFFFFF8007FFFFFFC0007E003FE0007E000 -FF0007E0007F8007E0003F8007E0001FC007E0000FE007E0000FE007E00007E007E00007F007E0 -0003F007E00003F807E00001F807E00001F807E00001F807E00001F807E00000FC07E00000FC07 -E00000FC07E00000FC07E00000FC07E00000FC07E00000FC07E00000FC07E00000FC07E00000FC -07E00000FC07E00000FC07E00001F807E00001F807E00001F807E00003F807E00003F007E00003 -F007E00007F007E00007E007E0000FE007E0001FC007E0003FC007E0007F8007E000FF0007E003 -FE007FFFFFFC00FFFFFFF800FFFFFFF000FFFFFFC0007FFFFF000026337EB22C>I<7FFFFFFFF0 -7FFFFFFFF8FFFFFFFFF87FFFFFFFF87FFFFFFFF803F00001F803F00001F803F00001F803F00001 -F803F00001F803F00001F803F00001F803F00000F003F000000003F000000003F000000003F000 -000003F001E00003F003F00003F003F00003F003F00003F003F00003FFFFF00003FFFFF00003FF -FFF00003FFFFF00003FFFFF00003F003F00003F003F00003F003F00003F003F00003F001E00003 -F000000003F000000003F000000003F000000003F000000003F000003C03F000007E03F000007E -03F000007E03F000007E03F000007E03F000007E03F000007E03F000007E7FFFFFFFFE7FFFFFFF -FEFFFFFFFFFE7FFFFFFFFE7FFFFFFFFC27337EB22C>I<7FFFFFFFF8FFFFFFFFFCFFFFFFFFFCFF -FFFFFFFC7FFFFFFFFC03F00000FC03F00000FC03F00000FC03F00000FC03F00000FC03F00000FC -03F00000FC03F000007803F000000003F000000003F000000003F000000003F000000003F000F0 -0003F001F80003F001F80003F001F80003F001F80003FFFFF80003FFFFF80003FFFFF80003FFFF -F80003FFFFF80003F001F80003F001F80003F001F80003F001F80003F000F00003F000000003F0 -00000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003 -F000000003F000000003F000000003F00000007FFFE00000FFFFE00000FFFFF00000FFFFE00000 -7FFFE0000026337EB22C>I<0001FC0380000FFF87C0001FFFEFC0007FFFFFC000FFFFFFC001FF -07FFC003FC01FFC003F800FFC007F0007FC00FE0003FC00FC0001FC01FC0001FC01F80001FC03F -80000FC03F00000FC03F00000FC07E00000FC07E000007807E000000007E00000000FE00000000 -FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC000000 -00FC0003FFF8FC0007FFFCFC0007FFFCFE0007FFFC7E0003FFF87E00000FC07E00000FC07E0000 -0FC03F00001FC03F00001FC03F80001FC01F80001FC01FC0003FC00FC0003FC00FE0007FC007F0 -007FC003F800FFC003FC01FFC001FF07FFC000FFFFFFC0007FFFEFC0001FFFCFC0000FFF078000 -01FC000026357DB32C>I<7FFE00FFFCFFFF01FFFEFFFF01FFFEFFFF01FFFE7FFE00FFFC07E000 -0FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0 -000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007 -E0000FC007FFFFFFC007FFFFFFC007FFFFFFC007FFFFFFC007FFFFFFC007E0000FC007E0000FC0 -07E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000F -C007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E000 -0FC007E0000FC07FFE00FFFCFFFF01FFFEFFFF01FFFEFFFF01FFFE7FFE00FFFC27337EB22C>I< -7FFFFFF8FFFFFFFCFFFFFFFCFFFFFFFC7FFFFFF8000FC000000FC000000FC000000FC000000FC0 -00000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000F -C000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC00000 -0FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000 -000FC000000FC000000FC000000FC000000FC000000FC000000FC0007FFFFFF8FFFFFFFCFFFFFF -FCFFFFFFFC7FFFFFF81E3379B22C>I<000FFFFF00001FFFFF00001FFFFF80001FFFFF00000FFF -FF00000007E000000007E000000007E000000007E000000007E000000007E000000007E0000000 -07E000000007E000000007E000000007E000000007E000000007E000000007E000000007E00000 -0007E000000007E000000007E000000007E000000007E000000007E000000007E000000007E000 -000007E000000007E000000007E000000007E000000007E000000007E000000007E000000007E0 -00000007E000000007E000000007E000380007E0007C0007E000FE0007E000FE0007E000FE000F -E000FE001FC0007F003F80007FC07F80003FFFFF00001FFFFE00000FFFFC000003FFF00000007F -80000021347AB22C>I<7FFC007FF8FFFE00FFFCFFFE00FFFCFFFE00FFFC7FFC007FF807C0001F -8007C0003F0007C0007F0007C0007E0007C000FC0007C001F80007C003F00007C007F00007C007 -E00007C00FC00007C01F800007C03F000007C03F000007C07E000007C0FC000007C1F8000007C3 -F8000007C3FC000007C7FC000007CFFE000007DFBE000007FFBF000007FF1F000007FE1F800007 -FC0FC00007F807C00007F807E00007F003E00007E003F00007C001F00007C001F80007C000FC00 -07C000FC0007C0007E0007C0003E0007C0003F0007C0001F0007C0001F8007C0000F8007C0000F -C007C00007E07FFC001FFCFFFE003FFEFFFE003FFEFFFE003FFE7FFC001FFC27337EB22C>I<7F -FFE00000FFFFF00000FFFFF00000FFFFF000007FFFE0000003F000000003F000000003F0000000 -03F000000003F000000003F000000003F000000003F000000003F000000003F000000003F00000 -0003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F000 -000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F0 -00000003F000000003F000000003F000000003F000000003F000000003F00000F003F00001F803 -F00001F803F00001F803F00001F803F00001F803F00001F803F00001F803F00001F87FFFFFFFF8 -FFFFFFFFF8FFFFFFFFF8FFFFFFFFF87FFFFFFFF025337DB22C>I<7FE0000FFCFFF0001FFEFFF0 -001FFEFFF8003FFE7FF8003FFC0FF8003FE00FBC007BE00FBC007BE00FBC007BE00FBC007BE00F -9E00F3E00F9E00F3E00F9E00F3E00F9F01F3E00F9F01F3E00F8F01E3E00F8F01E3E00F8F83E3E0 -0F8F83E3E00F8783C3E00F87C7C3E00F87C7C3E00F83C783E00F83C783E00F83C783E00F83EF83 -E00F81EF03E00F81EF03E00F81FF03E00F80FE03E00F80FE03E00F80FE03E00F807C03E00F8038 -03E00F800003E00F800003E00F800003E00F800003E00F800003E00F800003E00F800003E00F80 -0003E00F800003E00F800003E00F800003E00F800003E07FF0001FFCFFF8003FFEFFF8003FFEFF -F8003FFE7FF0001FFC27337EB22C>I<7FF0007FFCFFF800FFFEFFF800FFFEFFFC00FFFE7FFC00 -7FFC07FE0007C007DE0007C007DE0007C007CF0007C007CF0007C007CF0007C007CF8007C007C7 -8007C007C7C007C007C7C007C007C3C007C007C3E007C007C3E007C007C1E007C007C1F007C007 -C1F007C007C0F007C007C0F807C007C0F807C007C07C07C007C07C07C007C07C07C007C03E07C0 -07C03E07C007C01E07C007C01F07C007C01F07C007C00F07C007C00F87C007C00F87C007C00787 -C007C007C7C007C007C7C007C003C7C007C003E7C007C001E7C007C001E7C007C001E7C007C000 -F7C007C000F7C007C000FFC07FFC007FC0FFFE007FC0FFFE003FC0FFFE003FC07FFC001F802733 -7EB22C>I<007FFF000003FFFFE0000FFFFFF8001FFFFFFC003FFFFFFE003FE003FE003F8000FE -007F00007F007F00007F007E00003F007E00003F007E00003F00FE00003F80FC00001F80FC0000 -1F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00 -001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC -00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80 -FC00001F80FE00003F80FE00003F807E00003F007E00003F007E00003F007F00007F007F00007F -003F8000FE003FF007FE003FFFFFFE001FFFFFFC000FFFFFF80003FFFFE000007FFF000021357B -B32C>I<7FFFFFC0007FFFFFF800FFFFFFFC007FFFFFFF007FFFFFFF8003F000FFC003F0003FC0 -03F0000FE003F00007F003F00007F003F00003F003F00003F803F00001F803F00001F803F00001 -F803F00001F803F00001F803F00001F803F00003F803F00003F003F00007F003F00007F003F000 -0FE003F0003FC003F000FFC003FFFFFF8003FFFFFF0003FFFFFC0003FFFFF80003FFFFC00003F0 -00000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003 -F000000003F000000003F000000003F000000003F000000003F000000003F000000003F0000000 -7FFF8000007FFF800000FFFFC000007FFF8000007FFF80000025337EB22C>I<007FFF000003FF -FFE0000FFFFFF8001FFFFFFC003FFFFFFE003FF007FE003F8000FE007F00007F007F00007F007E -00003F007E00003F007E00003F00FE00003F80FC00001F80FC00001F80FC00001F80FC00001F80 -FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F -80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC0000 -1F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC01F01F80FC03F81F80FE03 -F83F807E01FC3F007E01FC3F007E00FE3F007F00FE7F007F007F7F003F807FFE003FF03FFE003F -FFFFFE001FFFFFFC000FFFFFF80003FFFFE000007FFFE000000007F000000007F000000003F800 -000003F800000001FC00000001FC00000000FE00000000FE000000007F000000007F000000003E -0021407BB32C>I<7FFFFC000000FFFFFF800000FFFFFFE00000FFFFFFF800007FFFFFFC000007 -E007FE000007E001FE000007E0007F000007E0003F800007E0001F800007E0001F800007E0000F -C00007E0000FC00007E0000FC00007E0000FC00007E0000FC00007E0000FC00007E0001F800007 -E0001F800007E0003F800007E0007F000007E001FE000007E007FE000007FFFFFC000007FFFFF8 -000007FFFFE0000007FFFFF0000007FFFFF8000007E007FC000007E001FC000007E000FE000007 -E0007F000007E0003F000007E0003F000007E0003F000007E0003F000007E0003F000007E0003F -000007E0003F000007E0003F000007E0003F060007E0003F1F8007E0003F1F8007E0003F1F8007 -E0003F1F8007E0003F1F807FFE001FBF80FFFF001FFF00FFFF000FFE00FFFF0007FE007FFE0007 -FC0000000000F00029347EB22C>I<000FF00700007FFE0F8001FFFFCF8007FFFFFF800FFFFFFF -801FF00FFF803FC003FF803F8001FF807F00007F807E00007F80FE00003F80FC00003F80FC0000 -1F80FC00001F80FC00001F80FC00001F80FE00000F007E000000007F000000007F800000003FE0 -0000001FF80000000FFFC000000FFFFC000003FFFF800001FFFFF000003FFFF8000007FFFC0000 -003FFE00000003FF00000000FF800000003F800000001FC00000000FC00000000FE00000000FE0 -78000007E0FC000007E0FC000007E0FC000007E0FC000007E0FC000007E0FE00000FC0FE00000F -C0FF00001F80FF80003F80FFE0007F00FFFC01FE00FFFFFFFE00FFFFFFFC00F9FFFFF000F83FFF -C0007003FE000023357CB32C>I<7FFFFFFFFCFFFFFFFFFEFFFFFFFFFEFFFFFFFFFEFFFFFFFFFE -FC007E007EFC007E007EFC007E007EFC007E007EFC007E007EFC007E007EFC007E007E78007E00 -3C00007E000000007E000000007E000000007E000000007E000000007E000000007E000000007E -000000007E000000007E000000007E000000007E000000007E000000007E000000007E00000000 -7E000000007E000000007E000000007E000000007E000000007E000000007E000000007E000000 -007E000000007E000000007E000000007E000000007E000000007E000000007E000000007E0000 -00007E000000007E0000003FFFFC00003FFFFC00007FFFFE00003FFFFC00003FFFFC0027337EB2 -2C>I<7FFF803FFFC0FFFFC07FFFE0FFFFC07FFFE0FFFFC07FFFE07FFF803FFFC003F00001F800 -03F00001F80003F00001F80003F00001F80003F00001F80003F00001F80003F00001F80003F000 -01F80003F00001F80003F00001F80003F00001F80003F00001F80003F00001F80003F00001F800 -03F00001F80003F00001F80003F00001F80003F00001F80003F00001F80003F00001F80003F000 -01F80003F00001F80003F00001F80003F00001F80003F00001F80003F00001F80003F00001F800 -03F00001F80003F00001F80003F00001F80003F00001F80003F00001F80003F00001F80003F800 -03F80001F80003F00001F80003F00001FC0007F00000FC0007E00000FE000FE000007F001FC000 -003F803F8000003FE0FF8000001FFFFF0000000FFFFE00000003FFF800000001FFF0000000003F -8000002B3480B22C>I<7FFC007FFCFFFE00FFFEFFFE00FFFEFFFE00FFFE7FFC007FFC0FC00007 -E00FE0000FE007E0000FC007E0000FC007E0000FC007F0001FC003F0001F8003F0001F8003F000 -1F8003F8003F8001F8003F0001F8003F0001F8003F0001FC007F0000FC007E0000FC007E0000FC -007E0000FE00FE00007E00FC00007E00FC00007E00FC00007F01FC00003F01F800003F01F80000 -3F01F800003F01F800001F83F000001F83F000001F83F000001F83F000000F83E000000FC7E000 -000FC7E000000FC7E0000007C7C0000007C7C0000007EFC0000007EFC0000003EF80000003EF80 -000003FF80000003FF80000001FF00000001FF00000001FF00000000FE000027337EB22C>I<7F -F00007FF00FFF8000FFF80FFF8000FFF80FFF8000FFF807FF00007FF001F0000007C001F000000 -7C001F0000007C001F800000FC000F800000F8000F800000F8000F800000F8000F800000F8000F -800000F8000F800000F8000F800000F80007C00001F00007C00001F00007C00001F00007C00001 -F00007C03E01F00007C07F01F00007C07F01F00007C07F01F00003E0FF83E00003E0FF83E00003 -E0F783E00003E0F783E00003E1F7C3E00003E1F7C3E00003E1F7C3E00001E1E3C3C00001E1E3C3 -C00001F3E3E7C00001F3E3E7C00001F3E3E7C00001F3E3E7C00001F3C1E7C00000F3C1E7800000 -F3C1E7800000F3C1E7800000F7C1F7800000F780F7800000F780F7800000F780F7800000FF80FF -8000007F007F0000007F007F0000007F007F0000007F007F0000003E003E000029337FB22C>I< -3FFF03FFE03FFF07FFF07FFF87FFF03FFF07FFF03FFF03FFE001F800FE0001FC00FE0000FC01FC -0000FE01FC00007E01F800007F03F800003F03F000003F87F000001F87E000001FCFE000000FCF -C000000FFFC0000007FF80000007FF80000003FF00000003FF00000001FE00000001FE00000000 -FC00000000FC00000001FE00000001FE00000003FF00000003FF00000007FF80000007FFC00000 -0FCFC000000FCFE000001FC7E000001F87F000003F83F000003F03F800007F01F800007E01FC00 -00FE00FC0000FC00FE0001FC007E0001F8007F0003F8003F0003F0003F8003F0001F807FFE00FF -FC7FFE01FFFCFFFF01FFFE7FFE01FFFC7FFE00FFFC27337EB22C>I<7FFC007FFCFFFE00FFFEFF -FE00FFFEFFFE00FFFE7FFC007FFC07F0000FC007F0001FC003F0001F8003F8003F8001F8003F80 -01FC007F0000FC007F0000FE007E00007E00FE00007F00FC00003F01FC00003F81F800001F81F8 -00001F83F000000FC3F000000FC7F0000007E7E0000007E7E0000003E7C0000003EFC0000001FF -80000001FF80000001FF00000000FF00000000FE000000007E000000007E000000007E00000000 -7E000000007E000000007E000000007E000000007E000000007E000000007E000000007E000000 -007E000000007E000000007E000000007E000000007E00000007FFE000000FFFF000000FFFF000 -000FFFF0000007FFE00027337EB22C>I<3FFFFFFFC07FFFFFFFE07FFFFFFFE07FFFFFFFE07FFF -FFFFE07E00001FC07E00001F807E00003F807E00007F007E00007E007E0000FE007E0001FC003C -0001F800000003F800000007F000000007E00000000FE00000001FC00000001F800000003F8000 -00007F000000007E00000000FE00000000FC00000001F800000003F800000003F000000007E000 -00000FE00000000FC00000001FC00000003F800000003F000000007F00000000FE00000000FC00 -000001FC00000003F80003C003F00007E007F00007E00FE00007E00FC00007E01FC00007E03F80 -0007E03F000007E07F000007E0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE07FFFFFFFC023 -337CB22C>I<7FFFFCFFFFFEFFFFFEFFFFFEFFFFFCFC0000FC0000FC0000FC0000FC0000FC0000 -FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000 -FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000 -FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000 -FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FFFFFCFFFFFEFFFFFE -FFFFFE7FFFFC17416FB92C>I<7800000000F800000000FC00000000FC00000000FE000000007E -000000007F000000003F000000003F800000001F800000001FC00000000FC00000000FE0000000 -07E000000007E000000007F000000003F000000003F800000001F800000001FC00000000FC0000 -0000FE000000007E000000007F000000003F000000003F800000001F800000001F800000001FC0 -0000000FC00000000FE000000007E000000007F000000003F000000003F800000001F800000001 -FC00000000FC00000000FC00000000FE000000007E000000007F000000003F000000003F800000 -001F800000001FC00000000FC00000000FE000000007E000000007F000000003F000000003F000 -000003F800000001F800000001FC00000000FC00000000FE000000007E000000007F000000003F -000000003F800000001F800000001F800000000F80000000070021417BB92C>I<7FFFFCFFFFFE -FFFFFEFFFFFE7FFFFE00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E -00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E -00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E -00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E -00007E00007E00007E00007E00007E00007E7FFFFEFFFFFEFFFFFEFFFFFE7FFFFC17417DB92C> -I<000E0000003F800000FFE00003FFF8000FFFFE001FFFFF007FF1FFC0FFE0FFE0FF803FE0FE00 -0FE07C0007C0300001801B0C78B22C>I<7FFFFFFF00FFFFFFFF80FFFFFFFF80FFFFFFFF80FFFF -FFFF807FFFFFFF0021067B7D2C>I<007001F003F807F00FF00FC01F803F003E007E007C007C00 -FC00F800F800F800F800F800FF00FF80FFC07FC07FC03FC03F800F000D1A70B82C>I<00FFF000 -0007FFFE00000FFFFF80001FFFFFE0001FFFFFF0001FC01FF8001FC007F8000F8001FC00070000 -FC00000000FE000000007E000000007E000000007E000000FFFE00000FFFFE00007FFFFE0003FF -FFFE000FFFFFFE001FFF807E003FF0007E003FC0007E007F00007E00FE00007E00FC00007E00FC -00007E00FC00007E00FC00007E00FE00007E007F0000FE007F8003FE003FE00FFE001FFFFFFFFC -0FFFFFFFFE07FFFFBFFE01FFFE1FFE003FF003FC27247CA32C>I<7FF0000000FFF8000000FFF8 -000000FFF80000007FF800000001F800000001F800000001F800000001F800000001F800000001 -F800000001F800000001F800000001F800000001F800000001F81FC00001F8FFF80001FBFFFE00 -01FFFFFF0001FFFFFF8001FFE03FC001FF801FE001FF0007F001FE0003F001FC0001F801FC0001 -FC01F80000FC01F80000FC01F80000FE01F800007E01F800007E01F800007E01F800007E01F800 -007E01F800007E01F800007E01F800007E01F80000FE01FC0000FC01FC0000FC01FC0001F801FE -0003F801FE0007F001FF000FF001FF801FE001FFE07FC001FFFFFF8001FFFFFF0001FBFFFE0001 -F8FFF00000F01F800027337FB22C>I<0003FFC000001FFFFC00007FFFFE0001FFFFFE0003FFFF -FF0007FC007F000FF0007F000FE0003E001FC0001C003F800000003F000000007F000000007E00 -0000007E00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC -00000000FC000000007E000000007E000000007F000000003F00000F003F80001F801FC0001F80 -0FE0003F800FF0007F0007FC01FF0003FFFFFE0001FFFFFC00007FFFF800001FFFE0000003FE00 -0021247AA32C>I<00000FFE0000001FFF0000001FFF0000001FFF0000000FFF000000003F0000 -00003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F00 -0000003F000003F03F00001FFE3F0000FFFFBF0001FFFFFF0003FFFFFF0007FC0FFF000FF003FF -001FE001FF001FC000FF003F80007F003F00007F007E00003F007E00003F00FE00003F00FC0000 -3F00FC00003F00FC00003F00FC00003F00FC00003F00FC00003F00FC00003F00FC00003F00FE00 -003F007E00007F007E00007F007F0000FF003F0000FF001F8001FF001FC003FF000FF007FF0007 -F81FFF0003FFFFFFFC01FFFFBFFE00FFFF3FFE003FFC3FFE0007F01FFC27337DB22C>I<0003FE -0000001FFFC000007FFFF00001FFFFF80003FFFFFC0007FE03FE000FF800FF000FE0003F801FC0 -001F803F80001FC03F00000FC07F00000FC07E00000FE07E000007E0FC000007E0FFFFFFFFE0FF -FFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFC0FC00000000FE000000007E000000007E00000000 -7F000000003F000003C03F800007E01FC00007E00FF0000FE007F8003FC007FE00FFC001FFFFFF -8000FFFFFF00003FFFFC00000FFFF0000001FF800023247CA32C>I<000007F80000003FFE0000 -00FFFF000001FFFF800003FFFF800007F83F800007F03F80000FE01F00000FC00000000FC00000 -000FC00000000FC00000000FC00000000FC00000000FC000007FFFFFFE00FFFFFFFF00FFFFFFFF -00FFFFFFFF007FFFFFFE00000FC00000000FC00000000FC00000000FC00000000FC00000000FC0 -0000000FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000F -C00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC0000000 -0FC00000000FC00000000FC00000000FC00000000FC000003FFFFFF0007FFFFFF8007FFFFFF800 -7FFFFFF8003FFFFFF00021337DB22C>I<00000001F00007F80FFC001FFE3FFE007FFFFFFF01FF -FFFFFF03FFFFFE7F03FC0FF83F07F003F81E0FE001FC000FC000FC001FC000FE001F80007E001F -80007E001F80007E001F80007E001F80007E001F80007E001FC000FE000FC000FC000FE001FC00 -07F003F80003FC0FF00007FFFFF00007FFFFE0000FFFFF80000F9FFE00000F87F800000F800000 -000F800000000F800000000FC000000007E000000007FFFFE00003FFFFFE0007FFFFFF800FFFFF -FFE01FFFFFFFF03FC0001FF83F000003F87E000000FC7C0000007CFC0000007EF80000003EF800 -00003EF80000003EF80000003EFC0000007E7E000000FC3F800003F83FE0000FF81FFC007FF00F -FFFFFFE003FFFFFF8000FFFFFE00003FFFF8000003FF800028387EA42C>I<7FF000000000FFF8 -00000000FFF800000000FFF8000000007FF80000000001F80000000001F80000000001F8000000 -0001F80000000001F80000000001F80000000001F80000000001F80000000001F80000000001F8 -0000000001F80FE0000001F87FFC000001F9FFFE000001FBFFFF000001FFFFFF000001FFF03F80 -0001FFC01F800001FF801FC00001FF000FC00001FE000FC00001FC000FC00001FC000FC00001F8 -000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC0 -0001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8 -000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC0007FFFE0FFFF -00FFFFF1FFFF80FFFFF1FFFF80FFFFF1FFFF807FFFE0FFFF0029337FB22C>I<00078000000FC0 -00001FE000001FE000001FE000001FE000000FC000000780000000000000000000000000000000 -0000000000000000000000000000000000007FFFC0007FFFE000FFFFE0007FFFE0007FFFE00000 -07E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E000 -0007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0 -000007E0000007E0000007E0000007E0000007E0000007E0007FFFFFFCFFFFFFFEFFFFFFFEFFFF -FFFE7FFFFFFC1F3479B32C>I<00000F0000001F8000003FC000003FC000003FC000003FC00000 -1F8000000F00000000000000000000000000000000000000000000000000000000000000000001 -FFFF8003FFFFC003FFFFC003FFFFC001FFFFC000000FC000000FC000000FC000000FC000000FC0 -00000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000F -C000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC00000 -0FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000 -000FC000000FC000000FC000000FC000001FC000001F807C003F807C003F00FE007F00FE01FE00 -FFFFFC007FFFF8007FFFF0003FFFE00007FF00001A467CB32C>I<7FE0000000FFF0000000FFF0 -000000FFF00000007FF000000001F000000001F000000001F000000001F000000001F000000001 -F000000001F000000001F000000001F000000001F000000001F01FFFF001F03FFFF801F03FFFF8 -01F03FFFF801F01FFFF001F000FE0001F001FC0001F003F80001F007F00001F00FE00001F01FC0 -0001F03F800001F07F000001F0FE000001F1FC000001F3FC000001F7FE000001FFFF000001FFFF -000001FF9F800001FF0FC00001FE07E00001FC07E00001F803F00001F001F80001F000FC0001F0 -00FC0001F0007E0001F0003F0001F0001F8001F0001F807FFFC0FFFCFFFFE1FFFEFFFFE1FFFEFF -FFE1FFFE7FFFC0FFFC27337EB22C>I<7FFFE00000FFFFF00000FFFFF00000FFFFF000007FFFF0 -00000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003 -F000000003F000000003F000000003F000000003F000000003F000000003F000000003F0000000 -03F000000003F000000003F000000003F000000003F000000003F000000003F000000003F00000 -0003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F000 -000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F0 -00000003F000000003F000007FFFFFFF80FFFFFFFFC0FFFFFFFFC0FFFFFFFFC07FFFFFFF802233 -7BB22C>I<7F81F003E0007FCFFC1FF800FFDFFE3FFC007FFFFEFFFC007FFFFFFFFE0007FE1FFC -3E0007FC1FF83F0007F00FE01F0007F00FE01F0007E00FC01F0007E00FC01F0007E00FC01F0007 -C00F801F0007C00F801F0007C00F801F0007C00F801F0007C00F801F0007C00F801F0007C00F80 -1F0007C00F801F0007C00F801F0007C00F801F0007C00F801F0007C00F801F0007C00F801F0007 -C00F801F0007C00F801F0007C00F801F0007C00F801F0007C00F801F0007C00F801F007FFC3FF8 -7FF07FFC7FF8FFF0FFFE7FFCFFF87FFC7FF8FFF07FFC3FF87FF02D2481A32C>I<7FF00FE00000 -FFF87FFC0000FFF9FFFE0000FFFBFFFF00007FFFFFFF000001FFF03F800001FFC01F800001FF80 -1FC00001FF000FC00001FE000FC00001FC000FC00001FC000FC00001F8000FC00001F8000FC000 -01F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F800 -0FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC000 -01F8000FC00001F8000FC00001F8000FC00001F8000FC0007FFFE0FFFF00FFFFF1FFFF80FFFFF1 -FFFF80FFFFF1FFFF807FFFE0FFFF0029247FA32C>I<0007FC0000001FFF0000007FFFC00001FF -FFF00003FFFFF80007FC07FC000FF001FE001FE000FF001F80003F003F80003F803F00001F807E -00000FC07E00000FC07E00000FC0FC000007E0FC000007E0FC000007E0FC000007E0FC000007E0 -FC000007E0FC000007E0FE00000FE07E00000FC07E00000FC07F00001FC03F00001F803F80003F -801FC0007F001FE000FF000FF001FE0007FC07FC0003FFFFF80001FFFFF000007FFFC000001FFF -00000007FC000023247CA32C>I<7FF01FC000FFF8FFF800FFFBFFFE00FFFFFFFF007FFFFFFF80 -01FFE03FC001FF801FE001FF0007F001FE0003F001FC0001F801FC0001FC01F80000FC01F80000 -FC01F80000FE01F800007E01F800007E01F800007E01F800007E01F800007E01F800007E01F800 -007E01F800007E01F80000FE01FC0000FC01FC0000FC01FC0001F801FE0003F801FE0007F001FF -000FF001FF801FE001FFE07FC001FFFFFF8001FFFFFF0001FBFFFE0001F8FFF00001F81F800001 -F800000001F800000001F800000001F800000001F800000001F800000001F800000001F8000000 -01F800000001F800000001F800000001F800000001F80000007FFFE00000FFFFF00000FFFFF000 -00FFFFF000007FFFE0000027367FA32C>I<0003F8078000001FFF0FC000007FFFCFC00001FFFF -EFC00003FFFFFFC00007FC07FFC0000FF001FFC0000FE000FFC0001FC0007FC0003F80003FC000 -3F00003FC0007F00001FC0007E00001FC0007E00000FC000FC00000FC000FC00000FC000FC0000 -0FC000FC00000FC000FC00000FC000FC00000FC000FC00000FC000FC00000FC000FE00000FC000 -7E00001FC0007E00001FC0003F00003FC0003F80003FC0001FC0007FC0001FE000FFC0000FF003 -FFC00007FC07FFC00003FFFFFFC00001FFFFEFC000007FFF8FC000001FFF0FC0000003F80FC000 -0000000FC0000000000FC0000000000FC0000000000FC0000000000FC0000000000FC000000000 -0FC0000000000FC0000000000FC0000000000FC0000000000FC0000000000FC0000000000FC000 -000003FFFF00000007FFFF80000007FFFF80000007FFFF80000003FFFF0029367DA32C>I<7FFE -003FC0FFFF01FFF0FFFF07FFF8FFFF1FFFFC7FFF3FFFFC003F7FC1FC003FFF01FC003FFC00F800 -3FF80070003FF00000003FE00000003FC00000003FC00000003F800000003F800000003F800000 -003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F0000 -00003F000000003F000000003F000000003F000000003F000000003F000000003F0000007FFFFF -E000FFFFFFF000FFFFFFF000FFFFFFF0007FFFFFE00026247EA32C>I<003FF87001FFFFF80FFF -FFF81FFFFFF83FFFFFF87FC00FF87E0003F8FC0001F8F80001F8F80001F8F80001F8FC0000F07F -0000007FE000003FFF80001FFFFC000FFFFF8001FFFFE0003FFFF80001FFFC000007FC000000FE -7800007FFC00003FFC00001FFE00001FFE00001FFF00003FFF80003EFFC000FEFFF003FCFFFFFF -FCFFFFFFF8FFFFFFE0F8FFFF80701FFC0020247AA32C>I<001E000000003F000000003F000000 -003F000000003F000000003F000000003F000000003F000000003F000000003F0000007FFFFFFF -00FFFFFFFF80FFFFFFFF80FFFFFFFF807FFFFFFF00003F000000003F000000003F000000003F00 -0000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F -000000003F000000003F000000003F000000003F000000003F000000003F0003C0003F0007E000 -3F0007E0003F0007E0003F0007E0003F0007E0003F800FE0001F801FC0001FE03FC0000FFFFF80 -0007FFFF000003FFFE000001FFF80000003FC000232E7EAD2C>I<7FF003FF8000FFF807FFC000 -FFF807FFC000FFF807FFC0007FF803FFC00001F8000FC00001F8000FC00001F8000FC00001F800 -0FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC000 -01F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F800 -0FC00001F8000FC00001F8000FC00001F8000FC00001F8000FC00001F8001FC00001F8001FC000 -01F8003FC00001FC007FC00000FE01FFC00000FFFFFFFF00007FFFFFFF80003FFFFFFF80001FFF -CFFF800003FE07FF0029247FA32C>I<7FFF01FFFCFFFF01FFFEFFFF83FFFEFFFF01FFFE7FFF01 -FFFC03E0000F8003E0000F8003F0001F8001F0001F0001F0001F0001F8003F0000F8003E0000F8 -003E0000FC007E00007C007C00007C007C00007E00FC00003E00F800003E00F800003F01F80000 -1F01F000001F01F000001F83F000000F83E000000F83E000000FC7E0000007C7C0000007C7C000 -0007EFC0000003EF80000003EF80000003FF80000001FF00000001FF00000000FE000000007C00 -0027247EA32C>I<7FFF007FFF007FFF80FFFF00FFFF80FFFF807FFF80FFFF007FFF007FFF0007 -C00001F00007C00001F00007C00001F00007C00001F00007C00001F00007C00001F00003E00003 -E00003E00003E00003E00003E00003E03E03E00003E07F03E00003E07F03E00001F07F07C00001 -F0FF87C00001F0FF87C00001F0F787C00001F0F787C00001F1F7C7C00000F1F7C7800000F9E3CF -800000F9E3CF800000FBE3EF800000FBE3EF800000FBE3EF8000007BC1EF0000007FC1FF000000 -7FC1FF0000007F80FF0000007F80FF0000003F80FE0000001F007C000029247FA32C>I<3FFF03 -FFF07FFF87FFF87FFF87FFF87FFF87FFF83FFF03FFF000FC007E0000FC00FC00007E01F800003F -01F000001F83F000001F87E000000FCFC0000007EF80000003FF80000001FF00000001FE000000 -00FC000000007C00000000FE00000001FE00000001FF00000003EF80000007CFC000000FC7C000 -000F83E000001F01F000003F01F800007E00F800007C007C0000F8007E0001F8003F007FFF01FF -FC7FFF83FFFCFFFF83FFFE7FFF83FFFC7FFF01FFFC27247EA32C>I<7FFF01FFFCFFFF01FFFEFF -FF83FFFEFFFF01FFFE7FFF01FFFC03E0000F8001F0000F8001F0001F8001F8001F0000F8001F00 -00F8003F0000FC003E00007C003E00007E007E00003E007C00003E007C00003F00FC00001F00F8 -00001F00F800000F81F800000F81F000000F81F0000007C1F0000007C3E0000007C3E0000003E3 -E0000003E3C0000001E7C0000001F7C0000001F780000000FF80000000FF80000000FF00000000 -7F000000007F000000003E000000003E000000007E000000007C000000007C00000000FC000000 -00F800000000F800000001F800001C01F000003E03F000007F07E000007F0FE000007F1FC00000 -7FFF8000003FFF0000003FFE0000001FFC00000007E000000027367EA32C>I<3FFFFFFFE07FFF -FFFFF07FFFFFFFF07FFFFFFFF07FFFFFFFF07E00001FE07E00003FC07E00007F807E0000FF007E -0001FE003C0003FC00000007F80000000FF00000001FE00000003FC00000007F80000000FF0000 -0001FC00000003F80000000FF00000001FE00000003FC00000007F80000000FF00000001FE0001 -E003FC0003F007F80003F00FF00003F01FE00003F03FC00003F07F800003F0FFFFFFFFF0FFFFFF -FFF0FFFFFFFFF0FFFFFFFFF07FFFFFFFE024247DA32C>I<0000007F00000007FF8000001FFF80 -00007FFF800000FFFF000001FF80000001FE00000003F800000003F000000003F000000003F000 -000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F0 -00000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003 -F000000007F00000001FE0000000FFE000007FFFC00000FFFF800000FFFE000000FFFF8000007F -FFC0000000FFE00000001FE000000007F000000003F000000003F000000003F000000003F00000 -0003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F000 -000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F8 -00000001FE00000001FF80000000FFFF0000007FFF8000001FFF80000007FF800000007F002141 -7BB92C>I<78FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC -FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC7806416DB92C>I<7F -80000000FFF8000000FFFE000000FFFF8000007FFFC0000000FFE00000001FE000000007F00000 -0003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F000 -000003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F0 -00000003F000000003F000000003F000000003F800000001FE00000001FF80000000FFFF000000 -7FFF8000001FFF8000007FFF800000FFFF000001FF80000001FE00000003F800000003F0000000 -03F000000003F000000003F000000003F000000003F000000003F000000003F000000003F00000 -0003F000000003F000000003F000000003F000000003F000000003F000000003F000000003F000 -000003F000000003F000000007F00000001FE0000000FFE000007FFFC00000FFFF800000FFFE00 -0000FFF80000007F8000000021417BB92C>I<00F8007003FE00F80FFF01F81FFF87F83FFFCFF0 -7F9FFFE0FF0FFFC0FC07FF80F803FE007000F8001D0A79B22C>I E /Fx -14 121 df<001F000000001FC000000007E000000003F000000001F800000001FC00000001FC00 -000000FC00000000FE00000000FE000000007E000000007F000000003F000000003F000000003F -800000001F800000001FC00000001FC00000000FC00000000FE00000000FE000000007E0000000 -07F000000007F000000003F000000003F800000003F800000001F800000001FC00000001FC0000 -0000FC00000000FE00000001FE00000003FE000000077F0000000E7F0000001C3F0000003C3F80 -0000783F800000F01F800001E01FC00003C01FC00007C00FC0000F800FE0001F000FE0003E0007 -E0007C0007F000F80003F001F80003F803F00003F807E00001F80FC00001FC1F800001FC3F8000 -00FC7F000000FEFE000000FEFC0000007EF80000003F700000001F283B7CB930>21 -D<0003800000000007C00007000007E0000F80000FC0001F80000FC0001F80000FC0001F80000F -C0001F80001F80003F00001F80003F00001F80003F00001F80003F00003F00007E00003F00007E -00003F00007E00003F00007E00007E0000FC00007E0000FC00007E0000FC00007E0000FC0000FC -0001F80000FC0001F80000FC0001F80000FC0001F80001F80003F00001F80003F01801F80003F0 -1801F80003F01803F80007E03003F80007E03003F80007E03003F8000FE03007F8001FE06007F8 -001FE06007FC0073E0C007FC00E3E0C00FDF0381E1800FCFFF00FF000FC3FC003E000FC0000000 -001F80000000001F80000000001F80000000001F80000000003F00000000003F00000000003F00 -000000003F00000000007E00000000007E00000000007E00000000007E0000000000FC00000000 -007C00000000003800000000002D367EA432>I<1C003E007F00FF80FF80FF807F003E001C0009 -09798817>58 D<1C007E007F00FF80FF80FFC07FC07FC01CC000C000C000C000C0018001800180 -03000300030006000C000C001800300020000A19798817>I<00000000000180000000000007C0 -00000000001FC000000000007FC00000000001FF000000000007FC00000000001FF00000000000 -7FC00000000001FF000000000007FC00000000001FF000000000007FC00000000001FF00000000 -0007FC00000000001FF000000000007FC00000000001FF000000000007FC00000000001FF00000 -0000007FC00000000001FF000000000007FC00000000001FF000000000007FC00000000000FF00 -0000000000FF0000000000007FC000000000001FF0000000000007FC000000000001FF00000000 -00007FC000000000001FF0000000000007FC000000000001FF0000000000007FC000000000001F -F0000000000007FC000000000001FF0000000000007FC000000000001FF0000000000007FC0000 -00000001FF0000000000007FC000000000001FF0000000000007FC000000000001FF0000000000 -007FC000000000001FC0000000000007C000000000000180323279AD41>I<40000000000000F8 -000000000000FE000000000000FF8000000000003FE000000000000FF8000000000003FE000000 -000000FF8000000000003FE000000000000FF8000000000003FE000000000000FF800000000000 -3FE000000000000FF8000000000003FE000000000000FF8000000000003FE000000000000FF800 -0000000003FE000000000000FF8000000000003FE000000000000FF8000000000003FE00000000 -0000FF8000000000003FC000000000003FC00000000000FF800000000003FE00000000000FF800 -000000003FE00000000000FF800000000003FE00000000000FF800000000003FE00000000000FF -800000000003FE00000000000FF800000000003FE00000000000FF800000000003FE0000000000 -0FF800000000003FE00000000000FF800000000003FE00000000000FF800000000003FE0000000 -0000FF800000000000FE000000000000F800000000000060000000000000323279AD41>62 -D<0000003FE001000001FFF803000007FFFE0700000FC01F0F00003F00079E00007C0001FE0000 -F00000FE0001E000007E0003E000007C0003C000003C00078000003C000F8000003C000F000000 -38001F00000038001F00000038001F00000038003F00000030003F00000030003F00000030003F -80000000003F80000000003FC0000000001FF0000000001FFE000000000FFFE00000000FFFFE00 -000007FFFFC0000003FFFFF0000001FFFFF8000000FFFFFC0000001FFFFE00000003FFFF000000 -003FFF0000000003FF8000000000FF80000000003F80000000003F80000000001F80000000001F -80000000000F80040000000F800C0000000F800C0000000F800C0000000F801C0000001F001C00 -00001F001C0000001E001C0000003E003C0000003C003C00000078003E000000F8003F000000F0 -007F000003E0007FC00007C00079F0001F8000707E007E0000E03FFFFC0000C00FFFF00000C001 -FF800000303B7CB933>83 D<00000000F80000000003FE000000000707000000000E0780000000 -1E1F800000003E1F800000007C3F800000007C3F80000000FC1F00000000FC0E00000000FC0000 -000001F80000000001F80000000001F80000000001F80000000001F80000000003F00000000003 -F00000000003F00000000003F00000000003F00000000007E00000000007E000000003FFFFF000 -0007FFFFF0000007FFFFE00000000FC0000000000FC0000000000FC0000000000FC0000000000F -C0000000001F80000000001F80000000001F80000000001F80000000001F80000000001F800000 -00003F00000000003F00000000003F00000000003F00000000003F00000000007E00000000007E -00000000007E00000000007E00000000007E0000000000FC0000000000FC0000000000FC000000 -0000FC0000000000FC0000000001F80000000001F80000000001F80000000001F80000000001F8 -0000000001F00000000003F00000000003F00000000003F00000000003E00000000003E0000000 -0007E00000000007C00000000007C00000001C07800000003E0F800000007E0F00000000FE0F00 -000000FE1E00000000FC1C000000007838000000003070000000001FE0000000000FC000000000 -294C7CBA29>102 D<0000E00001F00003F80003F80003F00003E00001C0000000000000000000 -00000000000000000000000000000000000000000000000000000000F80001FE00070F00060F00 -0C0F80180F80300F80300F80601F80601F80601F80C03F00C03F00C03F00007E00007E0000FC00 -00FC0000FC0001F80001F80001F80003F00003F00007E01807E01807E0180FC0300FC0300FC030 -0F80600F80600F80C00F818007830007870003FC0000F80015397EB71D>105 -D<00000007000000000F800000001F800000003F800000003F800000001F000000000E00000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000F800000003FE000000070F0000000C0F80000 -0180F800000300FC00000600FC00000600FC00000C00FC00001800FC00001800FC00001801F800 -003001F800003001F800000001F800000003F000000003F000000003F000000003F000000007E0 -00000007E000000007E000000007E00000000FC00000000FC00000000FC00000000FC00000001F -800000001F800000001F800000001F800000003F000000003F000000003F000000003F00000000 -7E000000007E000000007E000000007E00000000FC00000000FC00000000FC00000000FC000000 -01F800001C01F800003E03F000007E03E00000FE07E00000FE07C00000FC0F800000781F000000 -707C0000003FF80000000FC0000000214981B722>I<03E0007F000007F801FFC0000C3C0781F0 -00183E0E00F800183E1800F800303F30007C00303F60007C00603FC0007C00603F80007C00603F -00007C00603F00007C00C07E0000FC00C07E0000FC00C07E0000FC00007E0000FC0000FC0001F8 -0000FC0001F80000FC0001F80000FC0003F00001F80003F00001F80003F00001F80007E00001F8 -0007E00003F00007E00003F0000FC03003F0000FC03003F0000FC03007E0001F806007E0001F80 -6007E0001F806007E0001F00C00FC0001F00C00FC0001F01800FC0001F03000FC0000F07001F80 -000F0E000F800007F80007000001F0002C267EA432>110 D<000F8003F000001FE00FFC000030 -F03C1E000060F8700F000060F8C0078000C0FD8007C000C0FF0003E00180FE0003E00180FC0003 -E00180FC0003F00180FC0003F00301F80003F00301F80003F00301F80003F00001F80003F00003 -F00007F00003F00007F00003F00007F00003F00007F00007E0000FE00007E0000FE00007E0000F -E00007E0000FC0000FC0001FC0000FC0001F80000FC0001F80000FC0003F00001F80003F00001F -80007E00001F80007C00001F8000F800003FC001F000003FC001E000003F6003C000003F600F80 -00007E383F0000007E1FFC0000007E07E00000007E0000000000FC0000000000FC0000000000FC -0000000000FC0000000001F80000000001F80000000001F80000000001F80000000003F0000000 -0003F00000000003F0000000007FFFC0000000FFFFC00000007FFFC00000002C3583A42A>112 -D<00F800038001FE0007C0070F000FE00E0F000FF00C0F800FF0180F800FF0300F8007F0300F80 -03F0601F8001F0601F8000F0601F8000E0C03F0000E0C03F0000E0C03F0000E0007E0000E0007E -0000C000FC0000C000FC0000C000FC0000C001F800018001F800018001F800018001F800030003 -F000030003F000060003F000060003F000060003F0000C0003F0000C0003F000180003F0003000 -01F000300001F000600000F800C0000078038000003E0F0000001FFC00000007F0000024267EA4 -28>118 D<0007E001F000001FF807FC0000383C0E0E0000601E180F0000C00F301F8001800F30 -3F8003000FE03F8006000FE03F0006000FC03E000C000FC01C000C000FC0000018001F80000018 -001F80000018001F80000000001F80000000003F00000000003F00000000003F00000000003F00 -000000007E00000000007E00000000007E00000000007E0000000000FC0000000000FC000C0000 -00FC000C000000FC000C000001F80018001C01F80018003E01F80030007E03F8003000FE03F800 -6000FE067800C000FC0678018000780C3C03000038381E0E00001FF00FFC000007C003F0000029 -267EA42F>120 D E /Fy 78[42 1[51 51 51[42 46 42 69 46 51 28 -37 32 1[51 46 51 74 28 51 28 28 51 46 32 42 51 37 51 42 10[65 -65 55 51 60 69 51 69 69 83 51 2[32 69 1[46 51 69 60 55 65 1[37 -5[42 42 42 42 42 42 42 42 42 42 25 21 28 21 44[{}62 83.333337 -/Palatino-Bold rf /Fz 80[45 44 51[37 42 42 60 42 46 28 32 32 -38 42 37 46 65 23 37 23 23 42 42 23 32 42 34 38 37 3[28 1[28 -1[55 3[65 51 46 2[51 65 1[78 3[28 65 1[46 51 65 1[51 60 1[42 -3[21 21 7[42 42 1[25 21 28 21 2[28 28 23 65 2[42 35[{}58 83.333337 -/Palatino-Italic rf /FA 47[83 16[37 4[42 8[42 1[50 50 3[42 -47[42 46 43 69 47 50 27 35 33 46 50 45 48 73 24 46 19 24 48 -46 28 40 51 37 46 42 3[28 1[28 55 55 55 83 60 65 51 44 55 65 -50 65 69 79 51 60 28 28 69 63 46 51 64 59 51 65 1[37 1[50 1[21 -21 42 42 42 42 42 42 42 42 42 42 50 21 28 21 50 32 28 28 23 -65 2[42 1[23 33[{}87 83.333337 /Palatino-Roman rf /FB 81[126 -52[115 103 172 115 126 69 92 80 1[126 115 126 184 69 126 1[69 -126 115 80 103 126 92 1[103 12[138 126 149 1[126 172 172 207 -3[80 5[149 1[161 17[61 2[52 44[{}35 207.333362 /Palatino-Bold -rf /FC 171[50 1[54 11[42 1[62 2[58 65[{}5 75.000000 /Palatino-Bold -rf /FD 78[37 58[42 2[32 30 1[45 41 1[66 1[42 5[36 2[41 37 14[50 -2[59 62 19[19 37 37 2[37 3[37 4[19 44[{.167 SlantFont}20 75.000000 -/Palatino-Roman rf /FE 137[66 1[40 53 47 2[66 73 106 40 2[40 -73 2[60 73 2[60 13[73 3[100 10[100 86 80 19[30 46[{}19 119.999948 -/Palatino-Bold rf /FF 140[39 36 2[50 2[27 3[53 2[44 1[41 1[46 -26[51 17[46 3[46 1[23 46[{}12 91.666666 /Palatino-Roman rf -/FG 138[104 1[76 66 3[104 1[57 3[104 1[66 85 1[76 1[85 13[104 -123 4[170 77[{}13 170.833325 /Palatino-Bold rf end +TeXDict begin 40258431 52099146 1000 600 600 (man.dvi) +@start /Fa 190[45 65[{TeXBase1Encoding ReEncodeFont}1 +58.333334 /Palatino-Roman rf /Fb 1 42 df<17F0A283177C173C173E83A2717E71 +7E717E007FB87EB97E846C17FFCBEA1F80F00FE0F003F0F001FE9538007F80F11FF0A2F1 +7F80953801FE00F003F0F00FE0F01F80007FB9C7FCB912FC606C5FCAEA03E04D5A4D5A4D +C8FCA2173E173C177C5F5FA2442A7CA74D>41 D E /Fc 1 62 df<007FB812C0B912E0A2 +6C17C0CCFCAC007FB812C0B912E0A26C17C033147C9C3C>61 D E +/Fd 1 16 df15 D E +/Fe 1 22 df<137CEB7F80EB1FE0130F6D7EA26D7EA36D7EA36D7EA28080A26E7EA36E7E +A281140FA26E7EA381140F141FEC3DFC1479ECF8FEEB01F0EB03E0903807C07FEB0F80EB +1F00013EEB3F80137E4914C04848131F485A4848EB0FE0EA1FC0123F4848EB07F048C7FC +4815F848140348EC01FC48140026357CB32D>21 D E /Ff 2 99 +df<131FEBFF8C3801E0DE3803807E3807007C48133C121E123E003C5B127CA3485BA215 +401560903801E0C012781303393807E180391C1CF300380FF87F3807E03C1B177E9522> +97 DI E /Fg 167[40 4[31 3[47 5[20 73[{ +TeXBase1Encoding ReEncodeFont}4 59.999974 /Palatino-Roman +rf /Fh 74 125 df<123C127E12FFAF127EAE123C1200A7123C127E12FFA4127E123C08 +2F71AE27>33 D<00101320007C13F838FE01FCAAEAFC00007C13F8A900381370161778AE +27>I<90383C03C090387E07E0A7EBFE0F01FC13C0A2003FB512FC4814FEB7FCA36C14FE +3901F81F80AC007FB512FEB7FCA36C14FE6C14FC3903F03F00A200075BEBE07EA73803C0 +3C202E7DAD27>II40 D<127012F812FE7E6C7E6C7EEA0FE06C7E12037F6C7E1200137EA27FA2 +EB1F80A3EB0FC0A4EB07E0ACEB0FC0A4EB1F80A3EB3F00A2137EA25B1201485A5B120748 +5AEA3FC0485A48C7FC5A12F81270133A7AB327>I<130F497EA60078EB81E000FEEB87F0 +00FF138FEBDFBF6CB512E06C14C0000F1400000313FCC613F0A2000313FC000F13FF003F +14C04814E039FFDFBFF0EB1F8F00FE13870078EB81E00000EB8000A66DC7FC1C207BA627 +>II<120FEA +3FC013E0EA7FF0A213F8A2123FA2120F120113F01203EA07E0121FEA7FC0EAFF8013005A +12700D14738927>I<007FB512F8B612FCA46C14F81E067C9927>I<121EEA7F80A2EAFFC0 +A4EA7F80A2EA1E000A0A728927>I<1538157C15FCA2140115F8140315F0140715E0140F +15C0141F1580143F1500A25C147E14FE5C13015C13035C13075C130F5CA2131F5C133F91 +C7FC5B137E13FE5B12015B12035BA212075B120F5B121F5B123F90C8FC5A127E12FE5AA2 +5A12781E3A7CB327>II<130E131FA25B5BA25B5A5A127FB5FCA2 +13BFEA7E3F1200B3AA003FB512805A15C01580A21A2F79AE27>III<1278B612FE15FFA315FE39FC0001FCEC03F8EC07F0007814E0C7120F +EC1FC01580143FEC7F00147E14FE5C13015C13035C13075CA2495AA3495AA3133F91C7FC +A55B137EA9133C20307DAE27>55 D<121EEA7F80A2EAFFC0A4EA7F80A2EA1E00C7FCAC12 +1EEA7F80A2EAFFC0A4EA7F80A2EA1E000A20729F27>58 D<120FEA3FC0A2EA7FE0A4EA3F +C0A2EA0F00C7FCAC120FEA3F8013C0127F13E0A3123FA2120F120713C0120FA2EA3F80EA +7F005A5A12F812700B2A739F27>I<1230127812FE7E13C06C7EEA3FF8EA0FFC6C7E3801 +FF806C7FEB3FF06D7EEB0FFEEB03FF6D13C09038007FE0EC3FF8EC0FFC1407A2140FEC3F +F8EC7FE0903801FFC0491300EB0FFEEB1FF8495AEBFFC0485BD807FEC7FC485AEA3FF8EA +7FE0485A90C8FC5A127812301E287CAA27>62 DIII< +007FB5FCB612C08115F87E3907E003FCEC00FE157E157F81A6157EA25D1403EC0FF890B5 +5A15C015F081819038E000FE157FED3F80151FA2ED0FC0A6151F1680153FED7F004A5A00 +7FB55AB65A5D15E06C1480222E7FAD27>I<903803F80E90381FFE1F90383FFFBF90B6FC +5A3803FE0F3807F803497E48487E485A49137FA248C7123FA25A127E151E150012FE5AAA +7E127EA2151E007F143F7EA26C7E157F6D137E6C6C13FE3907F001FCEBF8033903FE0FF8 +6CB512F06C14E0013F13C06D1300EB03F820307DAE27>I<387FFFFC14FFB612C06C8081 +3907E00FF81407EC01FC6E7EA2157E157F811680151FA316C0150FABED1F80A3153F1600 +A25D15FEA24A5A4A5A140F007FB55A5DB65A6C91C7FC14FC222E7FAD27>I<007FB61280 +B712C0A37E3907E0000FA6ED078092C7FCA4EC07804A7EA390B5FCA5EBE00FA36E5A91C8 +FCA4ED03C0ED07E0A7007FB6FCB7FCA36C15C0232E7FAD27>I<007FB61280B712C0A37E +3907E0000FA6ED078092C7FCA4EC07804A7EA390B5FCA5EBE00FA36E5A91C8FCAC387FFF +80B57EA36C5B222E7EAD27>I<903807F03890381FFC7C90387FFFFC90B5FC5A3803FC1F +3807F00F380FE007EBC003001F13011380123F90C7FCA2127EA2157892C7FC5AA8EC1FFF +4A1380A3007E6D1300EC00FCA36C1301A21380121FEBC003120FEBE0073807F00F3803FC +1F6CB5FC7EEB7FFE90381FFC78D907F0C7FC21307DAE27>I<3A7FFE07FFE0B54813F0A3 +6C486C13E03A07E0007E00AF90B512FEA59038E0007EB03A7FFE07FFE0B54813F0A36C48 +6C13E0242E7FAD27>I<007FB512E0B612F0A36C14E039001F8000B3B2007FB512E0B612 +F0A36C14E01C2E7BAD27>I<3A7FFC07FF8016C0486C5A6C487E16803A07C001F8001403 +5D4A5A4A5A141F5D4AC7FC147E14FE5CEBC1F8EBC3F013C75CEBCFF0EBDFF813FF8013FE +EBFC7E143EEBF83F497E01E07F140F01C07F1407811403816E7EA26E7E157C157E3A7FFC +01FFC016E0486C5A6C487E16C0232E7FAD27>75 D<387FFFC080B5FC7E5CD803F0C8FCB3 +AAED0780ED0FC0A7007FB6FCA2B7FC7E1680222E7FAD27>II<3A7FF003FFE0486C4813F0A213FC007F6D13E000079038003E +0013DEA313CFA3148013C714C0A213C314E0A213C114F0A3EBC0F8A31478147CA2143C14 +3EA2141E141F140FA3EC07BEA3EC03FEEA7FFCEAFFFE1401A26C486C5A242E7FAD27>I< +EBFFFC0007EBFF80001F14E0A24814F0EBC00F397F8007F8EB0003007E1301A348EB00FC +B3A76C1301007E14F8A3007F1303EB8007393FE01FF090B5FC6C14E0A200071480C6EBFC +001E307CAE27>I<007FB5FCB612E081816C803907E003FEEC00FF81ED3F80151F16C015 +0FA6151F1680153FED7F005DEC03FE90B55A5D5D5D92C7FC01E0C8FCADEA7FFEB5FCA36C +5A222E7FAD27>I<387FFFF0B512FE6E7E816C803907E01FF014076E7E1401811400A514 +015D14034A5A141F90B55A5D5DA281EBE01F6E7E14076E7EA816F0EDF1F8A4397FFE01FB +B5EBFFF08016E06C48EB7FC0C8EA1F00252F7FAD27>82 D<90387FC0E03901FFF1F00007 +13FF5A5AEA3FE0EB801F387F000F007E130712FE5A1403A3EC01E06C90C7FC127E127FEA +3FC013F86CB47E6C13F86C13FE6CEBFF80C614C0010F13E0010013F0140FEC07F8140314 +0115FC1400127812FCA46CEB01F8A26C130390388007F09038F01FE090B5FC15C0150000 +F85B38701FF81E307CAE27>I<007FB61280B712C0A439FC03F00FA60078EC0780000091 +C7FCB3AB90B512C04880A36C5C222E7EAD27>I<3A7FFE01FFF8B54813FCA36C486C13F8 +3A07E0001F80B3AB6D133F00031500A26D5B0001147E6D13FE6C6C485A90387F87F814FF +6D5B010F13C06D5BD901FEC7FC262F80AD27>I<3A7FFC03FFE06D5A00FF15F0007F15E0 +497E3A07E0007E00A46C6C5BA4EBF80100015CA46C6C485AA490387E07E0A56D485AA401 +1F5B149FA3010F90C7FCA5EB07FEA46D5AA26D5A242F7FAD27>II<393FFC1FFE387FFE3F815D383FFC1F3903F00FE001F85B12 +01EBFC1F00005CEBFE3F017E90C7FCEB7F7FEB3F7E14FE6D5AA26D5AA26D5AA213031307 +80130F80131F80EB3F7E147F497E017E7F141F01FC7F140FD801F87F14071203496C7E12 +0701E07F3A7FFC0FFF8000FF15C06D5A497E007F1580222E7EAD27>I<3A7FFC03FFE06D +5A00FF15F0007F15E0497E3A07F000FE0000035CEBF80100015CA2EBFC0300005CEBFE07 +017E5BA26D485AA290381F9F80A3010F90C7FCA2EB07FEA26D5AA26D5AAF90381FFF8049 +7FA36D5B242E7FAD27>I<127812F87EA27E127E127F7E7F121F7F120F7F12077F1203A2 +7F12017F12007F137E137F7F80131F80130FA280130780130380130180130080147E147F +80A21580141F15C0140F15E0140715F0140315F8140115FC1400A2157C15381E3A7CB327 +>92 D<131C137E3801FF80000713E0001F13F84813FC38FFE7FF13C3130000FC133F0078 +131E180B79AD27>94 D<13E0EA01F01207120F13E0EA1FC0EA3F00A2127E127C12FC5AA4 +B4FC138013C0127FA2123F1380EA0F000C1773B227>96 D<3803FFC0000F13F04813FC48 +13FF811380EC1FC0381F000F000480C71207A2EB0FFF137F0003B5FC120F5A383FFC07EA +7FC0130012FE5AA46C130F007F131FEBC0FF6CB612806C15C07E000313F1C69038807F80 +22207C9F27>IIIIII<153F90391FC0FF80D97FF313C048B612E05A +4814EF390FF07F873A1FC01FC3C0EDC000EB800F48486C7EA66C6C485AEBC01FA2390FF0 +7F8090B5C7FC5C485BEB7FF0EB1FC090C9FCA27F6CB5FC15E015F84814FE4880EB800100 +7EC7EA3F80007C140F00FC15C0481407A46C140F007C1580007F143F6C6CEB7F009038F8 +07FF6CB55A000714F86C5CC614C0D90FFCC7FC23337EA027>II<130F497E497EA46D5A6DC7FC90C8FCA7383FFF +80487FA37EEA000FB3A4007FB512F0B6FC15F815F07E1D2F7BAE27>I107 D<387FFF80B57EA37EEA00 +0FB3B2007FB512F8B612FCA36C14F81E2E7CAD27>I<397F07C01F3AFF9FF07FC09039FF +F9FFE091B57E7E3A0FFC7FF1F89038F03FC001E0138001C01300A3EB803EB03A7FF0FFC3 +FF486C01E3138001F913E701F813E36C4801C313002920819F27>I<387FE07F39FFF1FF +C001F713F090B5FC6C80000313C1EC01FCEBFE005B5BA25BB03A7FFF83FFE0B500C713F0 +A36C018313E024207F9F27>II<387FE0FFD8FFF313C090B512F0816C800003EB81FE49C67E49EB3F8049131F16C049 +130FA216E01507A6150F16C07F151F6DEB3F80157F6DEBFF009038FF83FEECFFFC5D5D01 +F313C0D9F0FEC7FC91C8FCAC387FFF80B57EA36C5B23317F9F27>I<90380FF03C90383F +FE7E90B5FC000314FE5A380FFC1F381FE007EBC003383F800148C7FC127EA200FE147E5A +A67E007E14FEA2007F1301EA3F80EBC003381FE007380FF81F6CB5FC7E6C147E38007FFC +EB0FF090C7FCAC91381FFFF8A24A13FC6E13F8A226317E9F27>I<397FFC03FC39FFFE0F +FF023F13804A13C0007F90B5FC39007FFE1F14F89138F00F809138E002004AC7FC5CA291 +C8FCA2137EAD007FB57EB67EA36C5C22207E9F27>I<9038FFF3800007EBFFC0121F5A5A +EB803F38FC000F5AA2EC07806C90C7FCEA7F8013FC383FFFF06C13FC000713FF00011480 +D8000F13C09038003FE014070078EB03F000FC1301A27E14036CEB07E0EBE01F90B512C0 +1580150000FB13FC38707FF01C207B9F27>I<133C137EA8007FB512F0B612F8A36C14F0 +D8007EC7FCAE1518157EA415FE6D13FC1483ECFFF86D13F06D13E0010313C0010013001F +297EA827>I<397FE01FF8486C487EA3007F131F00031300B21401A21403EBFC0F6CB612 +E016F07EEB3FFE90390FF87FE024207F9F27>I<3A7FFC0FFF80486C4813C0A36C486C13 +803A07C000F800EBE00100035CA2EBF00300015CA2EBF80700005CA390387C0F80A36D48 +C7FCA3EB3F3FEB1F3EA214FE6D5AA36D5AA26D5A22207E9F27>I<3A7FFE07FFE000FF15 +F06D5A497E007F15E03A0F80001F00A36D5B0007143EA414F0EBC1F83903E3FC7CA4EBE7 +9EA200011478A301F713F8A2EBFF0F6C5CA3EBFE0790387C03E024207F9F27>I<393FFC +1FFF486C5A168016006C487E3901F807E06C6C485A4A5A017E90C7FC6D5AEB1F7E5C6D5A +13076D5A5C80497E130F497E143EEB3E3FEB7E1F90387C0F8001F87F00016D7E3803F003 +3A7FFE1FFF80A2B54813C06C486C1380A222207E9F27>I<3A7FFC0FFF80486C4813C0A3 +6C486C13803A07E000F800000313015D13F00001130301F85B1200A26D485A137CA29038 +7E0F80133EA2011F90C7FC5CA2130F149E14BE130714FC1303A25C1301A25CA213035CA2 +13075C1208EA3E0F007F5B131FD87E7FC8FCEA7FFE6C5A5B6C5AEA07C022317E9F27>I< +001FB512FE4814FFA490380001FEEC03FCEC07F8EC0FF0001EEB1FE0C7EA3FC0EC7F80EC +FF00495A495A495AEB1FE0495A495A49C7FC485A4848131E4848133F485A485A485A485A +B7FCA46C14FE20207E9F27>I<127812FCB3B3B3A21278063A70B327>124 +D E /Fi 134[37 2[37 42 25 29 29 1[37 33 42 58 1[33 1[21 +37 37 21 29 37 30 1[33 7[50 5[42 19[37 16[19 46[{ +TeXBase1Encoding ReEncodeFont}23 75.000000 /Palatino-Italic +rf /Fj 21 122 df<007FB51280B612C0A46C14801A067C9623>45 +D47 D<1230127812FE7E7FEA7FE06C7EEA0F +F8EA07FE6C7EC613C06D7E6D7EEB0FFC6D7E903801FF806D13C0147FA214FF4913809038 +07FE00495AEB3FF0495A495A000390C7FC485AEA0FF8EA3FF0485AEAFF8090C8FC5A1278 +12301A247CA523>62 D<3803FF80000F13E04813F8487F80EB80FFEC3F80381F001FC7FC +140F14FF137F0003B5FC120F5A387FF00F130012FCA25A141F7E6C133F387F81FF90B512 +FC6C14FE7E000713C73901FE01FC1F1D7D9C23>97 DI100 DI<147F903801FFC0010713E05B5BEB3FCF140F90383E07C091C7FCA4007FB51280B612 +C0A36C1480D8003EC7FCB3383FFFFE487FA36C5B1B297EA823>I<133813FEA5133890C7 +FCA6EA7FFC487EA3127FEA003EB3387FFFFEB6FCA36C13FE182A7AA923>105 +D107 DI<397E1F01F039FF7FC7FC9038FFEFFE14FF6C80390FE1FE1FEB +C1FC01C07FEB80F8A2EB00F0AE3A7FE3FE3FE026FFF3FF13F0A3267FE3FE13E0241D819C +23>I<38FF81FCEBC7FF01DF138090B512C0A23907FE0FE0EBF807EBF00313E0A313C0AD +39FFFE1FFF5CA380201D7F9C23>I<133F3801FFE0487F487F487F381FC0FE383F807F38 +3E001F007E1480007C130F00FC14C0481307A66C130FA2007C1480007E131F6CEB3F006D +5A381FE1FE6CB45A6C5B6C5B6C5BD8003FC7FC1A1D7C9C23>I<38FF81FCEBC7FF01DF13 +C090B512E015F03907FE0FF8EBF8039038F001FCEBE000A249137EA2153EA5157E7F15FC +7F14019038F803F89038FE0FF090B5FC15E001DF138001CF1300EBC3F801C0C7FCAAEAFF +FEA51F2C7F9C23>I<397FF00FE039FFF87FF8ECFFFC13FB6CB5FCC613F8ECC078EC8000 +91C7FC5BA25BA35BAA387FFFFCB57EA36C5B1E1D7E9C23>114 D<3801FF9C000F13FE5A +127FA2EAFF0000FC137E48133EA26C131C6C1300EA7FF0383FFF80000F13E06C13F83800 +7FFCEB01FEEB007F0070133F00F8131F7E143F7E38FF80FFEBFFFE14FC14F814F0007013 +80181D7B9C23>I<137013F8A7007FB51280B612C0A36C1480D800F8C7FCACEC01C0EC03 +E0A3EBFC07140F9038FE1FC0EB7FFF158090383FFE00EB0FFCEB07F01B257EA423>I<39 +FF807FC001C013E0A400071303B01407140FEBE03F90B6FC7EA2C613F3EB3FC1201D7F9C +23>I<39FFF03FFCA5390F8007C000071480A2EBC00F00031400A26D5A0001131EA2EBF0 +3E0000133CA2EBF87CEB7878A2EB7CF8EB3CF0A2133F6D5AA36D5A6D5A1E1D7E9C23>I< +39FFF03FFCA539078007C0158013C00003130F1500EA01E05CEBF01E1200A26D5A1378A2 +6D5AA3EB1E7014F0130EEB0FE0A213075CA35CA2130F91C7FCA2EA3E1FEA7F1E133EEA7C +FC127F5B6C5A6C5AEA0F801E2C7E9C23>121 D E /Fk 104[75 2[37 +37 25[42 39 62 42 45 24 32 30 42 45 41 43 66 22 42 17 +22 43 42 25 36 46 33 41 37 6[50 50 50 75 54 58 46 39 +50 1[45 59 62 71 46 2[25 62 57 42 46 58 53 46 58 1[33 +3[19 19 1[37 3[37 37 2[37 45 19 25 19 45 1[25 25 21 35[45 +45 2[{TeXBase1Encoding ReEncodeFont}68 75.000000 /Palatino-Roman +rf /Fl 1 4 df<1338A50060130C00F8133E00FC137E00FE13FE383FBBF83807FFC00001 +1300EA007C48B4FC000713C0383FBBF838FE38FE00FC137E00F8133E0060130C00001300 +A517197B9A22>3 D E /Fm 7 94 df<12C07E12707E7E7E120F6C7E6C7EA26C7E6C7EA2 +1378A2137C133C133E131EA2131F7FA21480A3EB07C0A6EB03E0B2EB07C0A6EB0F80A314 +00A25B131EA2133E133C137C1378A25BA2485A485AA2485A48C7FC120E5A5A5A5A5A1352 +7CBD20>41 D<15301578B3A6007FB812F8B912FCA26C17F8C80078C8FCB3A6153036367B +AF41>43 D48 DI<007FB812F8B912FCA3CCFCAEB912FCA36C17F836167B9F41>61 +D91 D93 D E /Fn 5 111 df97 DI<133EEA07FEA2EA007CA213FCA25BA21201A25BA2120314FCEBE3FF9038EF07 +80D807FC13C0EBF00313E0A2EA0FC014071380A2121FEC0F801300A248EB1F00A2003E14 +06143E127EEC7C0C127C151800FCEB3C30157048EB1FE00070EB0F801F297CA727>104 +D<130E131F5BA2133E131C90C7FCA7EA03E0487EEA0C78EA187C1230A212605B12C0A2EA +01F0A3485AA2485AA2EBC180EA0F81A2381F0300A213066C5A131CEA07F06C5A11287DA6 +17>I<3907801FC0390FE07FF03918F0E0F83930F1807CEBFB00D860FE133C5B5B00C114 +7C5B1201A248485BA34A5AEA07C01660EC03E0A23A0F8007C0C0A2EDC180913803C300D8 +1F0013C7EC01FE000EEB00F8231B7D9929>110 D E /Fo 167[35 +4[28 3[42 5[18 73[{TeXBase1Encoding ReEncodeFont}4 53.333281 +/Palatino-Roman rf /Fp 4 53 df<13E01201120712FF12F91201B3A7487EB512C0A2 +12217AA01E>49 DI<13FF000313C0380F03E0 +381C00F014F8003E13FC147CA2001E13FC120CC712F8A2EB01F0EB03E0EB0FC03801FF00 +A2380003E0EB00F01478147C143E143F1230127812FCA2143E48137E0060137C003813F8 +381E03F0380FFFC00001130018227DA01E>I<14E01301A213031307A2130D131D133913 +31136113E113C1EA01811203EA07011206120C121C12181230127012E0B6FCA2380001E0 +A6EB03F0EB3FFFA218227DA11E>I E /Fq 9 115 df<007FB612FEA2B8FCA36C15FEA228 +077BA133>45 D99 DIII<14E0EB03F8A2497EA36D5AA2EB00E091C8FCAA383FFFF8 +487FA47EEA0001B3AD007FB612C0B712E016F0A216E06C15C0243E78BD33>105 +D<4AB4FC263FFC0713C0267FFE1F13F000FF017F7F91B5FC6CB67E6CEC07FEC6EBF801EC +F0004A7F4A7F5CA291C7FCA35BB3A43B3FFFF80FFFFC486D4813FEB56C4813FFA26C496C +13FE6C496C13FC302C7FAB33>110 DI114 D E /Fr 14 121 df<153815FC14011407EC0FF8EC1FE0 +EC7FC0ECFF00495A495A495A495A5C495A495A49C7FC137E13FE485A5B12035B485AA248 +5AA2121F5B123F90C8FCA35A127EA312FE5AAB127C127EA3123E123FA26C7EA26C7E7F6C +7E120313FC12016C7E137C131C1E426DB92C>40 D<14E0497E80806D7E147FEC3F80141F +EC0FC0A2EC07E0A2EC03F0A3EC01F8A61400A31401A7140315F0A3140715E0A2140F15C0 +141F1580A2EC3F005C147E14FE5C1301495A495AA2495A495A495A49C7FC13FEEA03FC48 +5A485AEA3FE0485A48C8FC5A12F812701D427AB92C>I46 D<903807FFFE497FA36D5BD9007FC7FC147E +A214FEA25CA21301A25CA21303A25CA21307A25CA2130FA25CA2131FA25CA2133FA291C8 +FCA25B161E017E143FA201FE147F167E5BA2000115FE16FC007FB6FCA2B7FC6C15F8A228 +337EB22C>76 D97 D99 D<147F903803FFC0010F13F0013F13F84913FCEBFFC13801FE004848 +137E485AD80FE013FE15FC485A383F800190380007F848133F90B512F015E01580B5EAFE +0014F000FCC8FCA6127E151C007F143E6C6C13FEEBC00F6CB5FC6C14FC6C14F0000114C0 +39007FFE001F2475A32C>101 D104 +D +109 D<3901F007F03907F81FFC390FFC7FFE486CB5FC48B6128090383FFE1F14F8007E13 +F014E0EB7FC012FE00FC1380140049133FC6481400A348485B157EA24913FE0003ECFC18 +167EEBF00115F8000715FE020313FC01E013F015F1000F15F8EDF3F001C013FF6E13E016 +C0496C13806CC7EA3E0027247AA32C>I<14FE903807FF80011F13E04913F090B5FC48EB +83F83903FE01FCEBF800485A4848137E485AA2485A90C7FC5A127EA215FE12FE4814FCA2 +140115F81403EC07F0A2EC0FE0007EEB1FC0EC3F80007F13FFD83F8313006CB45A14F86C +5B000313C0C648C7FC1F2476A32C>I115 DI<90391FC01F809039FFF07FE0489038 +F9FFF8000790B5FC4815FCD81FF013F03A3FC07FE07E9039803FC0FED87F001381007E14 +8300FE140348EC01FC16F891387F00F0C71400147EA214FEA25CA201011418001E157E00 +3F5B127F018314FE00FF15FC01031301D8FE07EB03F839FC0FFC073A7E1FFE1FF0007FB6 +12E06C15C0023F1300390FFC1FFE3903F007F027247AA32C>120 +D E /Fs 107[33 33 25[37 34 55 38 40 22 28 26 1[40 36 +39 59 19 37 1[19 39 37 22 32 41 29 37 33 8[44 66 48 52 +41 35 44 1[40 52 55 63 3[22 55 1[37 1[51 47 41 52 1[29 +3[17 17 1[33 33 2[33 33 1[33 2[17 22 17 2[22 22 18 36[40 +2[{TeXBase1Encoding ReEncodeFont}58 66.666667 /Palatino-Roman +rf /Ft 12 107 df<007FB81280B912C0A26C17803204799641>0 +D14 D +I<007FB812F8B912FCA26C17F8CCFCAD007FB812F8B912FCA26C17F8CCFCAD007FB812F8 +B912FCA26C17F836267BA741>17 D20 D<181EA4181F84A285180785727EA272 +7E727E85197E85F11F80F10FC0F107F0007FBA12FCBCFCA26C19FCCCEA07F0F10FC0F11F +80F13F00197E61614E5A4E5AA24E5A61180F96C7FCA260181EA4482C7BAA53>33 +D<1430A31478A314FCA2497EA2497E497FA2497F90381F7BE090383E79F09038FC78FCD8 +01F8137ED807F0EB3F80D83FE0EB1FF0D8FF80EB07FCD8FE00130100F8EC007C00C0150C +C71400B3B3AD1430264A7EB92A>I<173CA2173E171E171F717E170784717E717E717E84 +007FB87EBAFC8585CBEA03E0F001F8F000FE193FF11FE0F107F8F101FFA2F107F8F11FE0 +F13F0019FEF001F8F003E0BA5A6196C7FC6C5FCB5A604D5A4D5A4D5A60170F4DC8FC171E +173E173CA2482E7BAB53>41 D<91381FFFFE91B6FC1303010F14FED91FF0C7FCEB7F8001 +FEC8FCEA01F8485A485A485A5B48C9FCA2123EA25AA2127812F8A25AA2B712FE16FFA216 +FE00F0C9FCA27EA21278127CA27EA27EA26C7E7F6C7E6C7E6C7EEA00FEEB7F80EB1FF06D +B512FE010314FF1300021F13FE283279AD37>50 D +102 D<12FCEAFFC0EA07F0EA01FCEA007E7F80131F80130FB3A7801307806D7E6D7EEB00 +7EEC1FF0EC07F8EC1FF0EC7E00495A495A495A5C130F5CB3A7131F5C133F91C7FC137E48 +5AEA07F0EAFFC000FCC8FC1D537ABD2A>I<126012F0B3B3B3B3A91260045377BD17>106 +D E /Fu 8 117 df<140EB3A2B812E0A3C7000EC8FCB3A22B2B7DA333>43 +D<13381378EA01F8121F12FE12E01200B3AB487EB512F8A215267BA521>49 +D<13FF000313E0380E03F0381800F848137C48137E00787F12FC6CEB1F80A4127CC7FC15 +005C143E147E147C5C495A495A5C495A010EC7FC5B5B903870018013E0EA018039030003 +0012065A001FB5FC5A485BB5FCA219267DA521>I<13FF000313E0380F01F8381C007C00 +30137E003C133E007E133FA4123CC7123E147E147C5C495AEB07E03801FF8091C7FC3800 +01E06D7E147C80143F801580A21238127C12FEA21500485B0078133E00705B6C5B381F01 +F03807FFC0C690C7FC19277DA521>I<1438A2147814F81301A2130313071306130C131C +131813301370136013C012011380EA03005A120E120C121C5A12305A12E0B612E0A2C7EA +F800A7497E90383FFFE0A21B277EA621>I<0018130C001F137CEBFFF85C5C1480D819FC +C7FC0018C8FCA7137F3819FFE0381F81F0381E0078001C7F0018133EC7FC80A21580A212 +30127C12FCA3150012F00060133E127000305B001C5B380F03E03803FFC0C648C7FC1927 +7DA521>I104 D<13C0A41201A3120312 +07120F121FB512E0A23807C000AC1430A73803E060A23801F0C03800FF80EB3F0014257F +A31A>116 D E /Fv 134[55 50 83 55 61 33 44 39 61 61 55 +61 89 33 61 1[33 61 55 39 50 61 44 61 50 11[78 66 61 +72 1[61 83 83 100 61 2[39 83 1[55 61 83 72 66 78 7[50 +50 50 50 50 50 50 50 50 50 29 25 33 42[61 2[{ +TeXBase1Encoding ReEncodeFont}55 100.000003 /Palatino-Bold +rf /Fw 139[57 1[67 1[105 7[105 2[86 3[86 29[124 9[86 +86 86 86 86 86 86 86 86 86 48[{TeXBase1Encoding ReEncodeFont}17 +172.833377 /Palatino-Bold rf /Fx 94 127 df<121C127FEAFF80B1EA7F00AF123E +C7FCA8121C127FA2EAFF80A3EA7F00A2121C09346FB32C>33 D<003C131E007F137F4814 +80A66C1400A6007E7FA6003E133EA3003C131E001C131C191977B32C>I<010F133C9038 +1F807EA8013F13FE4A5AA4007FB612F0B712F8A4003F15F03A007E01F800A5EBFE0301FC +5BA6003FB612F0B712F8A46C15F03A01F807E000A30003130F01F05BA86C486C5A25337D +B22C>IIIII<143814FC13011303EB07F8EB0FF0EB1FC0EB3F80EB7F0013FE485A485A5B12075B12 +0F5B485AA2123F90C7FCA25A127EA312FE5AAC7E127EA3127F7EA27F121FA26C7E7F1207 +7F12037F6C7E6C7E137FEB3F80EB1FC0EB0FF0EB07F8EB03FC130113001438164272B92C +>I<127012FC7E7E6C7E6C7EEA0FE06C7E6C7E6C7E6C7E137F7F1480131F14C0130FEB07 +E0A214F01303A214F81301A314FC1300AC130114F8A3130314F0A2130714E0A2EB0FC013 +1F1480133F14005B13FE485A485A485A485AEA3FC0485A48C7FC5A5A1270164279B92C> +II<147814FCAF007F +B612F0B712F8A46C15F0C700FCC7FCAF147825267DAB2C>II<007FB6FCB71280A46C150021067B9B2C>I<121FEA3F80EA7FC0EAFF +E0A5EA7FC0EA3F80EA1F000B0B708A2C>I<1507ED0F80151FA2153F16005D157E15FE5D +14015D14035DA214075D140F5D141F5D143F92C7FC5C147E14FE5CA213015C13035C1307 +5C130F5C131F5CA2133F91C8FC5B137E13FE5B12015B12035B12075BA2120F5B121F5B12 +3F90C9FC5A127E12FE5AA25A127821417BB92C>II<1307497EA2131FA2133F137F13FF5A1207127FB5FC13DF139FEA7C1F1200 +B3AE007FB512E0B612F0A36C14E01C3477B32C>IIII<000FB512FE4880A35D0180C8FCADEB83FE90389FFF8090B512E0 +15F8819038FE03FE9038F000FF01C07F49EB3F8090C7121F6C15C0C8120FA2ED07E0A412 +3C127EB4FC150F16C0A248141F007EEC3F80007FEC7F006C6C5B6D485A391FF80FFC6CB5 +5A6C5C000114C06C6C90C7FCEB0FF823347CB22C>II<1278B712C016E0A316C000FCC7EA3F80ED7F0015FE00785CC712 +014A5A4A5A5D140F5D4A5A143F92C7FC5C147E14FE5C13015CA2495AA213075CA3495AA4 +495AA5133F91C8FCAA131E23357CB32C>III<121FEA3F +80EA7FC0EAFFE0A5EA7FC0EA3F80EA1F00C7FCAE121FEA3F80EA7FC0EAFFE0A5EA7FC0EA +3F80EA1F000B2470A32C>II<1507ED1F80153F15FF14034A1300EC1FFC4A5AEC +FFE0491380010790C7FCEB0FFCEB3FF8EB7FE048485A4890C8FCEA0FFEEA1FF8EA7FF0EA +FFC05BA27FEA7FF0EA1FF8EA0FFEEA03FF6C13C06C6C7EEB3FF8EB0FFC6DB4FC01017F6D +13E0EC3FF86E7EEC07FF6E13801400153F151FED0700212A7BAD2C>I<003FB612E04815 +F0B712F8A36C15F0CAFCA8007FB612F0B712F8A36C15F06C15E025147DA22C>I<127012 +FC7E6C7E13E06C7EEA1FFC6C7E3803FF80C67FEB7FF0EB1FF8EB0FFEEB03FF6D13C06D6C +7EEC3FF8EC0FFC6EB4FC0201138080A25C02071300EC0FFCEC3FF8EC7FE049485A4990C7 +FCEB0FFEEB1FF8EB7FF0EBFFC000035BD80FFEC8FC485AEA7FF0485A138048C9FC5A1270 +212A7BAD2C>I +II<14FE497EA4497FA214EFA2130781A214C7A2010F7FA314C390 +381F83F0A590383F01F8A490387E00FCA549137E90B512FEA34880A29038F8003FA34848 +EB1F80A4000715C049130FD87FFEEBFFFC6D5AB514FE6C15FC497E27347EB32C>I<007F +B512E015F8B612FE6C8016C03903F0003FED0FE0ED07F01503A2ED01F8A6ED03F0A21507 +ED0FE0ED1FC0EDFF8090B612005D5D15FF16C09039F0001FE0ED07F0ED03F81501ED00FC +A216FE167EA616FE16FC1501ED03F8150FED3FF0007FB612E016C0B712806CECFE0015F0 +27337FB22C>I<02FF13700107EBE0F84913F9013F13FD4913FFEBFF813901FE007F4848 +131FD807F0130F1507485A491303485A150148C7FCA25A007EEC00F01600A212FE5AAB7E +127EA3007F15F06CEC01F8A26C7EA26C6C13036D14F06C6C130716E0D803FC131F6C6CEB +3FC03A00FF81FF806DB512006D5B010F5B6D13F00100138025357DB32C>I<007FB5FCB6 +12C015F0816C803907E003FEEC00FFED7F80153FED1FC0ED0FE0A2150716F0150316F815 +01A4ED00FCACED01F8A3150316F0A2150716E0150FED1FC0153FED7F80EDFF00EC03FE00 +7FB55AB65A5D15C06C91C7FC26337EB22C>I<007FB612F0B712F8A37E3903F00001A7ED +00F01600A4EC01E04A7EA490B5FCA5EBF003A46E5A91C8FCA5163C167EA8007FB612FEB7 +FCA36C15FC27337EB22C>I<007FB612F8B712FCA37ED803F0C7FCA716781600A515F04A +7EA490B5FCA5EBF001A46E5A92C7FCAD387FFFE0B5FC805C7E26337EB22C>I<903901FC +038090390FFF87C04913EF017F13FF90B6FC4813073803FC01497E4848137F4848133F49 +131F121F5B003F140F90C7FCA2127EED078092C7FCA212FE5AA8913803FFF84A13FCA27E +007E6D13F89138000FC0A36C141FA27F121F6D133F120F6D137F6C7E6C6C13FF6D5A3801 +FF076C90B5FC6D13EF011F13CF6DEB0780D901FCC7FC26357DB32C>II<007FB512F8B612FCA36C14F839000FC000B3B3A5007FB5 +12F8B612FCA36C14F81E3379B22C>I<0107B512804914C0A36D148090390003F000B3AF +1218127EA2B4FCA24A5A48130F007F131F9038C07FC06CB55A6C91C7FC6C5B000313F838 +007FC022347BB22C>II<38 +7FFFE0B57EA36C5BD803F0C8FCB3AE16F0ED01F8A8007FB6FCB7FCA36C15F025337DB22C +>IIII<007FB512C0B612F88115FF6C15802603F00013C0153FED0FE0ED +07F0A2150316F81501A6150316F01507A2ED0FE0ED3FC015FF90B61280160015FC5D15C0 +01F0C8FCB0387FFF80B57EA36C5B25337EB22C>II<387FFFFCB67E15E015F8 +6C803907E007FE1401EC007F6F7E151FA26F7EA64B5AA2153F4BC7FCEC01FE140790B55A +5D15E081819038E007FCEC01FE1400157F81A8160FEE1F80A5D87FFEEB1FBFB5ECFF0081 +5E6C486D5AC8EA01F029347EB22C>I<90381FF80790B5EA0F804814CF000714FF5A381F +F01F383FC003497E48C7FC007E147F00FE143F5A151FA46CEC0F00007E91C7FC127F7FEA +3FE0EA1FFCEBFFC06C13FC0003EBFFC06C14F06C6C7F01077F9038007FFEEC07FF020013 +80153FED1FC0A2ED0FE0A20078140712FCA56CEC0FC0A26CEC1F806D133F01E0EB7F0090 +38FE01FF90B55A5D00F914F0D8F83F13C0D8700790C7FC23357CB32C>I<007FB612FCB7 +12FEA43AFC007E007EA70078153CC71400B3AF90383FFFFCA2497F6D5BA227337EB22C> +I<3B7FFF803FFFC0B56C4813E0A36C496C13C03B03F00001F800B3AF6D130300015DA26D +130700005D6D130F017F495A6D6C485AECE0FF6DB5C7FC6D5B010313F86D5B9038003F80 +2B3480B22C>I +II<3A3FFF +03FFE0484913F0148714076C6D13E03A01F800FE007F0000495A13FE017E5BEB7F03013F +5B1487011F5B14CF010F5B14FF6D5BA26D90C7FCA26D5AA26D5AA2497EA2497EA2497F81 +EB0FCF81EB1FC7EC87F0EB3F83EC03F8EB7F01017E7FEBFE00497F0001147E49137F0003 +80491480151FD87FFEEBFFFC6D5AB514FE6C15FC497E27337EB22C>II<003FB612C04815E0A4 +007EC7EA1FC0ED3F80A2ED7F00157E15FE4A5A003C5CC712034A5AA24A5A4A5AA24A5A4A +C7FCA214FE495AA2495A495AA2495A495AA2495A49C8FCA213FE485AA24848EB03C049EB +07E01207485A5B121F485AA248C7FCB7FCA46C15C023337CB22C>I<387FFFFCB512FEA3 +14FC00FCC7FCB3B3B3B512FC14FEA36C13FC17416FB92C>I<127812F87EA27E127E127F +7E7F121F7F120F7F1207A27F12037F12017F12007F137E137F7F80131FA280130F801307 +801303801301801300A280147E147F8081141F81140F811407811403A281140181140081 +157E157F811680151FA2150FED070021417BB92C>I<387FFFFCB512FEA37EC7127EB3B3 +B3387FFFFEB5FCA36C13FC17417DB92C>I<130EEB3F80EBFFE0000313F8000F13FE487F +D87FF113C0D8FFE013E0EB803F38FE000F007CEB07C00030EB01801B0C78B22C>I<007F +B6FCB71280A46C150021067B7D2C>I<137013F812011203EA07F0EA0FE0EA1FC01380EA +3F00123E127E127CA212FC5AA4EAFF8013C013E0A2127FA2123FEA1FC0EA0F800D1B71B8 +2C>I<3801FFF0000713FE001F6D7E15E048809038C01FF81407EC01FC381F80000006C7 +7EC8127EA3ECFFFE131F90B5FC1203120F48EB807E383FF800EA7FC090C7FC12FE5AA47E +007F14FEEB8003383FE01F6CB612FC6C15FE6C14BF0001EBFE1F3A003FF007FC27247CA3 +2C>II<903803FFE0011F13F8017F13FE48B5FC48804848C6FCEA0FF0485A49137E +4848131890C9FC5A127EA25AA8127EA2127F6C140F6DEB1F806C7E6D133F6C6CEB7F0039 +07FE03FF6CB55A6C5C6C6C5B011F13E0010390C7FC21247AA32C>IIII +II< +1307EB1FC0A2497EA36D5AA20107C7FC90C8FCA7387FFFC080B5FC7EA2EA0007B3A8007F +B512FCB612FEA36C14FC1F3479B32C>I<140EEC3F80A2EC7FC0A3EC3F80A2EC0E0091C7 +FCA748B512804814C0A37EC7120FB3B3A2141F003C1480007E133FB414005CEB01FEEBFF +FC6C5B5C001F5B000790C7FC1A467CB32C>II<387FFFE0B57EA37EEA0003B3B3A5007F +B61280B712C0A36C158022337BB22C>I<3A7F83F007E09039CFFC1FF83AFFDFFE3FFCD8 +7FFF13FF91B57E3A07FE1FFC3E01FCEBF83F496C487E01F013E001E013C0A301C01380B3 +3B7FFC3FF87FF0027F13FFD8FFFE6D13F8D87FFC4913F0023F137F2D2481A32C>I<397F +F01FE039FFF87FFC9038F9FFFE01FB7F6CB6FC00019038F03F80ECC01F02807FEC000F5B +5BA25BB3267FFFE0B5FCB500F11480A36C01E0140029247FA32C>II<397FF01FE0 +39FFF8FFF801FB13FE90B6FC6C158000019038F07FC09138801FE091380007F049EB03F8 +5BED01FC491300A216FE167EA816FE6D14FCA2ED01F86D13036DEB07F0150F9138801FE0 +9138E07FC091B51280160001FB5B01F813F8EC3FC091C8FCAD387FFFE0B57EA36C5B2736 +7FA32C>I<903903FC078090391FFF0FC0017F13CF48B512EF4814FF3807FE07380FF001 +48487E49137F4848133F90C7FC48141F127E150F5AA87E007E141FA26C143F7F6C6C137F +6D13FF380FF0033807FC0F6CB6FC6C14EF6C6C138F6D130FEB07F890C7FCAD0203B5FC4A +1480A36E140029367DA32C>II<90387FF8700003B512F8120F5A5A387FC00F387E00034813015AA36CEB +00F0007F140013F0383FFFC06C13FE6CEBFF80000314E0C66C13F8010113FCEB0007EC00 +FE0078147F00FC143F151F7EA26C143F6D133E6D13FE9038F007FC90B5FC15F815E000F8 +148039701FFC0020247AA32C>I<131E133FA9007FB6FCB71280A36C1500D8003FC8FCB1 +ED03C0ED07E0A5EC800F011FEB1FC0ECE07F6DB51280160001035B6D13F89038003FE023 +2E7EAD2C>I<3A7FF003FF80486C487FA3007F7F0001EB000FB3A3151FA2153F6D137F39 +00FE03FF90B7FC6D15807F6D13CF902603FE07130029247FA32C>I<3A7FFF01FFFCB514 +FE148314016C15FC3A03E0000F80A26D131F00011500A26D5B0000143EA26D137E017C13 +7CA2017E13FC013E5BA2EB3F01011F5BA21483010F5BA214C701075BA214EF01035BA214 +FF6D90C7FCA26D5A147C27247EA32C>II<3A3FFF03FFF048018713F8A36C010313F03A00FC007E005D90387E01F8013F5BEB1F +83EC87E090380FCFC0903807EF80EB03FF6D90C7FC5C6D5A147C14FE130180903803EF80 +903807CFC0EB0FC7EC83E090381F01F0013F7FEB7E00017C137C49137E0001803A7FFF01 +FFFC1483B514FE6C15FC140127247EA32C>I<3A7FFF01FFFCB5008113FE148314816C01 +0113FC3A03E0000F806C7E151F6D140012005D6D133E137C017E137E013E137CA2013F13 +FC6D5BA2EB0F815DA2EB07C1ECC3E0A2EB03E3ECE7C0130114F75DEB00FFA292C7FC80A2 +143EA2147E147CA214FC5CA2EA0C01003F5BEA7F83EB87E0EA7E0F495A387FFF806C90C8 +FC6C5A6C5AEA07E027367EA32C>I<003FB612E04815F0A4007EC7EA1FE0ED3FC0ED7F80 +EDFF004A5A003C495AC7485A4A5A4A5A4A5A4A5A4AC7FCEB01FC495AEB0FF0495A495A49 +5A49C8FC4848EB01E04848EB03F0485A485A485A485A485AB7FCA46C15E024247DA32C> +I<15FF02071380141F147F91B512004913C04AC7FCEB03F85CB31307EB1FE013FF007F5B +B55A49C8FC6D7E6C7FC67F131FEB07F01303B380EB01FEECFFC06D13FF6E1380141F1407 +0200130021417BB92C>I<127812FCB3B3B3A9127806416DB92C>II< +01F81370D803FE13F8380FFF0148138748EBCFF0397F9FFFE0D8FF0F13C0D8FC07138039 +F803FE00387000F81D0A79B22C>I E /Fy 14 121 df<133F14C0EB07F06D7E801301A2 +6D7EA3147FA36E7EA36E7EA36E7EA36E7EA36E7EA36E7EA26E7EA214014A7E5C4A7E9138 +1E3F80143C14784A6C7E1301EB03E049486C7EEB0F80EB1F00496D7E137E5B48486D7E48 +5A485A000F6E7E485A485A48C87E12FE167F4816800070151F293B7CB930>21 +DI<121C127FEAFF80A5EA7F00121C0909798817>58 D<121C127FEAFF80A213C0A3 +127F121C1200A412011380A2120313005A1206120E5A5A5A12600A19798817>II<124012F812FE6C7EEA3FE0EA0FF8EA03FE +C66C7EEB3FE0EB0FF8EB03FE903800FF80EC3FE0EC0FF8EC03FE913800FF80ED3FE0ED0F +F8ED03FE923800FF80EE3FE0EE0FF8EE03FE933800FF80EF3FC0A2EFFF80933803FE00EE +0FF8EE3FE0EEFF80DB03FEC7FCED0FF8ED3FE0EDFF80DA03FEC8FCEC0FF8EC3FE0ECFF80 +D903FEC9FCEB0FF8EB3FE0EBFF80D803FECAFCEA0FF8EA3FE0EAFF8048CBFC12F8126032 +3279AD41>62 D<92391FE00380DBFFFC130002036D5A91390FE01F8F91393F0007DF027E +EB01FE02F81300495A4948147E177C4948143C495AA2011F153891C8FCA3491530A28094 +C7FC80806D7E14FEECFFE06D13FE6DEBFFC06D14F06D806D80021F7F02037FEC003F0303 +7F1500167F163F161FA3120C160FA2001C151F94C7FCA3003C153EA25E003E5D127E007F +4A5A6D495A6DEB0FC0D8F9F0495AD8F0FE01FEC8FC39E03FFFF8010F13E0D8C00190C9FC +313D7CBA33>83 D<16F8ED03FEED0F8792381F0F80ED3E3F167F157CA215FC1700161C4A +48C7FCA414035DA414075DA20107B512F0A39026000FE0C7FC5DA4141F5DA4143F92C8FC +A45C147EA514FE5CA413015CA4495AA45C1307A25C121E123F387F8F80A200FF90C9FC13 +1E12FEEA7C3CEA7878EA1FF0EA07C0294C7CBA29>102 D<14E0EB03F8A21307A314F0EB +01C090C7FCAB13F8EA03FEEA070F000E1380121C121812381230EA701F1260133F00E013 +0012C05BEA007EA213FE5B1201A25B12035BA20007131813E01438000F133013C01470EB +806014E014C01381EB838038078700EA03FEEA00F815397EB71D>105 +D<150FED3F80A2157FA31600151C92C7FCABEC0F80EC3FE0ECF0F0903801C0F849487E14 +005B130E130C131CEB1801133801305BA2EB0003A25DA21407A25DA2140FA25DA2141FA2 +5DA2143FA292C7FCA25CA2147EA214FEA25CA21301001E5B123F387F83F0A238FF87E049 +5A00FE5BD87C1FC8FCEA707EEA3FF8EA0FC0214981B722>I110 D<90390F8003F090391FE00FFC903939F03C1F903A70F8700F80 +903AE0FDE007C09038C0FF80030013E00001491303018015F05CEA038113015CA2D80003 +1407A25CA20107140FA24A14E0A2010F141F17C05CEE3F80131FEE7F004A137E16FE013F +5C6E485A4B5A6E485A90397F700F80DA383FC7FC90387E1FFCEC07E001FEC9FCA25BA212 +01A25BA21203A25B1207B512C0A32C3583A42A>112 D<01F8EB03C0D803FEEB07E0D807 +0F130F000E018013F0121C12180038140700301403D8701F130112601500D8E03F14E000 +C090C7FC5BEA007E16C013FE5B1501000115805B150316001203495B1506150E150C151C +151815385D00015C6D485A6C6C485AD97E0FC7FCEB1FFEEB07F024267EA428>118 +D<903907E001F090391FF807FC9039783E0E0F9039E01F1C1FD801C09038383F803A0380 +0FF07F0100EBE0FF5A000E4A1300000C157E021F133C001C4AC7FC1218A2C7123FA292C8 +FCA25CA2147EA214FEA24A130CA20101141C001E1518003F5BD87F81143801835C00FF15 +60010714E03AFE0E7C01C0D87C1C495A2778383E0FC7FC391FF00FFC3907C003F029267E +A42F>120 D E /Fz 105[42 27[42 46 42 69 46 51 28 37 32 +1[51 46 51 74 28 51 28 28 51 46 32 42 51 37 51 42 10[65 +65 55 51 60 69 51 69 69 83 51 2[32 69 69 46 51 69 60 +55 65 1[37 5[42 42 42 42 42 42 42 42 42 42 25 21 28 21 +50 39[51 51 2[{TeXBase1Encoding ReEncodeFont}64 83.333337 +/Palatino-Bold rf /FA 133[37 42 42 60 42 46 28 32 32 +38 42 37 46 65 23 37 23 23 42 42 23 32 42 34 38 37 3[28 +1[28 1[55 3[65 51 46 2[51 65 1[78 3[28 65 1[46 51 65 +1[51 60 1[42 3[21 21 7[42 42 1[25 21 28 21 2[28 28 23 +65 2[42 31[45 44 2[{TeXBase1Encoding ReEncodeFont}58 +83.333337 /Palatino-Italic rf /FB 64[37 39[83 42 1[42 +42 24[42 46 43 69 47 50 27 35 33 46 50 45 48 73 24 46 +19 24 48 46 28 40 51 37 46 42 3[28 1[28 55 55 55 83 60 +65 51 44 55 65 50 65 69 79 51 60 28 28 69 63 46 51 64 +59 51 65 1[37 1[50 1[21 21 42 42 42 42 42 42 42 42 42 +42 50 21 28 21 50 32 28 28 23 65 2[42 1[23 29[50 50 2[{ +TeXBase1Encoding ReEncodeFont}87 83.333337 /Palatino-Roman +rf /FC 134[115 103 172 115 126 69 92 80 1[126 115 126 +184 69 126 1[69 126 115 80 103 126 92 1[103 12[138 126 +149 1[126 172 172 207 3[80 5[149 1[161 17[61 2[52 41[126 +2[{TeXBase1Encoding ReEncodeFont}35 207.333362 /Palatino-Bold +rf /FD 171[50 1[54 11[42 1[62 2[58 65[{TeXBase1Encoding ReEncodeFont}5 +75.000000 /Palatino-Bold rf /FE 105[37 34[32 30 1[45 +41 1[66 1[42 2[43 2[36 1[33 1[37 14[50 2[59 1[71 18[19 +37 1[37 2[37 1[37 37 37 3[19 44[{ +.167 SlantFont TeXBase1Encoding ReEncodeFont}22 75.000000 +/Palatino-Roman rf /FF 137[66 1[40 53 47 2[66 73 106 +40 2[40 73 2[60 73 2[60 13[73 3[100 10[100 86 80 19[30 +46[{TeXBase1Encoding ReEncodeFont}19 119.999948 /Palatino-Bold +rf /FG 140[39 36 2[50 2[27 3[53 2[44 1[41 1[46 26[51 +17[46 3[46 1[23 46[{TeXBase1Encoding ReEncodeFont}12 +91.666666 /Palatino-Roman rf /FH 138[104 1[76 66 3[104 +1[57 3[104 1[66 85 1[76 1[85 13[104 123 4[170 77[{ +TeXBase1Encoding ReEncodeFont}13 170.833325 /Palatino-Bold +rf end %%EndProlog %%BeginSetup %%Feature: *Resolution 600dpi @@ -1491,8042 +936,9119 @@ TeXDict begin %%EndSetup %%Page: 1 1 -1 0 bop 75 1114 a FG(Scsh)41 b(Reference)i(Manual)p 75 1184 -3901 34 v 2608 1284 a FF(For)22 b(scsh)g(r)n(elease)g(0.4)75 -4280 y FE(Olin)29 b(Shivers)g(and)h(Brian)f(D.)g(Carlstrom)p -75 4350 3901 17 v 365 5147 a FD(November)18 b(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 2907 5071 323 4 v 2907 5173 4 102 v 1707 w FC(DRAFT)p -3226 5173 V 2907 5176 323 4 v eop +1 0 bop 75 1114 a FH(Scsh)41 b(Reference)i(Manual)p 75 +1183 3900 34 v 2608 1283 a FG(For)22 b(scsh)g(r)n(elease)g(0.4)75 +4280 y FF(Olin)29 b(Shivers)g(and)h(Brian)f(D.)g(Carlstrom)p +75 4350 3900 17 v 365 5147 a FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 2907 5071 323 4 v 2907 5173 4 102 v 1811 w +FD(DRAFT)p 3226 5173 V 2907 5176 323 4 v eop %%Page: 2 2 -2 1 bop 681 1303 a FB(Acknowledgements)681 1783 y FA(Who)24 -b(should)f(I)h(thank?)34 b(My)23 b(so-called)g(\252colleagues,\272)f(who)i -(laugh)f(at)g(me)g(behind)h(my)681 1883 y(back,)19 b(all)h(the)g(while)h -(becoming)g(famous)f(on)h Fz(my)e FA(work?)28 b(My)19 b(worthless)i(graduate) -e(stu-)681 1983 y(dents,)h(whose)h(computer)f(skills)h(appear)e(to)h(be)g -(limited)g(to)h(downloading)g(bitmaps)f(of)o(f)681 2082 y(of)k(netnews?)38 -b(My)24 b(par)o(ents,)g(who)h(ar)o(e)e(still)i(waiting)f(for)g(me)h(to)f -(quit)h(\252fooling)g(ar)o(ound)681 2182 y(with)19 b(computers,\272)f(go)g -(to)h(med)e(school,)j(and)d(become)h(a)g(radiologist?)27 b(My)18 -b(department)681 2281 y(chairman,)29 b(a)e(manager)h(who)g(gives)g(one)h(new) -f(insight)h(into)g(and)e(sympathy)i(for)e(dis-)681 2381 y(gr)o(untled)21 -b(postal)g(workers?)805 2506 y(My)i(God,)g(no)h(one)f(could)g(blame)f -(me\320no)i(one!\320if)f(I)g(went)g(of)o(f)f(the)h(edge)f(and)g(just)681 -2605 y(lost)k(it)g(completely)g(one)g(day)-9 b(.)41 b(I)26 -b(couldn't)g(get)g(thr)o(ough)g(the)g(day)f(as)g(it)h(is)g(without)h(the)681 -2705 y(Pr)o(ozac)19 b(and)i(Jack)f(Daniels)i(I)f(keep)f(on)i(the)f(shelf,)g -(behind)g(my)h(T)-8 b(ops-20)20 b(JSYS)g(manuals.)681 2805 -y(I)h(start)g(getting)i(the)e(shakes)h(r)o(eal)e(bad)h(ar)o(ound)g(10am,)f -(right)i(befor)o(e)e(my)i(advisor)f(meet-)681 2904 y(ings.)27 -b(A)17 b(10)g(oz.)g(Jack)g('n)h(Zac)f(helps)h(me)g(get)g(thr)o(ough)g(the)g -(meetings)g(without)h(one)f(of)g(my)681 3004 y(students)h(winding)g(up)g -(with)g(his)h(sever)o(ed)d(head)h(in)h(a)f(bowling-ball)h(bag.)26 -b(They)19 b(look)g(at)681 3103 y(me)k(funny;)h(they)g(think)g(I)f(twitch)h(a) -f(lot.)35 b(I'm)23 b(not)h(twitching.)36 b(I'm)23 b(contr)o(olling)h(my)g -(im-)681 3203 y(pulse)18 b(to)g(snag)g(my)h(9mm)f(Sig-Sauer)e(out)j(fr)o(om)e -(my)i(day-pack)d(and)i(make)g(a)f(few)h(str)o(ong)681 3303 -y(points)k(about)e(the)h(quality)g(of)g(under)o(graduate)e(education)h(in)h -(Amerika.)805 3427 y(If)i(I)f(thought)i(anyone)f(car)o(ed,)e(if)i(I)f -(thought)i(anyone)f(would)g(even)g(be)f(r)o(eading)g(this,)681 -3527 y(I'd)f(pr)o(obably)f(make)h(an)g(ef)o(fort)f(to)h(keep)g(up)g -(appearances)f(until)i(the)f(last)g(possible)h(mo-)681 3626 -y(ment.)27 b(But)20 b(no)h(one)g(does,)f(and)g(no)h(one)f(will.)28 -b(So)20 b(I)g(can)g(pr)o(etty)g(much)g(say)g(exactly)g(what)681 -3726 y(I)h(think.)805 3851 y(Oh,)g(yes,)g(the)g Fz(acknowledgements.)26 -b FA(I)21 b(think)h(not.)28 b(I)21 b(did)f(it.)28 b(I)21 b(did)f(it)h(all,)f -(by)h(myself.)2834 4043 y(Olin)g(Shivers)2834 4143 y(Cambridge)2834 -4243 y(September)e(4,)h(1994)681 5147 y(ii)p 1952 5071 323 -4 v 1952 5173 4 102 v 1251 w FC(DRAFT)p 2271 5173 V 1952 5176 -323 4 v 435 w FD(November)e(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +2 1 bop 681 1303 a FC(Acknowledgements)681 1784 y FB(Who)24 +b(should)g(I)f(thank?)33 b(My)23 b(so-called)g(\223colleagues,\224)f +(who)j(laugh)e(at)g(me)g(behind)h(my)681 1884 y(back,)19 +b(all)h(the)h(while)g(becoming)g(famous)f(on)h FA(my)e +FB(work?)26 b(My)20 b(worthless)h(graduate)e(stu-)681 +1983 y(dents,)h(whose)h(computer)f(skills)h(appear)e(to)h(be)g(limited) +g(to)h(downloading)g(bitmaps)f(of)o(f)681 2083 y(of)k(netnews?)37 +b(My)24 b(par)o(ents,)g(who)h(ar)o(e)e(still)i(waiting)g(for)f(me)g(to) +h(quit)g(\223fooling)g(ar)o(ound)681 2183 y(with)31 b(computers,\224)i +(go)e(to)h(med)e(school,)k(and)d(become)g(a)f(radiologist?)56 +b(My)31 b(depart-)681 2282 y(ment)24 b(chairman,)g(a)f(manager)g(who)i +(gives)f(one)g(new)g(insight)h(into)g(and)e(sympathy)h(for)681 +2382 y(disgr)o(untled)d(postal)g(workers?)805 2506 y(My)i(God,)g(no)h +(one)f(could)g(blame)f(me\227no)i(one!\227if)f(I)g(went)g(of)o(f)f(the) +h(edge)f(and)g(just)681 2606 y(lost)k(it)g(completely)g(one)h(day)-9 +b(.)39 b(I)26 b(couldn't)g(get)g(thr)o(ough)g(the)g(day)f(as)h(it)g(is) +g(without)h(the)681 2706 y(Pr)o(ozac)g(and)g(Jack)g(Daniels)i(I)f(keep) +g(on)h(the)f(shelf,)i(behind)e(my)g(T)-8 b(ops-20)28 +b(JSYS)f(manu-)681 2805 y(als.)43 b(I)27 b(start)f(getting)i(the)e +(shakes)h(r)o(eal)f(bad)g(ar)o(ound)g(10am,)h(right)g(befor)o(e)e(my)i +(advisor)681 2905 y(meetings.)h(A)20 b(10)h(oz.)g(Jack)f('n)i(Zac)f +(helps)g(me)h(get)f(thr)o(ough)h(the)f(meetings)h(without)h(one)681 +3005 y(of)e(my)h(students)g(winding)h(up)f(with)g(his)g(sever)o(ed)e +(head)h(in)h(a)f(bowling-ball)h(bag.)28 b(They)681 3104 +y(look)d(at)f(me)g(funny;)i(they)e(think)h(I)g(twitch)f(a)g(lot.)36 +b(I'm)25 b(not)f(twitching.)37 b(I'm)25 b(contr)o(olling)681 +3204 y(my)19 b(impulse)h(to)g(snag)f(my)h(9mm)f(Sig-Sauer)e(out)j(fr)o +(om)f(my)g(day-pack)f(and)h(make)g(a)f(few)681 3303 y(str)o(ong)j +(points)h(about)e(the)h(quality)h(of)e(under)o(graduate)f(education)h +(in)i(Amerika.)805 3428 y(If)h(I)f(thought)i(anyone)f(car)o(ed,)e(if)i +(I)f(thought)i(anyone)f(would)g(even)g(be)f(r)o(eading)g(this,)681 +3528 y(I'd)f(pr)o(obably)f(make)h(an)g(ef)o(fort)f(to)h(keep)g(up)g +(appearances)f(until)i(the)f(last)g(possible)h(mo-)681 +3627 y(ment.)k(But)20 b(no)h(one)g(does,)f(and)g(no)h(one)g(will.)26 +b(So)21 b(I)f(can)g(pr)o(etty)g(much)h(say)f(exactly)g(what)681 +3727 y(I)h(think.)805 3851 y(Oh,)g(yes,)g(the)g FA(acknowledgements.)k +FB(I)20 b(think)i(not.)k(I)21 b(did)f(it.)26 b(I)21 b(did)f(it)h(all,)g +(by)f(myself.)2834 4044 y(Olin)h(Shivers)2834 4144 y(Cambridge)2834 +4243 y(September)e(4,)h(1994)681 5147 y(ii)p 1952 5071 +323 4 v 1952 5173 4 102 v 1251 w FD(DRAFT)p 2271 5173 +V 1952 5176 323 4 v 538 w FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 3 3 -3 2 bop 365 1307 a FB(Contents)365 1852 y Fy(1)83 b(Introduction)2217 -b(1)490 1981 y FA(1.1)86 b(Obtaining)21 b(scsh)63 b Fx(:)42 -b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f -(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b FA(1)490 2110 y(1.2)86 -b(Building)21 b(scsh)50 b Fx(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h -(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 -b FA(2)490 2239 y(1.3)86 b(Caveats)59 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f -(:)h(:)f(:)h(:)f(:)132 b FA(2)490 2367 y(1.4)86 b(Naming)21 -b(conventions)36 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f -(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b FA(3)490 -2496 y(1.5)86 b(Lexical)20 b(issues)44 b Fx(:)e(:)g(:)f(:)h(:)f(:)h(:)f(:)h -(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)132 b FA(4)681 2625 y(1.5.1)97 b(Extended)20 b(symbol)i(syntax)g -Fx(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f -(:)132 b FA(4)681 2754 y(1.5.2)97 b(Extended)20 b(string)i(syntax)78 -b Fx(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)132 b FA(5)681 2883 y(1.5.3)97 b(Block)21 b(comments)h(and)f -(executable)e(interpr)o(eter)o(-triggers)59 b Fx(:)42 b(:)f(:)132 -b FA(5)681 3011 y(1.5.4)97 b(Her)o(e-strings)81 b Fx(:)41 b(:)h(:)f(:)h(:)g -(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f -(:)132 b FA(5)681 3140 y(1.5.5)97 b(Dot)79 b Fx(:)41 b(:)h(:)g(:)f(:)h(:)f(:) -h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h -(:)f(:)h(:)f(:)132 b FA(7)490 3269 y(1.6)86 b(Recor)o(d)20 -b(types)h(and)f(the)h Fw(define-record)15 b FA(form)80 b Fx(:)42 -b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b FA(7)490 -3398 y(1.7)86 b(A)20 b(wor)o(d)g(about)h(Unix)g(standar)o(ds)29 -b Fx(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)132 b FA(8)365 3611 y Fy(2)83 b(Process)20 b(notation)2035 -b(10)490 3739 y FA(2.1)86 b(Extended)19 b(pr)o(ocess)i(forms)g(and)f(i/o)i(r) -o(edir)o(ections)70 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 -b FA(10)681 3868 y(2.1.1)97 b(Port)22 b(and)e(\256le)h(descriptor)f(sync)85 -b Fx(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)95 -b FA(1)-5 b(1)490 3997 y(2.2)86 b(Pr)o(ocess)20 b(forms)36 -b Fx(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f -(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FA(12)490 -4126 y(2.3)86 b(Using)21 b(extended)f(pr)o(ocess)g(forms)h(in)g(Scheme)75 -b Fx(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 -b FA(13)681 4254 y(2.3.1)97 b(Pr)o(ocedur)o(es)20 b(and)g(special)g(forms)40 -b Fx(:)h(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 -b FA(14)681 4383 y(2.3.2)97 b(Interfacing)21 b(pr)o(ocess)f(output)h(to)g -(Scheme)81 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 -b FA(14)490 4512 y(2.4)86 b(Mor)o(e)19 b(complex)i(pr)o(ocess)g(operations)i -Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:) -91 b FA(16)681 4641 y(2.4.1)97 b(Pids)21 b(and)g(ports)g(together)65 -b Fx(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)91 b FA(17)681 4770 y(2.4.2)97 b(Multiple)21 b(str)o(eam)f(captur)o(e) -39 b Fx(:)j(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)91 b FA(17)490 4898 y(2.5)86 b(Conditional)21 b(pr)o(ocess)g -(sequencing)h(forms)45 b Fx(:)d(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)91 b FA(19)365 5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1226 w FA(iii)p eop +3 2 bop 365 1307 a FC(Contents)365 1852 y Fz(1)83 b(Introduction)2217 +b(1)490 1981 y FB(1.1)86 b(Obtaining)21 b(scsh)63 b Fy(:)42 +b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b FB(1)490 +2110 y(1.2)86 b(Building)21 b(scsh)50 b Fy(:)42 b(:)g(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:) +f(:)h(:)f(:)h(:)f(:)132 b FB(2)490 2239 y(1.3)86 b(Caveats)59 +b Fy(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 +b FB(2)490 2367 y(1.4)86 b(Naming)21 b(conventions)36 +b Fy(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b FB(3)490 2496 +y(1.5)86 b(Lexical)20 b(issues)44 b Fy(:)e(:)g(:)f(:)h(:)f(:)h(:)f(:)h +(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:) +f(:)h(:)f(:)132 b FB(4)681 2625 y(1.5.1)97 b(Extended)20 +b(symbol)i(syntax)g Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b FB(4)681 2754 y(1.5.2)97 +b(Extended)20 b(string)i(syntax)78 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b +FB(5)681 2883 y(1.5.3)97 b(Block)21 b(comments)h(and)f(executable)e +(interpr)o(eter)o(-triggers)59 b Fy(:)42 b(:)f(:)132 +b FB(5)681 3011 y(1.5.4)97 b(Her)o(e-strings)81 b Fy(:)41 +b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h +(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b FB(5)681 3140 y(1.5.5)97 +b(Dot)79 b Fy(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:) +h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 +b FB(7)490 3269 y(1.6)86 b(Recor)o(d)20 b(types)h(and)f(the)h +Fx(define-record)15 b FB(form)80 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:) +h(:)f(:)h(:)f(:)132 b FB(7)490 3398 y(1.7)86 b(A)20 b(wor)o(d)g(about)h +(Unix)g(standar)o(ds)29 b Fy(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b FB(9)365 +3611 y Fz(2)83 b(Process)20 b(notation)2035 b(10)490 +3739 y FB(2.1)86 b(Extended)19 b(pr)o(ocess)i(forms)g(and)f(i/o)i(r)o +(edir)o(ections)70 b Fy(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 +b FB(10)681 3868 y(2.1.1)97 b(Port)22 b(and)e(\002le)h(descriptor)f +(sync)85 b Fy(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:) +h(:)f(:)95 b FB(1)-5 b(1)490 3997 y(2.2)86 b(Pr)o(ocess)20 +b(forms)36 b Fy(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 +b FB(12)490 4126 y(2.3)86 b(Using)21 b(extended)f(pr)o(ocess)g(forms)h +(in)g(Scheme)75 b Fy(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)91 b FB(13)681 4254 y(2.3.1)97 b(Pr)o(ocedur)o(es)20 +b(and)g(special)g(forms)40 b Fy(:)h(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g +(:)f(:)h(:)f(:)h(:)f(:)91 b FB(14)681 4383 y(2.3.2)97 +b(Interfacing)21 b(pr)o(ocess)f(output)h(to)g(Scheme)81 +b Fy(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 +b FB(14)490 4512 y(2.4)86 b(Mor)o(e)19 b(complex)i(pr)o(ocess)g +(operations)i Fy(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)91 b FB(16)681 4641 y(2.4.1)97 b(Pids)21 +b(and)g(ports)g(together)65 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FB(17)681 +4770 y(2.4.2)97 b(Multiple)21 b(str)o(eam)f(captur)o(e)39 +b Fy(:)j(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:) +h(:)f(:)91 b FB(17)490 4898 y(2.5)86 b(Conditional)21 +b(pr)o(ocess)g(sequencing)h(forms)45 b Fy(:)d(:)g(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FB(19)365 5147 y +FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1226 w FB(iii)p eop %%Page: 4 4 -4 3 bop 805 614 a FA(2.6)86 b(Pr)o(ocess)21 b(\256lters)41 -b Fx(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FA(20)681 825 -y Fy(3)82 b(System)20 b(Calls)2164 b(21)805 953 y FA(3.1)86 -b(Err)o(ors)58 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:) -h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:) -90 b FA(21)996 1080 y(3.1.1)98 b(Interactive)20 b(mode)h(and)f(err)o(or)g -(handling)39 b Fx(:)i(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 -b FA(23)805 1207 y(3.2)c(I/O)79 b Fx(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f -(:)h(:)f(:)h(:)f(:)h(:)90 b FA(24)996 1334 y(3.2.1)98 b(Standar)o(d)18 -b(R4RS)j(I/O)h(pr)o(ocedur)o(es)34 b Fx(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:) -f(:)h(:)f(:)h(:)f(:)h(:)90 b FA(24)996 1462 y(3.2.2)98 b(Port)21 -b(manipulation)h(and)e(standar)o(d)f(ports)48 b Fx(:)42 b(:)f(:)h(:)g(:)f(:)h -(:)f(:)h(:)f(:)h(:)90 b FA(24)996 1589 y(3.2.3)98 b(String)21 -b(ports)40 b Fx(:)h(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FA(26)996 1716 -y(3.2.4)98 b(Revealed)20 b(ports)h(and)f(\256le)h(descriptors)36 -b Fx(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 -b FA(26)996 1844 y(3.2.5)98 b(Port-mapping)21 b(machinery)61 -b Fx(:)42 b(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h -(:)90 b FA(29)996 1971 y(3.2.6)98 b(Unix)21 b(I/O)64 b Fx(:)42 -b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g -(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FA(31)996 2098 y(3.2.7)98 b(Buf)o(fer)o(ed)18 -b(I/O)57 b Fx(:)42 b(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FA(36)996 2225 -y(3.2.8)98 b(File)21 b(locking)48 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 -b FA(37)805 2353 y(3.3)c(File)21 b(system)69 b Fx(:)42 b(:)g(:)f(:)h(:)f(:)h -(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h -(:)f(:)h(:)f(:)h(:)90 b FA(38)805 2480 y(3.4)c(Pr)o(ocesses)67 -b Fx(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g -(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b -FA(50)996 2607 y(3.4.1)98 b(Pr)o(ocess)20 b(objects)i(and)e(pr)o(ocess)g(r)o -(eaping)75 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 -b FA(53)996 2735 y(3.4.2)98 b(Pr)o(ocess)20 b(waiting)28 b -Fx(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f -(:)h(:)f(:)h(:)f(:)h(:)90 b FA(56)996 2862 y(3.4.3)98 b(Analysing)21 -b(pr)o(ocess)g(status)f(codes)45 b Fx(:)d(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h -(:)f(:)h(:)f(:)h(:)90 b FA(57)805 2989 y(3.5)c(Pr)o(ocess)21 -b(state)79 b Fx(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:) -g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 -b FA(58)805 3116 y(3.6)c(User)20 b(and)h(gr)o(oup)f(database)f(access)k -Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h -(:)90 b FA(59)805 3244 y(3.7)c(Accessing)21 b(command-line)g(ar)o(guments)49 -b Fx(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 -b FA(60)805 3371 y(3.8)c(System)21 b(parameters)38 b Fx(:)j(:)h(:)f(:)h(:)g -(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f -(:)h(:)90 b FA(62)805 3498 y(3.9)c(Signal)21 b(system)40 b -Fx(:)i(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:) -h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FA(62)805 3626 -y(3.10)44 b(T)-5 b(ime)39 b Fx(:)j(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:) -h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)h(:)90 b FA(62)996 3753 y(3.10.1)56 b(T)-8 b(erminology)70 -b Fx(:)42 b(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h -(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FA(62)996 3880 y(3.10.2)56 -b(Basic)20 b(data)g(types)77 b Fx(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f -(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FA(63)996 -4007 y(3.10.3)56 b(T)-5 b(ime)21 b(zones)59 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f -(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h -(:)90 b FA(64)996 4135 y(3.10.4)56 b(Pr)o(ocedur)o(es)61 b -Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h -(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FA(64)805 4262 y(3.1)-5 -b(1)49 b(Envir)o(onment)22 b(variables)30 b Fx(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 -b FA(68)996 4389 y(3.1)-5 b(1.1)61 b(Path)21 b(lists)g(and)g(colon)g(lists)44 -b Fx(:)d(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h -(:)90 b FA(70)996 4516 y(3.1)-5 b(1.2)61 b Fw($USER)p FA(,)18 -b Fw($HOME)p FA(,)h(and)h Fw($PATH)25 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FA(71)805 4644 -y(3.12)44 b(T)-8 b(erminal)21 b(device)f(contr)o(ol)67 b Fx(:)42 -b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)h(:)90 b FA(71)996 4771 y(3.12.1)56 b(Portability)21 -b(acr)o(oss)f(OS)h(variants)35 b Fx(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:) -f(:)h(:)f(:)h(:)f(:)h(:)90 b FA(71)996 4898 y(3.12.2)56 b(The)21 -b(tty-info)g(r)o(ecor)o(d)e(type)52 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FA(72)681 5147 -y(iv)p 1952 5071 323 4 v 1952 5173 4 102 v 1228 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +4 3 bop 805 614 a FB(2.6)86 b(Pr)o(ocess)21 b(\002lters)41 +b Fy(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:) +h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b +FB(20)681 825 y Fz(3)82 b(System)20 b(Calls)2164 b(21)805 +953 y FB(3.1)86 b(Err)o(ors)58 b Fy(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:) +g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(21)996 1080 y(3.1.1)98 +b(Interactive)20 b(mode)h(and)f(err)o(or)g(handling)39 +b Fy(:)i(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 +b FB(23)805 1207 y(3.2)c(I/O)79 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:) +h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(24)996 1334 y(3.2.1)98 +b(Standar)o(d)18 b(R4RS)j(I/O)h(pr)o(ocedur)o(es)34 b +Fy(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 +b FB(24)996 1462 y(3.2.2)98 b(Port)21 b(manipulation)h(and)e(standar)o +(d)f(ports)48 b Fy(:)42 b(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 +b FB(24)996 1589 y(3.2.3)98 b(String)21 b(ports)40 b +Fy(:)h(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(26)996 1716 +y(3.2.4)98 b(Revealed)20 b(ports)h(and)f(\002le)h(descriptors)36 +b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 +b FB(26)996 1844 y(3.2.5)98 b(Port-mapping)21 b(machinery)61 +b Fy(:)42 b(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)h(:)90 b FB(29)996 1971 y(3.2.6)98 b(Unix)21 b(I/O)64 +b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(31)996 +2098 y(3.2.7)98 b(Buf)o(fer)o(ed)18 b(I/O)57 b Fy(:)42 +b(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g +(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(36)996 2225 y(3.2.8)98 +b(File)21 b(locking)48 b Fy(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 +b FB(37)805 2353 y(3.3)c(File)21 b(system)69 b Fy(:)42 +b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(40)805 +2480 y(3.4)c(Pr)o(ocesses)67 b Fy(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:) +h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)90 b FB(51)996 2607 y(3.4.1)98 b(Pr)o(ocess)20 +b(objects)i(and)e(pr)o(ocess)g(r)o(eaping)75 b Fy(:)41 +b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(54)996 +2735 y(3.4.2)98 b(Pr)o(ocess)20 b(waiting)28 b Fy(:)41 +b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)h(:)90 b FB(57)996 2862 y(3.4.3)98 +b(Analysing)21 b(pr)o(ocess)g(status)f(codes)45 b Fy(:)d(:)f(:)h(:)f(:) +h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(58)805 +2989 y(3.5)c(Pr)o(ocess)21 b(state)79 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:) +h(:)f(:)h(:)f(:)h(:)90 b FB(59)805 3116 y(3.6)c(User)20 +b(and)h(gr)o(oup)f(database)f(access)k Fy(:)41 b(:)h(:)f(:)h(:)g(:)f(:) +h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b +FB(61)805 3244 y(3.7)c(Accessing)21 b(command-line)g(ar)o(guments)49 +b Fy(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:) +90 b FB(61)805 3371 y(3.8)c(System)21 b(parameters)38 +b Fy(:)j(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:) +f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(63)805 3498 +y(3.9)c(Signal)21 b(system)40 b Fy(:)i(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:) +f(:)h(:)90 b FB(63)805 3626 y(3.10)44 b(T)-5 b(ime)39 +b Fy(:)j(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:) +h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 +b FB(67)996 3753 y(3.10.1)56 b(T)-8 b(erminology)70 b +Fy(:)42 b(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(67)996 3880 +y(3.10.2)56 b(Basic)20 b(data)g(types)77 b Fy(:)42 b(:)g(:)f(:)h(:)f(:) +h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 +b FB(68)996 4007 y(3.10.3)56 b(T)-5 b(ime)21 b(zones)59 +b Fy(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(69)996 +4135 y(3.10.4)56 b(Pr)o(ocedur)o(es)61 b Fy(:)41 b(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:) +f(:)h(:)90 b FB(69)805 4262 y(3.1)-5 b(1)49 b(Envir)o(onment)22 +b(variables)30 b Fy(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(73)996 +4389 y(3.1)-5 b(1.1)61 b(Path)21 b(lists)g(and)g(colon)g(lists)44 +b Fy(:)d(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:) +f(:)h(:)90 b FB(75)996 4516 y(3.1)-5 b(1.2)61 b Fx($USER)p +FB(,)18 b Fx($HOME)p FB(,)h(and)h Fx($PATH)25 b Fy(:)41 +b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h +(:)90 b FB(76)805 4644 y(3.12)44 b(T)-8 b(erminal)21 +b(device)f(contr)o(ol)67 b Fy(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:) +f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 +b FB(76)996 4771 y(3.12.1)56 b(Portability)21 b(acr)o(oss)f(OS)h +(variants)35 b Fy(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:) +h(:)f(:)h(:)90 b FB(76)996 4898 y(3.12.2)56 b(Miscellaneous)21 +b(pr)o(ocedur)o(es)33 b Fy(:)42 b(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h +(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FB(77)681 5147 y(iv)p +1952 5071 323 4 v 1952 5173 4 102 v 1228 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226) +f(21)13 b(:)f(47)p eop %%Page: 5 5 -5 4 bop 681 614 a FA(3.12.3)55 b(Using)22 b(tty-info)f(r)o(ecor)o(ds)55 -b Fx(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)91 b FA(74)681 742 y(3.12.4)55 b(Other)21 b(terminal-device)f(pr)o -(ocedur)o(es)69 b Fx(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 -b FA(75)681 869 y(3.12.5)55 b(Contr)o(ol)22 b(terminals,)e(sessions,)i(and)f -(terminal)f(pr)o(ocess)h(gr)o(oups)126 b(76)681 997 y(3.12.6)55 -b(Pseudo-terminals)22 b Fx(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h -(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FA(77)365 1208 -y Fy(4)83 b(Networking)2195 b(85)490 1335 y FA(4.1)86 b(High-level)21 -b(interface)73 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:) -h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FA(85)490 -1462 y(4.2)86 b(Sockets)77 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:) -h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)91 b FA(86)490 1590 y(4.3)86 b(Socket)20 b(addr)o(esses)54 -b Fx(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FA(87)490 1717 -y(4.4)86 b(Socket)20 b(primitives)38 b Fx(:)j(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h -(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 -b FA(88)490 1845 y(4.5)86 b(Performing)21 b(input)g(and)g(output)g(on)g -(sockets)41 b Fx(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 -b FA(90)490 1972 y(4.6)86 b(Socket)20 b(options)76 b Fx(:)42 -b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f -(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FA(91)490 2099 y(4.7)86 -b(Database-information)20 b(entries)56 b Fx(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:) -f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FA(92)365 -2310 y Fy(5)83 b(Strings)20 b(and)f(characters)1821 b(94)490 -2438 y FA(5.1)86 b(String)21 b(manipulation)63 b Fx(:)41 b(:)h(:)f(:)h(:)g(:) -f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:) -91 b FA(94)681 2565 y(5.1.1)97 b(Regular)21 b(expr)o(essions)58 -b Fx(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h -(:)f(:)h(:)f(:)91 b FA(94)681 2693 y(5.1.2)97 b(Other)21 b(string)h -(manipulation)f(facilities)85 b Fx(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)91 b FA(96)681 2820 y(5.1.3)97 b(Manipulating)21 b(\256le-names)85 -b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f -(:)91 b FA(97)490 2947 y(5.2)86 b(ASCII)20 b(encoding)26 b -Fx(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)49 b FA(102)490 3075 -y(5.3)86 b(Character)19 b(sets)27 b Fx(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g -(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f -(:)49 b FA(103)681 3202 y(5.3.1)97 b(Cr)o(eating)20 b(character)g(sets)27 -b Fx(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)49 b FA(103)681 3330 y(5.3.2)97 b(Querying)22 b(character)d(sets) -56 b Fx(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:) -h(:)f(:)49 b FA(103)681 3457 y(5.3.3)97 b(Character)20 b(set)g(algebra)g -Fx(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)49 b FA(104)681 3584 y(5.3.4)97 b(Standar)o(d)19 -b(character)g(sets)74 b Fx(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h -(:)g(:)f(:)h(:)f(:)h(:)f(:)49 b FA(104)365 3795 y Fy(6)83 b(Reading)19 -b(delimited)e(strings)1628 b(105)365 4007 y(7)83 b(A)-6 b(wk,)20 -b(record)h(I/O,)f(and)g(\256eld)f(parsing)1325 b(108)490 4134 -y FA(7.1)86 b(Recor)o(d)20 b(I/O)h(and)g(\256eld)f(parsing)57 -b Fx(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)49 b FA(108)681 4261 y(7.1.1)97 b(Reading)21 b(r)o(ecor)o(ds)68 -b Fx(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g -(:)f(:)h(:)f(:)h(:)f(:)49 b FA(108)681 4389 y(7.1.2)97 b(Parsing)21 -b(\256elds)39 b Fx(:)i(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:) -f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)49 b FA(109)681 4516 -y(7.1.3)97 b(Field)21 b(r)o(eaders)59 b Fx(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)54 -b FA(1)-5 b(12)681 4644 y(7.1.4)97 b(Forwar)o(d-pr)o(ogr)o(ess)19 -b(guarantees)h(and)g(empty-string)i(matches)g Fx(:)54 b FA(1)-5 -b(13)681 4771 y(7.1.5)97 b(Reader)20 b(limitations)57 b Fx(:)42 -b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)54 b FA(1)-5 b(15)490 4898 y(7.2)86 b(A)-6 b(wk)48 b -Fx(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)54 -b FA(1)-5 b(15)365 5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1252 w FA(v)p eop +5 4 bop 681 614 a FB(3.12.3)55 b(The)21 b(tty-info)g(r)o(ecor)o(d)e +(type)52 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:) +f(:)h(:)f(:)h(:)f(:)91 b FB(77)681 742 y(3.12.4)55 b(Using)22 +b(tty-info)f(r)o(ecor)o(ds)55 b Fy(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FB(79)681 +869 y(3.12.5)55 b(Other)21 b(terminal-device)f(pr)o(ocedur)o(es)69 +b Fy(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 +b FB(80)681 997 y(3.12.6)55 b(Contr)o(ol)22 b(terminals,)e(sessions,)i +(and)f(terminal)f(pr)o(ocess)h(gr)o(oups)126 b(81)681 +1124 y(3.12.7)55 b(Pseudo-terminals)22 b Fy(:)41 b(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 +b FB(82)365 1335 y Fz(4)83 b(Networking)2195 b(89)490 +1462 y FB(4.1)86 b(High-level)21 b(interface)73 b Fy(:)41 +b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h +(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FB(89)490 1590 y(4.2)86 +b(Sockets)77 b Fy(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:) +f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h +(:)f(:)91 b FB(90)490 1717 y(4.3)86 b(Socket)20 b(addr)o(esses)54 +b Fy(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FB(91)490 +1845 y(4.4)86 b(Socket)20 b(primitives)38 b Fy(:)j(:)h(:)f(:)h(:)f(:)h +(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:) +f(:)h(:)f(:)91 b FB(92)490 1972 y(4.5)86 b(Performing)21 +b(input)g(and)g(output)g(on)g(sockets)41 b Fy(:)h(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FB(94)490 2099 y(4.6)86 +b(Socket)20 b(options)76 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:) +h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)91 b FB(95)490 2227 y(4.7)86 b(Database-information)20 +b(entries)56 b Fy(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:) +h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FB(96)365 2438 y Fz(5)83 +b(Strings)20 b(and)f(characters)1821 b(98)490 2565 y +FB(5.1)86 b(String)21 b(manipulation)63 b Fy(:)41 b(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:) +f(:)91 b FB(98)681 2693 y(5.1.1)97 b(Regular)21 b(expr)o(essions)58 +b Fy(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)91 b FB(98)681 2820 y(5.1.2)97 b(Other)21 +b(string)h(manipulation)f(facilities)85 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g +(:)f(:)h(:)f(:)h(:)f(:)49 b FB(100)681 2947 y(5.1.3)97 +b(Manipulating)21 b(\002le-names)85 b Fy(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)49 b FB(101)490 +3075 y(5.2)86 b(ASCII)20 b(encoding)26 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:) +h(:)f(:)h(:)f(:)49 b FB(106)490 3202 y(5.3)86 b(Character)19 +b(sets)27 b Fy(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)49 +b FB(107)681 3330 y(5.3.1)97 b(Cr)o(eating)20 b(character)g(sets)27 +b Fy(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)49 b FB(107)681 3457 y(5.3.2)97 b(Querying)22 +b(character)d(sets)56 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)49 b FB(107)681 3584 +y(5.3.3)97 b(Character)20 b(set)g(algebra)g Fy(:)42 b(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)49 +b FB(108)681 3712 y(5.3.4)97 b(Standar)o(d)19 b(character)g(sets)74 +b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)49 b FB(108)365 3923 y Fz(6)83 b(Reading)19 +b(delimited)e(strings)1628 b(109)365 4134 y(7)83 b(A)-6 +b(wk,)20 b(record)h(I/O,)f(and)g(\002eld)f(parsing)1328 +b(1)m(12)490 4261 y FB(7.1)86 b(Recor)o(d)20 b(I/O)h(and)g(\002eld)f +(parsing)57 b Fy(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h +(:)g(:)f(:)h(:)f(:)h(:)f(:)54 b FB(1)-5 b(12)681 4389 +y(7.1.1)97 b(Reading)21 b(r)o(ecor)o(ds)68 b Fy(:)41 +b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)54 b FB(1)-5 b(13)681 4516 y(7.1.2)97 +b(Parsing)21 b(\002elds)39 b Fy(:)i(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)54 +b FB(1)-5 b(13)681 4644 y(7.1.3)97 b(Field)21 b(r)o(eaders)59 +b Fy(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)54 b FB(1)-5 b(16)681 +4771 y(7.1.4)97 b(Forwar)o(d-pr)o(ogr)o(ess)19 b(guarantees)h(and)g +(empty-string)i(matches)g Fy(:)54 b FB(1)-5 b(17)681 +4898 y(7.1.5)97 b(Reader)20 b(limitations)57 b Fy(:)42 +b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)54 b FB(1)-5 b(19)365 5147 y FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p 1636 5071 323 +4 v 1636 5173 4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 +5176 323 4 v 1252 w FB(v)p eop %%Page: 6 6 -6 5 bop 996 614 a FA(7.2.1)98 b(Examples)50 b Fx(:)42 b(:)f(:)h(:)f(:)h(:)g -(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f -(:)h(:)53 b FA(1)-5 b(18)681 822 y Fy(8)82 b(Miscellaneous)18 -b(routines)1731 b(121)805 946 y FA(8.1)86 b(Integer)21 b(bitwise)g(ops)40 -b Fx(:)h(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h -(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FA(121)805 1071 y(8.2)86 -b(List)21 b(pr)o(ocedur)o(es)40 b Fx(:)h(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 -b FA(121)805 1196 y(8.3)86 b(T)-8 b(op)21 b(level)82 b Fx(:)41 -b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FA(121)681 -1403 y Fy(9)82 b(Running)20 b(scsh)2096 b(123)805 1528 y FA(9.1)86 -b(Scsh)21 b(command-line)g(switches)72 b Fx(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:) -h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FA(124)996 -1652 y(9.1.1)98 b(Scripts)20 b(and)h(pr)o(ograms)72 b Fx(:)42 -b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:) -49 b FA(124)996 1777 y(9.1.2)98 b(Inserting)21 b(interpr)o(eter)f(triggers)h -(into)g(scsh)h(pr)o(ograms)62 b Fx(:)41 b(:)h(:)f(:)h(:)49 -b FA(124)996 1901 y(9.1.3)98 b(Module)20 b(system)37 b Fx(:)k(:)h(:)g(:)f(:)h -(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 -b FA(125)996 2026 y(9.1.4)98 b(Switches)84 b Fx(:)42 b(:)f(:)h(:)f(:)h(:)g(:) -f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h -(:)49 b FA(126)996 2150 y(9.1.5)98 b(The)21 b(meta)f(ar)o(gument)76 -b Fx(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)49 b FA(129)996 2275 y(9.1.6)98 b(Examples)50 -b Fx(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FA(131)996 2399 -y(9.1.7)98 b(Pr)o(ocess)20 b(exit)h(values)44 b Fx(:)e(:)f(:)h(:)f(:)h(:)f(:) -h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 -b FA(133)805 2524 y(9.2)86 b(The)21 b(scsh)g(virtual)g(machine)81 -b Fx(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h -(:)f(:)h(:)f(:)h(:)49 b FA(134)996 2648 y(9.2.1)98 b(VM)20 -b(ar)o(guments)50 b Fx(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FA(134)996 -2773 y(9.2.2)98 b(Inserting)21 b(interpr)o(eter)f(triggers)h(into)g(heap)g -(images)69 b Fx(:)42 b(:)f(:)h(:)f(:)h(:)49 b FA(135)996 2897 -y(9.2.3)98 b(Inserting)21 b(a)g(double-level)f(trigger)g(into)i(Scheme)e(pr)o -(ograms)37 b Fx(:)42 b(:)49 b FA(136)805 3022 y(9.3)86 b(Compiling)22 -b(scsh)g(pr)o(ograms)49 b Fx(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f -(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FA(136)805 -3147 y(9.4)86 b(Statically)20 b(linking)i(heap)f(images)26 -b Fx(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)h(:)49 b FA(137)805 3271 y(9.5)86 b(Standar)o(d)19 b(\256le)i -(locations)50 b Fx(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h -(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FA(137)681 3479 -y Fy(10)40 b(Changes)20 b(from)h(the)e(previous)h(release)1304 -b(138)805 3603 y FA(10.1)44 b(New)21 b(featur)o(es)52 b Fx(:)42 -b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f -(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FA(138)805 3728 y(10.2)44 -b(Incompatible)21 b(impr)o(ovements)i Fx(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f -(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FA(140)805 -3852 y(10.3)44 b(Backwar)o(ds-compatible)19 b(impr)o(ovements)55 -b Fx(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 -b FA(142)681 4060 y Fy(1)m(1)43 b(T)-9 b(odo)2427 b(145)681 -5147 y FA(vi)p 1952 5071 323 4 v 1952 5173 4 102 v 1228 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +6 5 bop 805 614 a FB(7.2)86 b(A)-6 b(wk)48 b Fy(:)42 +b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)53 +b FB(1)-5 b(19)996 739 y(7.2.1)98 b(Examples)50 b Fy(:)42 +b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FB(122)681 946 +y Fz(8)82 b(Miscellaneous)18 b(routines)1731 b(125)805 +1071 y FB(8.1)86 b(Integer)21 b(bitwise)g(ops)40 b Fy(:)h(:)h(:)f(:)h +(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:) +f(:)h(:)f(:)h(:)49 b FB(125)805 1196 y(8.2)86 b(List)21 +b(pr)o(ocedur)o(es)40 b Fy(:)h(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 +b FB(125)805 1320 y(8.3)86 b(T)-8 b(op)21 b(level)82 +b Fy(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h +(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 +b FB(125)681 1528 y Fz(9)82 b(Running)20 b(scsh)2096 +b(127)805 1652 y FB(9.1)86 b(Scsh)21 b(command-line)g(switches)72 +b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)49 b FB(128)996 1777 y(9.1.1)98 b(Scripts)20 +b(and)h(pr)o(ograms)72 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FB(128)996 +1901 y(9.1.2)98 b(Inserting)21 b(interpr)o(eter)f(triggers)h(into)g +(scsh)h(pr)o(ograms)62 b Fy(:)41 b(:)h(:)f(:)h(:)49 b +FB(128)996 2026 y(9.1.3)98 b(Module)20 b(system)37 b +Fy(:)k(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g +(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FB(129)996 2150 y(9.1.4)98 +b(Switches)84 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h +(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 +b FB(130)996 2275 y(9.1.5)98 b(The)21 b(meta)f(ar)o(gument)76 +b Fy(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)49 b FB(133)996 2399 y(9.1.6)98 b(Examples)50 +b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FB(135)996 +2524 y(9.1.7)98 b(Pr)o(ocess)20 b(exit)h(values)44 b +Fy(:)e(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)49 b FB(138)805 2648 y(9.2)86 b(The)21 +b(scsh)g(virtual)g(machine)81 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g +(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 +b FB(138)996 2773 y(9.2.1)98 b(VM)20 b(ar)o(guments)50 +b Fy(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h +(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FB(139)996 2897 y(9.2.2)98 +b(Inserting)21 b(interpr)o(eter)f(triggers)h(into)g(heap)g(images)69 +b Fy(:)42 b(:)f(:)h(:)f(:)h(:)49 b FB(140)996 3022 y(9.2.3)98 +b(Inserting)21 b(a)g(double-level)f(trigger)g(into)i(Scheme)e(pr)o +(ograms)37 b Fy(:)42 b(:)49 b FB(140)805 3147 y(9.3)86 +b(Compiling)22 b(scsh)g(pr)o(ograms)49 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 +b FB(140)805 3271 y(9.4)86 b(Statically)20 b(linking)i(heap)f(images)26 +b Fy(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)49 b FB(141)805 3396 y(9.5)86 b(Standar)o(d)19 +b(\002le)i(locations)50 b Fy(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g +(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 +b FB(141)681 3603 y Fz(10)40 b(Changes)20 b(from)h(the)e(previous)h +(release)1304 b(143)805 3728 y FB(10.1)44 b(New)21 b(featur)o(es)52 +b Fy(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 +b FB(143)805 3852 y(10.2)44 b(Incompatible)21 b(impr)o(ovements)i +Fy(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)49 b FB(145)805 3977 y(10.3)44 b(Backwar)o +(ds-compatible)19 b(impr)o(ovements)55 b Fy(:)42 b(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FB(147)681 4184 +y Fz(1)m(1)43 b(T)-9 b(odo)2427 b(150)681 5147 y FB(vi)p +1952 5071 323 4 v 1952 5173 4 102 v 1228 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226) +f(21)13 b(:)f(47)p eop %%Page: 1 7 -1 6 bop 365 1264 a Fv(Chapter)45 b(1)365 1707 y FB(Introduction)365 -2166 y FA(This)25 b(is)f(a)f(draft)g(manual)g(for)h(scsh,)h(a)e(Unix)g(shell) -i(that)f(is)g(embedded)e(within)j(Scheme.)365 2265 y(Scsh)17 -b(is)g(a)f(Scheme)h(system)g(designed)g(for)f(writing)i(useful)f(standalone)f -(Unix)h(pr)o(ograms)365 2365 y(and)24 b(shell)g(scripts\320it)h(spans)f(a)f -(wide)h(range)f(of)h(application,)h(fr)o(om)e(\252script\272)g(applica-)365 -2465 y(tions)k(usually)f(handled)f(with)i(perl)e(or)g(sh,)j(to)e(mor)o(e)f -(standar)o(d)f(systems)i(applications)365 2564 y(usually)21 -b(written)h(in)f(C.)490 2691 y(Scsh)i(comes)g(built)g(on)h(top)f(of)g(Scheme) -f(48,)h(and)f(has)h(two)h(components:)33 b(a)22 b(pr)o(ocess)365 -2791 y(notation)d(for)f(r)o(unning)h(pr)o(ograms)f(and)f(setting)i(up)f -(pipelines)g(and)f(r)o(edir)o(ections,)h(and)f(a)365 2890 y(complete)g -(syscall)h(library)e(for)h(low-level)g(access)f(to)h(the)h(operating)e -(system.)27 b(This)18 b(man-)365 2990 y(ual)28 b(gives)h(a)e(complete)i -(description)f(of)g(scsh.)51 b(A)28 b(general)f(discussion)j(of)e(the)g -(design)365 3090 y(principles)21 b(behind)g(scsh)h(can)e(be)g(found)h(in)g(a) -g(companion)h(paper)-6 b(,)19 b(\252A)h(Scheme)g(Shell.\272)365 -3373 y Fu(1.1)99 b(Obtaining)26 b(scsh)365 3590 y FA(Scsh)g(is)h(distributed) -f(via)f(net)i(publication.)44 b(W)-8 b(e)26 b(place)f(new)i(r)o(eleases)e(at) -g(well-known)365 3690 y(network)i(sites,)h(and)e(allow)g(them)h(to)g(pr)o -(opagate)d(fr)o(om)i(ther)o(e.)43 b(W)-8 b(e)26 b(curr)o(ently)g(r)o(elease) -365 3789 y(scsh)c(to)f(the)g(following)h(Internet)f(sites:)573 -3932 y Fw(ftp://ftp-swiss.)o(ai)o(.mi)o(t.)o(edu)o(/p)o(ub)o(/su)o(/)573 -4031 y(http://www-swiss)o(.a)o(i.m)o(it)o(.ed)o(u/)o(sc)o(sh/)o(sc)o(sh.)o -(ht)o(ml)573 4131 y(http://www.cs.in)o(di)o(ana)o(.e)o(du/)o(sc)o(he)o(me-)o -(re)o(pos)o(it)o(or)o(y/)365 4273 y FA(These)d(sites)h(ar)o(e)d(the)j(MIT)e -(Pr)o(oject)h(Mac)f(ftp)h(server)-6 b(,)17 b(the)h(Scheme)g(Shell)g(home)h -(page,)e(the)365 4373 y(Indiana)j(Scheme)g(Repository)h(home)g(page,)e(r)o -(espectively)-9 b(.)26 b(Each)20 b(should)h(have)f(a)f(com-)365 -4473 y(pr)o(essed)e(tar)g(\256le)h(of)f(the)h(entir)o(e)f(scsh)h(r)o(elease,) -f(which)h(includes)g(all)g(the)g(sour)o(ce)f(code)g(and)365 -4572 y(the)23 b(manual,)g(and)g(a)f(separate)f(\256le)i(containing)h(just)g -(this)f(manual)g(in)g(Postscript)h(form,)365 4672 y(for)d(those)g(who)h -(simply)g(wish)f(to)g(r)o(ead)e(about)i(the)g(system.)490 4799 -y(However)-6 b(,)24 b(nothing)i(is)e(certain)g(for)g(long)h(on)f(the)g(Net.) -38 b(Pr)o(obably)23 b(the)h(best)g(way)g(to)365 4898 y(get)19 -b(a)e(copy)i(of)f(scsh)h(is)g(to)g(use)f(a)g(network)h(r)o(esour)o -(ce-discovery)d(tool,)k(such)f(as)f(ar)o(chie,)f(to)365 5147 -y FD(November)h(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 -323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 -5176 323 4 v 1257 w FA(1)p eop -%%Page: 2 8 -2 7 bop 681 614 a FA(\256nd)17 b(ftp)f(servers)g(storing)i(scsh)g(tar)e -(\256les.)26 b(T)-8 b(ake)17 b(the)g(set)g(of)f(sites)h(storing)h(the)f(most) -h(r)o(ecent)681 714 y(r)o(elease)h(of)i(scsh,)g(choose)g(one)h(close)f(to)g -(your)g(site,)g(and)f(download)h(the)g(tar)f(\256le.)681 994 -y Fu(1.2)99 b(Building)26 b(scsh)681 1210 y FA(Scsh)35 b(curr)o(ently)g(r)o -(uns)h(on)f(a)g(fairly)g(lar)o(ge)f(set)h(of)g(Unix)h(systems,)j(including)d -(Linux,)681 1310 y(NetBSD,)28 b(SunOS,)h(Solaris,)i(AIX,)e(NeXTSTEP)-11 -b(,)29 b(Irix,)i(and)e(HP-UX.)g(W)-8 b(e)29 b(use)h(the)f(Gnu)681 -1409 y(pr)o(oject's)14 b(autocon\256g)h(tool)h(to)e(generate)g -(self-con\256guring)h(shell)g(scripts)g(that)f(customise)681 -1509 y(the)25 b(scsh)g(Make\256le)f(for)g(dif)o(fer)o(ent)f(OS)h(variants.)39 -b(This)25 b(means)g(that)g(if)f(you)h(use)g(one)g(of)681 1609 -y(the)i(common)i(Unix)e(implementations,)i(building)f(scsh)g(should)g(r)o -(equir)o(e)d(exactly)i(the)681 1708 y(following)22 b(steps:)938 -1850 y Fw(gunzip)41 b(scsh-0.4.0.tar.gz)159 b Fz(Uncompr)o(ess)20 -b(the)g(r)o(elease)i(tar)f(\256le.)938 1950 y Fw(untar)42 b(xfv)g -(scsh-0.4.0.tar)160 b Fz(Unpack)20 b(the)g(sour)o(ce)h(code.)938 -2050 y Fw(cd)43 b(scsh-0.4.0)641 b Fz(Move)21 b(to)f(the)h(sour)o(ce)f(dir)o -(ectory)m(.)938 2149 y Fw(./configure)728 b Fz(Examine)20 b(host;)g(build)h -(Make\256le.)938 2249 y Fw(make)1036 b Fz(Build)21 b(system.)681 -2388 y FA(When)16 b(you)f(ar)o(e)f(done,)j(you)f(should)g(have)f(a)f(virtual) -h(machine)h(compiled)f(in)h(\256le)g Fw(scshvm)p FA(,)681 2488 -y(and)k(a)g(heap)h(image)f(in)h(\256le)g Fw(scsh/scsh.image)p -FA(.)h(T)-7 b(yping)888 2681 y Fw(make)42 b(install)681 2973 -y FA(will)63 b(install)f(these)h(pr)o(ograms)e(in)i(your)f(installation)h -(dir)o(ectory)f(\(by)f(default,)681 3073 y Fw(/usr/local)p -FA(\),)16 b(along)21 b(with)h(a)e(small)h(stub)g(startup)f(binary)-9 -b(,)20 b Fw(scsh)p FA(.)805 3199 y(If)26 b(you)h(don't)g(have)f(the)h -(patience)f(to)h(do)f(this,)j(you)e(can)f(start)g(up)g(a)g(Scheme)g(shell)681 -3298 y(immediately)21 b(after)e(the)i(initial)g(make)g(by)g(simply)g(saying) -888 3439 y Fw(./scshvm)41 b(-o)h(./scshvm)f(-i)h(scsh/scsh.image)681 -3579 y FA(See)20 b(chapter)g(9)g(for)g(full)h(details)g(on)g(installation)h -(locations)f(and)g(startup)f(options.)805 3705 y(It)i(is)f(not)i(too)f(dif)o -(\256cult)f(to)g(port)h(scsh)g(to)g(another)f(Unix)g(platform)g(if)h(your)f -(OS)h(is)f(not)681 3804 y(supported)e(by)g(the)g(curr)o(ent)g(r)o(elease.)25 -b(See)19 b(the)g(r)o(elease)f(notes)i(for)f(mor)o(e)f(details)h(on)h(how)681 -3904 y(to)h(do)g(this.)681 4185 y Fu(1.3)99 b(Caveats)681 4400 -y FA(It)19 b(is)g(important)g(to)g(note)h(what)f(scsh)g(is)g -Fz(not)p FA(,)g(as)g(well)g(as)f(what)h(it)g(is.)28 b(Scsh,)19 -b(in)g(the)g(curr)o(ent)681 4500 y(r)o(elease,)28 b(is)g(primarily)g -(designed)g(for)g(the)g(writing)h(of)f(shell)h(scripts\320pr)o(ogramming.)681 -4599 y(It)e(is)g(not)g(a)g(very)f(comfortable)h(system)g(for)g(interactive)f -(command)h(use:)40 b(the)27 b(curr)o(ent)681 4699 y(r)o(elease)22 -b(lacks)h(job)h(contr)o(ol,)h(command-line)f(editing,)g(a)f(terse,)g -(convenient)i(command)681 4799 y(syntax,)36 b(and)c(it)h(does)g(not)g(r)o -(ead)f(in)h(an)g(initialisation)h(\256le)f(analogous)g(to)h -Fw(.login)c FA(or)681 4898 y Fw(.profile)p FA(.)43 b(W)-8 b(e)28 -b(hope)f(to)h(addr)o(ess)e(all)h(of)g(these)g(issues)h(in)g(futur)o(e)e(r)o -(eleases;)j(we)e(even)681 5147 y(2)p 1952 5071 323 4 v 1952 -5173 4 102 v 1257 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 -v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p +1 6 bop 365 1276 a Fw(Chapter)45 b(1)365 1730 y FC(Introduction)365 +2200 y FB(This)25 b(is)f(a)f(draft)g(manual)g(for)h(scsh,)h(a)e(Unix)g +(shell)i(that)f(is)g(embedded)e(within)j(Scheme.)365 +2300 y(Scsh)17 b(is)g(a)f(Scheme)h(system)g(designed)g(for)f(writing)i +(useful)f(standalone)f(Unix)h(pr)o(ograms)365 2400 y(and)24 +b(shell)g(scripts\227it)h(spans)f(a)f(wide)h(range)f(of)h(application,) +h(fr)o(om)e(\223script\224)g(applica-)365 2499 y(tions)k(usually)f +(handled)f(with)i(perl)e(or)g(sh,)j(to)e(mor)o(e)f(standar)o(d)f +(systems)i(applications)365 2599 y(usually)21 b(written)h(in)f(C.)490 +2737 y(Scsh)i(comes)g(built)h(on)f(top)h(of)f(Scheme)f(48,)h(and)f(has) +h(two)h(components:)31 b(a)23 b(pr)o(ocess)365 2837 y(notation)i(for)f +(r)o(unning)h(pr)o(ograms)e(and)h(setting)g(up)g(pipelines)g(and)g(r)o +(edir)o(ections,)f(and)365 2936 y(a)29 b(complete)h(syscall)f(library)g +(for)g(low-level)h(access)e(to)i(the)g(operating)f(system.)52 +b(This)365 3036 y(manual)26 b(gives)g(a)f(complete)h(description)g(of)g +(scsh.)40 b(A)26 b(general)f(discussion)i(of)f(the)f(de-)365 +3136 y(sign)31 b(principles)e(behind)h(scsh)g(can)f(be)g(found)g(in)h +(a)f(companion)h(paper)-6 b(,)30 b(\223A)f(Scheme)365 +3235 y(Shell.\224)365 3548 y Fv(1.1)99 b(Obtaining)26 +b(scsh)365 3781 y FB(Scsh)h(is)f(distributed)g(via)g(net)g +(publication.)43 b(W)-8 b(e)26 b(place)g(new)g(r)o(eleases)f(at)h +(well-known)365 3880 y(network)h(sites,)h(and)e(allow)h(them)g(to)f(pr) +o(opagate)f(fr)o(om)h(ther)o(e.)42 b(W)-8 b(e)26 b(curr)o(ently)g(r)o +(elease)365 3980 y(scsh)c(to)f(the)g(following)h(Internet)f(sites:)573 +4140 y Fx(ftp://ftp-swiss.)o(ai)o(.mi)o(t.)o(edu)o(/p)o(ub)o(/su)o(/) +573 4240 y(http://www-swiss)o(.a)o(i.m)o(it)o(.ed)o(u/)o(sc)o(sh/)o(sc) +o(sh.)o(ht)o(ml)573 4340 y(http://www.cs.in)o(di)o(ana)o(.e)o(du/)o(sc) +o(he)o(me-)o(re)o(pos)o(it)o(or)o(y/)365 4500 y FB(These)16 +b(sites)h(ar)o(e)e(the)h(MIT)g(Pr)o(oject)g(Mac)f(ftp)h(server)-6 +b(,)16 b(the)g(Scheme)g(Shell)g(home)h(page,)f(and)365 +4599 y(the)26 b(Indiana)g(Scheme)g(Repository)h(home)g(page,)f(r)o +(espectively)-9 b(.)40 b(Each)26 b(should)h(have)e(a)365 +4699 y(compr)o(essed)18 b(tar)f(\002le)h(of)g(the)g(entir)o(e)f(scsh)h +(r)o(elease,)f(which)i(includes)f(all)f(the)h(sour)o(ce)g(code)365 +4799 y(and)27 b(the)h(manual,)h(and)e(a)h(separate)e(\002le)i +(containing)g(just)h(this)f(manual)g(in)g(Postscript)365 +4898 y(form,)21 b(for)f(those)i(who)f(simply)h(wish)g(to)f(r)o(ead)e +(about)i(the)g(system.)365 5147 y FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21) +13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 +w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1257 w FB(1)p eop +%%Page: 2 8 +2 7 bop 805 614 a FB(However)-6 b(,)25 b(nothing)h(is)e(certain)g(for)g +(long)h(on)g(the)f(Net.)36 b(Pr)o(obably)23 b(the)h(best)h(way)f(to)681 +714 y(get)h(a)f(copy)h(of)g(scsh)g(is)g(to)h(use)e(a)h(network)g(r)o +(esour)o(ce-discovery)e(tool,)k(such)e(as)f(ar)o(chie,)681 +814 y(to)j(\002nd)f(ftp)g(servers)g(storing)h(scsh)g(tar)f(\002les.)43 +b(T)-8 b(ake)26 b(the)h(set)f(of)g(sites)h(storing)h(the)e(most)681 +913 y(r)o(ecent)20 b(r)o(elease)f(of)i(scsh,)g(choose)g(one)g(close)g +(to)h(your)f(site,)f(and)h(download)g(the)g(tar)f(\002le.)681 +1194 y Fv(1.2)99 b(Building)26 b(scsh)681 1409 y FB(Scsh)35 +b(curr)o(ently)g(r)o(uns)h(on)f(a)g(fairly)g(lar)o(ge)f(set)h(of)g +(Unix)h(systems,)j(including)d(Linux,)681 1509 y(NetBSD,)28 +b(SunOS,)h(Solaris,)i(AIX,)e(NeXTSTEP)-11 b(,)29 b(Irix,)i(and)e +(HP-UX.)g(W)-8 b(e)29 b(use)h(the)f(Gnu)681 1609 y(pr)o(oject's)38 +b(autocon\002g)i(tool)f(to)g(generate)f(self-con\002guring)h(shell)g +(scripts)g(that)f(cus-)681 1708 y(tomise)24 b(the)h(scsh)f(Make\002le)f +(for)h(dif)o(fer)o(ent)d(OS)j(variants.)35 b(This)24 +b(means)g(that)g(if)g(you)g(use)681 1808 y(one)30 b(of)g(the)g(common)i +(Unix)e(implementations,)j(building)e(scsh)f(should)h(r)o(equir)o(e)e +(ex-)681 1907 y(actly)20 b(the)h(following)h(steps:)938 +2050 y Fx(gunzip)41 b(scsh-0.4.0.tar.gz)159 b FA(Uncompr)o(ess)20 +b(the)g(r)o(elease)i(tar)f(\002le.)938 2149 y Fx(untar)42 +b(xfv)g(scsh-0.4.0.tar)160 b FA(Unpack)20 b(the)g(sour)o(ce)h(code.)938 +2249 y Fx(cd)43 b(scsh-0.4.0)641 b FA(Move)21 b(to)f(the)h(sour)o(ce)f +(dir)o(ectory)m(.)938 2349 y Fx(./configure)728 b FA(Examine)20 +b(host;)g(build)h(Make\002le.)938 2448 y Fx(make)1036 +b FA(Build)21 b(system.)681 2588 y FB(When)40 b(you)g(ar)o(e)f(done,)44 +b(you)d(should)f(have)g(a)f(virtual)g(machine)i(compiled)f(in)g(\002le) +681 2687 y Fx(scshvm)p FB(,)18 b(and)i(a)g(heap)h(image)f(in)i(\002le)e +Fx(scsh/scsh.image)p FB(.)g(T)-7 b(yping)888 2880 y Fx(make)42 +b(install)681 3173 y FB(will)63 b(install)f(these)h(pr)o(ograms)e(in)i +(your)f(installation)h(dir)o(ectory)f(\(by)f(default,)681 +3272 y Fx(/usr/local)p FB(\),)16 b(along)21 b(with)h(a)e(small)h(stub)g +(startup)f(binary)-9 b(,)20 b Fx(scsh)p FB(.)805 3398 +y(If)26 b(you)h(don't)g(have)f(the)h(patience)f(to)h(do)f(this,)j(you)e +(can)f(start)g(up)g(a)g(Scheme)g(shell)681 3498 y(immediately)21 +b(after)e(the)i(initial)g(make)g(by)g(simply)g(saying)888 +3638 y Fx(./scshvm)41 b(-o)h(./scshvm)f(-i)h(scsh/scsh.image)681 +3778 y FB(See)20 b(chapter)g(9)g(for)g(full)h(details)g(on)g +(installation)h(locations)f(and)g(startup)f(options.)805 +3904 y(It)i(is)f(not)i(too)f(dif)o(\002cult)f(to)g(port)h(scsh)g(to)g +(another)f(Unix)g(platform)g(if)h(your)f(OS)h(is)f(not)681 +4004 y(supported)e(by)g(the)h(curr)o(ent)e(r)o(elease.)24 +b(See)18 b(the)i(r)o(elease)e(notes)i(for)f(mor)o(e)g(details)g(on)h +(how)681 4103 y(to)h(do)g(this.)681 4384 y Fv(1.3)99 +b(Caveats)681 4599 y FB(It)19 b(is)g(important)h(to)f(note)g(what)g +(scsh)h(is)f FA(not)p FB(,)g(as)g(well)g(as)g(what)g(it)g(is.)25 +b(Scsh,)19 b(in)h(the)f(curr)o(ent)681 4699 y(r)o(elease,)28 +b(is)g(primarily)g(designed)g(for)g(the)g(writing)h(of)f(shell)h +(scripts\227pr)o(ogramming.)681 4799 y(It)e(is)g(not)h(a)e(very)h +(comfortable)g(system)g(for)g(interactive)f(command)i(use:)38 +b(the)27 b(curr)o(ent)681 4898 y(r)o(elease)22 b(lacks)h(job)h(contr)o +(ol,)h(command-line)f(editing,)g(a)f(terse,)g(convenient)i(command)681 +5147 y(2)p 1952 5071 323 4 v 1952 5173 4 102 v 1257 w +FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 3 9 -3 8 bop 365 614 a FA(have)22 b(designs)i(for)e(several)g(of)h(these)f(featur) -o(es;)g(but)h(the)g(system)g(as-r)o(eleased)d(does)j(not)365 -714 y(curr)o(ently)e(pr)o(ovide)e(these)i(featur)o(es.)490 -839 y(In)h(the)g(curr)o(ent)f(r)o(elease,)g(the)h(system)h(has)f(some)g(r)o -(ough)h(edges.)30 b(It)22 b(is)h(quite)f(slow)h(to)365 938 -y(start)16 b(up;)i(we)e(hope)h(to)f(\256x)g(that)h(by)f(pr)o(oviding)g(a)g -(static-heap)f(linker)i(in)g(the)f(next)g(r)o(elease.)365 1038 -y(For)21 b(now)-8 b(,)22 b(the)f(initial)g(image)g(load)f(takes)h(about)g(a)f -(cpu)g(second.)490 1162 y(This)i(manual)f(is)h(very)-9 b(,)20 -b(very)h(r)o(ough:)29 b(incomplete,)22 b(inconsistent,)g(and)f(misleading.) -365 1262 y(At)c(some)h(point,)h(we)e(will)h(polish)h(it)e(up,)h(\256nish)h -(it)e(of)o(f,)g(and)g(r)o(e-typeset)f(it)i(using)g(markup,)365 -1362 y(so)30 b(we)f(can)g(generate)f(html,)k(info)d(nodes,)i(and)e(T)1990 -1381 y(E)2030 1362 y(X)h(output)f(fr)o(om)g(the)g(single)h(sour)o(ce)365 -1461 y(without)22 b(having)f(to)h(deal)d(with)j(T)-8 b(exinfo.)28 -b(But)20 b(it's)i(all)e(ther)o(e)g(is,)h(for)g(now)-8 b(.)365 -1736 y Fu(1.4)99 b(Naming)25 b(conventions)365 1950 y FA(Scsh)18 -b(follows)h(a)f(general)f(naming)i(scheme)f(that)g(consistently)i(employs)f -(a)e(set)i(of)f(abbr)o(e-)365 2050 y(viations.)41 b(This)26 -b(is)g(intended)f(to)g(make)g(it)g(easier)f(to)i(r)o(emember)e(the)h(names)g -(of)h(things.)365 2150 y(Some)21 b(of)g(the)g(common)h(ones)f(ar)o(e:)365 -2331 y Fw(fdes)40 b FA(Means)30 b(\252\256le)g(descriptor)-6 -b(,\272)31 b(a)e(small)i(integer)f(used)g(in)h(Unix)f(to)g(r)o(epr)o(esent)f -(I/O)573 2430 y(channels.)365 2591 y Fx(:)14 b(:)g(:)g Fw(*)41 -b FA(A)14 b(given)g(bit)g(of)g(functionality)h(sometimes)g(comes)g(in)g(two)f -(r)o(elated)f(forms,)i(the)f(\256rst)573 2691 y(being)19 b(a)g -Fz(special)g(form)f FA(that)h(contains)h(a)f(body)g(of)g(Scheme)f(code)h(to)h -(be)e(executed)g(in)573 2790 y(some)d(context,)h(and)f(the)g(other)g(being)g -(a)g Fz(pr)o(ocedur)o(e)f FA(that)h(takes)f(a)h(pr)o(ocedural)e(ar)o(gu-)573 -2890 y(ment)21 b(\(a)e(\252thunk\272\))h(to)h(be)f(called)g(in)g(the)h(same)f -(context.)28 b(The)20 b(pr)o(ocedur)o(e)e(variant)573 2990 -y(is)g(named)f(by)h(taking)g(the)f(name)h(of)f(the)h(special)f(form,)h(and)f -(appending)h(an)f(aster)o(-)573 3089 y(isk.)28 b(For)21 b(example:)756 -3250 y Fw(;;;)42 b(Special)f(form:)756 3350 y(\(with-cwd)e("/etc")843 -3450 y(\(for-each)h(print-file)f(\(directory-files)o(\)\))843 -3549 y(\(display)h("All)i(done"\)\))756 3749 y(;;;)g(Procedure:)756 -3848 y(\(with-cwd*)d("/etc")843 3948 y(\(lambda)h(\(\))930 -4047 y(\(for-each)g(print-file)f(\(directory-files\))o(\))930 -4147 y(\(display)h("All)i(done"\)\)\))365 4339 y Fz(action)p -Fw(/)p Fz(modi\256er)e FA(The)16 b(in\256x)g(\252)p Fw(/)p -FA(\272)e(is)i(pr)o(onounced)f(\252with,\272)i(as)e(in)h Fw(exec/env)p -FA(\320\252exec)11 b(with)573 4438 y(envir)o(onment.\272)365 -4599 y Fw(call/)p Fx(:)j(:)g(:)53 b FA(Pr)o(ocedur)o(es)13 -b(that)i(call)f(their)h(ar)o(gument)f(on)h(some)g(computed)g(value)e(ar)o(e)h -(usu-)573 4699 y(ally)25 b(named)g(\252)p Fw(call/)p Fx(:)14 -b(:)g(:)d FA(,\272)25 b Fz(e.g.)p FA(,)h Fw(\(call/fdes)39 -b Fz(port)k(pr)o(oc)o Fw(\))p FA(,)26 b(which)g(calls)f Fz(pr)o(oc)f -FA(on)573 4799 y Fz(port)o FA('s)30 b(\256le)f(descriptor)-6 -b(,)31 b(r)o(eturning)f(whatever)e Fz(pr)o(oc)h FA(r)o(eturns.)53 -b(The)29 b(abbr)o(eviated)573 4898 y(name)21 b(means)f(\252call)g(with)i -(\256le)f(descriptor)-6 b(.\272)365 5147 y FD(November)18 b(1,)h(1995)h(\261) -f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 -w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1257 w FA(3)p eop +3 8 bop 365 614 a FB(syntax,)36 b(and)c(it)i(does)e(not)i(r)o(ead)d(in) +j(an)e(initialisation)i(\002le)f(analogous)h(to)f Fx(.login)d +FB(or)365 714 y Fx(.profile)p FB(.)42 b(W)-8 b(e)28 b(hope)g(to)f(addr) +o(ess)f(all)h(of)h(these)f(issues)h(in)g(futur)o(e)e(r)o(eleases;)j(we) +f(even)365 814 y(have)22 b(designs)i(for)e(several)g(of)h(these)f +(featur)o(es;)g(but)h(the)g(system)g(as-r)o(eleased)d(does)j(not)365 +913 y(curr)o(ently)e(pr)o(ovide)e(these)i(featur)o(es.)490 +1057 y(In)28 b(the)h(curr)o(ent)e(r)o(elease,)i(the)f(system)h(has)g +(some)g(r)o(ough)f(edges.)48 b(It)28 b(is)h(quite)g(slow)365 +1156 y(to)h(start)f(up;)34 b(we)29 b(hope)h(to)f(\002x)h(that)f(by)h +(pr)o(oviding)f(a)g(static-heap)f(linker)i(in)g(the)g(next)365 +1256 y(r)o(elease.)24 b(For)d(now)-8 b(,)22 b(the)f(initial)g(image)g +(load)f(takes)h(about)f(a)h(cpu)f(second.)490 1399 y(This)i(manual)f +(is)h(very)-9 b(,)21 b(very)g(r)o(ough:)27 b(incomplete,)22 +b(inconsistent,)h(and)e(misleading.)365 1499 y(At)c(some)h(point,)h(we) +e(will)h(polish)h(it)e(up,)h(\002nish)h(it)e(of)o(f,)g(and)g(r)o +(e-typeset)f(it)i(using)g(markup,)365 1599 y(so)30 b(we)f(can)g +(generate)f(html,)k(info)d(nodes,)i(and)e(T)1990 1618 +y(E)2030 1599 y(X)h(output)f(fr)o(om)g(the)g(single)h(sour)o(ce)365 +1698 y(without)22 b(having)f(to)h(deal)d(with)j(T)-8 +b(exinfo.)26 b(But)20 b(it's)i(all)e(ther)o(e)g(is,)h(for)g(now)-8 +b(.)365 2024 y Fv(1.4)99 b(Naming)25 b(conventions)365 +2263 y FB(Scsh)18 b(follows)h(a)f(general)f(naming)i(scheme)f(that)g +(consistently)i(employs)f(a)e(set)i(of)f(abbr)o(e-)365 +2363 y(viations.)40 b(This)26 b(is)f(intended)g(to)h(make)f(it)g +(easier)g(to)g(r)o(emember)g(the)g(names)g(of)h(things.)365 +2462 y(Some)21 b(of)g(the)g(common)h(ones)f(ar)o(e:)365 +2685 y Fx(fdes)40 b FB(Means)30 b(\223\002le)g(descriptor)-6 +b(,\224)31 b(a)e(small)i(integer)f(used)g(in)h(Unix)f(to)g(r)o(epr)o +(esent)f(I/O)573 2784 y(channels.)365 2976 y Fx(...*)40 +b FB(A)26 b(given)h(bit)g(of)g(functionality)h(sometimes)f(comes)h(in)f +(two)g(r)o(elated)e(forms,)j(the)573 3075 y(\002rst)f(being)f(a)g +FA(special)h(form)f FB(that)g(contains)h(a)f(body)h(of)f(Scheme)g(code) +h(to)f(be)h(exe-)573 3175 y(cuted)f(in)h(some)g(context,)i(and)d(the)h +(other)f(being)h(a)g FA(pr)o(ocedur)o(e)e FB(that)i(takes)f(a)g(pr)o +(o-)573 3274 y(cedural)c(ar)o(gument)h(\(a)f(\223thunk\224\))h(to)h(be) +f(called)f(in)i(the)g(same)f(context.)33 b(The)23 b(pr)o(o-)573 +3374 y(cedur)o(e)e(variant)g(is)i(named)f(by)g(taking)h(the)f(name)h +(of)f(the)g(special)g(form,)h(and)f(ap-)573 3474 y(pending)f(an)g +(asterisk.)k(For)c(example:)756 3665 y Fx(;;;)42 b(Special)f(form:)756 +3765 y(\(with-cwd)e("/etc")843 3864 y(\(for-each)h(print-file)f +(\(directory-files)o(\)\))843 3964 y(\(display)h("All)i(done"\)\))756 +4163 y(;;;)g(Procedure:)756 4263 y(\(with-cwd*)d("/etc")843 +4362 y(\(lambda)h(\(\))930 4462 y(\(for-each)g(print-file)f +(\(directory-files\))o(\))930 4562 y(\(display)h("All)i(done"\)\)\))365 +4799 y FA(action)p Fx(/)p FA(modi\002er)e FB(The)e(in\002x)h(\223)p +Fx(/)p FB(\224)e(is)h(pr)o(onounced)g(\223with,\224)43 +b(as)37 b(in)i Fx(exec/env)p FB(\227\223exec)573 4898 +y(with)21 b(envir)o(onment.\224)365 5147 y FE(Mar)o(ch)e(10,)g(1997)h +(\226)f(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 +4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 +v 1257 w FB(3)p eop %%Page: 4 10 -4 9 bop 681 614 a Fw(with-)p Fx(:)14 b(:)g(:)53 b FA(Pr)o(ocedur)o(es)24 -b(that)j(call)e(their)i(ar)o(gument,)f(and)g(special)f(forms)i(that)f -(execute)888 714 y(their)14 b(bodies)h(in)f(some)h(special)e(dynamic)h -(context)h(fr)o(equently)e(have)h(names)g(of)g(the)888 814 -y(form)i Fw(with-)p Fx(:)e(:)g(:)d FA(.)26 b(For)15 b(example,)g -Fw(\(with-env)40 b Fz(env)k(body)2703 841 y Ft(1)2784 814 y -Fx(:)14 b(:)g(:)g Fw(\))g FA(and)h Fw(\(with-env*)888 913 y -Fz(env)44 b(thunk)o Fw(\))p FA(.)27 b(These)20 b(forms)h(set)g(the)f(pr)o -(ocess)g(envir)o(onment)h(body)-9 b(,)20 b(execute)g(their)888 -1013 y(body)e(or)f(thunk,)h(and)f(then)h(r)o(eturn)e(after)g(r)o(esetting)h -(the)g(envir)o(onment)h(to)f(its)h(orig-)888 1112 y(inal)j(state.)681 -1276 y Fw(create-)38 b FA(Pr)o(ocedur)o(es)13 b(that)h(cr)o(eate)e(objects)j -(in)f(the)h(\256le)f(system)h(\(\256les,)g(dir)o(ectories,)f(temp)888 -1375 y(\256les,)21 b(\256fos,)g Fz(etc.)p FA(\),)f(begin)h(with)g -Fw(create-)p Fx(:)14 b(:)g(:)d FA(.)681 1539 y Fw(delete-)38 -b FA(Pr)o(ocedur)o(es)24 b(that)g(delete)g(objects)h(fr)o(om)g(the)f(\256le)h -(system)h(\(\256les,)f(dir)o(ectories,)888 1638 y(temp)c(\256les,)g(\256fos,) -g Fz(etc.)p FA(\),)f(begin)h(with)g Fw(delete-)p Fx(:)14 b(:)g(:)d -FA(.)702 1802 y Fz(r)o(ecord)o Fw(:)p Fz(\256eld)62 b FA(Pr)o(ocedur)o(es)22 -b(that)i(access)f(\256elds)h(of)g(a)f(r)o(ecor)o(d)f(ar)o(e)h(usually)h -(written)g(with)888 1901 y(a)h(colon)i(between)e(the)g(name)h(of)f(the)h(r)o -(ecor)o(d)d(and)i(the)h(name)f(of)h(the)f(\256eld,)h(as)g(in)888 -2001 y Fw(user-info:home-di)o(r)p FA(.)681 2164 y Fw(\045)p -Fx(:)14 b(:)g(:)55 b FA(A)27 b(per)o(cent)g(sign)h(is)g(used)g(to)g(pr)o -(e\256x)f(lower)o(-level)g(scsh)h(primitives)g(that)g(ar)o(e)e(not)888 -2264 y(commonly)d(used.)681 2427 y Fw(-info)39 b FA(Data)17 -b(str)o(uctur)o(es)h(packaging)g(up)f(information)i(about)f(various)g(OS)f -(entities)i(fr)o(e-)888 2527 y(quently)i(end)f(in)g Fx(:)14 -b(:)g(:)f Fw(-info)p FA(.)25 b(Examples:)i Fw(user-info)p FA(,)16 -b Fw(file-info)p FA(,)f Fw(group-info)p FA(,)888 2627 y(and)21 -b Fw(host-info)p FA(.)681 2812 y(Enumerated)14 b(constants)i(fr)o(om)f(some)h -(set)f Fz(s)h FA(ar)o(e)d(usually)j(named)f Fz(s)p Fw(/)p Fz(const)3012 -2824 y Ft(1)3050 2812 y FA(,)h Fz(s)p Fw(/)p Fz(const)3339 -2824 y Ft(2)3377 2812 y FA(,)g Fx(:)e(:)g(:)f FA(.)681 2912 -y(For)29 b(example,)i(the)e(various)g(Unix)g(signal)h(integers)f(have)g(the)h -(names)f Fw(signal/cont)p FA(,)681 3011 y Fw(signal/kill)p -FA(,)16 b Fw(signal/int)p FA(,)g Fw(signal/hup)p FA(,)g(and)21 -b(so)g(forth.)681 3288 y Fu(1.5)99 b(Lexical)25 b(issues)681 -3502 y FA(Scsh's)c(lexical)f(syntax)h(is)g(just)g(R4RS)g(Scheme,)f(with)i -(the)f(following)h(exceptions.)681 3752 y Fy(1.5.1)81 b(Extended)18 -b(symbol)i(syntax)681 3934 y FA(Scsh's)h(symbol)h(syntax)e(dif)o(fers)g(fr)o -(om)g(R4RS)h(Scheme)f(in)h(the)g(following)i(ways:)805 4120 -y Fs(\017)41 b FA(In)29 b(scsh,)i(symbol)e(case)f(is)h(pr)o(eserved)d(by)j -Fw(read)e FA(and)h(is)g(signi\256cant)i(on)f(symbol)888 4220 -y(comparison.)f(This)22 b(means)1071 4358 y Fw(\(run)42 b(\(less)f -(Readme\)\))888 4497 y FA(displays)21 b(the)g(right)g(\256le.)805 -4660 y Fs(\017)41 b FA(\252)p Fw(-)p FA(\272)16 b(and)h(\252)p -Fw(+)p FA(\272)e(ar)o(e)h(allowed)h(to)h(begin)f(symbols.)27 -b(So)17 b(the)h(following)g(ar)o(e)e(legitimate)888 4760 y(symbols:)1071 -4898 y Fw(-O2)42 b(-geometry)e(+Wn)681 5147 y FA(4)p 1952 5071 -323 4 v 1952 5173 4 102 v 1257 w FC(DRAFT)p 2271 5173 V 1952 -5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +4 9 bop 681 614 a Fx(call/...)38 b FB(Pr)o(ocedur)o(es)30 +b(that)i(call)g(their)g(ar)o(gument)g(on)g(some)h(computed)f(value)f +(ar)o(e)888 714 y(usually)21 b(named)f(\223)p Fx(call/...)p +FB(,\224)c FA(e.g.)o FB(,)k Fx(\(call/fdes)40 b FA(port)j(pr)o(oc)o +Fx(\))p FB(,)20 b(which)h(calls)f FA(pr)o(oc)888 814 +y FB(on)f FA(port)o FB('s)f(\002le)g(descriptor)-6 b(,)18 +b(r)o(eturning)g(whatever)f FA(pr)o(oc)g FB(r)o(eturns.)24 +b(The)18 b(abbr)o(eviated)888 913 y(name)j(means)g(\223call)f(with)h +(\002le)g(descriptor)-6 b(.\224)681 1082 y Fx(with-...)38 +b FB(Pr)o(ocedur)o(es)22 b(that)i(call)g(their)g(ar)o(gument,)g(and)f +(special)h(forms)g(that)g(execute)888 1182 y(their)38 +b(bodies)h(in)f(some)h(special)e(dynamic)h(context)h(fr)o(equently)e +(have)h(names)888 1282 y(of)g(the)h(form)f Fx(with-...)p +FB(.)74 b(For)38 b(example,)k Fx(\(with-env)d FA(env)44 +b(body)3111 1309 y Fu(1)3192 1282 y Fx(...\))36 b FB(and)888 +1381 y Fx(\(with-env*)k FA(env)j(thunk)p Fx(\))p FB(.)28 +b(These)22 b(forms)g(set)g(the)g(pr)o(ocess)f(envir)o(onment)h(body)-9 +b(,)888 1481 y(execute)22 b(their)i(body)f(or)g(thunk,)h(and)f(then)g +(r)o(eturn)g(after)e(r)o(esetting)i(the)g(envir)o(on-)888 +1581 y(ment)f(to)f(its)g(original)g(state.)681 1750 y +Fx(create-)38 b FB(Pr)o(ocedur)o(es)d(that)i(cr)o(eate)e(objects)i(in)g +(the)g(\002le)g(system)g(\(\002les,)j(dir)o(ectories,)888 +1849 y(temp)21 b(\002les,)g(\002fos,)g FA(etc.)p FB(\),)f(begin)h(with) +g Fx(create-...)p FB(.)681 2019 y Fx(delete-)38 b FB(Pr)o(ocedur)o(es) +24 b(that)g(delete)g(objects)h(fr)o(om)g(the)f(\002le)h(system)h +(\(\002les,)f(dir)o(ectories,)888 2118 y(temp)c(\002les,)g(\002fos,)g +FA(etc.)p FB(\),)f(begin)h(with)g Fx(delete-...)p FB(.)702 +2287 y FA(r)o(ecord)o Fx(:)p FA(\002eld)62 b FB(Pr)o(ocedur)o(es)22 +b(that)i(access)f(\002elds)h(of)g(a)f(r)o(ecor)o(d)f(ar)o(e)h(usually)h +(written)g(with)888 2387 y(a)h(colon)i(between)e(the)g(name)h(of)f(the) +h(r)o(ecor)o(d)d(and)i(the)h(name)f(of)h(the)f(\002eld,)h(as)g(in)888 +2487 y Fx(user-info:home-di)o(r)p FB(.)681 2656 y Fx(\045...)40 +b FB(A)25 b(per)o(cent)g(sign)i(is)g(used)f(to)g(pr)o(e\002x)f(lower)o +(-level)g(scsh)i(primitives)g(that)f(ar)o(e)e(not)888 +2755 y(commonly)f(used.)681 2925 y Fx(-info)39 b FB(Data)17 +b(str)o(uctur)o(es)h(packaging)g(up)f(information)i(about)f(various)g +(OS)f(entities)i(fr)o(e-)888 3024 y(quently)k(end)e(in)h(.)12 +b(.)g(.)g Fx(-info)p FB(.)27 b(Examples:)g Fx(user-info)p +FB(,)18 b Fx(file-info)p FB(,)f Fx(group-info)p FB(,)888 +3124 y(and)k Fx(host-info)p FB(.)681 3319 y(Enumerated)15 +b(constants)i(fr)o(om)f(some)h(set)f FA(s)h FB(ar)o(e)e(usually)h +(named)g FA(s)p Fx(/)p FA(const)3022 3331 y Fu(1)3059 +3319 y FB(,)h FA(s)p Fx(/)p FA(const)3349 3331 y Fu(2)3387 +3319 y FB(,)g(.)12 b(.)g(.)g(.)681 3418 y(For)29 b(example,)i(the)e +(various)g(Unix)g(signal)h(integers)f(have)g(the)h(names)f +Fx(signal/cont)p FB(,)681 3518 y Fx(signal/kill)p FB(,)16 +b Fx(signal/int)p FB(,)g Fx(signal/hup)p FB(,)g(and)21 +b(so)g(forth.)681 3801 y Fv(1.5)99 b(Lexical)25 b(issues)681 +4018 y FB(Scsh's)c(lexical)f(syntax)h(is)g(just)g(R4RS)g(Scheme,)f +(with)i(the)f(following)h(exceptions.)681 4276 y Fz(1.5.1)81 +b(Extended)18 b(symbol)i(syntax)681 4462 y FB(Scsh's)h(symbol)h(syntax) +e(dif)o(fers)g(fr)o(om)g(R4RS)h(Scheme)f(in)h(the)g(following)i(ways:) +805 4656 y Ft(\017)41 b FB(In)29 b(scsh,)i(symbol)e(case)f(is)h(pr)o +(eserved)d(by)j Fx(read)e FB(and)h(is)g(signi\002cant)i(on)f(symbol)888 +4756 y(comparison.)e(This)21 b(means)1071 4898 y Fx(\(run)42 +b(\(less)f(Readme\)\))681 5147 y FB(4)p 1952 5071 323 +4 v 1952 5173 4 102 v 1257 w FD(DRAFT)p 2271 5173 V 1952 +5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 5 11 -5 10 bop 490 614 a Fs(\017)41 b FA(\252)p Fw(|)p FA(\272)22 -b(and)i(\252)p Fw(.)p FA(\272)e(ar)o(e)g(symbol)j(constituents.)38 -b(This)24 b(allows)h Fw(|)e FA(for)g(the)h(pipe)g(symbol,)573 -714 y(and)14 b Fw(..)h FA(for)f(the)h(par)o(ent-dir)o(ectory)e(symbol.)27 -b(\(Of)14 b(course,)i(\252)p Fw(.)p FA(\272)e(alone)h(is)g(not)h(a)e(sym-)573 -814 y(bol,)21 b(but)g(a)f(dotted-pair)f(marker)-6 b(.\))490 -988 y Fs(\017)41 b FA(A)14 b(symbol)i(may)f(begin)g(with)h(a)e(digit.)26 -b(So)15 b(the)g(following)h(ar)o(e)e(legitimate)h(symbols:)756 -1137 y Fw(9x15)41 b(80x36-3+440)365 1405 y Fy(1.5.2)81 b(Extended)18 -b(string)i(syntax)365 1597 y FA(Scsh)e(strings)g(ar)o(e)e(allowed)h(to)h -(contain)g(the)h(A)t Fr(N)t(S)t(I)h FA(C)d(escape)g(sequences)h(such)f(as)g -Fw(\\n)g FA(and)365 1697 y Fw(\\161)p FA(.)365 1965 y Fy(1.5.3)81 -b(Block)21 b(comments)e(and)h(executable)d(interpreter)o(-triggers)365 -2156 y FA(Scsh)k(allows)g(sour)o(ce)g(\256les)g(to)g(begin)g(with)h(a)e -(header)f(of)i(the)g(form)573 2305 y Fw(#!/usr/local/bin)o(/s)o(csh)37 -b(-s)365 2454 y FA(The)16 b(Unix)g(operating)g(system)h(tr)o(eats)e(sour)o -(ce)h(\256les)g(beginning)i(with)e(the)h(headers)e(of)h(this)365 -2554 y(form)h(specially;)g(they)g(can)e(be)h(dir)o(ectly)g(executed)f(by)h -(the)h(operating)f(system)h(\(see)e(chap-)365 2653 y(ter)24 -b(9)g(for)g(information)h(on)g(how)g(to)f(use)g(this)h(featur)o(e\).)36 -b(The)24 b(scsh)g(interpr)o(eter)f(ignor)o(es)365 2753 y(this)f(special)f -(header)f(by)i(tr)o(eating)e Fw(#!)h FA(as)g(a)f(comment)i(marker)f(similar)h -(to)f Fw(;)p FA(.)29 b(When)21 b(the)365 2853 y(scsh)f(r)o(eader)c -(encounters)k Fw(#!)p FA(,)e(it)h(skips)g(characters)f(until)h(it)g(\256nds)g -(the)g(closing)h(sequence)365 2952 y -(newline/exclamation-point/sharp-sign/newline.)490 3083 y(Although)g(the)g -(form)g(of)f(the)h Fw(#!)f FA(r)o(ead-macr)o(o)e(was)i(chosen)i(to)f(support) -g(interpr)o(eter)o(-)365 3183 y(triggers)c(for)g(executable)e(Unix)h -(scripts,)i(it)f(is)g(a)f(general)g(block-comment)i(sequence)f(and)365 -3283 y(can)21 b(be)f(used)h(as)f(such)h(anywher)o(e)f(in)i(a)e(scsh)h(pr)o -(ogram.)365 3551 y Fy(1.5.4)81 b(Here-strings)365 3742 y FA(The)24 -b(r)o(ead)f(macr)o(o)g Fw(#<)h FA(is)g(used)g(to)g(intr)o(oduce)g(\252her)o -(e-strings\272)f(in)i(pr)o(ograms,)f(similar)g(to)365 3842 -y(the)k Fw(<<)f FA(\252her)o(e)g(document\272)g(r)o(edir)o(ections)g(pr)o -(ovided)g(by)g(sh)i(and)e(csh.)49 b(Ther)o(e)27 b(ar)o(e)f(two)365 -3942 y(kinds)g(of)f(her)o(e-string,)g(character)o(-delimited)e(and)h -(line-delimited;)j(they)e(ar)o(e)f(both)h(in-)365 4041 y(tr)o(oduced)20 -b(by)h(the)g Fw(#<)f FA(sequence.)365 4309 y Fy(Character)o(-delimited)15 -b(here-strings)365 4501 y FA(A)21 b Fz(character-delimited)d -FA(her)o(e-string)j(has)g(the)f(form)573 4650 y Fw(#<)p Fq(x)p -Fw(...stuff...)p Fq(x)365 4799 y FA(wher)o(e)j Fz(x)g FA(is)h(any)g(single)g -(character)e(\(except)g Fw(<)p FA(,)i(see)f(below\),)h(which)g(is)g(used)f -(to)h(delimit)365 4898 y(the)d(string)h(bounds.)28 b(Some)20 -b(examples:)365 5147 y FD(November)e(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1257 w FA(5)p eop +5 10 bop 573 614 a FB(displays)21 b(the)g(right)g(\002le.)490 +798 y Ft(\017)41 b FB(\223)p Fx(-)p FB(\224)16 b(and)h(\223)p +Fx(+)p FB(\224)e(ar)o(e)h(allowed)h(to)h(begin)g(symbols.)25 +b(So)17 b(the)h(following)h(ar)o(e)c(legitimate)573 897 +y(symbols:)756 1056 y Fx(-O2)42 b(-geometry)e(+Wn)490 +1256 y Ft(\017)h FB(\223)p Fx(|)p FB(\224)22 b(and)i(\223)p +Fx(.)p FB(\224)e(ar)o(e)h(symbol)i(constituents.)36 b(This)24 +b(allows)h Fx(|)e FB(for)h(the)g(pipe)g(symbol,)573 1356 +y(and)30 b Fx(..)f FB(for)h(the)g(par)o(ent-dir)o(ectory)e(symbol.)55 +b(\(Of)30 b(course,)i(\223)p Fx(.)p FB(\224)d(alone)i(is)f(not)h(a)573 +1455 y(symbol,)21 b(but)g(a)f(dotted-pair)g(marker)-6 +b(.\))490 1638 y Ft(\017)41 b FB(A)26 b(symbol)h(may)g(begin)f(with)i +(a)d(digit.)43 b(So)26 b(the)h(following)h(ar)o(e)d(legitimate)h(sym-) +573 1738 y(bols:)756 1897 y Fx(9x15)41 b(80x36-3+440)365 +2181 y Fz(1.5.2)81 b(Extended)18 b(string)i(syntax)365 +2380 y FB(Scsh)e(strings)g(ar)o(e)e(allowed)h(to)h(contain)g(the)h(A)t +Fs(N)t(S)t(I)h FB(C)d(escape)g(sequences)h(such)f(as)g +Fx(\\n)g FB(and)365 2480 y Fx(\\161)p FB(.)365 2764 y +Fz(1.5.3)81 b(Block)21 b(comments)e(and)h(executable)d(interpreter)o +(-triggers)365 2964 y FB(Scsh)k(allows)g(sour)o(ce)g(\002les)g(to)g +(begin)g(with)h(a)e(header)f(of)i(the)g(form)573 3122 +y Fx(#!/usr/local/bin)o(/s)o(csh)37 b(-s)365 3281 y FB(The)30 +b(Unix)g(operating)g(system)g(tr)o(eats)f(sour)o(ce)g(\002les)h +(beginning)h(with)g(the)f(headers)f(of)365 3381 y(this)23 +b(form)f(specially;)h(they)f(can)g(be)g(dir)o(ectly)f(executed)g(by)h +(the)g(operating)g(system)h(\(see)365 3480 y(chapter)32 +b(9)g(for)h(information)h(on)f(how)h(to)f(use)f(this)i(featur)o(e\).)59 +b(The)33 b(scsh)g(interpr)o(eter)365 3580 y(ignor)o(es)c(this)g +(special)f(header)f(by)i(tr)o(eating)f Fx(#!)f FB(as)i(a)e(comment)j +(marker)e(similar)g(to)h Fx(;)p FB(.)365 3679 y(When)18 +b(the)g(scsh)g(r)o(eader)d(encounters)j Fx(#!)p FB(,)f(it)h(skips)g +(characters)e(until)i(it)g(\002nds)g(the)f(closing)365 +3779 y(sequence)k(newline/exclamation-point/sharp-sign/newline.)490 +3916 y(Although)f(the)g(form)g(of)f(the)h Fx(#!)f FB(r)o(ead-macr)o(o)e +(was)i(chosen)i(to)f(support)g(interpr)o(eter)o(-)365 +4016 y(triggers)32 b(for)e(executable)g(Unix)h(scripts,)j(it)d(is)h(a)f +(general)f(block-comment)i(sequence)365 4116 y(and)21 +b(can)f(be)g(used)h(as)f(such)i(anywher)o(e)e(in)h(a)f(scsh)i(pr)o +(ogram.)365 4400 y Fz(1.5.4)81 b(Here-strings)365 4599 +y FB(The)33 b(r)o(ead)e(macr)o(o)h Fx(#<)g FB(is)h(used)f(to)h(intr)o +(oduce)g(\223her)o(e-strings\224)e(in)i(pr)o(ograms,)i(similar)365 +4699 y(to)f(the)f Fx(<<)f FB(\223her)o(e)f(document\224)i(r)o(edir)o +(ections)f(pr)o(ovided)f(by)i(sh)h(and)e(csh.)62 b(Ther)o(e)32 +b(ar)o(e)365 4799 y(two)22 b(kinds)f(of)g(her)o(e-string,)f(character)o +(-delimited)e(and)i(line-delimited;)h(they)g(ar)o(e)e(both)365 +4898 y(intr)o(oduced)h(by)h(the)g Fx(#<)f FB(sequence.)365 +5147 y FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1257 w FB(5)p eop %%Page: 6 12 -6 11 bop 938 601 a FA(Her)o(e-string)20 b(syntax)288 b(Or)o(dinary)20 -b(string)i(syntax)p 888 634 1943 4 v 938 704 a Fw(#<|Hello,)40 -b(world.|)227 b("Hello,)41 b(world.")938 804 y(#)g -Fz([fdes])g(\256le-name)p Fw(\))209 b(;)43 b(Open)f(file)g(create/truncate.) -888 3822 y(\(<<)h Fz([fdes])g(object)p Fw(\))280 b(;)43 b(Use)g -Fz(object)p Fw('s)g(printed)d(rep.)888 3921 y(\(>>)j Fz([fdes])g(\256le-name) -o Fw(\))166 b(;)43 b(Open)f(file)g(for)h(append.)888 4021 y(\(=)g -Fz(fdes)h(fdes/port)o Fw(\))279 b(;)43 b(Dup2)888 4121 y(\(-)g -Fz(fdes/port)o Fw(\))452 b(;)43 b(Close)f Fz(fdes/port)o Fw(.)888 -4220 y(stdports)567 b(;)43 b(0,1,2)f(dup'd)f(from)h(standard)f(ports.)681 -4368 y FA(The)26 b(input)h(r)o(edir)o(ections)e(default)g(to)h(\256le)h +(inside)h(of)g(standar)o(d)e(Scheme)681 2378 y(code.)23 +b(The)16 b(basic)g(elements)g(of)f(this)i(notation)g(ar)o(e)d +FA(pr)o(ocess)i(forms)p FB(,)h FA(extended)e(pr)o(ocess)g(forms)p +FB(,)681 2478 y(and)20 b FA(r)o(edir)o(ections)p FB(.)681 +2773 y Fv(2.1)99 b(Extended)24 b(process)h(forms)g(and)f(i/o)i +(redirections)681 2996 y FB(An)20 b FA(extended)f(pr)o(ocess)h(form)h +FB(is)f(a)g(speci\002cation)g(of)h(a)e(Unix)i(pr)o(ocess)e(to)i(r)o +(un,)g(in)f(a)g(particu-)681 3095 y(lar)g(I/O)h(envir)o(onment:)888 +3244 y FA(epf)44 b FB(::=)f Fx(\()p FA(pf)g(r)o(edir)1476 +3256 y Fu(1)1557 3244 y Fx(...)f FA(r)o(edir)1891 3256 +y Fn(n)1936 3244 y Fx(\))681 3394 y FB(wher)o(e)19 b +FA(pf)g FB(is)h(a)g(pr)o(ocess)f(form)h(and)f(the)h FA(r)o(edir)2101 +3406 y Fn(i)2149 3394 y FB(ar)o(e)e(r)o(edir)o(ection)h(specs.)25 +b(A)19 b FA(r)o(edir)o(ection)g(spec)681 3493 y FB(is)i(one)g(of:)888 +3623 y Fx(\(<)43 b FA([fdes])g(\002le-name)p Fx(\))209 +b(;)43 b(Open)f(file)g(for)h(read.)888 3722 y(\(>)g FA([fdes])g +(\002le-name)p Fx(\))209 b(;)43 b(Open)f(file)g(create/truncate.)888 +3822 y(\(<<)h FA([fdes])g(object)p Fx(\))280 b(;)43 b(Use)g +FA(object)p Fx('s)g(printed)d(rep.)888 3921 y(\(>>)j +FA([fdes])g(\002le-name)o Fx(\))166 b(;)43 b(Open)f(file)g(for)h +(append.)888 4021 y(\(=)g FA(fdes)h(fdes/port)o Fx(\))279 +b(;)43 b(Dup2)888 4121 y(\(-)g FA(fdes/port)o Fx(\))452 +b(;)43 b(Close)f FA(fdes/port)o Fx(.)888 4220 y(stdports)567 +b(;)43 b(0,1,2)f(dup'd)f(from)h(standard)f(ports.)681 +4368 y FB(The)26 b(input)h(r)o(edir)o(ections)e(default)g(to)h(\002le)h (descriptor)f(0;)i(the)e(output)h(r)o(edir)o(ections)e(de-)681 -4468 y(fault)20 b(to)h(\256le)g(descriptor)f(1.)805 4599 y(The)42 -b(subforms)g(of)f(a)g(r)o(edir)o(ection)g(ar)o(e)f(implicitly)i(backquoted,) -47 b(and)41 b(symbols)681 4699 y(stand)e(for)h(their)f(print-names.)84 -b(So)40 b Fw(\(>)i(,x\))d FA(means)g(\252output)h(to)g(the)g(\256le)f(named) -681 4799 y(by)h(Scheme)f(variable)g Fw(x)p FA(,\272)44 b(and)39 -b Fw(\(<)k(/usr/shivers/.lo)o(gi)o(n\))34 b FA(means)40 b(\252r)o(ead)d(fr)o -(om)681 4898 y Fw(/usr/shivers/.lo)o(gi)o(n)p FA(.\272)681 -5147 y(10)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +4468 y(fault)20 b(to)h(\002le)g(descriptor)f(1.)805 4599 +y(The)42 b(subforms)g(of)f(a)g(r)o(edir)o(ection)g(ar)o(e)f(implicitly) +i(backquoted,)47 b(and)41 b(symbols)681 4699 y(stand)e(for)h(their)g +(print-names.)82 b(So)40 b Fx(\(>)i(,x\))d FB(means)h(\223output)g(to)g +(the)g(\002le)f(named)681 4799 y(by)h(Scheme)f(variable)g +Fx(x)p FB(,\224)44 b(and)39 b Fx(\(<)k(/usr/shivers/.lo)o(gi)o(n\))34 +b FB(means)40 b(\223r)o(ead)d(fr)o(om)681 4898 y Fx(/usr/shivers/.lo)o +(gi)o(n)p FB(.\224)681 5147 y(10)p 1952 5071 323 4 v +1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 +5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 11 17 -11 16 bop 490 614 a FA(Her)o(e)19 b(ar)o(e)h(two)h(mor)o(e)g(examples)f(of)h -(i/o)g(r)o(edir)o(ection:)1318 800 y Fw(\(<)43 b(,\(vector-ref)38 -b(fv)43 b(i\)\))1318 900 y(\(>>)f(2)h(/tmp/buf\))365 1083 y -FA(These)16 b(two)g(r)o(edir)o(ections)e(cause)h(the)h(\256le)g -Fw(fv[i])d FA(to)j(be)f(opened)h(on)g(stdin,)h(and)e Fw(/tmp/buf)365 -1183 y FA(to)21 b(be)g(opened)f(for)h(append)f(writes)h(on)g(stderr)-6 -b(.)490 1310 y(The)18 b(r)o(edir)o(ection)e Fw(\(<<)42 b Fz(object)q -Fw(\))17 b FA(causes)g(input)i(to)f(come)g(fr)o(om)f(the)h(printed)g(r)o(epr) -o(esen-)365 1410 y(tation)j(of)g Fz(object)p FA(.)28 b(For)21 -b(example,)573 1553 y Fw(\(<<)42 b("The)g(quick)g(brown)f(fox)i(jumped)e -(over)h(the)g(lazy)g(dog."\))365 1697 y FA(causes)15 b(r)o(eads)e(fr)o(om)i -(stdin)g(to)g(pr)o(oduce)f(the)h(characters)f(of)h(the)g(above)f(string.)26 -b(The)15 b(object)365 1796 y(is)21 b(converted)g(to)g(its)g(printed)g(r)o -(epr)o(esentation)e(using)j(the)f Fw(display)c FA(pr)o(ocedur)o(e,)i(so)573 -1940 y Fw(\(<<)42 b(\(A)h(five)f(element)f(list\)\))365 2083 -y FA(is)21 b(the)g(same)g(as)573 2226 y Fw(\(<<)42 b("\(A)h(five)e(element)g -(list\)"\))365 2369 y FA(is)21 b(the)g(same)g(as)573 2513 y -Fw(\(<<)42 b(,\(reverse)e('\(list)h(element)g(five)h(A\)\)\))p -FA(.)365 2656 y(\(Her)o(e)15 b(we)h(use)g(the)g(implicit)h(backquoting)g -(featur)o(e)d(to)j(compute)f(the)h(list)f(to)h(be)e(printed.\))490 -2784 y(The)27 b(r)o(edir)o(ection)f Fw(\(=)43 b Fz(fdes)h(fdes/port)o -Fw(\))26 b FA(causes)h Fz(fdes/port)g FA(to)g(be)g(dup'd)g(into)h(\256le)f -(de-)365 2883 y(scriptor)21 b Fz(fdes)p FA(.)28 b(For)21 b(example,)f(the)g -(r)o(edir)o(ection)573 3026 y Fw(\(=)43 b(2)g(1\))365 3170 -y FA(causes)20 b(stderr)f(to)h(be)g(the)g(same)f(as)h(stdout.)28 -b Fz(fdes/port)19 b FA(can)g(also)h(be)g(a)f(port,)h(for)g(example:)573 -3313 y Fw(\(=)43 b(2)g(,\(current-output)o(-p)o(ort)o(\)\))365 -3456 y FA(causes)16 b(stderr)g(to)h(be)f(dup'd)g(fr)o(om)g(the)g(curr)o(ent)g -(output)h(port.)26 b(In)16 b(this)i(case,)e(it)h(is)f(an)h(err)o(or)365 -3556 y(if)23 b(the)h(port)f(is)h(not)g(a)e(\256le)i(port)f(\()p -Fz(e.g.)o FA(,)h(a)f(string)g(port\).)35 b(Mor)o(e)22 b(complex)i(r)o(edir)o -(ections)e(can)365 3656 y(be)j(accomplished)f(using)i(the)e -Fw(begin)f FA(pr)o(ocess)h(form,)h(discussed)g(below)-8 b(,)26 -b(which)f(gives)365 3755 y(the)c(pr)o(ogrammer)f(full)h(contr)o(ol)g(of)g -(i/o)g(r)o(edir)o(ection)f(fr)o(om)g(Scheme.)365 4014 y Fy(2.1.1)81 -b(Port)21 b(and)f(\256le)f(descriptor)h(sync)365 4201 y FA(It's)33 -b(important)g(to)h(r)o(emember)d(that)i(r)o(ebinding)f(Scheme's)h(curr)o(ent) -f(I/O)h(ports)g(\()p Fz(e.g.)o FA(,)365 4301 y(using)28 b Fw -(call-with-input-)o(fi)o(le)20 b FA(to)27 b(r)o(ebind)f(the)h(value)f(of)g -Fw(\(current-input-po)o(rt)o(\))p FA(\))365 4400 y(does)j Fz(not)f -FA(automatically)g(\252r)o(ebind\272)e(the)j(\256le)f(r)o(efer)o(enced)e(by)i -(the)h(Unix)f(stdio)h(\256le)f(de-)365 4500 y(scriptors)g(0,)g(1,)h(and)e(2.) -47 b(This)27 b(is)h(impossible)h(to)f(do)f(in)h(general,)g(since)g(some)g -(Scheme)365 4599 y(ports)18 b(ar)o(e)d(not)j(r)o(epr)o(esentable)d(as)i(Unix) -g(\256le)g(descriptors.)26 b(For)18 b(example,)f(many)g(Scheme)365 -4699 y(implementations)32 b(pr)o(ovide)e(\252string)h(ports,\272)i(that)e -(is,)i(ports)e(that)g(collect)g(characters)365 4799 y(sent)15 -b(to)g(them)g(into)g(memory)g(buf)o(fers.)24 b(The)15 b(accumulated)e(string) -i(can)f(later)g(be)g(r)o(etrieved)365 4898 y(fr)o(om)29 b(the)g(port)g(as)g -(a)f(string.)53 b(If)28 b(a)h(user)f(wer)o(e)h(to)g(bind)g -Fw(\(current-output-)o(po)o(rt\))22 b FA(to)365 5147 y FD(November)c(1,)h -(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 -4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1220 -w FA(1)-5 b(1)p eop +11 16 bop 490 614 a FB(Her)o(e)19 b(ar)o(e)h(two)h(mor)o(e)g(examples)f +(of)h(i/o)g(r)o(edir)o(ection:)1318 800 y Fx(\(<)43 b(,\(vector-ref)38 +b(fv)43 b(i\)\))1318 900 y(\(>>)f(2)h(/tmp/buf\))365 +1083 y FB(These)j(two)g(r)o(edir)o(ections)e(cause)h(the)h(\002le)f +Fx(fv[i])f FB(to)i(be)f(opened)g(on)h(stdin,)52 b(and)365 +1183 y Fx(/tmp/buf)18 b FB(to)j(be)f(opened)h(for)f(append)g(writes)h +(on)h(stderr)-6 b(.)490 1310 y(The)18 b(r)o(edir)o(ection)e +Fx(\(<<)42 b FA(object)q Fx(\))17 b FB(causes)g(input)i(to)f(come)g(fr) +o(om)f(the)h(printed)g(r)o(epr)o(esen-)365 1410 y(tation)j(of)g +FA(object)p FB(.)26 b(For)21 b(example,)573 1553 y Fx(\(<<)42 +b("The)g(quick)g(brown)f(fox)i(jumped)e(over)h(the)g(lazy)g(dog."\))365 +1697 y FB(causes)32 b(r)o(eads)f(fr)o(om)i(stdin)g(to)g(pr)o(oduce)e +(the)i(characters)e(of)h(the)h(above)f(string.)62 b(The)365 +1796 y(object)25 b(is)g(converted)e(to)i(its)g(printed)f(r)o(epr)o +(esentation)f(using)i(the)f Fx(display)e FB(pr)o(ocedur)o(e,)365 +1896 y(so)573 2039 y Fx(\(<<)42 b(\(A)h(five)f(element)f(list\)\))365 +2182 y FB(is)21 b(the)g(same)g(as)573 2326 y Fx(\(<<)42 +b("\(A)h(five)e(element)g(list\)"\))365 2469 y FB(is)21 +b(the)g(same)g(as)573 2612 y Fx(\(<<)42 b(,\(reverse)e('\(list)h +(element)g(five)h(A\)\)\))p FB(.)365 2756 y(\(Her)o(e)15 +b(we)h(use)g(the)g(implicit)h(backquoting)g(featur)o(e)d(to)j(compute)f +(the)h(list)f(to)h(be)e(printed.\))490 2883 y(The)27 +b(r)o(edir)o(ection)f Fx(\(=)43 b FA(fdes)h(fdes/port)o +Fx(\))26 b FB(causes)h FA(fdes/port)g FB(to)g(be)g(dup'd)g(into)h +(\002le)f(de-)365 2983 y(scriptor)21 b FA(fdes)p FB(.)26 +b(For)21 b(example,)f(the)h(r)o(edir)o(ection)573 3126 +y Fx(\(=)43 b(2)g(1\))365 3269 y FB(causes)20 b(stderr)f(to)i(be)e(the) +h(same)g(as)g(stdout.)26 b FA(fdes/port)19 b FB(can)g(also)i(be)e(a)h +(port,)g(for)g(example:)573 3413 y Fx(\(=)43 b(2)g(,\(current-output)o +(-p)o(ort)o(\)\))365 3556 y FB(causes)29 b(stderr)f(to)h(be)f(dup'd)h +(fr)o(om)f(the)h(curr)o(ent)f(output)h(port.)50 b(In)29 +b(this)h(case,)g(it)f(is)g(an)365 3656 y(err)o(or)19 +b(if)h(the)g(port)g(is)h(not)g(a)e(\002le)h(port)g(\()p +FA(e.g.)o FB(,)g(a)g(string)g(port\).)25 b(Mor)o(e)19 +b(complex)i(r)o(edir)o(ections)365 3755 y(can)31 b(be)f(accomplished)h +(using)h(the)f Fx(begin)e FB(pr)o(ocess)h(form,)j(discussed)e(below)-8 +b(,)34 b(which)365 3855 y(gives)21 b(the)g(pr)o(ogrammer)f(full)h +(contr)o(ol)g(of)g(i/o)g(r)o(edir)o(ection)f(fr)o(om)g(Scheme.)365 +4114 y Fz(2.1.1)81 b(Port)21 b(and)f(\002le)f(descriptor)h(sync)365 +4301 y FB(It's)33 b(important)g(to)h(r)o(emember)d(that)i(r)o(ebinding) +f(Scheme's)h(curr)o(ent)f(I/O)h(ports)g(\()p FA(e.g.)o +FB(,)365 4400 y(using)28 b Fx(call-with-input-)o(fi)o(le)20 +b FB(to)27 b(r)o(ebind)f(the)h(value)f(of)g Fx(\(current-input-po)o(rt) +o(\))p FB(\))365 4500 y(does)42 b FA(not)f FB(automatically)h(\223r)o +(ebind\224)e(the)h(\002le)h(r)o(efer)o(enced)d(by)j(the)g(Unix)f(stdio) +h(\002le)365 4599 y(descriptors)f(0,)46 b(1,)g(and)41 +b(2.)87 b(This)42 b(is)g(impossible)g(to)g(do)g(in)f(general,)46 +b(since)c(some)365 4699 y(Scheme)37 b(ports)g(ar)o(e)f(not)i(r)o(epr)o +(esentable)c(as)j(Unix)g(\002le)g(descriptors.)74 b(For)38 +b(example,)365 4799 y(many)27 b(Scheme)e(implementations)j(pr)o(ovide)d +(\223string)h(ports,\224)h(that)g(is,)g(ports)f(that)h(col-)365 +4898 y(lect)36 b(characters)f(sent)h(to)g(them)g(into)h(memory)g(buf)o +(fers.)69 b(The)36 b(accumulated)f(string)365 5147 y +FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1220 w FB(1)-5 b(1)p eop %%Page: 12 18 -12 17 bop 681 614 a FA(such)21 b(a)g(port,)g(it)g(would)g(be)g(impossible)h -(to)g(associate)e(\256le)h(descriptor)g(1)g(with)g(this)h(port,)681 -714 y(as)31 b(it)g(cannot)g(be)g(r)o(epr)o(esented)e(in)i(Unix.)58 -b(So,)34 b(if)c(the)h(user)g(subsequently)h(forked)f(of)o(f)681 -814 y(some)19 b(other)g(pr)o(ogram)g(as)f(a)h(subpr)o(ocess,)f(that)h(pr)o -(ogram)f(would)i(of)f(course)g(not)g(see)g(the)681 913 y(Scheme)h(string)i -(port)e(as)h(its)g(standar)o(d)e(output.)805 1038 y(T)-8 b(o)21 -b(keep)f(stdio)h(synced)f(with)h(the)g(values)f(of)g(Scheme's)g(curr)o(ent)g -(i/o)h(ports,)g(use)f(the)681 1137 y(special)i(r)o(edir)o(ection)g -Fw(stdports)p FA(.)31 b(This)24 b(causes)f(0,)g(1,)g(2)f(to)i(be)f(r)o(edir)o -(ected)d(fr)o(om)j(the)g(cur)o(-)681 1237 y(r)o(ent)d(Scheme)g(standar)o(d)f -(ports.)28 b(It)21 b(is)g(equivalent)g(to)g(the)g(thr)o(ee)f(r)o(edir)o -(ections:)888 1406 y Fw(\(=)43 b(0)g(,\(current-input-p)o(or)o(t\)\))888 -1505 y(\(=)g(1)g(,\(current-output-)o(po)o(rt\))o(\))888 1605 -y(\(=)g(2)g(,\(error-output-po)o(rt)o(\)\))681 1773 y FA(The)30 -b(r)o(edir)o(ections)g(ar)o(e)f(done)h(in)h(the)g(indicated)e(or)o(der)-6 -b(.)56 b(This)31 b(will)g(cause)f(an)g(err)o(or)f(if)681 1873 -y(one)23 b(of)h(the)f(curr)o(ent)f(i/o)i(ports)g(isn't)g(a)e(Unix)i(port)f -(\()p Fz(e.g.)o FA(,)g(if)g(one)h(is)f(a)g(string)h(port\).)34 -b(This)681 1973 y(Scheme/Unix)18 b(i/o)h(synchr)o(onisation)h(can)e(also)g -(be)g(had)g(in)h(Scheme)e(code)h(\(as)g(opposed)681 2072 y(to)j(a)f(r)o(edir) -o(ection)g(spec\))g(with)h(the)g Fw(\(stdports->stdio\))14 -b FA(pr)o(ocedur)o(e.)681 2344 y Fu(2.2)99 b(Process)25 b(forms)681 -2558 y FA(A)19 b Fz(pr)o(ocess)h(form)g FA(speci\256es)g(a)g(computation)h -(to)f(perform)g(as)f(an)h(independent)g(Unix)g(pr)o(o-)681 -2658 y(cess.)27 b(It)21 b(can)f(be)h(one)g(of)g(the)g(following:)888 -2790 y Fw(\(begin)41 b(.)j Fz(scheme-code)n Fw(\))888 2889 -y(\(|)f Fz(pf)1072 2916 y Ft(1)1153 2889 y Fx(:)14 b(:)g(:)57 -b Fz(pf)1361 2916 y Fm(n)1406 2889 y Fw(\))888 2989 y(\(|+)43 -b Fz(connect-list)g(pf)1550 3016 y Ft(1)1631 2989 y Fx(:)14 -b(:)g(:)57 b Fz(pf)1838 3016 y Fm(n)1884 2989 y Fw(\))888 3088 -y(\(epf)42 b(.)h Fz(epf)p Fw(\))888 3188 y(\()p Fz(pr)o(og)f(ar)o(g)1235 -3215 y Ft(1)1316 3188 y Fx(:)14 b(:)g(:)57 b Fz(ar)o(g)1580 -3215 y Fm(n)1625 3188 y Fw(\))2114 2794 y(;)43 b(Run)f Fz(scheme-code)h -Fw(in)g(a)g(fork.)2114 2894 y(;)g(Simple)e(pipeline)2114 2993 -y(;)i(Complex)e(pipeline)2114 3093 y(;)i(An)g(extended)d(process)h(form.)2114 -3192 y(;)i(Default:)d(exec)i(the)h(program.)681 3323 y FA(The)21 -b(default)f(case)h Fw(\()p Fz(pr)o(og)42 b(ar)o(g)1645 3350 -y Ft(1)1726 3323 y Fx(:)14 b(:)g(:)57 b Fz(ar)o(g)1989 3350 -y Fm(n)2035 3323 y Fw(\))20 b FA(is)i(also)g(implicitly)g(backquoted.)29 -b(That)21 b(is,)h(it)681 3423 y(is)f(equivalent)g(to:)888 3561 -y Fw(\(begin)41 b(\(apply)h(exec-path)d(`\()p Fz(pr)o(og)j(ar)o(g)2325 -3588 y Ft(1)2406 3561 y Fx(:)14 b(:)g(:)57 b Fz(ar)o(g)2669 -3588 y Fm(n)2714 3561 y Fw(\)\)\))681 3700 y(Exec-path)27 b -FA(is)j(the)h(version)g(of)g(the)f Fw(exec\(\))e FA(system)j(call)g(that)f -(uses)h(scsh's)g(path)f(list)681 3799 y(to)f(sear)o(ch)e(for)h(an)h -(executable.)49 b(The)28 b(pr)o(ogram)g(and)g(the)h(ar)o(guments)f(must)h(be) -f(either)681 3899 y(strings,)g(symbols,)h(or)e(integers.)44 -b(Symbols)27 b(and)f(integers)h(ar)o(e)e(coer)o(ced)g(to)h(strings.)45 -b(A)681 3999 y(symbol's)24 b(print-name)f(is)h(used.)35 b(Integers)23 -b(ar)o(e)f(converted)h(to)g(strings)h(in)g(base)f(10.)34 b(Us-)681 -4098 y(ing)15 b(symbols)h(instead)e(of)g(strings)h(is)g(convenient,)h(since)f -(it)g(suppr)o(esses)f(the)g(clutter)g(of)h(the)681 4198 y(surr)o(ounding)j -Fw(")p Fx(:)c(:)g(:)f Fw(")k FA(quotation)i(marks.)27 b(T)-8 -b(o)18 b(aid)f(this)h(purpose,)g(scsh)h(r)o(eads)d(symbols)j(in)681 -4297 y(a)h(case-sensitive)g(manner)-6 b(,)21 b(so)g(that)g(you)g(can)f(say) -888 4436 y Fw(\(more)42 b(Readme\))681 4575 y FA(and)20 b(get)h(the)g(right)g -(\256le.)805 4699 y(A)16 b Fz(connect-list)f FA(is)h(a)g(speci\256cation)g -(of)g(how)h(two)f(pr)o(ocesses)f(ar)o(e)g(to)h(be)g(wir)o(ed)f(together)681 -4799 y(by)28 b(pipes.)51 b(It)28 b(has)g(the)h(form)g Fw(\(\()p -Fz(fr)o(om)1902 4826 y Ft(1)1983 4799 y Fz(fr)o(om)2138 4826 -y Ft(2)2219 4799 y Fx(:)14 b(:)g(:)57 b Fz(to)p Fw(\))43 b -Fx(:)14 b(:)g(:)g Fw(\))28 b FA(and)g(is)g(implicitly)i(back-)681 -4898 y(quoted.)e(For)21 b(example,)681 5147 y(12)p 1952 5071 -323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 -5176 323 4 v 435 w FD(November)d(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +12 17 bop 681 614 a FB(can)41 b(later)h(be)f(r)o(etrieved)g(fr)o(om)g +(the)h(port)g(as)g(a)g(string.)90 b(If)41 b(a)h(user)f(wer)o(e)h(to)g +(bind)681 714 y Fx(\(current-output-)o(po)o(rt\))24 b +FB(to)32 b(such)g(a)f(port,)j(it)d(would)h(be)f(impossible)i(to)e +(associate)681 814 y(\002le)26 b(descriptor)g(1)g(with)g(this)h(port,)h +(as)e(it)g(cannot)h(be)e(r)o(epr)o(esented)f(in)j(Unix.)42 +b(So,)27 b(if)f(the)681 913 y(user)j(subsequently)i(forked)e(of)o(f)g +(some)h(other)g(pr)o(ogram)f(as)g(a)g(subpr)o(ocess,)i(that)f(pr)o(o-) +681 1013 y(gram)20 b(would)i(of)e(course)h(not)h(see)e(the)h(Scheme)f +(string)i(port)f(as)f(its)h(standar)o(d)e(output.)805 +1157 y(T)-8 b(o)32 b(keep)f(stdio)h(synced)g(with)g(the)f(values)g(of)h +(Scheme's)f(curr)o(ent)g(i/o)h(ports,)i(use)681 1257 +y(the)25 b(special)g(r)o(edir)o(ection)f Fx(stdports)p +FB(.)35 b(This)26 b(causes)f(0,)h(1,)f(2)g(to)h(be)e(r)o(edir)o(ected)f +(fr)o(om)i(the)681 1356 y(curr)o(ent)20 b(Scheme)g(standar)o(d)f +(ports.)26 b(It)21 b(is)g(equivalent)g(to)g(the)g(thr)o(ee)f(r)o(edir)o +(ections:)888 1580 y Fx(\(=)43 b(0)g(,\(current-input-p)o(or)o(t\)\)) +888 1679 y(\(=)g(1)g(,\(current-output-)o(po)o(rt\))o(\))888 +1779 y(\(=)g(2)g(,\(error-output-po)o(rt)o(\)\))681 2002 +y FB(The)30 b(r)o(edir)o(ections)g(ar)o(e)f(done)i(in)g(the)f +(indicated)g(or)o(der)-6 b(.)54 b(This)31 b(will)g(cause)f(an)h(err)o +(or)e(if)681 2102 y(one)23 b(of)h(the)f(curr)o(ent)g(i/o)h(ports)f +(isn't)h(a)f(Unix)g(port)h(\()p FA(e.g.)o FB(,)f(if)h(one)f(is)h(a)f +(string)h(port\).)32 b(This)681 2202 y(Scheme/Unix)18 +b(i/o)h(synchr)o(onisation)h(can)e(also)g(be)g(had)g(in)h(Scheme)e +(code)h(\(as)g(opposed)681 2301 y(to)j(a)f(r)o(edir)o(ection)g(spec\))g +(with)h(the)g Fx(\(stdports->stdio\))14 b FB(pr)o(ocedur)o(e.)681 +2629 y Fv(2.2)99 b(Process)25 b(forms)681 2868 y FB(A)19 +b FA(pr)o(ocess)h(form)g FB(speci\002es)g(a)g(computation)h(to)f +(perform)g(as)f(an)h(independent)g(Unix)g(pr)o(o-)681 +2968 y(cess.)25 b(It)c(can)g(be)f(one)h(of)g(the)g(following:)888 +3130 y Fx(\(begin)41 b(.)j FA(scheme-code)n Fx(\))888 +3230 y(\(|)f FA(pf)1072 3257 y Fu(1)1153 3230 y Fx(...)g +FA(pf)1381 3257 y Fn(n)1426 3230 y Fx(\))888 3329 y(\(|+)g +FA(connect-list)g(pf)1550 3356 y Fu(1)1631 3329 y Fx(...)f +FA(pf)1858 3356 y Fn(n)1904 3329 y Fx(\))888 3429 y(\(epf)g(.)h +FA(epf)p Fx(\))888 3528 y(\()p FA(pr)o(og)f(ar)o(g)1235 +3556 y Fu(1)1316 3528 y Fx(...)h FA(ar)o(g)1600 3556 +y Fn(n)1645 3528 y Fx(\))2134 3134 y(;)g(Run)f FA(scheme-code)h +Fx(in)g(a)g(fork.)2134 3234 y(;)g(Simple)e(pipeline)2134 +3334 y(;)i(Complex)e(pipeline)2134 3433 y(;)i(An)g(extended)d(process)h +(form.)2134 3533 y(;)i(Default:)d(exec)i(the)h(program.)681 +3694 y FB(The)19 b(default)g(case)g Fx(\()p FA(pr)o(og)42 +b(ar)o(g)1640 3721 y Fu(1)1721 3694 y Fx(...)g FA(ar)o(g)2004 +3721 y Fn(n)2049 3694 y Fx(\))19 b FB(is)h(also)g(implicitly)h +(backquoted.)k(That)19 b(is,)h(it)681 3793 y(is)h(equivalent)g(to:)888 +3962 y Fx(\(begin)41 b(\(apply)h(exec-path)d(`\()p FA(pr)o(og)j(ar)o(g) +2325 3989 y Fu(1)2406 3962 y Fx(...)g FA(ar)o(g)2689 +3989 y Fn(n)2735 3962 y Fx(\)\)\))681 4131 y(Exec-path)27 +b FB(is)j(the)h(version)g(of)g(the)f Fx(exec\(\))e FB(system)j(call)g +(that)f(uses)h(scsh's)g(path)f(list)681 4231 y(to)f(sear)o(ch)e(for)i +(an)f(executable.)48 b(The)29 b(pr)o(ogram)e(and)i(the)f(ar)o(guments)h +(must)g(be)f(either)681 4331 y(strings,)h(symbols,)g(or)d(integers.)44 +b(Symbols)27 b(and)f(integers)h(ar)o(e)e(coer)o(ced)g(to)i(strings.)44 +b(A)681 4430 y(symbol's)17 b(print-name)g(is)f(used.)24 +b(Integers)16 b(ar)o(e)f(converted)h(to)h(strings)g(in)g(base)f(10.)23 +b(Using)681 4530 y(symbols)k(instead)e(of)g(strings)i(is)f(convenient,) +h(since)f(it)f(suppr)o(esses)g(the)h(clutter)f(of)h(the)681 +4630 y(surr)o(ounding)f Fx("...")d FB(quotation)j(marks.)37 +b(T)-8 b(o)24 b(aid)g(this)h(purpose,)g(scsh)g(r)o(eads)e(symbols)681 +4729 y(in)e(a)f(case-sensitive)h(manner)-6 b(,)20 b(so)h(that)g(you)g +(can)g(say)888 4898 y Fx(\(more)42 b(Readme\))681 5147 +y FB(12)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w +FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 13 19 -13 18 bop 573 614 a Fw(\(|+)42 b(\(\(1)h(2)g(0\))f(\(3)h(1\)\))g -Fz(pf)1498 641 y Ft(1)1579 614 y Fz(pf)1632 641 y Ft(2)1669 -614 y Fw(\))365 805 y FA(r)o(uns)20 b Fz(pf)603 832 y Ft(1)659 -805 y FA(and)f Fz(pf)872 832 y Ft(2)909 805 y FA(.)27 b(The)19 -b(\256rst)g(clause)g Fw(\(1)42 b(2)h(0\))19 b FA(causes)f Fz(pf)2160 -832 y Ft(1)2198 805 y FA('s)h(stdout)g(\(1\))f(and)g(stderr)g(\(2\))g(to)365 -904 y(be)g(connected)g(via)g(pipe)g(to)g Fz(pf)1317 931 y Ft(2)1354 -904 y FA('s)g(stdin)h(\(0\).)25 b(The)19 b(second)f(clause)g -Fw(\(3)42 b(1\))18 b FA(causes)f Fz(pf)3002 931 y Ft(1)3039 -904 y FA('s)h(\256le)365 1004 y(descriptor)j(3)f(to)h(be)f(connected)h(to)g -Fz(pf)1563 1031 y Ft(2)1600 1004 y FA('s)g(\256le)g(descriptor)f(1.)490 -1161 y(The)32 b Fw(begin)e FA(pr)o(ocess)i(form)h(does)f(a)g -Fw(stdio->stdports)26 b FA(synchr)o(onisation)34 b(in)e(the)365 -1261 y(child)25 b(pr)o(ocess)f(befor)o(e)g(executing)g(the)h(body)g(of)g(the) -g(form.)39 b(This)25 b(guarantees)f(that)g(the)365 1361 y Fw(begin)14 -b FA(form,)j(like)f(all)g(other)g(pr)o(ocess)g(forms,)h(\252sees\272)e(the)h -(ef)o(fects)f(of)h(any)g(associated)f(I/O)365 1460 y(r)o(edir)o(ections.)490 -1618 y(Note)20 b(that)g(R4RS)g(does)h(not)f(specify)g(whether)h(or)f(not)h -Fw(|)f FA(and)f Fw(|+)h FA(ar)o(e)e(r)o(eadable)g(sym-)365 -1717 y(bols.)28 b(Scsh)21 b(does.)365 2079 y Fu(2.3)99 b(Using)26 -b(extended)d(process)j(forms)f(in)f(Scheme)365 2337 y FA(Pr)o(ocess)h(forms)h -(and)e(extended)g(pr)o(ocess)h(forms)g(ar)o(e)f Fz(not)h FA(Scheme.)40 -b(They)25 b(ar)o(e)f(a)g(dif)o(fer)o(-)365 2436 y(ent)31 b(notation)h(for)f -(expr)o(essing)f(computation)i(that,)h(like)e(Scheme,)i(is)e(based)f(upon)i -(s-)365 2536 y(expr)o(essions.)c(Extended)19 b(pr)o(ocess)h(forms)h(ar)o(e)e -(used)h(in)h(Scheme)f(pr)o(ograms)g(by)g(embed-)365 2636 y(ding)15 -b(them)g(inside)g(special)e(Scheme)h(forms.)26 b(Ther)o(e)13 -b(ar)o(e)g(thr)o(ee)h(basic)g(Scheme)g(forms)h(that)365 2735 -y(use)21 b(extended)f(pr)o(ocess)g(forms:)28 b Fw(exec-epf)p -FA(,)17 b Fw(&)p FA(,)j(and)g Fw(run)p FA(.)365 2907 y Fw(\(exec-epf)40 -b Fz(.)21 b(epf)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(no)21 -b(r)o(eturn)g(value)1177 b FA(syntax)365 3006 y Fw(\(&)43 b -Fz(.)21 b(epf)o Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(integer)1767 -b FA(syntax)365 3106 y Fw(\(run)42 b Fz(.)21 b(epf)p Fw(\))86 -b Fs(\000)-14 b(!)87 b Fz(integer)1680 b FA(syntax)573 3269 -y(The)23 b Fw(\(exec-epf)40 b(.)j Fz(epf)p Fw(\))23 b FA(form)g(nukes)g(the)h -(curr)o(ent)e(pr)o(ocess:)32 b(it)23 b(establishes)g(the)573 -3369 y(i/o)c(r)o(edir)o(ections)f(and)h(then)g(overlays)g(the)f(curr)o(ent)g -(pr)o(ocess)h(with)g(the)g(r)o(equested)573 3468 y(computation.)573 -3623 y(The)d Fw(\(&)43 b(.)g Fz(epf)p Fw(\))15 b FA(form)i(is)f(similar)-6 -b(,)17 b(except)e(that)i(the)f(pr)o(ocess)g(is)g(forked)g(of)o(f)f(in)h -(back-)573 3723 y(gr)o(ound.)27 b(The)21 b(form)g(r)o(eturns)f(the)h(subpr)o -(ocess')f(pr)o(ocess)h(object.)573 3878 y(The)15 b Fw(\(run)42 -b(.)h Fz(epf)p Fw(\))15 b FA(form)g(r)o(uns)h(the)f(pr)o(ocess)g(in)g(for)o -(egr)o(ound:)24 b(after)14 b(forking)h(of)o(f)f(the)573 3977 -y(computation,)k(it)f(waits)g(for)g(the)g(subpr)o(ocess)f(to)i(exit,)f(and)f -(r)o(eturns)h(its)g(exit)g(status.)573 4132 y(These)23 b(special)g(forms)g -(ar)o(e)f(macr)o(os)h(that)g(expand)f(into)j(the)e(equivalent)g(series)h(of) -573 4232 y(system)17 b(calls.)25 b(The)16 b(de\256nition)h(of)f(the)g -Fw(exec-epf)d FA(macr)o(o)i(is)h(non-trivial,)i(as)d(it)h(pr)o(o-)573 -4331 y(duces)j(the)g(code)h(to)f(handle)h(i/o)g(r)o(edir)o(ections)e(and)h -(set)g(up)h(pipelines.)27 b(However)-6 b(,)573 4431 y(the)21 -b(de\256nitions)h(of)f(the)f Fw(&)h FA(and)f Fw(run)g FA(macr)o(os)g(ar)o(e)f -(very)i(simple:)756 4623 y Fw(\(&)42 b(.)h Fz(epf)p Fw(\))170 -b Fs(\021)83 b Fw(\(fork)41 b(\()p Fx(\025)e Fw(\(\))k(\(exec-epf)d(.)j -Fz(epf)p Fw(\)\)\))756 4723 y(\(run)e(.)j Fz(epf)o Fw(\))83 -b Fs(\021)g Fw(\(wait)41 b(\(&)i(.)g Fz(epf)p Fw(\)\))365 5147 -y FD(November)18 b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 -5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V -1636 5176 323 4 v 1216 w FA(13)p eop +13 18 bop 365 614 a FB(and)21 b(get)f(the)h(right)h(\002le.)490 +739 y(A)31 b FA(connect-list)g FB(is)h(a)g(speci\002cation)g(of)f(how)i +(two)f(pr)o(ocesses)g(ar)o(e)e(to)i(be)g(wir)o(ed)f(to-)365 +839 y(gether)22 b(by)h(pipes.)30 b(It)22 b(has)g(the)h(form)f +Fx(\(\()p FA(fr)o(om)1791 866 y Fu(1)1872 839 y FA(fr)o(om)2028 +866 y Fu(2)2108 839 y Fx(...)43 b FA(to)o Fx(\))g(...\))21 +b FB(and)h(is)g(implicitly)365 938 y(backquoted.)k(For)21 +b(example,)573 1077 y Fx(\(|+)42 b(\(\(1)h(2)g(0\))f(\(3)h(1\)\))g +FA(pf)1498 1104 y Fu(1)1579 1077 y FA(pf)1632 1104 y +Fu(2)1669 1077 y Fx(\))365 1215 y FB(r)o(uns)26 b FA(pf)609 +1242 y Fu(1)672 1215 y FB(and)e FA(pf)890 1242 y Fu(2)928 +1215 y FB(.)38 b(The)25 b(\002rst)g(clause)g Fx(\(1)43 +b(2)g(0\))24 b FB(causes)h FA(pf)2221 1242 y Fu(1)2258 +1215 y FB('s)g(stdout)h(\(1\))e(and)g(stderr)h(\(2\))365 +1315 y(to)d(be)f(connected)g(via)g(pipe)g(to)h FA(pf)1426 +1342 y Fu(2)1463 1315 y FB('s)g(stdin)g(\(0\).)k(The)21 +b(second)h(clause)f Fx(\(3)42 b(1\))21 b FB(causes)g +FA(pf)3134 1342 y Fu(1)3171 1315 y FB('s)365 1415 y(\002le)g +(descriptor)g(3)f(to)h(be)f(connected)h(to)g FA(pf)1698 +1442 y Fu(2)1735 1415 y FB('s)g(\002le)g(descriptor)f(1.)490 +1539 y(The)32 b Fx(begin)e FB(pr)o(ocess)i(form)h(does)f(a)g +Fx(stdio->stdports)26 b FB(synchr)o(onisation)34 b(in)e(the)365 +1639 y(child)25 b(pr)o(ocess)g(befor)o(e)e(executing)i(the)g(body)g(of) +g(the)g(form.)37 b(This)26 b(guarantees)e(that)g(the)365 +1738 y Fx(begin)j FB(form,)k(like)f(all)f(other)g(pr)o(ocess)g(forms,)i +(\223sees\224)d(the)h(ef)o(fects)f(of)h(any)g(associated)365 +1838 y(I/O)22 b(r)o(edir)o(ections.)490 1962 y(Note)e(that)g(R4RS)g +(does)h(not)f(specify)g(whether)h(or)f(not)h Fx(|)f FB(and)f +Fx(|+)h FB(ar)o(e)e(r)o(eadable)g(sym-)365 2062 y(bols.)26 +b(Scsh)21 b(does.)365 2338 y Fv(2.3)99 b(Using)26 b(extended)d(process) +j(forms)f(in)f(Scheme)365 2553 y FB(Pr)o(ocess)32 b(forms)h(and)e +(extended)h(pr)o(ocess)f(forms)i(ar)o(e)d FA(not)i FB(Scheme.)60 +b(They)32 b(ar)o(e)f(a)g(dif-)365 2652 y(fer)o(ent)f(notation)h(for)f +(expr)o(essing)g(computation)h(that,)i(like)e(Scheme,)h(is)e(based)g +(upon)365 2752 y(s-expr)o(essions.)44 b(Extended)26 b(pr)o(ocess)g +(forms)h(ar)o(e)e(used)i(in)g(Scheme)g(pr)o(ograms)f(by)h(em-)365 +2851 y(bedding)17 b(them)g(inside)g(special)f(Scheme)g(forms.)25 +b(Ther)o(e)16 b(ar)o(e)f(thr)o(ee)h(basic)g(Scheme)g(forms)365 +2951 y(that)21 b(use)g(extended)f(pr)o(ocess)g(forms:)26 +b Fx(exec-epf)p FB(,)17 b Fx(&)p FB(,)j(and)g Fx(run)p +FB(.)365 3098 y Fx(\(exec-epf)40 b FA(.)21 b(epf)p Fx(\))86 +b Ft(\000)-14 b(!)87 b FA(no)21 b(r)o(eturn)g(value)1177 +b FB(syntax)365 3198 y Fx(\(&)43 b FA(.)21 b(epf)o Fx(\))87 +b Ft(\000)-14 b(!)87 b FA(pr)o(oc)1858 b FB(syntax)365 +3297 y Fx(\(run)42 b FA(.)21 b(epf)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(pr)o(oc)1771 b FB(syntax)573 3436 y(The)23 +b Fx(\(exec-epf)40 b(.)j FA(epf)p Fx(\))23 b FB(form)g(nukes)h(the)g +(curr)o(ent)e(pr)o(ocess:)30 b(it)24 b(establishes)f(the)573 +3536 y(i/o)c(r)o(edir)o(ections)f(and)h(then)g(overlays)g(the)f(curr)o +(ent)g(pr)o(ocess)h(with)g(the)g(r)o(equested)573 3636 +y(computation.)573 3767 y(The)d Fx(\(&)43 b(.)g FA(epf)p +Fx(\))15 b FB(form)i(is)f(similar)-6 b(,)17 b(except)e(that)i(the)f(pr) +o(ocess)g(is)g(forked)g(of)o(f)f(in)h(back-)573 3867 +y(gr)o(ound.)25 b(The)c(form)g(r)o(eturns)f(the)h(subpr)o(ocess')g(pr)o +(ocess)f(object.)573 3999 y(The)28 b Fx(\(run)42 b(.)h +FA(epf)p Fx(\))27 b FB(form)h(r)o(uns)h(the)f(pr)o(ocess)f(in)i(for)o +(egr)o(ound:)38 b(after)27 b(forking)h(of)o(f)573 4098 +y(the)f(computation,)i(it)e(waits)g(for)g(the)g(subpr)o(ocess)f(to)i +(exit,)g(and)e(r)o(eturns)g(its)i(exit)573 4198 y(status.)573 +4330 y(These)23 b(special)g(forms)g(ar)o(e)f(macr)o(os)h(that)g(expand) +f(into)j(the)e(equivalent)g(series)h(of)573 4429 y(system)31 +b(calls.)53 b(The)30 b(de\002nition)h(of)f(the)g Fx(exec-epf)d +FB(macr)o(o)j(is)g(non-trivial,)j(as)c(it)573 4529 y(pr)o(oduces)20 +b(the)i(code)f(to)h(handle)f(i/o)h(r)o(edir)o(ections)e(and)h(set)g(up) +h(pipelines.)27 b(How-)573 4628 y(ever)-6 b(,)19 b(the)i(de\002nitions) +h(of)f(the)g Fx(&)f FB(and)h Fx(run)e FB(macr)o(os)h(ar)o(e)g(very)g +(simple:)756 4769 y Fx(\(&)42 b(.)h FA(epf)p Fx(\))170 +b Ft(\021)83 b Fx(\(fork)41 b(\()p Fy(\025)e Fx(\(\))k(\(exec-epf)d(.)j +FA(epf)p Fx(\)\)\))756 4868 y(\(run)e(.)j FA(epf)o Fx(\))83 +b Ft(\021)g Fx(\(wait)41 b(\(&)i(.)g FA(epf)p Fx(\)\))365 +5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(13)p eop %%Page: 14 20 -14 19 bop 681 614 a Fy(2.3.1)81 b(Procedures)19 b(and)h(special)f(forms)681 -944 y FA(It)33 b(is)g(a)f(general)g(design)i(principle)e(in)i(scsh)f(that)g -(all)g(functionality)g(made)f(available)681 1044 y(thr)o(ough)25 -b(special)e(syntax)i(is)f(also)h(available)e(in)i(a)e(straightforwar)o(d)h -(pr)o(ocedural)e(form.)681 1143 y(So)f(ther)o(e)g(ar)o(e)f(pr)o(ocedural)f -(equivalents)j(for)f(all)h(of)f(the)g(pr)o(ocess)g(notation.)31 -b(In)21 b(this)i(way)-9 b(,)681 1243 y(the)25 b(pr)o(ogrammer)f(is)i(not)g(r) -o(estricted)e(by)h(the)g(particular)f(details)h(of)g(the)g(syntax.)41 -b(Her)o(e)681 1343 y(ar)o(e)19 b(some)i(of)g(the)g(syntax/pr)o(ocedur)o(e)e -(equivalents:)p 888 1591 1055 4 v 888 1691 4 100 v 941 1661 -a(Notation)172 b(Pr)o(ocedur)o(e)p 1940 1691 V 888 1694 1055 -4 v 888 1711 V 888 1811 4 100 v 941 1781 a Fw(|)455 b(fork/pipe)p -1940 1811 V 888 1910 V 941 1880 a(|+)411 b(fork/pipe+)p 1940 -1910 V 888 2010 V 941 1980 a(exec-epf)147 b(exec-path)p 1940 -2010 V 888 2110 V 941 2080 a FA(r)o(edir)o(ection)99 b Fw(open)p -FA(,)19 b Fw(dup)p 1940 2110 V 888 2209 V 941 2179 a(&)455 -b(fork)p 1940 2209 V 888 2309 V 941 2279 a(run)367 b(wait)17 -b Fl(+)h Fw(fork)p 1940 2309 V 888 2312 1055 4 v 681 2595 a -FA(Having)e(a)g(solid)h(pr)o(ocedural)d(foundation)j(also)g(allows)f(for)g -(general)g(notational)h(experi-)681 2694 y(mentation)i(using)h(Scheme's)e -(macr)o(os.)26 b(For)19 b(example,)f(the)h(pr)o(ogrammer)f(can)g(build)g(his) -681 2794 y(own)g(pipeline)f(notation)h(on)f(top)g(of)g(the)g -Fw(fork)e FA(and)i Fw(fork/pipe)c FA(pr)o(ocedur)o(es.)24 b(Chapter)17 -b(3)681 2894 y(gives)k(the)g(full)f(story)i(on)f(all)g(the)g(pr)o(ocedur)o -(es)e(in)i(the)g(syscall)g(library)-9 b(.)681 3431 y Fy(2.3.2)81 -b(Interfacing)19 b(process)h(output)g(to)g(Scheme)681 3761 -y FA(Ther)o(e)k(is)h(a)f(family)g(of)h(pr)o(ocedur)o(es)e(and)h(special)h -(forms)g(that)f(can)h(be)f(used)g(to)i(captur)o(e)681 3861 -y(the)21 b(output)g(of)g(pr)o(ocesses)f(as)g(Scheme)h(data.)681 -4085 y Fw(\(run/port)40 b Fz(.)20 b(epf)p Fw(\))87 b Fs(\000)-14 -b(!)87 b Fz(port)1558 b FA(syntax)681 4184 y Fw(\(run/file)40 -b Fz(.)20 b(epf)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(string)1494 -b FA(syntax)681 4284 y Fw(\(run/string)39 b Fz(.)20 b(epf)p -Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(string)1407 b FA(syntax)681 -4384 y Fw(\(run/strings)38 b Fz(.)21 b(epf)p Fw(\))87 b Fs(\000)-15 -b(!)87 b Fz(string)21 b(list)1237 b FA(syntax)681 4483 y Fw(\(run/sexp)40 -b Fz(.)20 b(epf)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(object)1505 -b FA(syntax)681 4583 y Fw(\(run/sexps)39 b Fz(.)21 b(epf)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(list)1548 b FA(syntax)888 -4799 y(These)15 b(forms)f(all)h(fork)f(of)o(f)g(subpr)o(ocesses,)h -(collecting)g(the)g(pr)o(ocess')f(output)h(to)f(std-)888 4898 -y(out)22 b(in)f(some)g(form)g(or)g(another)-6 b(.)681 5147 -y(14)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +14 19 bop 681 614 a Fz(2.3.1)81 b(Procedures)19 b(and)h(special)f +(forms)681 931 y FB(It)33 b(is)g(a)f(general)g(design)i(principle)e(in) +i(scsh)f(that)g(all)g(functionality)g(made)f(available)681 +1030 y(thr)o(ough)25 b(special)e(syntax)i(is)f(also)h(available)e(in)i +(a)e(straightforwar)o(d)h(pr)o(ocedural)e(form.)681 1130 +y(So)f(ther)o(e)g(ar)o(e)f(pr)o(ocedural)g(equivalents)i(for)f(all)g +(of)h(the)g(pr)o(ocess)f(notation.)29 b(In)21 b(this)i(way)-9 +b(,)681 1229 y(the)25 b(pr)o(ogrammer)g(is)g(not)h(r)o(estricted)e(by)i +(the)f(particular)f(details)h(of)g(the)h(syntax.)39 b(Her)o(e)681 +1329 y(ar)o(e)19 b(some)i(of)g(the)g(syntax/pr)o(ocedur)o(e)e +(equivalents:)p 888 1562 1055 4 v 888 1661 4 100 v 941 +1632 a(Notation)172 b(Pr)o(ocedur)o(e)p 1940 1661 V 888 +1665 1055 4 v 888 1681 V 888 1781 4 100 v 941 1751 a +Fx(|)455 b(fork/pipe)p 1940 1781 V 888 1881 V 941 1851 +a(|+)411 b(fork/pipe+)p 1940 1881 V 888 1980 V 941 1950 +a(exec-epf)147 b(exec-path)p 1940 1980 V 888 2080 V 941 +2050 a FB(r)o(edir)o(ection)99 b Fx(open)p FB(,)19 b +Fx(dup)p 1940 2080 V 888 2179 V 941 2150 a(&)455 b(fork)p +1940 2179 V 888 2279 V 941 2249 a(run)367 b(wait)17 b +Fm(+)h Fx(fork)p 1940 2279 V 888 2282 1055 4 v 681 2549 +a FB(Having)e(a)g(solid)h(pr)o(ocedural)d(foundation)j(also)g(allows)f +(for)g(general)g(notational)h(experi-)681 2649 y(mentation)i(using)h +(Scheme's)f(macr)o(os.)24 b(For)19 b(example,)f(the)h(pr)o(ogrammer)f +(can)h(build)f(his)681 2748 y(own)g(pipeline)f(notation)h(on)g(top)f +(of)g(the)g Fx(fork)f FB(and)g Fx(fork/pipe)e FB(pr)o(ocedur)o(es.)22 +b(Chapter)17 b(3)681 2848 y(gives)k(the)g(full)f(story)i(on)f(all)g +(the)g(pr)o(ocedur)o(es)e(in)i(the)g(syscall)g(library)-9 +b(.)681 3359 y Fz(2.3.2)81 b(Interfacing)19 b(process)h(output)g(to)g +(Scheme)681 3675 y FB(Ther)o(e)k(is)h(a)f(family)g(of)h(pr)o(ocedur)o +(es)e(and)h(special)h(forms)g(that)f(can)h(be)f(used)g(to)i(captur)o(e) +681 3775 y(the)21 b(output)g(of)g(pr)o(ocesses)f(as)g(Scheme)h(data.) +681 3992 y Fx(\(run/port)40 b FA(.)20 b(epf)p Fx(\))87 +b Ft(\000)-14 b(!)87 b FA(port)1558 b FB(syntax)681 4092 +y Fx(\(run/file)40 b FA(.)20 b(epf)p Fx(\))87 b Ft(\000)-14 +b(!)87 b FA(string)1494 b FB(syntax)681 4191 y Fx(\(run/string)39 +b FA(.)20 b(epf)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(string)1407 +b FB(syntax)681 4291 y Fx(\(run/strings)38 b FA(.)21 +b(epf)p Fx(\))87 b Ft(\000)-15 b(!)87 b FA(string)21 +b(list)1237 b FB(syntax)681 4391 y Fx(\(run/sexp)40 b +FA(.)20 b(epf)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(object)1505 +b FB(syntax)681 4490 y Fx(\(run/sexps)39 b FA(.)21 b(epf)p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(list)1548 b FB(syntax)888 +4699 y(These)30 b(forms)g(all)g(fork)g(of)o(f)f(subpr)o(ocesses,)i +(collecting)g(the)f(pr)o(ocess')f(output)i(to)888 4799 +y(stdout)22 b(in)f(some)g(form)g(or)g(another)-6 b(.)25 +b(The)c(subpr)o(ocess)g(r)o(uns)g(with)h(\002le)e(descriptor)888 +4898 y(1)h(and)f(the)h(curr)o(ent)f(output)h(port)g(bound)g(to)g(a)f +(pipe.)681 5147 y(14)p 1952 5071 323 4 v 1952 5173 4 +102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v +538 w FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 15 21 -15 20 bop 805 636 a Fw(run/port)227 b FA(V)-8 b(alue)18 b(is)g(a)g(port)g -(open)g(on)h(pr)o(ocess's)f(stdout.)26 b(Re-)1384 736 y(turns)c(immediately)e -(after)g(forking)h(child.)805 885 y Fw(run/file)227 b FA(V)-8 -b(alue)22 b(is)f(name)h(of)f(a)g(temp)g(\256le)h(containing)g(pr)o(o-)1384 -985 y(cess's)f(output.)28 b(Returns)22 b(when)f(pr)o(ocess)f(exits.)805 -1134 y Fw(run/string)139 b FA(V)-8 b(alue)21 b(is)g(a)f(string)i(containing)g -(pr)o(ocess')e(output.)1384 1234 y(Returns)i(when)f(eof)g(r)o(ead.)805 -1383 y Fw(run/strings)95 b FA(Splits)24 b(pr)o(ocess')f(output)g(into)h(a)f -(list)h(of)f(newline-)1384 1483 y(delimited)e(strings.)28 b(Returns)22 -b(when)f(eof)g(r)o(ead.)805 1632 y Fw(run/sexp)227 b FA(Reads)33 -b(a)g(single)g(object)h(fr)o(om)e(pr)o(ocess')h(stdout)1384 -1732 y(with)43 b Fw(read)p FA(.)91 b(Returns)42 b(as)g(soon)i(as)e(the)g(r)o -(ead)1384 1831 y(completes.)805 1981 y Fw(run/sexps)183 b FA(Repeatedly)25 -b(r)o(eads)f(objects)i(fr)o(om)f(pr)o(ocess')g(std-)1384 2081 -y(out)41 b(with)g Fw(read)p FA(.)84 b(Returns)41 b(accumulated)e(list)1384 -2180 y(upon)22 b(eof.)609 2333 y(The)37 b(delimiting)g(newlines)g(ar)o(e)e -(not)i(included)g(in)f(the)h(strings)g(r)o(eturned)e(by)573 -2432 y Fw(run/strings)p FA(.)573 2561 y(These)17 b(special)g(forms)h(just)g -(expand)f(into)h(calls)f(to)h(the)f(following)i(analogous)f(pr)o(o-)573 -2661 y(cedur)o(es.)365 2840 y Fw(\(run/port*)40 b Fz(thunk)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(port)1321 b FA(pr)o(ocedur)o(e)365 -2939 y Fw(\(run/file*)40 b Fz(thunk)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(string)1257 b FA(pr)o(ocedur)o(e)365 3039 y Fw(\(run/string*)39 -b Fz(thunk)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(string)1170 -b FA(pr)o(ocedur)o(e)365 3138 y Fw(\(run/strings*)39 b Fz(thunk)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(string)21 b(list)999 b FA(pr)o(ocedur)o(e) -365 3238 y Fw(\(run/sexp*)40 b Fz(thunk)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(object)1268 b FA(pr)o(ocedur)o(e)365 3338 y Fw(\(run/sexps*)39 -b Fz(thunk)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(object)21 b(list)1097 -b FA(pr)o(ocedur)o(e)573 3471 y(For)21 b(example,)f Fw(\(run/port)40 -b(.)j Fz(epf)p Fw(\))20 b FA(expands)g(into)756 3609 y Fw(\(run/port*)39 -b(\()p Fx(\025)g Fw(\(\))j(\(exec-epf)e(.)j Fz(epf)p Fw(\)\)\).)490 -3827 y FA(The)35 b(following)i(pr)o(ocedur)o(es)d(ar)o(e)g(also)i(of)f -(utility)i(for)e(generally)g(parsing)h(input)365 3927 y(str)o(eams)20 -b(in)i(scsh:)365 4068 y Fw(\(port->string)39 b Fz(port)p Fw(\))86 -b Fs(\000)-15 b(!)88 b Fz(string)1186 b FA(pr)o(ocedur)o(e)365 -4167 y Fw(\(port->sexp-list)37 b Fz(port)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(list)1153 b FA(pr)o(ocedur)o(e)365 4267 y Fw(\(port->string-lis)o -(t)37 b Fz(port)p Fw(\))87 b Fs(\000)-15 b(!)87 b Fz(string)21 -b(list)842 b FA(pr)o(ocedur)o(e)365 4367 y Fw(\(port->list)39 -b Fz(r)o(eader)21 b(port)p Fw(\))86 b Fs(\000)-14 b(!)87 b -Fz(list)1144 b FA(pr)o(ocedur)o(e)573 4500 y Fw(Port->string)32 -b FA(r)o(eads)37 b(the)g(port)h(until)g(eof,)k(then)c(r)o(eturns)f(the)h -(accumulated)573 4599 y(string.)47 b Fw(Port->sexp-list)21 -b FA(r)o(epeatedly)k(r)o(eads)h(data)g(fr)o(om)h(the)g(port)g(until)h(eof,) -573 4699 y(then)g(r)o(eturns)f(the)g(accumulated)g(list)h(of)f(items.)48 -b Fw(Port->string-list)21 b FA(r)o(epeat-)573 4799 y(edly)30 -b(r)o(eads)f(newline-terminated)h(strings)h(fr)o(om)f(the)g(port)h(until)g -(eof,)h(then)f(r)o(e-)573 4898 y(turns)g(the)h(accumulated)e(list)i(of)f -(strings.)60 b(The)31 b(delimiting)h(newlines)g(ar)o(e)e(not)365 -5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p -1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 -V 1636 5176 323 4 v 1216 w FA(15)p eop +15 20 bop 805 636 a Fx(run/port)227 b FB(V)-8 b(alue)18 +b(is)h(a)f(port)g(open)h(on)f(pr)o(ocess's)g(stdout.)25 +b(Re-)1384 736 y(turns)d(immediately)e(after)g(forking)h(child.)805 +885 y Fx(run/file)227 b FB(V)-8 b(alue)22 b(is)f(name)h(of)f(a)g(temp)g +(\002le)h(containing)g(pr)o(o-)1384 985 y(cess's)f(output.)26 +b(Returns)c(when)f(pr)o(ocess)g(exits.)805 1134 y Fx(run/string)139 +b FB(V)-8 b(alue)21 b(is)g(a)f(string)i(containing)g(pr)o(ocess')e +(output.)1384 1234 y(Returns)i(when)f(eof)g(r)o(ead.)805 +1383 y Fx(run/strings)95 b FB(Splits)24 b(pr)o(ocess')f(output)g(into)h +(a)f(list)h(of)f(newline-)1384 1483 y(delimited)e(strings.)26 +b(Returns)c(when)f(eof)g(r)o(ead.)805 1632 y Fx(run/sexp)227 +b FB(Reads)33 b(a)g(single)g(object)h(fr)o(om)e(pr)o(ocess')h(stdout) +1384 1732 y(with)44 b Fx(read)p FB(.)88 b(Returns)44 +b(as)e(soon)h(as)f(the)h(r)o(ead)1384 1831 y(completes.)805 +1981 y Fx(run/sexps)183 b FB(Repeatedly)25 b(r)o(eads)f(objects)i(fr)o +(om)f(pr)o(ocess')g(std-)1384 2081 y(out)41 b(with)g +Fx(read)p FB(.)83 b(Returns)41 b(accumulated)f(list)1384 +2180 y(upon)22 b(eof.)609 2333 y(The)37 b(delimiting)g(newlines)g(ar)o +(e)e(not)i(included)g(in)f(the)h(strings)g(r)o(eturned)e(by)573 +2432 y Fx(run/strings)p FB(.)573 2561 y(These)17 b(special)g(forms)h +(just)g(expand)f(into)h(calls)f(to)h(the)f(following)i(analogous)f(pr)o +(o-)573 2661 y(cedur)o(es.)365 2840 y Fx(\(run/port*)40 +b FA(thunk)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(port)1321 +b FB(pr)o(ocedur)o(e)365 2939 y Fx(\(run/file*)40 b FA(thunk)p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(string)1257 b FB(pr)o(ocedur)o(e)365 +3039 y Fx(\(run/string*)39 b FA(thunk)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(string)1170 b FB(pr)o(ocedur)o(e)365 3138 +y Fx(\(run/strings*)39 b FA(thunk)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(string)21 b(list)999 b FB(pr)o(ocedur)o(e)365 +3238 y Fx(\(run/sexp*)40 b FA(thunk)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(object)1268 b FB(pr)o(ocedur)o(e)365 3338 +y Fx(\(run/sexps*)39 b FA(thunk)p Fx(\))87 b Ft(\000)-14 +b(!)87 b FA(object)21 b(list)1097 b FB(pr)o(ocedur)o(e)573 +3471 y(For)21 b(example,)f Fx(\(run/port)40 b(.)j FA(epf)p +Fx(\))20 b FB(expands)g(into)756 3609 y Fx(\(run/port*)39 +b(\()p Fy(\025)g Fx(\(\))j(\(exec-epf)e(.)j FA(epf)p +Fx(\)\)\).)490 3827 y FB(The)35 b(following)i(pr)o(ocedur)o(es)d(ar)o +(e)g(also)i(of)f(utility)i(for)e(generally)g(parsing)h(input)365 +3927 y(str)o(eams)20 b(in)i(scsh:)365 4068 y Fx(\(port->string)39 +b FA(port)p Fx(\))86 b Ft(\000)-15 b(!)88 b FA(string)1186 +b FB(pr)o(ocedur)o(e)365 4167 y Fx(\(port->sexp-list)37 +b FA(port)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(list)1153 +b FB(pr)o(ocedur)o(e)365 4267 y Fx(\(port->string-lis)o(t)37 +b FA(port)p Fx(\))87 b Ft(\000)-15 b(!)87 b FA(string)21 +b(list)842 b FB(pr)o(ocedur)o(e)365 4367 y Fx(\(port->list)39 +b FA(r)o(eader)21 b(port)p Fx(\))86 b Ft(\000)-14 b(!)87 +b FA(list)1144 b FB(pr)o(ocedur)o(e)573 4500 y Fx(Port->string)32 +b FB(r)o(eads)37 b(the)g(port)h(until)g(eof,)k(then)c(r)o(eturns)f(the) +h(accumulated)573 4599 y(string.)46 b Fx(Port->sexp-list)21 +b FB(r)o(epeatedly)k(r)o(eads)h(data)g(fr)o(om)h(the)h(port)f(until)h +(eof,)573 4699 y(then)g(r)o(eturns)f(the)h(accumulated)e(list)j(of)e +(items.)47 b Fx(Port->string-lis)o(t)22 b FB(r)o(epeat-)573 +4799 y(edly)30 b(r)o(eads)f(newline-terminated)h(strings)h(fr)o(om)f +(the)g(port)h(until)g(eof,)h(then)f(r)o(e-)573 4898 y(turns)h(the)f +(accumulated)f(list)i(of)g(strings.)58 b(The)31 b(delimiting)i +(newlines)f(ar)o(e)e(not)365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226) +f(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 +v 540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 +w FB(15)p eop %%Page: 16 22 -16 21 bop 888 614 a FA(part)39 b(of)g(the)h(r)o(eturned)e(strings.)85 -b Fw(Port->list)35 b FA(generalises)k(these)h(two)g(pr)o(o-)888 -714 y(cedur)o(es.)71 b(It)35 b(uses)h Fz(r)o(eader)g FA(to)g(r)o(epeatedly)d -(r)o(ead)h(objects)i(fr)o(om)f(a)h(port.)71 b(It)36 b(ac-)888 -814 y(cumulates)h(these)g(objects)h(into)f(a)g(list,)k(which)d(is)f(r)o -(eturned)f(upon)h(eof.)76 b(The)888 913 y Fw(port->string-list)20 -b FA(and)26 b Fw(port->sexp-list)21 b FA(pr)o(ocedur)o(es)k(ar)o(e)g(trivial) -i(to)g(de-)888 1013 y(\256ne,)21 b(being)g(mer)o(ely)f Fw(port->list)d -FA(curried)j(with)i(the)e(appr)o(opriate)f(parsers:)1071 1212 -y Fw(\(port->string-li)o(st)37 b Fz(port)o Fw(\))44 b Fs(\021)f -Fw(\(port->list)c(read-line)h Fz(port)o Fw(\))1071 1312 y(\(port->sexp-list) -124 b Fz(port)o Fw(\))44 b Fs(\021)f Fw(\(port->list)c(read)j -Fz(port)o Fw(\))888 1512 y FA(The)21 b(following)h(compositions)h(also)e -(hold:)1071 1711 y Fw(run/string*)126 b Fs(\021)87 b Fw(port->string)256 -b Fs(\016)44 b Fw(run/port*)1071 1811 y(run/strings*)82 b Fs(\021)87 -b Fw(port->string-lis)o(t)37 b Fs(\016)44 b Fw(run/port*)1071 -1910 y(run/sexp*)214 b Fs(\021)87 b Fw(read)608 b Fs(\016)44 -b Fw(run/port*)1071 2010 y(run/sexps*)170 b Fs(\021)87 b Fw(port->sexp-list) -124 b Fs(\016)44 b Fw(run/port*)681 2376 y(\(reduce-port)38 -b Fz(port)20 b(r)o(eader)h(op)f(.)h(seeds)p Fw(\))87 b Fs(\000)-14 -b(!)87 b Fz(object)2488 2346 y Fk(\003)3170 2376 y FA(pr)o(ocedur)o(e)888 -2534 y(This)28 b(pr)o(ocedur)o(e)d(can)h(be)h(used)f(to)i(perform)e(a)h -(variety)f(of)h(iterative)f(operations)888 2633 y(over)18 b(an)g(input)h(str) -o(eam.)26 b(It)18 b(r)o(epeatedly)f(uses)h Fz(r)o(eader)g FA(to)h(r)o(ead)d -(an)j(object)f(fr)o(om)g Fz(port)o FA(.)888 2733 y(If)f(the)h(\256rst)g(r)o -(ead)d(r)o(eturns)i(eof,)h(then)g(the)f(entir)o(e)g Fw(reduce-port)c -FA(operation)18 b(r)o(eturns)888 2833 y(the)f(seeds)f(as)h(multiple)g -(values.)25 b(If)16 b(the)h(\256rst)g(r)o(ead)e(operation)i(r)o(eturns)f -(some)h(other)888 2932 y(value)f Fx(v)s FA(,)h(then)g Fz(op)e -FA(is)i(applied)e(to)i Fx(v)i FA(and)d(the)h(seeds:)24 b Fw(\()p -Fz(op)43 b(v)g Fw(.)g Fz(seeds)q Fw(\))p FA(.)25 b(This)17 -b(should)888 3032 y(r)o(eturn)24 b(a)f(new)h(set)g(of)g(seed)g(values,)g(and) -f(the)h(r)o(eduction)g(then)g(loops,)i(r)o(eading)d(a)888 3132 -y(new)g(value)e(fr)o(om)h(the)g(port,)h(and)e(so)i(forth.)31 -b(\(If)22 b(multiple)h(seed)e(values)h(ar)o(e)f(used,)888 3231 -y(then)h Fz(op)e FA(must)h(r)o(eturn)f(multiple)h(values.\))888 -3381 y(For)g(example,)f Fw(\(port->list)39 b Fz(r)o(eader)44 -b(port)o Fw(\))20 b FA(could)h(be)g(de\256ned)f(as)1071 3559 -y Fw(\(reverse)40 b(\(reduce-port)f Fz(port)k(r)o(eader)g Fw(cons)f -('\(\)\)\))888 3786 y FA(An)25 b(imperative)f(way)g(to)h(look)g(at)f -Fw(reduce-port)c FA(is)25 b(to)g(say)f(that)h(it)f(abstracts)g(the)888 -3886 y(idea)15 b(of)h(a)f(loop)i(over)e(a)g(str)o(eam)g(of)h(values)f(r)o -(ead)f(fr)o(om)i(some)g(port,)h(wher)o(e)e(the)h(seed)888 3986 -y(values)21 b(expr)o(ess)e(the)i(loop)h(state.)681 4352 y Fu(2.4)99 -b(More)24 b(complex)h(process)h(operations)681 4599 y FA(The)21 -b(pr)o(ocedur)o(es)e(and)h(special)g(forms)h(in)h(the)f(pr)o(evious)f -(section)h(pr)o(ovide)f(for)h(the)g(com-)681 4699 y(mon)c(case,)f(wher)o(e)f -(the)h(pr)o(ogrammer)f(is)h(only)h(inter)o(ested)e(in)h(the)g(output)h(of)f -(the)g(pr)o(ocess.)681 4799 y(These)f(special)g(forms)h(and)e(pr)o(ocedur)o -(es)g(pr)o(ovide)g(mor)o(e)h(complicated)g(facilities)g(for)h(ma-)681 -4898 y(nipulating)21 b(pr)o(ocesses.)681 5147 y(16)p 1952 5071 -323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 -5176 323 4 v 435 w FD(November)d(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +16 21 bop 888 614 a FB(part)39 b(of)h(the)g(r)o(eturned)e(strings.)83 +b Fx(Port->list)35 b FB(generalises)40 b(these)g(two)g(pr)o(o-)888 +714 y(cedur)o(es.)70 b(It)35 b(uses)h FA(r)o(eader)g +FB(to)g(r)o(epeatedly)e(r)o(ead)g(objects)j(fr)o(om)e(a)h(port.)70 +b(It)36 b(ac-)888 814 y(cumulates)h(these)h(objects)f(into)h(a)f(list,) +k(which)d(is)f(r)o(eturned)f(upon)i(eof.)74 b(The)888 +913 y Fx(port->string-list)20 b FB(and)26 b Fx(port->sexp-list)21 +b FB(pr)o(ocedur)o(es)k(ar)o(e)g(trivial)i(to)g(de-)888 +1013 y(\002ne,)21 b(being)g(mer)o(ely)f Fx(port->list)d +FB(curried)j(with)i(the)e(appr)o(opriate)f(parsers:)1071 +1212 y Fx(\(port->string-li)o(st)37 b FA(port)o Fx(\))44 +b Ft(\021)f Fx(\(port->list)c(read-line)h FA(port)o Fx(\))1071 +1312 y(\(port->sexp-list)124 b FA(port)o Fx(\))44 b Ft(\021)f +Fx(\(port->list)c(read)j FA(port)o Fx(\))888 1512 y FB(The)21 +b(following)h(compositions)h(also)e(hold:)1071 1711 y +Fx(run/string*)126 b Ft(\021)87 b Fx(port->string)256 +b Ft(\016)44 b Fx(run/port*)1071 1811 y(run/strings*)82 +b Ft(\021)87 b Fx(port->string-lis)o(t)37 b Ft(\016)44 +b Fx(run/port*)1071 1910 y(run/sexp*)214 b Ft(\021)87 +b Fx(read)608 b Ft(\016)44 b Fx(run/port*)1071 2010 y(run/sexps*)170 +b Ft(\021)87 b Fx(port->sexp-list)124 b Ft(\016)44 b +Fx(run/port*)681 2376 y(\(reduce-port)38 b FA(port)20 +b(r)o(eader)h(op)f(.)h(seeds)p Fx(\))87 b Ft(\000)-14 +b(!)87 b FA(object)2488 2346 y Fl(\003)3170 2376 y FB(pr)o(ocedur)o(e) +888 2534 y(This)28 b(pr)o(ocedur)o(e)d(can)h(be)h(used)f(to)i(perform)e +(a)h(variety)f(of)h(iterative)f(operations)888 2633 y(over)32 +b(an)f(input)h(str)o(eam.)57 b(It)32 b(r)o(epeatedly)d(uses)j +FA(r)o(eader)f FB(to)h(r)o(ead)e(an)i(object)f(fr)o(om)888 +2733 y FA(port)p FB(.)40 b(If)25 b(the)h(\002rst)g(r)o(ead)e(r)o +(eturns)h(eof,)h(then)g(the)g(entir)o(e)f Fx(reduce-port)c +FB(operation)888 2833 y(r)o(eturns)28 b(the)g(seeds)g(as)g(multiple)h +(values.)48 b(If)28 b(the)g(\002rst)h(r)o(ead)d(operation)j(r)o(eturns) +888 2932 y(some)20 b(other)g(value)e Fy(v)s FB(,)i(then)g +FA(op)e FB(is)i(applied)e(to)i Fy(v)j FB(and)18 b(the)i(seeds:)k +Fx(\()p FA(op)43 b(v)g Fx(.)g FA(seeds)q Fx(\))p FB(.)888 +3032 y(This)18 b(should)g(r)o(eturn)f(a)f(new)i(set)f(of)g(seed)g +(values,)g(and)g(the)g(r)o(eduction)g(then)g(loops,)888 +3132 y(r)o(eading)k(a)f(new)i(value)f(fr)o(om)g(the)g(port,)g(and)g(so) +h(forth.)27 b(\(If)21 b(multiple)h(seed)e(values)888 +3231 y(ar)o(e)g(used,)g(then)h FA(op)f FB(must)i(r)o(eturn)e(multiple)h +(values.\))888 3381 y(For)g(example,)f Fx(\(port->list)39 +b FA(r)o(eader)44 b(port)o Fx(\))20 b FB(could)h(be)g(de\002ned)f(as) +1071 3559 y Fx(\(reverse)40 b(\(reduce-port)f FA(port)k(r)o(eader)g +Fx(cons)f('\(\)\)\))888 3786 y FB(An)25 b(imperative)f(way)g(to)h(look) +g(at)f Fx(reduce-port)c FB(is)25 b(to)g(say)f(that)h(it)f(abstracts)g +(the)888 3886 y(idea)k(of)h(a)f(loop)h(over)g(a)f(str)o(eam)f(of)i +(values)f(r)o(ead)f(fr)o(om)h(some)h(port,)i(wher)o(e)d(the)888 +3986 y(seed)21 b(values)f(expr)o(ess)g(the)h(loop)g(state.)681 +4352 y Fv(2.4)99 b(More)24 b(complex)h(process)h(operations)681 +4599 y FB(The)21 b(pr)o(ocedur)o(es)e(and)h(special)g(forms)h(in)h(the) +f(pr)o(evious)f(section)h(pr)o(ovide)f(for)h(the)g(com-)681 +4699 y(mon)27 b(case,)h(wher)o(e)e(the)g(pr)o(ogrammer)g(is)h(only)h +(inter)o(ested)d(in)j(the)e(output)h(of)g(the)g(pr)o(o-)681 +4799 y(cess.)37 b(These)24 b(special)g(forms)h(and)f(pr)o(ocedur)o(es)f +(pr)o(ovide)h(mor)o(e)g(complicated)g(facilities)681 +4898 y(for)c(manipulating)i(pr)o(ocesses.)681 5147 y(16)p +1952 5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)d(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p eop %%Page: 17 23 -17 22 bop 365 614 a Fy(2.4.1)81 b(Pids)20 b(and)g(ports)g(together)365 -828 y Fw(\(run/port+proc)38 b Fz(.)21 b(epf)o Fw(\))87 b Fs(\000)-14 -b(!)87 b Fz([port)20 b(pr)o(oc])1120 b FA(syntax)365 928 y -Fw(\(run/port+proc*)38 b Fz(thunk)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz([port)20 b(pr)o(oc])883 b FA(pr)o(ocedur)o(e)573 -1054 y(This)16 b(special)f(form)g(and)g(its)h(analogous)g(pr)o(ocedur)o(e)d -(can)j(be)f(used)g(if)g(the)h(pr)o(ogram-)573 1154 y(mer)24 -b(also)h(wishes)g(access)f(to)h(the)f(pr)o(ocess')g(pid,)h(exit)f(status,)i -(or)e(other)h(informa-)573 1253 y(tion.)34 b(They)23 b(both)g(fork)g(of)o(f)f -(a)g(subpr)o(ocess,)h(r)o(eturning)g(two)g(values:)31 b(a)22 -b(port)h(open)573 1353 y(on)15 b(the)f(pr)o(ocess')f(stdout)i(\(and)e(curr)o -(ent)g(output)i(port\),)g(and)e(the)h(subpr)o(ocess's)g(pr)o(o-)573 -1452 y(cess)21 b(object.)30 b(A)20 b(pr)o(ocess)h(object)h(encapsulates)e -(the)i(subpr)o(ocess')f(pr)o(ocess)g(id)g(and)573 1552 y(exit)f(code;)h(it)g -(is)g(the)g(value)f(passed)g(to)h(the)g Fw(wait)e FA(system)i(call.)573 -1689 y(For)15 b(example,)g(to)g(uncompr)o(ess)g(a)f(tech)g(r)o(eport,)h(r)o -(eading)f(the)g(uncompr)o(essed)h(data)573 1788 y(into)27 b(scsh,)i(and)d -(also)g(be)h(able)f(to)h(track)e(the)i(exit)g(status)f(of)h(the)f(decompr)o -(ession)573 1888 y(pr)o(ocess,)20 b(use)h(the)g(following:)756 -2062 y Fw(\(receive)40 b(\(port)h(child\))g(\(run/port+proc)d(\(zcat)k -(tr91-145.tex.Z\))o(\))843 2161 y(\(let*)f(\(\(paper)g(\(port->string)d -(port\)\))1148 2261 y(\(status)i(\(wait)i(child\)\)\))930 2361 -y Fx(:)14 b(:)g(:)g FA(use)20 b Fw(paper)p FA(,)f Fw(status)p -FA(,)f(and)i Fw(child)f FA(her)o(e)p Fx(:)14 b(:)g(:)f Fw(\)\))573 -2535 y FA(Note)32 b(that)h(you)g(must)g Fz(\256rst)g FA(do)f(the)h -Fw(port->string)27 b FA(and)32 b Fz(then)g FA(do)h(the)g(wait\320)573 -2634 y(the)22 b(other)h(way)f(ar)o(ound)f(may)h(lock)h(up)f(when)g(the)h -(zcat)e(\256lls)i(up)f(its)g(output)h(pipe)573 2734 y(buf)o(fer)-6 -b(.)365 3018 y Fy(2.4.2)81 b(Multiple)19 b(stream)g(capture)365 -3209 y FA(Occasionally)-9 b(,)46 b(the)40 b(pr)o(ogrammer)g(may)h(want)f(to)h -(captur)o(e)e(multiple)i(distinct)g(out-)365 3308 y(put)35 -b(str)o(eams)e(fr)o(om)h(a)g(pr)o(ocess.)67 b(For)34 b(instance,)k(he)c(may)g -(wish)i(to)e(r)o(ead)f(the)h(stdout)365 3408 y(and)e(stderr)g(str)o(eams)f -(into)i(two)g(distinct)g(strings.)63 b(This)32 b(is)h(accomplished)f(with)h -(the)365 3508 y Fw(run/collecting)15 b FA(form)21 b(and)f(its)i(analogous)f -(pr)o(ocedur)o(e,)d Fw(run/collecting*)p FA(.)365 3661 y Fw(\(run/collecting) -38 b Fz(fds)20 b(.)h(epf)11 b Fw(\))87 b Fs(\000)-15 b(!)88 -b Fz([port)p Fx(:)14 b(:)g(:)e Fz(])1002 b FA(syntax)365 3761 -y Fw(\(run/collecting*)37 b Fz(fds)21 b(thunk)p Fw(\))86 b -Fs(\000)-14 b(!)87 b Fz([port)p Fx(:)14 b(:)g(:)f Fz(])776 -b FA(pr)o(ocedur)o(e)573 3906 y Fw(Run/collecting)15 b FA(and)21 -b Fw(run/collecting*)16 b FA(r)o(un)22 b(pr)o(ocesses)f(that)g(pr)o(oduce)f -(mul-)573 4005 y(tiple)g(output)g(str)o(eams)f(and)g(r)o(eturn)g(ports)h -(open)g(on)g(these)g(str)o(eams.)26 b(T)-8 b(o)20 b(avoid)g(is-)573 -4105 y(sues)e(of)g(deadlock,)g Fw(run/collecting)12 b FA(doesn't)18 -b(use)g(pipes.)27 b(Instead,)17 b(it)i(\256rst)f(r)o(uns)573 -4205 y(the)f(pr)o(ocess)f(with)h(output)g(to)g(temp)g(\256les,)g(then)h(r)o -(eturns)e(ports)h(open)f(on)i(the)f(temp)573 4304 y(\256les.)28 -b(For)21 b(example,)756 4452 y Fw(\(run/collecting)37 b(\(1)43 -b(2\))f(\(ls\)\))573 4599 y FA(r)o(uns)23 b Fw(ls)e FA(with)i(stdout)g(\(fd)e -(1\))g(and)h(stderr)f(\(fd)g(2\))h(r)o(edir)o(ected)d(to)k(temporary)e -(\256les.)573 4699 y(When)26 b(the)g Fw(ls)e FA(is)i(done,)h -Fw(run/collecting)20 b FA(r)o(eturns)25 b(thr)o(ee)g(values:)37 -b(the)26 b Fw(ls)e FA(pr)o(o-)573 4799 y(cess')31 b(exit)g(status,)j(and)c -(two)i(ports)g(open)f(on)h(the)f(temporary)g(\256les.)59 b(The)31 -b(\256les)573 4898 y(ar)o(e)17 b(deleted)h(befor)o(e)g Fw(run/collecting)13 -b FA(r)o(eturns,)19 b(so)g(when)h(the)f(ports)g(ar)o(e)f(closed,)365 -5147 y FD(November)g(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 -5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V -1636 5176 323 4 v 1216 w FA(17)p eop +17 22 bop 365 614 a Fz(2.4.1)81 b(Pids)20 b(and)g(ports)g(together)365 +828 y Fx(\(run/port+proc)38 b FA(.)21 b(epf)o Fx(\))87 +b Ft(\000)-14 b(!)87 b FA([port)20 b(pr)o(oc])1120 b +FB(syntax)365 928 y Fx(\(run/port+proc*)38 b FA(thunk)p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA([port)20 b(pr)o(oc])883 +b FB(pr)o(ocedur)o(e)573 1054 y(This)32 b(special)f(form)h(and)f(its)h +(analogous)g(pr)o(ocedur)o(e)e(can)h(be)g(used)g(if)h(the)f(pr)o(o-)573 +1154 y(grammer)26 b(also)h(wishes)g(access)f(to)h(the)g(pr)o(ocess')f +(pid,)i(exit)e(status,)i(or)f(other)f(in-)573 1253 y(formation.)k(They) +22 b(both)g(fork)g(of)o(f)f(a)h(subpr)o(ocess,)g(r)o(eturning)g(two)g +(values:)28 b(a)21 b(port)573 1353 y(open)28 b(on)g(the)f(pr)o(ocess')h +(stdout)g(\(and)e(curr)o(ent)h(output)h(port\),)h(and)e(the)g(subpr)o +(o-)573 1452 y(cess's)d(pr)o(ocess)f(object.)35 b(A)23 +b(pr)o(ocess)g(object)h(encapsulates)f(the)h(subpr)o(ocess')f(pr)o(o-) +573 1552 y(cess)e(id)f(and)h(exit)f(code;)g(it)h(is)g(the)g(value)g +(passed)f(to)h(the)g Fx(wait)e FB(system)i(call.)573 +1689 y(For)34 b(example,)i(to)e(uncompr)o(ess)g(a)f(tech)h(r)o(eport,)h +(r)o(eading)e(the)h(uncompr)o(essed)573 1788 y(data)21 +b(into)i(scsh,)g(and)f(also)g(be)g(able)f(to)i(track)f(the)g(exit)g +(status)g(of)g(the)h(decompr)o(es-)573 1888 y(sion)f(pr)o(ocess,)e(use) +g(the)h(following:)756 2062 y Fx(\(receive)40 b(\(port)h(child\))g +(\(run/port+proc)d(\(zcat)k(tr91-145.tex.Z\))o(\))843 +2161 y(\(let*)f(\(\(paper)g(\(port->string)d(port\)\))1148 +2261 y(\(status)i(\(wait)i(child\)\)\))930 2361 y FB(.)12 +b(.)g(.)g(use)21 b Fx(paper)p FB(,)e Fx(status)p FB(,)f(and)i +Fx(child)f FB(her)o(e.)12 b(.)g(.)g Fx(\)\))573 2535 +y FB(Note)23 b(that)g(you)g(must)h FA(\002rst)f FB(do)g(the)g +Fx(port->string)18 b FB(and)k FA(then)g FB(do)h(the)g(wait\227the)573 +2634 y(other)33 b(way)f(ar)o(ound)g(may)h(lock)g(up)g(when)g(the)g +(zcat)f(\002lls)h(up)g(its)g(output)g(pipe)573 2734 y(buf)o(fer)-6 +b(.)365 3018 y Fz(2.4.2)81 b(Multiple)19 b(stream)g(capture)365 +3209 y FB(Occasionally)-9 b(,)46 b(the)40 b(pr)o(ogrammer)g(may)h(want) +f(to)h(captur)o(e)e(multiple)i(distinct)g(out-)365 3308 +y(put)35 b(str)o(eams)e(fr)o(om)h(a)g(pr)o(ocess.)66 +b(For)35 b(instance,)i(he)e(may)f(wish)h(to)g(r)o(ead)e(the)h(stdout) +365 3408 y(and)e(stderr)g(str)o(eams)g(into)h(two)g(distinct)g +(strings.)61 b(This)33 b(is)g(accomplished)f(with)h(the)365 +3508 y Fx(run/collecting)15 b FB(form)21 b(and)f(its)i(analogous)f(pr)o +(ocedur)o(e,)d Fx(run/collecting*)p FB(.)365 3661 y Fx +(\(run/collecting)38 b FA(fds)20 b(.)h(epf)11 b Fx(\))87 +b Ft(\000)-15 b(!)88 b FA([port.)12 b(.)g(.)g(])1012 +b FB(syntax)365 3761 y Fx(\(run/collecting*)37 b FA(fds)21 +b(thunk)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA([port.)12 +b(.)g(.)g(])787 b FB(pr)o(ocedur)o(e)573 3906 y Fx(Run/collecting)15 +b FB(and)21 b Fx(run/collecting*)16 b FB(r)o(un)22 b(pr)o(ocesses)f +(that)g(pr)o(oduce)f(mul-)573 4005 y(tiple)28 b(output)h(str)o(eams)e +(and)h(r)o(eturn)g(ports)g(open)h(on)g(these)f(str)o(eams.)47 +b(T)-8 b(o)29 b(avoid)573 4105 y(issues)h(of)g(deadlock,)h +Fx(run/collecting)24 b FB(doesn't)30 b(use)g(pipes.)53 +b(Instead,)31 b(it)f(\002rst)573 4205 y(r)o(uns)19 b(the)g(pr)o(ocess)f +(with)h(output)g(to)g(temp)g(\002les,)g(then)g(r)o(eturns)f(ports)g +(open)h(on)g(the)573 4304 y(temp)i(\002les.)k(For)d(example,)756 +4452 y Fx(\(run/collecting)37 b(\(1)43 b(2\))f(\(ls\)\))573 +4599 y FB(r)o(uns)23 b Fx(ls)e FB(with)i(stdout)g(\(fd)e(1\))g(and)h +(stderr)f(\(fd)g(2\))h(r)o(edir)o(ected)d(to)k(temporary)e(\002les.)573 +4699 y(When)26 b(the)g Fx(ls)f FB(is)h(done,)h Fx(run/collecting)20 +b FB(r)o(eturns)25 b(thr)o(ee)g(values:)35 b(the)26 b +Fx(ls)f FB(pr)o(o-)573 4799 y(cess')31 b(exit)g(status,)j(and)d(two)h +(ports)g(open)f(on)h(the)g(temporary)e(\002les.)58 b(The)31 +b(\002les)573 4898 y(ar)o(e)17 b(deleted)h(befor)o(e)g +Fx(run/collecting)13 b FB(r)o(eturns,)19 b(so)g(when)h(the)f(ports)g +(ar)o(e)f(closed,)365 5147 y FE(Mar)o(ch)h(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(17)p +eop %%Page: 18 24 -18 23 bop 888 614 a FA(they)17 b(vanish.)26 b(The)16 b Fw(fds)f -FA(list)h(of)g(\256le)h(descriptors)e(is)i(implicitly)g(backquoted)f(by)g -(the)888 714 y(special-form)k(version.)888 919 y(For)h(example,)f(if)h -(Kaiming)g(has)g(his)h(mailbox)f(pr)o(otected,)e(then)1071 -1231 y Fw(\(receive)40 b(\(status)h(out)h(err\))1463 1330 y(\(run/collecting) -c(\(1)k(2\))h(\(cat)f(/usr/kmshea/mbox)o(\)\))1158 1430 y(\(list)g(status)f -(\(port->string)d(out\))k(\(port->string)c(err\)\)\))888 1741 -y FA(might)22 b(pr)o(oduce)e(the)h(list)1071 2050 y Fw(\(256)42 -b("")h("cat:)e(/usr/kmshea/mbox:)c(Permission)i(denied"\))888 -2464 y FA(What)31 b(is)h(the)f(deadlock)g(hazar)o(d)e(that)i(causes)g -Fw(run/collecting)25 b FA(to)32 b(use)f(temp)888 2564 y(\256les?)26 -b(Pr)o(ocesses)15 b(with)h(multiple)g(output)f(str)o(eams)g(can)f(lock)i(up)f -(if)g(they)g(use)g(pipes)888 2663 y(to)28 b(communicate)g(with)h(Scheme)e -(i/o)h(r)o(eaders.)46 b(For)28 b(example,)g(suppose)g(some)888 -2763 y(Unix)21 b(pr)o(ogram)f Fw(myprog)e FA(does)j(the)g(following:)967 -3074 y(1.)41 b(First,)21 b(outputs)g(a)g(single)g(\252)p Fw(\()p -FA(\272)e(to)j(stderr)-6 b(.)967 3280 y(2.)41 b(Then,)21 b(outputs)g(a)f -(megabyte)h(of)g(data)e(to)i(stdout.)967 3485 y(3.)41 b(Finally)-9 -b(,)21 b(outputs)g(a)g(single)g(\252)p Fw(\))p FA(\272)e(to)j(stderr)-6 -b(,)19 b(and)i(exits.)888 3796 y(Our)e(scsh)h(pr)o(ogrammer)e(decides)g(to)i -(r)o(un)f Fw(myprog)d FA(with)k(stdout)g(and)e(stderr)g(r)o(edi-)888 -3896 y(r)o(ected)23 b Fz(via)g(Unix)g(pipes)g FA(to)i(the)f(ports)g -Fw(port1)d FA(and)j Fw(port2)p FA(,)e(r)o(espectively)-9 b(.)35 -b(He)24 b(gets)888 3996 y(into)19 b(tr)o(ouble)f(when)g(he)g(subsequently)h -(says)f Fw(\(read)41 b(port2\))p FA(.)24 b(The)18 b(Scheme)g -Fw(read)888 4095 y FA(r)o(outine)h(r)o(eads)f(the)h(open)g(par)o(en,)f(and)g -(then)i(hangs)f(in)g(a)g Fw(read\(\))d FA(system)k(call)e(try-)888 -4195 y(ing)30 b(to)g(r)o(ead)e(a)h(matching)h(close)g(par)o(en.)52 -b(But)29 b(befor)o(e)g Fw(myprog)d FA(sends)k(the)g(close)888 -4294 y(par)o(en)17 b(down)i(the)f(stderr)f(pipe,)h(it)h(\256rst)f(tries)g(to) -g(write)g(a)g(megabyte)g(of)g(data)e(to)j(the)888 4394 y(stdout)d(pipe.)25 -b(However)-6 b(,)15 b(Scheme)f(is)i(not)f(r)o(eading)f(that)g(pipe\320it's)h -(stuck)g(waiting)888 4494 y(for)k(input)g(on)g(stderr)-6 b(.)26 -b(So)19 b(the)f(stdout)h(pipe)g(quickly)g(\256lls)h(up,)e(and)h -Fw(myprog)d FA(hangs,)888 4593 y(waiting)j(for)f(the)g(pipe)g(to)g(drain.)26 -b(The)18 b Fw(myprog)e FA(child)i(is)h(stuck)f(in)h(a)e(stdout/)p -Fw(port1)888 4693 y FA(write;)k(the)g(Scheme)f(par)o(ent)g(is)h(stuck)g(in)g -(a)f(stderr/)p Fw(port2)f FA(r)o(ead.)26 b(Deadlock.)888 4898 -y(Her)o(e's)20 b(a)h(concr)o(ete)f(example)g(that)g(does)h(exactly)f(the)h -(above:)681 5147 y(18)p 1952 5071 323 4 v 1952 5173 4 102 v -1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 w FD(November)d(1,)h -(1995)h(\261)f(15)13 b(:)f(58)p eop +18 23 bop 888 614 a FB(they)28 b(vanish.)45 b(The)27 +b Fx(fds)f FB(list)i(of)g(\002le)f(descriptors)g(is)h(implicitly)g +(backquoted)f(by)888 714 y(the)21 b(special-form)f(version.)888 +914 y(For)h(example,)f(if)h(Kaiming)g(has)g(his)h(mailbox)f(pr)o +(otected,)e(then)1071 1214 y Fx(\(receive)40 b(\(status)h(out)h(err\)) +1463 1313 y(\(run/collecting)c(\(1)k(2\))h(\(cat)f(/usr/kmshea/mbox)o +(\)\))1158 1413 y(\(list)g(status)f(\(port->string)d(out\))k +(\(port->string)c(err\)\)\))888 1713 y FB(might)22 b(pr)o(oduce)e(the)h +(list)1071 2008 y Fx(\(256)42 b("")h("cat:)e(/usr/kmshea/mbox:)c +(Permission)i(denied"\))888 2404 y FB(What)31 b(is)h(the)f(deadlock)g +(hazar)o(d)e(that)i(causes)g Fx(run/collecting)25 b FB(to)32 +b(use)f(temp)888 2504 y(\002les?)63 b(Pr)o(ocesses)32 +b(with)i(multiple)f(output)g(str)o(eams)g(can)f(lock)h(up)g(if)g(they)g +(use)888 2603 y(pipes)28 b(to)f(communicate)h(with)g(Scheme)f(i/o)h(r)o +(eaders.)43 b(For)28 b(example,)g(suppose)888 2703 y(some)22 +b(Unix)e(pr)o(ogram)g Fx(myprog)f FB(does)h(the)h(following:)967 +3003 y(1.)41 b(First,)21 b(outputs)g(a)g(single)g(\223)p +Fx(\()p FB(\224)e(to)j(stderr)-6 b(.)967 3203 y(2.)41 +b(Then,)21 b(outputs)g(a)f(megabyte)h(of)g(data)e(to)i(stdout.)967 +3402 y(3.)41 b(Finally)-9 b(,)21 b(outputs)g(a)g(single)g(\223)p +Fx(\))p FB(\224)e(to)j(stderr)-6 b(,)19 b(and)i(exits.)888 +3702 y(Our)e(scsh)h(pr)o(ogrammer)e(decides)g(to)i(r)o(un)f +Fx(myprog)d FB(with)k(stdout)g(and)e(stderr)g(r)o(edi-)888 +3802 y(r)o(ected)23 b FA(via)g(Unix)g(pipes)h FB(to)g(the)g(ports)h +Fx(port1)c FB(and)j Fx(port2)p FB(,)e(r)o(espectively)-9 +b(.)34 b(He)24 b(gets)888 3902 y(into)19 b(tr)o(ouble)f(when)h(he)f +(subsequently)h(says)f Fx(\(read)42 b(port2\))p FB(.)22 +b(The)c(Scheme)g Fx(read)888 4001 y FB(r)o(outine)h(r)o(eads)f(the)h +(open)g(par)o(en,)f(and)g(then)i(hangs)f(in)g(a)g Fx(read\(\))d +FB(system)k(call)e(try-)888 4101 y(ing)31 b(to)f(r)o(ead)d(a)i +(matching)i(close)f(par)o(en.)50 b(But)30 b(befor)o(e)e +Fx(myprog)f FB(sends)j(the)g(close)888 4200 y(par)o(en)d(down)h(the)f +(stderr)g(pipe,)i(it)e(\002rst)h(tries)g(to)f(write)h(a)f(megabyte)g +(of)g(data)g(to)888 4300 y(the)j(stdout)h(pipe.)53 b(However)-6 +b(,)31 b(Scheme)f(is)g(not)h(r)o(eading)e(that)h(pipe\227it's)g(stuck) +888 4400 y(waiting)37 b(for)f(input)g(on)h(stderr)-6 +b(.)71 b(So)36 b(the)g(stdout)g(pipe)g(quickly)h(\002lls)g(up,)i(and) +888 4499 y Fx(myprog)26 b FB(hangs,)k(waiting)f(for)f(the)g(pipe)g(to)h +(drain.)47 b(The)28 b Fx(myprog)e FB(child)i(is)h(stuck)888 +4599 y(in)i(a)e(stdout/)p Fx(port1)g FB(write;)35 b(the)30 +b(Scheme)g(par)o(ent)f(is)h(stuck)g(in)h(a)e(stderr/)p +Fx(port2)888 4699 y FB(r)o(ead.)24 b(Deadlock.)888 4898 +y(Her)o(e's)c(a)h(concr)o(ete)f(example)g(that)g(does)h(exactly)f(the)h +(above:)681 5147 y(18)p 1952 5071 323 4 v 1952 5173 4 +102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v +538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 19 25 -19 24 bop 756 614 a Fw(\(receive)40 b(\(status)g(port1)i(port2\))1148 +19 24 bop 756 614 a Fx(\(receive)40 b(\(status)g(port1)i(port2\))1148 714 y(\(run/collecting)37 b(\(1)43 b(2\))1322 814 y(\(begin)1409 -913 y(;;)g(Write)f(an)g(open)g(paren)g(to)h(stderr.)1409 1013 -y(\(run)f(\(echo)g("\("\))g(\(=)g(1)i(2\)\))1409 1112 y(;;)f(Copy)f(a)h(lot)f -(of)h(stuff)f(to)h(stdout.)1409 1212 y(\(run)f(\(cat)g(/usr/dict/words\)\)) -1409 1312 y(;;)h(Write)f(a)h(close)e(paren)h(to)h(stderr.)1409 -1411 y(\(run)f(\(echo)g("\)"\))g(\(=)g(1)i(2\)\)\)\))886 1611 -y(;;)f(OK.)f(Here,)g(I)h(have)f(a)h(port)f(PORT1)g(built)f(over)h(a)h(pipe) -886 1710 y(;;)g(connected)d(to)j(the)f(BEGIN)f(subproc's)f(stdout,)h(and)886 -1810 y(;;)i(PORT2)f(built)f(over)h(a)h(pipe)f(connected)e(to)j(the)f(BEGIN) -886 1910 y(;;)h(subproc's)d(stderr.)886 2009 y(\(read)i(port2\))f(;)i(Should) -e(return)g(the)i(empty)e(list.)886 2109 y(\(port->string)d(port1\)\))j(;)i -(Should)e(return)h(a)h(big)f(string.)573 2291 y FA(In)29 b(or)o(der)e(to)i -(avoid)f(this)h(pr)o(oblem,)h Fw(run/collecting)23 b FA(and)28 -b Fw(run/collecting*)573 2391 y FA(\256rst)20 b(r)o(un)h(the)f(child)h(pr)o -(ocess)e(to)i(completion,)g(buf)o(fering)e(all)h(the)h(output)f(str)o(eams) -573 2490 y(in)c(temp)g(\256les)h(\(using)f(the)g Fw(temp-file-channe)o(l)10 -b FA(pr)o(ocedur)o(e,)15 b(see)g(below\).)26 b(When)573 2590 -y(the)h(child)g(pr)o(ocess)g(exits,)h(ports)f(open)g(on)h(the)f(buf)o(fer)o -(ed)d(output)k(ar)o(e)d(r)o(eturned.)573 2689 y(This)c(appr)o(oach)f(has)g -(two)i(disadvantages)d(over)i(using)g(pipes:)672 2872 y Fs(\017)42 -b FA(The)21 b(total)i(output)f(fr)o(om)g(the)g(child)g(output)g(is)h -(temporarily)f(written)g(to)g(the)756 2971 y(disk)j(befor)o(e)e(r)o(eturning) -i(fr)o(om)f Fw(run/collecting)p FA(.)34 b(If)25 b(this)g(output)h(is)f(some) -756 3071 y(lar)o(ge)19 b(intermediate)h(r)o(esult,)g(the)h(disk)g(could)g -(\256ll)g(up.)672 3212 y Fs(\017)42 b FA(The)20 b(child)i(pr)o(oducer)d(and)i -(Scheme)g(consumer)g(ar)o(e)f(serialised;)g(ther)o(e)h(is)g(no)756 -3311 y(concurr)o(ency)f(overlap)g(in)h(their)g(execution.)573 -3493 y(However)-6 b(,)46 b(it)c(r)o(emains)f(a)g(simple)h(solution)i(that)d -(avoids)g(deadlock.)90 b(Mor)o(e)573 3593 y(sophisticated)50 -b(solutions)i(can)e(easily)g(be)g(pr)o(ogrammed)f(up)h(as)f(needed\320)573 -3693 y Fw(run/collecting*)14 b FA(itself)21 b(is)g(only)h(12)e(lines)h(of)g -(simple)g(code.)573 3834 y(See)27 b Fw(temp-file-channel)21 -b FA(for)28 b(mor)o(e)g(information)i(on)f(cr)o(eating)e(temp)h(\256les)h(as) -573 3933 y(communication)22 b(channels.)365 4262 y Fu(2.5)99 -b(Conditional)26 b(process)g(sequencing)f(forms)365 4492 y -FA(These)c(forms)g(allow)g(conditional)h(execution)f(of)g(a)f(sequence)h(of)g -(pr)o(ocesses.)365 4649 y Fw(\(||)43 b Fz(pf)604 4677 y Ft(1)662 -4649 y Fx(:)14 b(:)g(:)g Fz(pfn)p Fw(\))86 b Fs(\000)-14 b(!)87 -b Fz(boolean)1503 b FA(syntax)573 4799 y(Run)21 b(each)e(pr)o(oc)h(until)h -(one)f(completes)h(successfully)f(\()p Fz(i.e.)p FA(,)g(exit)g(status)g(zer)o -(o\).)26 b(Re-)573 4898 y(turn)21 b(tr)o(ue)g(if)f(some)i(pr)o(oc)e -(completes)h(successfully;)g(otherwise)g Fw(#f)p FA(.)365 5147 -y FD(November)d(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 -323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 -5176 323 4 v 1216 w FA(19)p eop +913 y(;;)g(Write)f(an)g(open)g(paren)g(to)h(stderr.)1409 +1013 y(\(run)f(\(echo)g("\("\))g(\(=)g(1)i(2\)\))1409 +1112 y(;;)f(Copy)f(a)h(lot)f(of)h(stuff)f(to)h(stdout.)1409 +1212 y(\(run)f(\(cat)g(/usr/dict/words\)\))1409 1312 +y(;;)h(Write)f(a)h(close)e(paren)h(to)h(stderr.)1409 +1411 y(\(run)f(\(echo)g("\)"\))g(\(=)g(1)i(2\)\)\)\))886 +1611 y(;;)f(OK.)f(Here,)g(I)h(have)f(a)h(port)f(PORT1)g(built)f(over)h +(a)h(pipe)886 1710 y(;;)g(connected)d(to)j(the)f(BEGIN)f(subproc's)f +(stdout,)h(and)886 1810 y(;;)i(PORT2)f(built)f(over)h(a)h(pipe)f +(connected)e(to)j(the)f(BEGIN)886 1910 y(;;)h(subproc's)d(stderr.)886 +2009 y(\(read)i(port2\))f(;)i(Should)e(return)g(the)i(empty)e(list.)886 +2109 y(\(port->string)d(port1\)\))j(;)i(Should)e(return)h(a)h(big)f +(string.)573 2291 y FB(In)29 b(or)o(der)e(to)i(avoid)f(this)h(pr)o +(oblem,)h Fx(run/collecting)23 b FB(and)28 b Fx(run/collecting*)573 +2391 y FB(\002rst)20 b(r)o(un)h(the)f(child)h(pr)o(ocess)e(to)i +(completion,)g(buf)o(fering)e(all)h(the)h(output)f(str)o(eams)573 +2490 y(in)c(temp)h(\002les)f(\(using)h(the)f Fx(temp-file-channel)9 +b FB(pr)o(ocedur)o(e,)15 b(see)h(below\).)24 b(When)573 +2590 y(the)j(child)g(pr)o(ocess)g(exits,)h(ports)f(open)g(on)h(the)f +(buf)o(fer)o(ed)d(output)k(ar)o(e)d(r)o(eturned.)573 +2689 y(This)c(appr)o(oach)f(has)g(two)i(disadvantages)d(over)i(using)g +(pipes:)672 2872 y Ft(\017)42 b FB(The)21 b(total)i(output)f(fr)o(om)g +(the)g(child)g(output)g(is)h(temporarily)f(written)g(to)g(the)756 +2971 y(disk)j(befor)o(e)f(r)o(eturning)g(fr)o(om)h Fx(run/collecting)p +FB(.)33 b(If)24 b(this)i(output)g(is)f(some)756 3071 +y(lar)o(ge)19 b(intermediate)h(r)o(esult,)g(the)h(disk)g(could)g +(\002ll)g(up.)672 3212 y Ft(\017)42 b FB(The)20 b(child)i(pr)o(oducer)d +(and)i(Scheme)g(consumer)g(ar)o(e)f(serialised;)g(ther)o(e)h(is)g(no) +756 3311 y(concurr)o(ency)f(overlap)g(in)h(their)g(execution.)573 +3493 y(However)-6 b(,)46 b(it)c(r)o(emains)g(a)f(simple)h(solution)i +(that)d(avoids)h(deadlock.)88 b(Mor)o(e)573 3593 y(sophisticated)50 +b(solutions)i(can)e(easily)g(be)g(pr)o(ogrammed)f(up)h(as)f(needed\227) +573 3693 y Fx(run/collecting*)14 b FB(itself)21 b(is)g(only)h(12)e +(lines)h(of)g(simple)g(code.)573 3834 y(See)27 b Fx(temp-file-channel) +21 b FB(for)28 b(mor)o(e)g(information)i(on)f(cr)o(eating)e(temp)h +(\002les)h(as)573 3933 y(communication)22 b(channels.)365 +4262 y Fv(2.5)99 b(Conditional)26 b(process)g(sequencing)f(forms)365 +4492 y FB(These)c(forms)g(allow)g(conditional)h(execution)f(of)g(a)f +(sequence)h(of)g(pr)o(ocesses.)365 4649 y Fx(\(||)43 +b FA(pf)604 4677 y Fu(1)662 4649 y FA(.)12 b(.)g(.)g(pfn)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(boolean)1514 b FB(syntax)573 +4799 y(Run)21 b(each)f(pr)o(oc)f(until)j(one)e(completes)h +(successfully)g(\()p FA(i.e.)o FB(,)f(exit)g(status)h(zer)o(o\).)j(Re-) +573 4898 y(turn)d(tr)o(ue)g(if)f(some)i(pr)o(oc)e(completes)h +(successfully;)g(otherwise)g Fx(#f)p FB(.)365 5147 y +FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p 1636 +5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p 1955 +5173 V 1636 5176 323 4 v 1216 w FB(19)p eop %%Page: 20 26 -20 25 bop 681 614 a Fw(\(&&)42 b Fz(pf)920 641 y Ft(1)978 614 -y Fx(:)14 b(:)g(:)f Fz(pfn)p Fw(\))87 b Fs(\000)-14 b(!)87 -b Fz(boolean)1503 b FA(syntax)888 756 y(Run)23 b(each)f(pr)o(oc)f(until)i -(one)g(fails)f(\()p Fz(i.e.)o FA(,)h(exit)e(status)i(non-zer)o(o\).)30 -b(Return)23 b(tr)o(ue)f(if)g(all)888 855 y(pr)o(ocs)f(complete)g -(successfully;)f(otherwise)i Fw(#f)p FA(.)681 1149 y Fu(2.6)99 -b(Process)25 b(\256lters)681 1363 y FA(These)20 b(pr)o(ocedur)o(es)f(ar)o(e)h -(useful)g(for)h(forking)g(of)o(f)f(pr)o(ocesses)g(to)i(\256lter)e(text)h(str) -o(eams.)681 1513 y Fw(\(char-filter)38 b Fz(\256lter)p Fw(\))87 -b Fs(\000)-14 b(!)87 b Fz(pr)o(ocedur)o(e)1085 b FA(pr)o(ocedur)o(e)888 -1654 y(The)20 b Fz(\256lter)g FA(ar)o(gument)f(is)h(a)g(character)p -Fs(!)p FA(character)c(pr)o(ocedur)o(e.)26 b(Returns)20 b(a)f(pr)o(oce-)888 -1753 y(dur)o(e)c(that)g(when)h(called,)g(r)o(epeatedly)d(r)o(eads)h(a)h -(character)f(fr)o(om)h(the)h(curr)o(ent)f(input)888 1853 y(port,)j(applies)e -Fz(\256lter)i FA(to)f(the)g(character)-6 b(,)16 b(and)g(writes)i(the)f(r)o -(esult)f(to)i(the)f(curr)o(ent)f(out-)888 1953 y(put)21 b(port.)28 -b(The)20 b(pr)o(ocedur)o(e)f(r)o(eturns)h(upon)i(r)o(eaching)e(eof)g(on)i -(the)f(input)g(port.)888 2086 y(For)28 b(example,)f(to)h(downcase)f(a)f(str)o -(eam)h(of)g(text)g(in)g(a)g(spell-checking)g(pipeline,)888 -2185 y(instead)21 b(of)g(using)g(the)g(Unix)g Fw(tr)43 b(A-Z)f(a-z)19 -b FA(command,)i(we)g(can)f(say:)1071 2351 y Fw(\(run)42 b(\(|)h(\(delatex\)) -1420 2451 y(\(begin)e(\(\(char-filter)d(char-downcase\)\)\))f(;)43 -b(tr)g(A-Z)f(a-z)1420 2550 y(\(spell\))1420 2650 y(\(sort\))1420 -2750 y(\(uniq\)\))1289 2849 y(\(<)h(scsh.tex\))1289 2949 y(\(>)g -(spell-errors.tx)o(t\)\))681 3323 y(\(string-filter)38 b Fz(\256lter)20 -b([bu\257en])p Fw(\))88 b Fs(\000)-14 b(!)87 b Fz(pr)o(ocedur)o(e)713 -b FA(pr)o(ocedur)o(e)888 3464 y(The)30 b Fz(\256lter)f FA(ar)o(gument)g(is)h -(a)f(string)p Fs(!)p FA(string)i(pr)o(ocedur)o(e.)51 b(Returns)30 -b(a)f(pr)o(ocedur)o(e)888 3563 y(that)e(when)g(called,)f(r)o(epeatedly)f(r)o -(eads)g(a)g(string)i(fr)o(om)f(the)h(curr)o(ent)e(input)i(port,)888 -3663 y(applies)18 b Fz(\256lter)h FA(to)g(the)f(string,)i(and)e(writes)h(the) -f(r)o(esult)g(to)h(the)g(curr)o(ent)e(output)i(port.)888 3763 -y(The)i(pr)o(ocedur)o(e)e(r)o(eturns)h(upon)h(r)o(eaching)g(eof)f(on)h(the)g -(input)h(port.)888 3895 y(The)i(optional)g Fz(bu\257en)h FA(ar)o(gument)e -(contr)o(ols)h(the)g(number)f(of)h(characters)e(each)h(in-)888 -3995 y(ternal)c(r)o(ead)e(operation)i(r)o(equests;)g(this)h(means)f(that)g -Fz(\256lter)g FA(will)h(never)e(be)h(applied)888 4095 y(to)i(a)g(string)g -(longer)g(than)g Fz(bu\257en)i FA(chars.)k(The)20 b(default)g -Fz(bu\257en)i FA(value)e(is)h(1024.)681 5147 y(20)p 1952 5071 -323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 -5176 323 4 v 435 w FD(November)d(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +20 25 bop 681 614 a Fx(\(&&)42 b FA(pf)920 641 y Fu(1)978 +614 y FA(.)12 b(.)g(.)g(pfn)p Fx(\))87 b Ft(\000)-14 +b(!)87 b FA(boolean)1514 b FB(syntax)888 756 y(Run)23 +b(each)f(pr)o(oc)g(until)h(one)g(fails)e(\()p FA(i.e.)p +FB(,)h(exit)h(status)f(non-zer)o(o\).)29 b(Return)23 +b(tr)o(ue)f(if)g(all)888 855 y(pr)o(ocs)f(complete)g(successfully;)f +(otherwise)i Fx(#f)p FB(.)681 1149 y Fv(2.6)99 b(Process)25 +b(\002lters)681 1363 y FB(These)20 b(pr)o(ocedur)o(es)f(ar)o(e)h +(useful)g(for)h(forking)g(of)o(f)f(pr)o(ocesses)g(to)i(\002lter)e(text) +h(str)o(eams.)681 1513 y Fx(\(char-filter)38 b FA(\002lter)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(pr)o(ocedur)o(e)1085 +b FB(pr)o(ocedur)o(e)888 1654 y(The)27 b FA(\002lter)h +FB(ar)o(gument)e(is)i(a)f(character)p Ft(!)p FB(character)d(pr)o +(ocedur)o(e.)42 b(Returns)28 b(a)f(pr)o(o-)888 1753 y(cedur)o(e)h(that) +h(when)h(called,)g(r)o(epeatedly)e(r)o(eads)f(a)i(character)f(fr)o(om)h +(the)g(curr)o(ent)888 1853 y(input)23 b(port,)g(applies)f +FA(\002lter)h FB(to)g(the)f(character)-6 b(,)21 b(and)h(writes)h(the)g +(r)o(esult)f(to)h(the)f(cur)o(-)888 1953 y(r)o(ent)i(output)g(port.)36 +b(The)24 b(pr)o(ocedur)o(e)e(r)o(eturns)h(upon)i(r)o(eaching)e(eof)h +(on)g(the)h(input)888 2052 y(port.)888 2185 y(For)j(example,)f(to)h +(downcase)f(a)f(str)o(eam)h(of)g(text)g(in)g(a)g(spell-checking)g +(pipeline,)888 2285 y(instead)21 b(of)g(using)g(the)g(Unix)g +Fx(tr)43 b(A-Z)f(a-z)19 b FB(command,)i(we)g(can)f(say:)1071 +2451 y Fx(\(run)42 b(\(|)h(\(delatex\))1420 2550 y(\(begin)e +(\(\(char-filter)d(char-downcase\)\)\))f(;)43 b(tr)g(A-Z)f(a-z)1420 +2650 y(\(spell\))1420 2750 y(\(sort\))1420 2849 y(\(uniq\)\))1289 +2949 y(\(<)h(scsh.tex\))1289 3049 y(\(>)g(spell-errors.tx)o(t\)\))681 +3422 y(\(string-filter)38 b FA(\002lter)20 b([bu\003en])p +Fx(\))88 b Ft(\000)-14 b(!)87 b FA(pr)o(ocedur)o(e)713 +b FB(pr)o(ocedur)o(e)888 3563 y(The)30 b FA(\002lter)g +FB(ar)o(gument)f(is)h(a)f(string)p Ft(!)p FB(string)i(pr)o(ocedur)o(e.) +50 b(Returns)30 b(a)f(pr)o(ocedur)o(e)888 3663 y(that)e(when)g(called,) +f(r)o(epeatedly)f(r)o(eads)g(a)g(string)i(fr)o(om)f(the)h(curr)o(ent)e +(input)i(port,)888 3763 y(applies)18 b FA(\002lter)h +FB(to)g(the)f(string,)i(and)e(writes)h(the)f(r)o(esult)g(to)h(the)g +(curr)o(ent)e(output)i(port.)888 3862 y(The)i(pr)o(ocedur)o(e)e(r)o +(eturns)h(upon)h(r)o(eaching)g(eof)f(on)h(the)g(input)h(port.)888 +3995 y(The)i(optional)g FA(bu\003en)h FB(ar)o(gument)e(contr)o(ols)h +(the)g(number)f(of)h(characters)e(each)h(in-)888 4095 +y(ternal)c(r)o(ead)e(operation)i(r)o(equests;)g(this)h(means)f(that)g +FA(\002lter)g FB(will)h(never)e(be)h(applied)888 4194 +y(to)i(a)g(string)g(longer)g(than)g FA(bu\003en)i FB(chars.)i(The)20 +b(default)g FA(bu\003en)i FB(value)e(is)h(1024.)681 5147 +y(20)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p eop %%Page: 21 27 -21 26 bop 365 1277 a Fv(Chapter)45 b(3)365 1731 y FB(System)51 -b(Calls)365 2226 y FA(Scsh)24 b(pr)o(ovides)e(\(almost\))h(complete)h(access) -f(to)g(the)h(basic)f(Unix)g(kernel)g(services:)32 b(pr)o(o-)365 -2325 y(cesses,)18 b(\256les,)g(signals)g(and)f(so)h(forth.)26 -b(These)18 b(pr)o(ocedur)o(es)d(comprise)j(a)f(Scheme)g(binding)365 -2425 y(for)j(P)t Fr(O)t(S)t(I)t(X)r FA(,)g(with)g(a)d(few)h(of)h(the)f(mor)o -(e)g(standar)o(d)f(extensions)i(thr)o(own)g(in)g(\()p Fz(e.g.)o -FA(,)f(symbolic)365 2525 y(links,)k Fw(fchown)p FA(,)c Fw(fstat)p -FA(,)g(sockets\).)365 2840 y Fu(3.1)99 b(Errors)365 3073 y -FA(Scsh)17 b(syscalls)g(never)g(r)o(eturn)f(err)o(or)g(codes,)h(and)f(do)h -(not)h(use)f(a)f(global)h Fw(errno)e FA(variable)g(to)365 3173 -y(r)o(eport)20 b(err)o(ors.)26 b(Err)o(ors)20 b(ar)o(e)f(consistently)j(r)o -(eported)d(by)i(raising)f(exceptions.)28 b(This)21 b(fr)o(ees)365 -3272 y(up)26 b(the)g(pr)o(ocedur)o(es)f(to)h(r)o(eturn)f(useful)h(values,)h -(and)f(allows)g(the)h(pr)o(ogrammer)e(to)h(as-)365 3372 y(sume)c(that)g -Fz(if)g(a)f(syscall)h(r)o(eturns,)g(it)f(succeeded.)30 b FA(This)22 -b(gr)o(eatly)f(simpli\256es)h(the)g(\257ow)h(of)e(the)365 3471 -y(code)g(fr)o(om)f(the)h(pr)o(ogrammer)6 b('s)20 b(point)i(of)f(view)-8 -b(.)490 3611 y(Since)14 b(Scheme)g(does)g(not)h(yet)g(have)e(a)h(standar)o(d) -f(exception)h(system,)i(the)f(scsh)g(de\256ni-)365 3710 y(tion)24 -b(r)o(emains)f(somewhat)h(vague)f(on)h(the)f(actual)g(form)g(of)g(exceptions) -h(and)f(exception)365 3810 y(handlers.)41 b(When)25 b(a)g(standar)o(d)e -(exception)i(system)h(is)g(de\256ned,)f(scsh)h(will)g(move)f(to)h(it.)365 -3909 y(For)21 b(now)-8 b(,)21 b(scsh)g(uses)f(the)g(Scheme)g(48)f(exception)h -(system,)h(with)g(a)f(simple)g(sugaring)h(on)365 4009 y(top)g(to)g(hide)g -(the)g(details)f(in)i(the)f(common)h(case.)490 4148 y(System)27 -b(call)f(err)o(or)g(exceptions)h(contain)h(the)f(Unix)g Fw(errno)d -FA(code)j(r)o(eported)e(by)i(the)365 4248 y(system)21 b(call.)26 -b(Unlike)20 b(C,)f(the)h Fw(errno)d FA(value)i(is)h(a)f(part)g(of)g(the)h -(exception)f(packet,)g(it)h(is)g Fz(not)365 4347 y FA(accessed)g(thr)o(ough)h -(a)g(global)g(variable.)490 4487 y(For)e(r)o(efer)o(ence)e(purposes,)i(the)h -(Unix)f Fw(errno)e FA(numbers)i(ar)o(e)f(bound)i(to)f(the)h(variables)365 -4586 y Fw(errno/perm)p FA(,)12 b Fw(errno/noent)p FA(,)f Fz(etc.)25 -b FA(System)14 b(calls)h(never)f(r)o(eturn)g Fw(error/intr)p -FA(\320they)c(au-)365 4686 y(tomatically)21 b(r)o(etry)-9 b(.)27 -b(\(Curr)o(ently)19 b(only)j(tr)o(ue)f(for)g(I/O)g(calls.\))365 -4845 y Fw(\(errno-error)39 b Fz(errno)22 b(syscall)e(.)h(data)p -Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(no)21 b(r)o(eturn)g(value)423 -b FA(pr)o(ocedur)o(e)365 5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1216 w FA(21)p eop +21 26 bop 365 1276 a Fw(Chapter)45 b(3)365 1731 y FC(System)51 +b(Calls)365 2226 y FB(Scsh)24 b(pr)o(ovides)f(\(almost\))g(complete)g +(access)g(to)h(the)g(basic)f(Unix)g(kernel)h(services:)30 +b(pr)o(o-)365 2326 y(cesses,)18 b(\002les,)h(signals)f(and)f(so)h +(forth.)25 b(These)17 b(pr)o(ocedur)o(es)f(comprise)i(a)f(Scheme)g +(binding)365 2426 y(for)j(P)t Fs(O)t(S)t(I)t(X)r FB(,)g(with)g(a)d(few) +h(of)h(the)f(mor)o(e)g(standar)o(d)f(extensions)i(thr)o(own)g(in)g(\()p +FA(e.g.)o FB(,)f(symbolic)365 2525 y(links,)k Fx(fchown)p +FB(,)c Fx(fstat)p FB(,)g(sockets\).)365 2840 y Fv(3.1)99 +b(Errors)365 3073 y FB(Scsh)24 b(syscalls)g(never)f(r)o(eturn)g(err)o +(or)g(codes,)h(and)f(do)h(not)g(use)g(a)f(global)h Fx(errno)e +FB(variable)365 3173 y(to)29 b(r)o(eport)e(err)o(ors.)47 +b(Err)o(ors)27 b(ar)o(e)f(consistently)k(r)o(eported)d(by)h(raising)g +(exceptions.)48 b(This)365 3272 y(fr)o(ees)19 b(up)i(the)f(pr)o(ocedur) +o(es)f(to)i(r)o(eturn)e(useful)h(values,)g(and)g(allows)h(the)g(pr)o +(ogrammer)e(to)365 3372 y(assume)26 b(that)g FA(if)f(a)h(syscall)g(r)o +(eturns,)h(it)e(succeeded.)40 b FB(This)27 b(gr)o(eatly)d(simpli\002es) +j(the)f(\003ow)h(of)365 3472 y(the)21 b(code)g(fr)o(om)f(the)h(pr)o +(ogrammer)6 b('s)20 b(point)i(of)e(view)-8 b(.)490 3611 +y(Since)20 b(Scheme)g(does)h(not)g(yet)f(have)g(a)g(standar)o(d)f +(exception)i(system,)g(the)f(scsh)h(de\002-)365 3710 +y(nition)d(r)o(emains)f(somewhat)g(vague)f(on)h(the)g(actual)f(form)h +(of)f(exceptions)h(and)g(exception)365 3810 y(handlers.)39 +b(When)26 b(a)f(standar)o(d)e(exception)i(system)h(is)g(de\002ned,)g +(scsh)f(will)h(move)g(to)g(it.)365 3910 y(For)21 b(now)-8 +b(,)21 b(scsh)g(uses)f(the)g(Scheme)g(48)f(exception)h(system,)h(with)g +(a)f(simple)g(sugaring)h(on)365 4009 y(top)g(to)g(hide)g(the)g(details) +f(in)i(the)f(common)h(case.)490 4148 y(System)27 b(call)f(err)o(or)g +(exceptions)h(contain)h(the)f(Unix)g Fx(errno)d FB(code)j(r)o(eported)e +(by)i(the)365 4248 y(system)21 b(call.)j(Unlike)c(C,)g(the)f +Fx(errno)f FB(value)h(is)h(a)f(part)g(of)h(the)f(exception)h(packet,)f +(it)h(is)g FA(not)365 4348 y FB(accessed)g(thr)o(ough)h(a)g(global)g +(variable.)490 4487 y(For)e(r)o(efer)o(ence)e(purposes,)i(the)h(Unix)f +Fx(errno)e FB(numbers)i(ar)o(e)f(bound)i(to)f(the)h(variables)365 +4586 y Fx(errno/perm)p FB(,)30 b Fx(errno/noent)p FB(,)f +FA(etc.)56 b FB(System)31 b(calls)g(never)g(r)o(eturn)f +Fx(error/intr)p FB(\227they)365 4686 y(automatically)21 +b(r)o(etry)-9 b(.)365 4845 y Fx(\(errno-error)39 b FA(errno)22 +b(syscall)e(.)h(data)p Fx(\))85 b Ft(\000)-14 b(!)87 +b FA(no)21 b(r)o(eturn)g(value)423 b FB(pr)o(ocedur)o(e)365 +5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(21)p eop %%Page: 22 28 -22 27 bop 888 614 a FA(Raises)17 b(a)f(Unix)g(err)o(or)g(exception)g(for)g -(Unix)h(err)o(or)e(number)i Fz(errno)q FA(.)26 b(The)16 b Fz(syscall)g -FA(and)888 714 y Fz(data)i FA(ar)o(guments)g(ar)o(e)f(packaged)g(up)i(in)g -(the)g(exception)f(packet)g(passed)g(to)h(the)g(ex-)888 814 -y(ception)i(handler)-6 b(.)681 1065 y Fw(\(with-errno-hand)o(le)o(r*)37 -b Fz(handler)21 b(thunk)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(value\(s\))20 -b(of)h(thunk)181 b FA(pr)o(ocedur)o(e)681 1164 y Fw(\(with-errno-hand)o(le)o -(r)38 b Fz(handler-spec)20 b(.)g(body)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(value)21 b(of)f(body)318 b FA(syntax)888 1310 y(Unix)30 -b(syscalls)g(raise)f(err)o(or)f(exceptions)i(by)f(calling)h -Fw(errno-error)p FA(.)49 b(Pr)o(ograms)888 1410 y(can)20 b(use)f -Fw(with-errno-handle)o(r*)13 b FA(to)20 b(establish)g(handlers)f(for)g(these) -h(exceptions.)888 1548 y(If)g(a)g(Unix)g(err)o(or)f(arises)h(while)h -Fz(thunk)f FA(is)h(executing,)f Fz(handler)g FA(is)g(called)g(on)h(two)g(ar)o -(-)888 1647 y(guments:)1071 1798 y Fw(\()p Fz(handler)43 b(errno)h(packet)o -Fw(\))888 1948 y Fz(packet)20 b FA(is)h(a)f(list)i(of)f(the)f(form)1559 -2136 y Fz(packet)i Fl(=)g Fw(\()p Fz(errno-msg)43 b(syscall)h -Fw(.)f Fz(data)o Fw(\))p Fx(;)888 2324 y FA(wher)o(e)24 b Fz(errno-msg)g -FA(is)h(the)f(standar)o(d)f(Unix)h(err)o(or)g(message)g(for)g(the)g(err)o(or) --6 b(,)24 b Fz(syscall)888 2423 y FA(is)e(the)g(pr)o(ocedur)o(e)d(that)j -(generated)e(the)i(err)o(or)-6 b(,)20 b(and)h Fz(data)g FA(is)h(a)f(list)h -(of)f(information)888 2523 y(generated)f(by)h(the)g(err)o(or)-6 -b(,)19 b(which)j(varies)e(fr)o(om)g(syscall)h(to)g(syscall.)888 -2661 y(If)g Fz(handler)f FA(r)o(eturns,)g(the)h(handler)g(sear)o(ch)f -(continues)h(upwar)o(ds.)27 b Fz(Handler)21 b FA(can)f(ac-)888 -2761 y(quir)o(e)c(the)g(exception)h(by)f(invoking)h(a)f(saved)f -(continuation.)28 b(This)16 b(pr)o(ocedur)o(e)e(can)888 2860 -y(be)21 b(sugar)o(ed)e(over)i(with)g(the)g(following)h(syntax:)1071 -3036 y Fw(\(with-errno-hand)o(ler)1245 3136 y(\(\()p Fz(errno)44 -b(packet)o Fw(\))f Fz(clause)h Fx(:)14 b(:)g(:)g Fw(\))1158 -3236 y Fz(body1)1158 3335 y(body2)1158 3435 y Fx(:)g(:)g(:)g -Fw(\))888 3611 y FA(This)31 b(form)g(executes)e(the)i(body)g(forms)f(with)h -(a)f(particular)g(errno)g(handler)g(in-)888 3711 y(stalled.)d(When)21 -b(an)f(errno)h(err)o(or)e(is)i(raised,)f(the)g(handler)g(sear)o(ch)g -(machinery)g(will)888 3810 y(bind)15 b(variable)f Fz(errno)h -FA(to)g(the)g(err)o(or)6 b('s)15 b(integer)f(code,)i(and)e(variable)g -Fz(packet)f FA(to)i(the)g(er)o(-)888 3910 y(r)o(or)6 b('s)18 -b(auxiliary)g(data)e(packet.)26 b(Then,)19 b(the)f(clauses)g(will)h(be)e -(checked)h(for)g(a)f(match.)888 4010 y(The)32 b(\256rst)g(clause)f(that)g -(matches)h(is)g(executed,)h(and)e(its)h(value)f(is)g(the)h(value)f(of)888 -4109 y(the)26 b(entir)o(e)f Fw(with-errno-handl)o(er)19 b FA(form.)41 -b(If)25 b(no)h(clause)f(matches,)i(the)e(handler)888 4209 y(sear)o(ch)20 -b(continues.)888 4347 y(Err)o(or)g(clauses)h(have)f(two)h(forms)1071 -4523 y Fw(\(\()p Fz(errno)44 b Fx(:)14 b(:)g(:)f Fw(\))44 b -Fz(body)e Fx(:)14 b(:)g(:)g Fw(\))1071 4623 y(\(else)42 b Fz(body)g -Fx(:)14 b(:)g(:)g Fw(\))888 4799 y FA(In)26 b(the)g(\256rst)f(type)h(of)f -(clause,)h(the)g Fz(errno)g FA(forms)g(ar)o(e)e(integer)h(expr)o(essions.)42 -b(They)888 4898 y(ar)o(e)25 b(evaluated)f(and)i(compar)o(ed)e(to)j(the)f(err) -o(or)6 b('s)25 b(errno)h(value.)42 b(An)26 b Fw(else)e FA(clause)681 -5147 y(22)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +22 27 bop 888 614 a FB(Raises)30 b(a)f(Unix)h(err)o(or)e(exception)i +(for)f(Unix)h(err)o(or)e(number)i FA(errno)q FB(.)52 +b(The)29 b FA(syscall)888 714 y FB(and)f FA(data)f FB(ar)o(guments)g +(ar)o(e)g(packaged)g(up)h(in)g(the)g(exception)g(packet)f(passed)h(to) +888 814 y(the)21 b(exception)g(handler)-6 b(.)681 1065 +y Fx(\(with-errno-hand)o(le)o(r*)37 b FA(handler)21 b(thunk)p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(value\(s\))20 b(of)h(thunk)181 +b FB(pr)o(ocedur)o(e)681 1164 y Fx(\(with-errno-hand)o(le)o(r)38 +b FA(handler-spec)20 b(.)g(body)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(value)21 b(of)f(body)318 b FB(syntax)888 +1310 y(Unix)30 b(syscalls)g(raise)f(err)o(or)g(exceptions)h(by)g +(calling)g Fx(errno-error)p FB(.)47 b(Pr)o(ograms)888 +1410 y(can)20 b(use)f Fx(with-errno-handle)o(r*)13 b +FB(to)20 b(establish)g(handlers)f(for)g(these)h(exceptions.)888 +1548 y(If)29 b(a)g(Unix)h(err)o(or)e(arises)h(while)h +FA(thunk)f FB(is)h(executing,)h FA(handler)e FB(is)h(called)e(on)i(two) +888 1647 y(ar)o(guments:)1071 1798 y Fx(\()p FA(handler)43 +b(errno)h(packet)o Fx(\))888 1948 y FA(packet)20 b FB(is)h(a)f(list)i +(of)f(the)f(form)1559 2136 y FA(packet)i Fm(=)g Fx(\()p +FA(errno-msg)43 b(syscall)h Fx(.)f FA(data)o Fx(\))p +Fy(;)888 2324 y FB(wher)o(e)24 b FA(errno-msg)g FB(is)h(the)f(standar)o +(d)f(Unix)h(err)o(or)g(message)g(for)g(the)g(err)o(or)-6 +b(,)24 b FA(syscall)888 2423 y FB(is)e(the)g(pr)o(ocedur)o(e)d(that)j +(generated)e(the)i(err)o(or)-6 b(,)20 b(and)h FA(data)g +FB(is)h(a)f(list)h(of)f(information)888 2523 y(generated)f(by)h(the)g +(err)o(or)-6 b(,)19 b(which)j(varies)e(fr)o(om)g(syscall)h(to)g +(syscall.)888 2661 y(If)32 b FA(handler)g FB(r)o(eturns,)j(the)d +(handler)g(sear)o(ch)f(continues)i(upwar)o(ds.)59 b FA(Handler)32 +b FB(can)888 2761 y(acquir)o(e)23 b(the)g(exception)g(by)h(invoking)h +(a)d(saved)h(continuation.)34 b(This)24 b(pr)o(ocedur)o(e)888 +2860 y(can)d(be)f(sugar)o(ed)g(over)g(with)i(the)f(following)h(syntax:) +1071 3036 y Fx(\(with-errno-hand)o(ler)1245 3136 y(\(\()p +FA(errno)44 b(packet)o Fx(\))f FA(clause)h Fx(...\))1158 +3236 y FA(body1)1158 3335 y(body2)1158 3435 y Fx(...\))888 +3611 y FB(This)31 b(form)g(executes)e(the)i(body)g(forms)f(with)h(a)f +(particular)g(errno)g(handler)g(in-)888 3711 y(stalled.)65 +b(When)34 b(an)g(errno)g(err)o(or)f(is)h(raised,)i(the)e(handler)g +(sear)o(ch)f(machinery)888 3810 y(will)f(bind)e(variable)f +FA(errno)j FB(to)f(the)f(err)o(or)6 b('s)30 b(integer)h(code,)h(and)e +(variable)f FA(packet)888 3910 y FB(to)22 b(the)f(err)o(or)6 +b('s)20 b(auxiliary)g(data)g(packet.)25 b(Then,)20 b(the)h(clauses)g +(will)g(be)g(checked)f(for)888 4010 y(a)29 b(match.)50 +b(The)29 b(\002rst)g(clause)f(that)h(matches)g(is)g(executed,)h(and)e +(its)h(value)g(is)g(the)888 4109 y(value)24 b(of)g(the)h(entir)o(e)f +Fx(with-errno-hand)o(ler)18 b FB(form.)36 b(If)24 b(no)h(clause)f +(matches,)h(the)888 4209 y(handler)c(sear)o(ch)e(continues.)888 +4347 y(Err)o(or)h(clauses)h(have)f(two)h(forms)1071 4523 +y Fx(\(\()p FA(errno)44 b Fx(...\))e FA(body)g Fx(...\))1071 +4622 y(\(else)g FA(body)g Fx(...\))888 4799 y FB(In)26 +b(the)g(\002rst)g(type)f(of)h(clause,)g(the)g FA(errno)g +FB(forms)g(ar)o(e)e(integer)i(expr)o(essions.)40 b(They)888 +4898 y(ar)o(e)25 b(evaluated)g(and)g(compar)o(ed)g(to)h(the)h(err)o(or) +6 b('s)25 b(errno)h(value.)41 b(An)26 b Fx(else)e FB(clause)681 +5147 y(22)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 23 29 -23 28 bop 573 614 a FA(matches)23 b(any)g(errno)g(value.)34 -b(Note)24 b(that)f(the)g Fz(errno)h FA(and)f Fz(data)f FA(variables)g(ar)o(e) -g(lexi-)573 714 y(cally)e(visible)h(to)h(the)f(err)o(or)e(clauses.)573 -865 y(Example:)756 1068 y Fw(\(with-errno-han)o(dl)o(er)930 -1168 y(\(\(errno)41 b(packet\))f(;)j(Only)f(handle)f(3)j(particular)39 -b(errors.)973 1267 y(\(\(errno/wouldbloc)o(k)f(errno/again\))1017 -1367 y(\(loop\)\))973 1467 y(\(\(errno/acces\))1017 1566 y(\(format)j(#t)h -("Not)g(allowed)f(access!"\))1017 1666 y(#f\)\))843 1865 y(\(foo)h -(frobbotz\))843 1965 y(\(blatz)f(garglemumph\)\))573 2168 y -FA(It)25 b(is)h(not)g(de\256ned)f(what)h(dynamic)f(context)h(the)g(handler)f -(executes)f(in,)j(so)f(\257uid)573 2267 y(variables)20 b(cannot)h(r)o -(eliably)f(be)g(r)o(efer)o(enced.)573 2410 y(Note)29 b(that)h(Scsh)f(system)i -(calls)e(always)g(r)o(etry)g(when)h(interr)o(upted,)h(so)f(that)f(the)573 -2502 y Fw(errno/intr)15 b FA(exception)k(is)h(never)f(raised.)26 -b(If)19 b(the)g(pr)o(ogrammer)g(wishes)h(to)g(abort)573 2593 -y(a)c(system)h(call)g(on)g(an)f(interr)o(upt,)i(he)f(should)g(have)f(the)h -(interr)o(upt)g(handler)f(explic-)573 2684 y(itly)j(raise)g(an)g(exception)g -(or)g(invoke)h(a)e(stor)o(ed)h(continuation)h(to)g(thr)o(ow)f(out)g(of)g(the) -573 2775 y(system)i(call.)756 2970 y FD(Remark:)52 b Fj(This)16 -b(is)g(not)i(strictly)e(tr)o(ue)g(in)h(the)h(curr)o(ent)e -(implementation\320only)756 3061 y(some)11 b(of)h(the)i(i/o)e(syscalls)f -(loop.)22 b(But)12 b(BSD)h(variants)g(never)f(r)o(eturn)g Fi(EINTR)i -Fj(any-)756 3153 y(way)-8 b(,)18 b(unless)g(you)g(explicitly)f(r)o(equest)g -(it,)i(so)f(we'll)g(live)g(w/it)i(for)d(now)-7 b(.)365 3730 -y Fy(3.1.1)81 b(Interactive)19 b(mode)h(and)g(error)h(handling)365 -3949 y FA(Scsh)27 b(r)o(uns)h(in)g(two)g(modes:)40 b(interactive)27 -b(and)g(script)g(mode.)46 b(It)28 b(starts)f(up)g(in)g(interac-)365 -4049 y(tive)c(mode)f(if)h(the)f(scsh)h(interpr)o(eter)e(is)i(started)f(up)g -(with)i(no)f(script)f(ar)o(gument.)32 b(Other)o(-)365 4148 -y(wise,)23 b(scsh)g(starts)e(up)i(in)f(script)g(mode.)32 b(The)22 -b(mode)g(determines)g(whether)g(scsh)h(prints)365 4248 y(pr)o(ompts)c(in)g -(between)f(r)o(eading)f(and)h(evaluating)g(forms,)h(and)f(it)h(af)o(fects)e -(the)h(default)g(er)o(-)365 4348 y(r)o(or)h(handler)-6 b(.)26 -b(In)19 b(interactive)g(mode,)g(the)g(default)f(err)o(or)g(handler)h(will)h -(r)o(eport)e(the)h(err)o(or)-6 b(,)365 4447 y(and)15 b(generate)g(an)g -(interactive)g(br)o(eakpoint)g(so)h(that)f(the)h(user)f(can)g(interact)g -(with)i(the)e(sys-)365 4547 y(tem)21 b(to)f(examine,)g(\256x,)h(or)f(dismiss) -h(fr)o(om)f(the)h(err)o(or)-6 b(.)26 b(In)20 b(script)h(mode,)f(the)g -(default)g(err)o(or)365 4647 y(handler)h(causes)f(the)h(scsh)g(pr)o(ocess)g -(to)g(exit.)490 4799 y(When)j(scsh)h(forks)f(a)g(child)g(with)h -Fw(\(fork\))p FA(,)d(the)i(child)g(r)o(esets)f(to)i(script)f(mode.)37 +23 28 bop 573 614 a FB(matches)23 b(any)g(errno)h(value.)32 +b(Note)24 b(that)f(the)h FA(errno)g FB(and)f FA(data)f +FB(variables)g(ar)o(e)g(lexi-)573 714 y(cally)e(visible)h(to)h(the)f +(err)o(or)e(clauses.)573 892 y(Example:)756 1149 y Fx(\(with-errno-han) +o(dl)o(er)930 1249 y(\(\(errno)41 b(packet\))f(;)j(Only)f(handle)f(3)j +(particular)39 b(errors.)973 1348 y(\(\(errno/wouldbloc)o(k)f +(errno/again\))1017 1448 y(\(loop\)\))973 1548 y(\(\(errno/acces\))1017 +1647 y(\(format)j(#t)h("Not)g(allowed)f(access!"\))1017 +1747 y(#f\)\))843 1946 y(\(foo)h(frobbotz\))843 2046 +y(\(blatz)f(garglemumph\)\))573 2302 y FB(It)25 b(is)h(not)g(de\002ned) +f(what)h(dynamic)f(context)h(the)g(handler)f(executes)f(in,)j(so)f +(\003uid)573 2402 y(variables)20 b(cannot)h(r)o(eliably)f(be)g(r)o +(efer)o(enced.)573 2580 y(Note)29 b(that)h(Scsh)f(system)i(calls)e +(always)g(r)o(etry)g(when)h(interr)o(upted,)h(so)f(that)f(the)573 +2680 y Fx(errno/intr)15 b FB(exception)20 b(is)g(never)f(raised.)24 +b(If)19 b(the)h(pr)o(ogrammer)f(wishes)h(to)g(abort)573 +2780 y(a)27 b(system)i(call)e(on)i(an)e(interr)o(upt,)j(he)e(should)h +(have)e(the)h(interr)o(upt)g(handler)f(ex-)573 2879 y(plicitly)19 +b(raise)g(an)g(exception)g(or)g(invoke)g(a)g(stor)o(ed)f(continuation)j +(to)e(thr)o(ow)g(out)h(of)573 2979 y(the)h(system)g(call.)365 +3636 y Fz(3.1.1)81 b(Interactive)19 b(mode)h(and)g(error)h(handling)365 +3909 y FB(Scsh)28 b(r)o(uns)g(in)g(two)g(modes:)39 b(interactive)27 +b(and)g(script)g(mode.)46 b(It)27 b(starts)g(up)h(in)f(interac-)365 +4008 y(tive)c(mode)g(if)f(the)h(scsh)g(interpr)o(eter)e(is)i(started)f +(up)g(with)i(no)f(script)g(ar)o(gument.)30 b(Other)o(-)365 +4108 y(wise,)23 b(scsh)g(starts)f(up)g(in)h(script)f(mode.)30 +b(The)22 b(mode)h(determines)f(whether)g(scsh)h(prints)365 +4208 y(pr)o(ompts)c(in)g(between)f(r)o(eading)f(and)h(evaluating)g +(forms,)h(and)f(it)h(af)o(fects)e(the)h(default)g(er)o(-)365 +4307 y(r)o(or)h(handler)-6 b(.)24 b(In)c(interactive)e(mode,)i(the)f +(default)f(err)o(or)h(handler)f(will)i(r)o(eport)f(the)g(err)o(or)-6 +b(,)365 4407 y(and)29 b(generate)f(an)g(interactive)g(br)o(eakpoint)g +(so)i(that)f(the)f(user)h(can)g(interact)f(with)h(the)365 +4506 y(system)e(to)f(examine,)h(\002x,)g(or)f(dismiss)h(fr)o(om)f(the)g +(err)o(or)-6 b(.)40 b(In)26 b(script)g(mode,)h(the)g(default)365 +4606 y(err)o(or)20 b(handler)g(causes)h(the)g(scsh)g(pr)o(ocess)f(to)h +(exit.)490 4799 y(When)j(scsh)h(forks)f(a)g(child)g(with)h +Fx(\(fork\))p FB(,)e(the)h(child)g(r)o(esets)g(to)g(script)g(mode.)36 b(This)365 4898 y(can)21 b(be)f(overridden)g(if)h(the)g(pr)o(ogrammer)f -(wishes.)365 5147 y FD(November)e(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1216 w FA(23)p eop +(wishes.)365 5147 y FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(23)p +eop %%Page: 24 30 -24 29 bop 681 614 a Fu(3.2)99 b(I/O)681 834 y Fy(3.2.1)81 b(Standard)18 -b(R4RS)i(I/O)h(procedures)681 1022 y FA(In)29 b(scsh,)j(most)d(standar)o(d)f -(R4RS)h(i/o)h(operations)f(\(such)g(as)g Fw(display)d FA(or)j -Fw(read-char)p FA(\))681 1121 y(work)22 b(on)h(both)f(integer)g(\256le)g -(descriptors)g(and)g(Scheme)f(ports.)32 b(When)22 b(doing)h(i/o)f(with)681 -1221 y(a)k(\256le)h(descriptor)-6 b(,)28 b(the)f(i/o)h(operation)f(is)h(done) -f(dir)o(ectly)f(on)i(the)f(\256le,)i(bypassing)e(any)681 1321 -y(buf)o(fer)o(ed)j(data)j(that)g(may)g(have)g(accumulated)f(in)i(an)f -(associated)g(port.)65 b(Note)33 b(that)681 1420 y(character)o(-at-a-time)27 -b(operations)k(such)g(as)f Fw(read-char)d FA(ar)o(e)i(likely)i(to)g(be)f -(quite)h(slow)681 1520 y(when)21 b(performed)f(dir)o(ectly)g(upon)h(\256le)g -(descriptors.)805 1648 y(The)27 b(standar)o(d)e(R4RS)h(pr)o(ocedur)o(es)f -Fw(read-char)p FA(,)f Fw(char-ready?)p FA(,)f Fw(write)p FA(,)j -Fw(display)p FA(,)681 1748 y Fw(newline)p FA(,)f(and)i Fw(write-char)c -FA(ar)o(e)i(all)i(generic,)h(accepting)f(integer)g(\256le)g(descriptor)g(ar)o -(-)681 1848 y(guments)g(as)f(well)g(as)g(ports.)44 b(Scsh)26 -b(also)g(mandates)g(the)g(availability)g(of)g Fw(format)p FA(,)e(and)681 -1947 y(further)c(r)o(equir)o(es)g Fw(format)e FA(to)j(accept)f(\256le)h -(descriptor)f(ar)o(guments)h(as)f(well)h(as)g(ports.)805 2076 -y(The)15 b(pr)o(ocedur)o(es)d Fw(peek-char)f FA(and)i Fw(read)g -FA(do)h Fz(not)g FA(accept)f(\256le)i(descriptor)f(ar)o(guments,)681 -2175 y(since)j(these)h(functions)g(r)o(equir)o(e)f(the)g(ability)h(to)f(r)o -(ead)f(ahead)g(in)i(the)g(input)g(str)o(eam,)f(a)f(fea-)681 -2275 y(tur)o(e)k(not)h(supported)g(by)g(Unix)f(I/O.)681 2536 -y Fy(3.2.2)81 b(Port)20 b(manipulation)e(and)h(standard)g(ports)681 -2748 y Fw(\(close-after)38 b Fz(port)20 b(consumer)p Fw(\))88 -b Fs(\000)-15 b(!)88 b Fz(value\(s\))20 b(of)h(consumer)394 -b FA(pr)o(ocedur)o(e)888 2865 y(Returns)16 b Fw(\()p Fz(consumer)43 -b(port)p Fw(\))p FA(,)15 b(but)g(closes)g(the)g(port)g(on)g(r)o(eturn.)25 -b(No)15 b(dynamic-wind)888 2957 y(magic.)1071 3120 y FD(Remark:)54 -b Fj(Is)19 b(ther)o(e)f(a)h(less-awkwar)o(d)e(name?)681 3372 -y Fw(\(error-output-po)o(rt)o(\))81 b Fs(\000)-14 b(!)87 b -Fz(port)1214 b FA(pr)o(ocedur)o(e)888 3516 y(This)33 b(pr)o(ocedur)o(e)d(is)j -(analogous)g(to)g Fw(current-output-)o(por)o(t)p FA(,)c(but)j(pr)o(oduces)g -(a)888 3615 y(port)21 b(used)g(for)f(err)o(or)g(messages\320the)h(scsh)g -(equivalent)g(of)g(stderr)-6 b(.)681 3814 y Fw(\(with-current-in)o(pu)o(t-p)o -(or)o(t*)37 b Fz(port)20 b(thunk)p Fw(\))83 b Fs(\000)-14 b(!)84 -b Fz(value\(s\))19 b(of)i(thunk)86 b FA(pr)o(ocedur)o(e)681 -3914 y Fw(\(with-current-ou)o(tp)o(ut-)o(po)o(rt)o(*)38 b Fz(port)16 -b(thunk)p Fw(\))66 b Fs(\000)-14 b(!)66 b Fz(value\(s\))17 -b(of)h(thunk)86 b FA(pr)o(ocedur)o(e)681 4013 y Fw(\(with-error-outp)o(ut)o -(-po)o(rt)o(*)37 b Fz(port)21 b(thunk)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(value\(s\))20 b(of)h(thunk)122 b FA(pr)o(ocedur)o(e)888 -4157 y(These)20 b(pr)o(ocedur)o(es)e(install)i Fz(port)f FA(as)g(the)h(curr)o -(ent)e(input,)i(curr)o(ent)f(output,)h(and)f(er)o(-)888 4257 -y(r)o(or)i(output)g(port,)f(r)o(espectively)-9 b(,)20 b(for)g(the)h(duration) -g(of)g(a)f(call)g(to)h Fz(thunk)p FA(.)681 4456 y Fw(\(with-current-in)o(pu)o -(t-p)o(or)o(t)37 b Fz(port)21 b(.)f(body)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(value\(s\))20 b(of)h(body)295 b FA(syntax)681 4555 -y Fw(\(with-current-ou)o(tp)o(ut-)o(po)o(rt)37 b Fz(port)20 -b(.)h(body)p Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(value\(s\))20 -b(of)h(body)251 b FA(syntax)681 4655 y Fw(\(with-error-outp)o(ut)o(-po)o(rt) -37 b Fz(port)20 b(.)g(body)p Fw(\))87 b Fs(\000)-15 b(!)87 -b Fz(value\(s\))21 b(of)f(body)339 b FA(syntax)888 4799 y(These)33 -b(special)f(forms)h(ar)o(e)f(simply)h(syntactic)g(sugar)g(for)f(the)h -Fw(with-current-)888 4898 y(input-port*)17 b FA(pr)o(ocedur)o(e)h(and)j -(friends.)681 5147 y(24)p 1952 5071 323 4 v 1952 5173 4 102 -v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 w FD(November)d(1,)h -(1995)h(\261)f(15)13 b(:)f(58)p eop +24 29 bop 681 614 a Fv(3.2)99 b(I/O)681 834 y Fz(3.2.1)81 +b(Standard)18 b(R4RS)i(I/O)h(procedures)681 1022 y FB(In)29 +b(scsh,)j(most)d(standar)o(d)f(R4RS)h(i/o)h(operations)f(\(such)g(as)g +Fx(display)d FB(or)j Fx(read-char)p FB(\))681 1121 y(work)22 +b(on)h(both)g(integer)f(\002le)g(descriptors)g(and)g(Scheme)f(ports.)30 +b(When)23 b(doing)f(i/o)h(with)681 1221 y(a)j(\002le)h(descriptor)-6 +b(,)28 b(the)f(i/o)h(operation)f(is)h(done)f(dir)o(ectly)f(on)i(the)f +(\002le,)i(bypassing)e(any)681 1321 y(buf)o(fer)o(ed)k(data)h(that)h +(may)h(have)f(accumulated)f(in)i(an)f(associated)g(port.)63 +b(Note)34 b(that)681 1420 y(character)o(-at-a-time)27 +b(operations)k(such)g(as)f Fx(read-char)d FB(ar)o(e)i(likely)i(to)g(be) +f(quite)h(slow)681 1520 y(when)21 b(performed)f(dir)o(ectly)g(upon)h +(\002le)g(descriptors.)805 1648 y(The)27 b(standar)o(d)e(R4RS)h(pr)o +(ocedur)o(es)f Fx(read-char)p FB(,)f Fx(char-ready?)p +FB(,)f Fx(write)p FB(,)j Fx(display)p FB(,)681 1748 y +Fx(newline)p FB(,)f(and)i Fx(write-char)c FB(ar)o(e)i(all)i(generic,)h +(accepting)f(integer)g(\002le)g(descriptor)g(ar)o(-)681 +1848 y(guments)g(as)f(well)h(as)f(ports.)42 b(Scsh)26 +b(also)h(mandates)e(the)i(availability)e(of)i Fx(format)p +FB(,)d(and)681 1947 y(further)c(r)o(equir)o(es)g Fx(format)e +FB(to)j(accept)f(\002le)h(descriptor)f(ar)o(guments)h(as)f(well)h(as)g +(ports.)805 2076 y(The)36 b(pr)o(ocedur)o(es)e Fx(peek-char)f +FB(and)i Fx(read)f FB(do)i FA(not)g FB(accept)f(\002le)h(descriptor)f +(ar)o(gu-)681 2175 y(ments,)41 b(since)c(these)g(functions)h(r)o(equir) +o(e)e(the)h(ability)g(to)g(r)o(ead)e(ahead)h(in)i(the)f(input)681 +2275 y(str)o(eam,)19 b(a)i(featur)o(e)e(not)i(supported)g(by)f(Unix)h +(I/O.)681 2536 y Fz(3.2.2)81 b(Port)20 b(manipulation)e(and)h(standard) +g(ports)681 2748 y Fx(\(close-after)38 b FA(port)20 b(consumer)p +Fx(\))88 b Ft(\000)-15 b(!)88 b FA(value\(s\))20 b(of)h(consumer)394 +b FB(pr)o(ocedur)o(e)888 2865 y(Returns)35 b Fx(\()p +FA(consumer)43 b(port)p Fx(\))p FB(,)36 b(but)e(closes)g(the)g(port)f +(on)i(r)o(eturn.)63 b(No)34 b(dynamic-)888 2957 y(wind)22 +b(magic.)1071 3120 y FE(Remark:)51 b Fk(Is)18 b(ther)o(e)h(a)g +(less-awkwar)o(d)e(name?)681 3372 y Fx(\(error-output-po)o(rt)o(\))81 +b Ft(\000)-14 b(!)87 b FA(port)1214 b FB(pr)o(ocedur)o(e)888 +3516 y(This)33 b(pr)o(ocedur)o(e)d(is)j(analogous)g(to)g +Fx(current-output-)o(por)o(t)p FB(,)c(but)j(pr)o(oduces)g(a)888 +3615 y(port)21 b(used)g(for)f(err)o(or)g(messages\227the)h(scsh)g +(equivalent)g(of)g(stderr)-6 b(.)681 3814 y Fx(\(with-current-in)o(pu)o +(t-p)o(or)o(t*)37 b FA(port)20 b(thunk)p Fx(\))83 b Ft(\000)-14 +b(!)83 b FA(value\(s\))20 b(of)h(thunk)86 b FB(pr)o(ocedur)o(e)681 +3914 y Fx(\(with-current-ou)o(tp)o(ut-)o(po)o(rt)o(*)38 +b FA(port)17 b(thunk)p Fx(\))65 b Ft(\000)-15 b(!)66 +b FA(value\(s\))17 b(of)i(thunk)86 b FB(pr)o(ocedur)o(e)681 +4013 y Fx(\(with-error-outp)o(ut)o(-po)o(rt)o(*)37 b +FA(port)21 b(thunk)p Fx(\))86 b Ft(\000)-14 b(!)87 b +FA(value\(s\))20 b(of)h(thunk)122 b FB(pr)o(ocedur)o(e)888 +4157 y(These)31 b(pr)o(ocedur)o(es)e(install)j FA(port)e +FB(as)h(the)g(curr)o(ent)f(input,)k(curr)o(ent)c(output,)j(and)888 +4257 y(err)o(or)20 b(output)h(port,)g(r)o(espectively)-9 +b(,)19 b(for)i(the)g(duration)f(of)h(a)f(call)h(to)g +FA(thunk)o FB(.)681 4456 y Fx(\(with-current-in)o(pu)o(t-p)o(or)o(t)37 +b FA(port)21 b(.)f(body)p Fx(\))86 b Ft(\000)-14 b(!)87 +b FA(value\(s\))20 b(of)h(body)295 b FB(syntax)681 4555 +y Fx(\(with-current-ou)o(tp)o(ut-)o(po)o(rt)37 b FA(port)20 +b(.)h(body)p Fx(\))86 b Ft(\000)-15 b(!)88 b FA(value\(s\))20 +b(of)h(body)251 b FB(syntax)681 4655 y Fx(\(with-error-outp)o(ut)o(-po) +o(rt)37 b FA(port)20 b(.)g(body)p Fx(\))87 b Ft(\000)-15 +b(!)87 b FA(value\(s\))21 b(of)f(body)339 b FB(syntax)888 +4799 y(These)33 b(special)f(forms)h(ar)o(e)f(simply)h(syntactic)g +(sugar)g(for)f(the)h Fx(with-current-)888 4898 y(input-port*)17 +b FB(pr)o(ocedur)o(e)h(and)j(friends.)681 5147 y(24)p +1952 5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p eop %%Page: 25 31 -25 30 bop 365 614 a Fw(\(set-current-inpu)o(t-)o(por)o(t!)37 -b Fz(port)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)580 -b FA(pr)o(ocedur)o(e)365 714 y Fw(\(set-current-outp)o(ut)o(-po)o(rt)o(!)38 -b Fz(port)p Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(unde\256ned)536 -b FA(pr)o(ocedur)o(e)365 814 y Fw(\(set-error-output)o(-p)o(ort)o(!)37 -b Fz(port)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)624 -b FA(pr)o(ocedur)o(e)573 958 y(These)21 b(pr)o(ocedur)o(es)f(alter)h(the)g -(dynamic)h(binding)g(of)g(the)f(curr)o(ent)g(I/O)h(port)f(pr)o(o-)573 -1057 y(cedur)o(es)e(to)i(new)h(values.)365 1257 y Fw(\(close)41 -b Fz(port/fd)p Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(boolean)1355 -b FA(pr)o(ocedur)o(e)573 1402 y(Close)21 b(the)g(port)g(or)g(\256le)f -(descriptor)-6 b(.)573 1537 y(If)27 b Fz(port/fd)g FA(is)h(a)g(\256le)g -(descriptor)-6 b(,)29 b(and)e(it)h(has)g(a)g(port)g(allocated)f(to)h(it,)i -(the)e(port)g(is)573 1637 y(shifted)c(to)h(a)e(new)i(\256le)f(descriptor)g -(cr)o(eated)e(with)k Fw(\(dup)41 b(port/fd\))21 b FA(befor)o(e)i(clos-)573 -1737 y(ing)18 b Fw(port/fd)p FA(.)24 b(The)18 b(port)g(then)g(has)g(its)g(r)o -(evealed)e(count)i(set)g(to)g(zer)o(o.)26 b(This)18 b(r)o(e\257ects)573 -1836 y(the)23 b(design)h(criteria)e(that)i(ports)f(ar)o(e)f(not)i(associated) -f(with)h(\256le)f(descriptors,)h(but)573 1936 y(with)d(open)g(\256les.)573 -2072 y(T)-8 b(o)19 b(close)f(a)g(\256le)g(descriptor)-6 b(,)18 -b(and)g(any)g(associated)g(port)g(it)h(might)g(have,)f(you)h(must)573 -2171 y(instead)h(say)h(one)g(of)g(\(as)f(appr)o(opriate\):)756 -2343 y Fw(\(close)41 b(\(fdes->inport)81 b(fd\)\))756 2443 -y(\(close)41 b(\(fdes->outport)c(fd\)\))573 2651 y FA(The)26 -b(pr)o(ocedur)o(e)e(r)o(eturns)h(tr)o(ue)h(if)g(it)g(closed)g(an)g(open)g -(port.)43 b(If)25 b(the)h(port)g(was)g(al-)573 2751 y(r)o(eady)19 -b(closed,)i(it)g(r)o(eturns)f(false;)g(this)h(is)g(not)h(an)e(err)o(or)-6 -b(.)365 2951 y Fw(\(stdports->stdio\))80 b Fs(\000)-14 b(!)87 -b Fz(unde\256ned)1111 b FA(pr)o(ocedur)o(e)365 3051 y Fw(\(stdio->stdports\)) -80 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)1111 b FA(pr)o(ocedur)o(e)573 -3195 y(These)17 b(two)g(pr)o(ocedur)o(es)e(ar)o(e)h(used)h(to)g(synchr)o -(onise)h(Unix')f(standar)o(d)e(I/O)i(\256le)g(de-)573 3294 -y(scriptors)k(and)f(Scheme's)h(curr)o(ent)f(I/O)h(ports.)573 -3430 y Fw(\(stdports->stdio)o(\))14 b FA(causes)21 b(the)f(standar)o(d)f(I/O) -j(\256le)e(descriptors)h(\(0,)e(1,)h(and)g(2\))573 3530 y(to)h(take)f(their)g -(values)g(fr)o(om)g(the)h(curr)o(ent)f(I/O)h(ports.)27 b(It)21 -b(is)g(exactly)e(equivalent)i(to)573 3630 y(the)g(series)f(of)h(r)o(edir)o -(ections:)1486 3599 y Ft(1)756 3802 y Fw(\(dup)41 b(\(current-input-po)o -(rt\))80 b(0\))756 3901 y(\(dup)41 b(\(current-output-p)o(ort)o(\))c(1\))756 -4001 y(\(dup)k(\(error-output-por)o(t\))124 b(2\))573 4173 -y(stdio->stdports)32 b FA(causes)37 b(the)h(bindings)h(of)f(the)g(curr)o(ent) -g(I/O)g(ports)g(to)h(be)573 4273 y(changed)21 b(to)h(ports)f(constr)o(ucted)h -(over)g(the)f(standar)o(d)f(I/O)i(\256le)f(descriptors.)30 -b(It)21 b(is)573 4372 y(exactly)f(equivalent)h(to)g(the)g(series)g(of)f -(assignments)756 4544 y Fw(\(set-current-in)o(pu)o(t-p)o(or)o(t!)81 -b(\(fdes->inport)38 b(0\)\))756 4644 y(\(set-current-ou)o(tp)o(ut-)o(po)o -(rt!)f(\(fdes->inport)h(1\)\))756 4744 y(\(set-error-outp)o(ut)o(-po)o(rt)o -(!)125 b(\(fdes->inport)38 b(2\)\))p 365 4821 1146 4 v 450 -4875 a Fo(1)485 4898 y Fr(Why)16 b(not)g Fh(move->fdes)p Fr(?)25 -b(Because)17 b(the)e(curr)o(ent)h(output)g(port)g(and)g(err)o(or)h(port)f -(might)g(be)f(the)h(same)g(port.)365 5147 y FD(November)i(1,)h(1995)h(\261)f -(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w -FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FA(25)p eop +25 30 bop 365 614 a Fx(\(set-current-inpu)o(t-)o(por)o(t!)37 +b FA(port)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(unde\002ned)580 +b FB(pr)o(ocedur)o(e)365 714 y Fx(\(set-current-outp)o(ut)o(-po)o(rt)o +(!)38 b FA(port)p Fx(\))86 b Ft(\000)-15 b(!)88 b FA(unde\002ned)536 +b FB(pr)o(ocedur)o(e)365 814 y Fx(\(set-error-output)o(-p)o(ort)o(!)37 +b FA(port)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(unde\002ned)624 +b FB(pr)o(ocedur)o(e)573 958 y(These)21 b(pr)o(ocedur)o(es)f(alter)h +(the)g(dynamic)h(binding)g(of)g(the)f(curr)o(ent)g(I/O)h(port)f(pr)o +(o-)573 1057 y(cedur)o(es)e(to)i(new)h(values.)365 1257 +y Fx(\(close)41 b FA(fd/port)p Fx(\))86 b Ft(\000)-15 +b(!)88 b FA(boolean)1355 b FB(pr)o(ocedur)o(e)573 1402 +y(Close)21 b(the)g(port)g(or)g(\002le)f(descriptor)-6 +b(.)573 1537 y(If)27 b FA(fd/port)g FB(is)h(a)g(\002le)g(descriptor)-6 +b(,)29 b(and)e(it)h(has)g(a)g(port)g(allocated)f(to)h(it,)i(the)e(port) +g(is)573 1637 y(shifted)c(to)h(a)e(new)i(\002le)f(descriptor)g(cr)o +(eated)e(with)k Fx(\(dup)41 b(fd/port\))21 b FB(befor)o(e)i(clos-)573 +1737 y(ing)c Fx(fd/port)p FB(.)i(The)e(port)f(then)g(has)h(its)f(r)o +(evealed)e(count)j(set)f(to)h(zer)o(o.)k(This)c(r)o(e\003ects)573 +1836 y(the)k(design)h(criteria)e(that)i(ports)f(ar)o(e)f(not)i +(associated)f(with)h(\002le)f(descriptors,)h(but)573 +1936 y(with)d(open)g(\002les.)573 2072 y(T)-8 b(o)19 +b(close)f(a)g(\002le)g(descriptor)-6 b(,)18 b(and)g(any)g(associated)g +(port)g(it)h(might)g(have,)f(you)h(must)573 2171 y(instead)h(say)h(one) +g(of)g(\(as)f(appr)o(opriate\):)756 2343 y Fx(\(close)41 +b(\(fdes->inport)81 b(fd\)\))756 2443 y(\(close)41 b(\(fdes->outport)c +(fd\)\))573 2651 y FB(The)26 b(pr)o(ocedur)o(e)e(r)o(eturns)h(tr)o(ue)h +(if)g(it)h(closed)f(an)g(open)g(port.)41 b(If)26 b(the)g(port)g(was)g +(al-)573 2751 y(r)o(eady)19 b(closed,)i(it)g(r)o(eturns)f(false;)g +(this)h(is)g(not)h(an)e(err)o(or)-6 b(.)365 2951 y Fx +(\(stdports->stdio\))80 b Ft(\000)-14 b(!)87 b FA(unde\002ned)1111 +b FB(pr)o(ocedur)o(e)365 3051 y Fx(\(stdio->stdports\))80 +b Ft(\000)-14 b(!)87 b FA(unde\002ned)1111 b FB(pr)o(ocedur)o(e)573 +3195 y(These)30 b(two)h(pr)o(ocedur)o(es)e(ar)o(e)g(used)h(to)h(synchr) +o(onise)g(Unix')g(standar)o(d)d(I/O)j(\002le)573 3294 +y(descriptors)20 b(and)h(Scheme's)f(curr)o(ent)g(I/O)i(ports.)573 +3430 y Fx(\(stdports->stdio)o(\))14 b FB(causes)21 b(the)f(standar)o(d) +f(I/O)j(\002le)e(descriptors)h(\(0,)e(1,)h(and)g(2\))573 +3530 y(to)h(take)f(their)h(values)f(fr)o(om)g(the)h(curr)o(ent)f(I/O)h +(ports.)26 b(It)20 b(is)h(exactly)f(equivalent)h(to)573 +3630 y(the)g(series)f(of)h(r)o(edir)o(ections:)1486 3599 +y Fu(1)756 3802 y Fx(\(dup)41 b(\(current-input-po)o(rt\))80 +b(0\))756 3901 y(\(dup)41 b(\(current-output-p)o(ort)o(\))c(1\))756 +4001 y(\(dup)k(\(error-output-por)o(t\))124 b(2\))573 +4173 y(stdio->stdports)32 b FB(causes)37 b(the)h(bindings)h(of)f(the)g +(curr)o(ent)g(I/O)g(ports)g(to)h(be)573 4273 y(changed)28 +b(to)h(ports)f(constr)o(ucted)h(over)f(the)g(standar)o(d)f(I/O)i +(\002le)g(descriptors.)48 b(It)573 4372 y(is)21 b(exactly)f(equivalent) +h(to)g(the)g(series)g(of)f(assignments)756 4544 y Fx(\(set-current-in)o +(pu)o(t-p)o(or)o(t!)81 b(\(fdes->inport)h(0\)\))756 4644 +y(\(set-current-ou)o(tp)o(ut-)o(po)o(rt!)37 b(\(fdes->outport)h(1\)\)) +756 4744 y(\(set-error-outp)o(ut)o(-po)o(rt)o(!)125 b(\(fdes->outport) +38 b(2\)\))p 365 4821 1146 4 v 450 4875 a Fp(1)485 4898 +y Fs(Why)16 b(not)g Fj(move->fdes)p Fs(?)24 b(Because)16 +b(the)g(curr)o(ent)g(output)g(port)h(and)e(err)o(or)i(port)g(might)e +(be)h(the)g(same)g(port.)365 5147 y FE(Mar)o(ch)j(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v +540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w +FB(25)p eop %%Page: 26 32 -26 31 bop 888 614 a FA(However)-6 b(,)57 b(you)51 b(ar)o(e)d(mor)o(e)i -(likely)h(to)f(\256nd)g(the)g(dynamic-extent)g(variant,)888 -714 y Fw(with-stdio-ports*)o FA(,)15 b(below)-8 b(,)21 b(to)g(be)g(of)f(use)h -(in)g(general)g(pr)o(ogramming.)681 909 y Fw(\(with-stdio-port)o(s*)37 -b Fz(thunk)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(value\(s\))21 -b(of)f(thunk)543 b FA(pr)o(ocedur)o(e)681 1009 y Fw(\(with-stdio-port)o(s)37 -b Fz(body)20 b Fx(:)14 b(:)g(:)g Fw(\))87 b Fs(\000)-14 b(!)87 -b Fz(value\(s\))20 b(of)h(body)669 b FA(syntax)888 1151 y Fw -(with-stdio-ports*)31 b FA(binds)37 b(the)h(standar)o(d)e(ports)i -Fw(\(current-input-)o(por)o(t\))o FA(,)888 1251 y Fw(\(current-output-p)o(or) -o(t\))p FA(,)23 b(and)k Fw(\(error-output-por)o(t\))21 b FA(to)28 -b(be)g(ports)g(on)g(\256le)888 1351 y(descriptors)21 b(0,)f(1,)g(2,)g(and)g -(then)h(calls)g Fz(thunk)o FA(.)28 b(It)21 b(is)g(equivalent)g(to:)1071 -1519 y Fw(\(with-current-in)o(put)o(-p)o(or)o(t)38 b(\(fdes->inport)g(0\)) -1158 1619 y(\(with-current-out)o(pu)o(t-)o(por)o(t)f(\(fdes->inport)i(1\)) -1245 1719 y(\(with-error-outpu)o(t-)o(por)o(t)e(\(fdes->outport)h(2\))1333 -1818 y(\(thunk\)\)\)\))888 1987 y FA(The)21 b Fw(with-stdio-ports)14 -b FA(special)21 b(form)f(is)h(mer)o(ely)g(syntactic)g(sugar)-6 -b(.)681 2261 y Fy(3.2.3)81 b(String)20 b(ports)681 2447 y FA(Scheme)h(48)g -(has)h(string)g(ports,)g(which)h(you)f(can)g(use.)30 b(Scsh)22 -b(has)g(not)g(committed)h(to)f(the)681 2546 y(particular)e(interface)g(or)h -(names)g(that)g(Scheme)g(48)f(uses,)h(so)g(be)g(warned)g(that)g(the)g(inter)o -(-)681 2646 y(face)e(described)h(her)o(ein)g(may)h(be)g(liable)f(to)h -(change.)681 2797 y Fw(\(make-string-inp)o(ut)o(-po)o(rt)37 -b Fz(string)p Fw(\))87 b Fs(\000)-15 b(!)88 b Fz(port)749 b -FA(pr)o(ocedur)o(e)888 2939 y(Returns)22 b(a)e(port)h(that)g(r)o(eads)e -(characters)g(fr)o(om)i(the)g(supplied)f(string.)681 3135 y -Fw(\(make-string-out)o(pu)o(t-p)o(or)o(t\))81 b Fs(\000)-15 -b(!)88 b Fz(port)952 b FA(pr)o(ocedur)o(e)681 3234 y Fw(\(string-output-p)o -(or)o(t-o)o(ut)o(pu)o(t)38 b Fz(port)p Fw(\))86 b Fs(\000)-15 -b(!)88 b Fz(port)683 b FA(pr)o(ocedur)o(e)888 3377 y(A)45 b(string)g(output)h -(port)f(is)g(a)g(port)g(that)f(collects)i(the)f(characters)e(given)j(to)888 -3476 y(it)j(into)g(a)f(string.)111 b(The)49 b(accumulated)e(string)i(is)g(r)o -(etrieved)d(by)j(applying)888 3576 y Fw(string-output-por)o(t-)o(out)o(pu)o -(t)15 b FA(to)21 b(the)g(port.)681 3771 y Fw(\(call-with-strin)o(g-)o(out)o -(pu)o(t-)o(por)o(t)37 b Fz(pr)o(ocedur)o(e)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(string)301 b FA(pr)o(ocedur)o(e)888 3914 y(The)74 -b Fz(pr)o(ocedur)o(e)e FA(value)h(is)h(called)e(on)i(a)f(port.)185 -b(When)74 b(it)g(r)o(eturns,)888 4013 y Fw(call-with-string-)o(ou)o(tpu)o(t-) -o(por)o(t)18 b FA(r)o(eturns)24 b(a)g(string)h(containing)g(the)g(charac-)888 -4113 y(ters)c(that)g(wer)o(e)e(written)j(to)f(that)f(port)h(during)g(the)g -(execution)g(of)g Fz(pr)o(ocedur)o(e)o FA(.)681 4387 y Fy(3.2.4)81 -b(Revealed)18 b(ports)j(and)e(\256le)h(descriptors)681 4572 -y FA(The)g(material)f(in)i(this)g(section)g(and)e(the)i(following)g(one)g(is) -f(not)h(critical)f(for)g(most)h(appli-)681 4672 y(cations.)28 -b(Y)-8 b(ou)21 b(may)g(safely)e(skim)j(or)e(completely)h(skip)g(this)g -(section)h(on)f(a)f(\256rst)g(r)o(eading.)805 4799 y(Dealing)k(with)f(Unix)g -(\256le)h(descriptors)e(in)i(a)e(Scheme)h(envir)o(onment)h(is)f(dif)o -(\256cult.)34 b(In)681 4898 y(Unix,)15 b(open)f(\256les)g(ar)o(e)f(part)g(of) -h(the)g(pr)o(ocess)f(envir)o(onment,)j(and)d(ar)o(e)g(r)o(efer)o(enced)e(by)j -(small)681 5147 y(26)p 1952 5071 323 4 v 1952 5173 4 102 v -1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 w FD(November)k(1,)h -(1995)h(\261)f(15)13 b(:)f(58)p eop +26 31 bop 888 614 a FB(However)-6 b(,)57 b(you)51 b(ar)o(e)d(mor)o(e)i +(likely)h(to)f(\002nd)g(the)g(dynamic-extent)g(variant,)888 +714 y Fx(with-stdio-ports*)o FB(,)15 b(below)-8 b(,)21 +b(to)g(be)g(of)f(use)h(in)g(general)g(pr)o(ogramming.)681 +909 y Fx(\(with-stdio-port)o(s*)37 b FA(thunk)p Fx(\))86 +b Ft(\000)-14 b(!)87 b FA(value\(s\))21 b(of)f(thunk)543 +b FB(pr)o(ocedur)o(e)681 1009 y Fx(\(with-stdio-port)o(s)37 +b FA(body)20 b(.)12 b(.)g(.)g Fx(\))88 b Ft(\000)-14 +b(!)87 b FA(value\(s\))20 b(of)h(body)680 b FB(syntax)888 +1151 y Fx(with-stdio-ports*)31 b FB(binds)37 b(the)h(standar)o(d)e +(ports)i Fx(\(current-input-)o(por)o(t\))o FB(,)888 1251 +y Fx(\(current-output-p)o(or)o(t\))p FB(,)23 b(and)k +Fx(\(error-output-por)o(t\))21 b FB(to)28 b(be)g(ports)g(on)g(\002le) +888 1351 y(descriptors)21 b(0,)f(1,)g(2,)g(and)g(then)h(calls)g +FA(thunk)o FB(.)26 b(It)21 b(is)g(equivalent)g(to:)1071 +1519 y Fx(\(with-current-in)o(put)o(-p)o(or)o(t)38 b(\(fdes->inport)g +(0\))1158 1619 y(\(with-current-out)o(pu)o(t-)o(por)o(t)f +(\(fdes->inport)i(1\))1245 1719 y(\(with-error-outpu)o(t-)o(por)o(t)e +(\(fdes->outport)h(2\))1333 1818 y(\(thunk\)\)\)\))888 +1987 y FB(The)21 b Fx(with-stdio-ports)14 b FB(special)21 +b(form)f(is)h(mer)o(ely)g(syntactic)g(sugar)-6 b(.)681 +2261 y Fz(3.2.3)81 b(String)20 b(ports)681 2447 y FB(Scheme)30 +b(48)g(has)h(string)h(ports,)h(which)f(you)f(can)g(use.)56 +b(Scsh)31 b(has)g(not)g(committed)h(to)681 2546 y(the)27 +b(particular)f(interface)h(or)g(names)h(that)f(Scheme)g(48)f(uses,)j +(so)f(be)f(warned)g(that)g(the)681 2646 y(interface)19 +b(described)h(her)o(ein)g(may)h(be)g(liable)f(to)h(change.)681 +2797 y Fx(\(make-string-inp)o(ut)o(-po)o(rt)37 b FA(string)p +Fx(\))87 b Ft(\000)-15 b(!)88 b FA(port)749 b FB(pr)o(ocedur)o(e)888 +2939 y(Returns)22 b(a)e(port)h(that)g(r)o(eads)e(characters)g(fr)o(om)i +(the)g(supplied)f(string.)681 3135 y Fx(\(make-string-out)o(pu)o(t-p)o +(or)o(t\))81 b Ft(\000)-15 b(!)88 b FA(port)952 b FB(pr)o(ocedur)o(e) +681 3234 y Fx(\(string-output-p)o(or)o(t-o)o(ut)o(pu)o(t)38 +b FA(port)p Fx(\))86 b Ft(\000)-15 b(!)88 b FA(string)619 +b FB(pr)o(ocedur)o(e)888 3377 y(A)45 b(string)g(output)h(port)f(is)g(a) +g(port)g(that)f(collects)i(the)f(characters)e(given)j(to)888 +3476 y(it)j(into)h(a)e(string.)109 b(The)49 b(accumulated)e(string)i +(is)g(r)o(etrieved)e(by)i(applying)888 3576 y Fx(string-output-por)o +(t-)o(out)o(pu)o(t)15 b FB(to)21 b(the)g(port.)681 3771 +y Fx(\(call-with-strin)o(g-)o(out)o(pu)o(t-)o(por)o(t)37 +b FA(pr)o(ocedur)o(e)p Fx(\))86 b Ft(\000)-14 b(!)87 +b FA(string)301 b FB(pr)o(ocedur)o(e)888 3914 y(The)74 +b FA(pr)o(ocedur)o(e)e FB(value)h(is)h(called)f(on)h(a)f(port.)184 +b(When)74 b(it)g(r)o(eturns,)888 4013 y Fx(call-with-string-)o(ou)o +(tpu)o(t-)o(por)o(t)18 b FB(r)o(eturns)24 b(a)g(string)h(containing)g +(the)g(charac-)888 4113 y(ters)c(that)g(wer)o(e)e(written)j(to)f(that)f +(port)h(during)g(the)g(execution)g(of)g FA(pr)o(ocedur)o(e)o +FB(.)681 4387 y Fz(3.2.4)81 b(Revealed)18 b(ports)j(and)e(\002le)h +(descriptors)681 4572 y FB(The)g(material)f(in)i(this)g(section)g(and)e +(the)i(following)g(one)g(is)f(not)h(critical)f(for)g(most)h(appli-)681 +4672 y(cations.)26 b(Y)-8 b(ou)21 b(may)g(safely)f(skim)i(or)e +(completely)h(skip)g(this)h(section)f(on)g(a)f(\002rst)h(r)o(eading.) +805 4799 y(Dealing)j(with)g(Unix)f(\002le)g(descriptors)g(in)h(a)f +(Scheme)f(envir)o(onment)i(is)g(dif)o(\002cult.)32 b(In)681 +4898 y(Unix,)h(open)f(\002les)g(ar)o(e)e(part)g(of)i(the)f(pr)o(ocess)g +(envir)o(onment,)k(and)30 b(ar)o(e)g(r)o(efer)o(enced)f(by)681 +5147 y(26)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 27 33 -27 32 bop 365 614 a FA(integers)27 b(called)f Fz(\256le)h(descriptors)p -FA(.)44 b(Open)27 b(\256le)g(descriptors)f(ar)o(e)f(the)i(fundamental)f(way) -365 714 y(i/o)20 b(r)o(edir)o(ections)d(ar)o(e)g(passed)h(to)h(subpr)o -(ocesses,)f(since)h(\256le)g(descriptors)f(ar)o(e)f(pr)o(eserved)365 -814 y(acr)o(oss)j(fork's)h(and)g(exec's.)490 938 y(Scheme,)g(on)i(the)f -(other)g(hand,)g(uses)h(ports)f(for)g(specifying)g(i/o)h(sour)o(ces.)30 -b(Ports)23 b(ar)o(e)365 1038 y(garbage-collected)c(Scheme)g(objects,)i(not)g -(integers.)28 b(Ports)20 b(can)g(be)g(garbage)f(collected;)365 -1137 y(when)k(a)f(port)g(is)g(collected,)g(it)g(is)h(also)f(closed.)31 -b(Because)21 b(\256le)h(descriptors)g(ar)o(e)f(just)i(inte-)365 -1237 y(gers,)c(it's)h(impossible)g(to)f(garbage)e(collect)j(them\320you)f -(wouldn't)h(be)f(able)f(to)h(close)g(\256le)365 1337 y(descriptor)d(3)g -(unless)h(ther)o(e)f(wer)o(e)f(no)i(3's)f(in)h(the)g(system,)g(and)f(you)h -(could)g(further)e(pr)o(ove)365 1436 y(that)21 b(your)g(pr)o(ogram)f(would)h -(never)g(again)f(compute)h(a)f(3.)27 b(This)22 b(is)f(dif)o(\256cult)f(at)g -(best.)490 1561 y(If)j(a)f(Scheme)h(pr)o(ogram)g(only)h(used)f(Scheme)f -(ports,)i(and)f(never)g(actually)f(used)h(\256le)365 1660 y(descriptors,)17 -b(this)g(would)g(not)g(be)g(a)f(pr)o(oblem.)25 b(But)16 b(Scheme)h(code)f -(must)h(descend)f(to)g(the)365 1760 y(\256le)21 b(descriptor)g(level)f(in)h -(at)g(least)f(two)h(cir)o(cumstances:)490 1933 y Fs(\017)41 -b FA(when)21 b(interfacing)g(to)g(for)o(eign)f(code)490 2089 -y Fs(\017)41 b FA(when)21 b(interfacing)g(to)g(a)f(subpr)o(ocess.)365 -2262 y(This)j(causes)f(a)g(pr)o(oblem.)31 b(Suppose)22 b(we)h(have)e(a)h -(Scheme)g(port)g(constr)o(ucted)h(on)g(top)g(of)365 2362 y(\256le)i -(descriptor)e(2.)38 b(W)-8 b(e)24 b(intend)h(to)f(fork)h(of)o(f)e(a)h(pr)o -(ogram)f(that)h(will)h(inherit)g(this)g(\256le)f(de-)365 2461 -y(scriptor)-6 b(.)46 b(If)27 b(we)g(dr)o(op)f(r)o(efer)o(ences)f(to)i(the)g -(port,)i(the)e(garbage)f(collector)h(may)g(pr)o(ema-)365 2561 -y(tur)o(ely)19 b(close)h(\256le)f(2)g(befor)o(e)f(we)i(fork)f(the)h(subpr)o -(ocess.)26 b(The)20 b(interface)e(described)g(below)365 2660 -y(is)24 b(intended)g(to)g(\256x)f(this)h(and)g(other)f(pr)o(oblems)h(arising) -g(fr)o(om)f(the)g(mismatch)i(between)365 2760 y(ports)c(and)g(\256le)g -(descriptors.)490 2885 y(The)h(Scheme)g(kernel)g(maintains)h(a)e(port)h -(table)g(that)g(maps)g(a)g(\256le)g(descriptor)g(to)g(the)365 -2984 y(Scheme)i(port)g(allocated)f(for)g(it)h(\(or)-6 b(,)24 -b Fw(#f)f FA(if)h(ther)o(e)f(is)h(no)g(port)g(allocated)f(for)h(this)g -(\256le)g(de-)365 3084 y(scriptor\).)i(This)15 b(is)h(used)f(to)h(ensur)o(e)e -(that)i(ther)o(e)e(is)i(at)f(most)h(one)g(open)f(port)g(for)h(each)e(open)365 -3183 y(\256le)21 b(descriptor)-6 b(.)490 3308 y(The)25 b(port)f(data)g(str)o -(uctur)o(e)g(for)h(\256le)g(ports)g(has)g(two)g(\256elds)g(besides)f(the)h -(descriptor:)365 3408 y Fz(r)o(evealed)16 b FA(and)f Fz(closed?)o -FA(.)26 b(When)16 b(a)f(\256le)h(port)f(is)h(closed)g(with)g -Fw(\(close)41 b(port\))p FA(,)15 b(the)g(port's)h(\256le)365 -3507 y(descriptor)23 b(is)g(closed,)g(its)g(entry)g(in)h(the)f(port)g(table)f -(is)h(clear)o(ed,)f(and)g(the)h(port's)g Fz(closed?)365 3607 -y FA(\256eld)e(is)g(set)g(to)g(tr)o(ue.)490 3731 y(When)j(a)f(\256le)g -(descriptor)g(is)h(closed)f(with)i Fw(\(close)41 b(fdes\))p -FA(,)22 b(any)h(associated)g(port)g(is)365 3831 y(shifted)j(to)g(a)g(new)g -(\256le)g(descriptor)g(cr)o(eated)e(with)j Fw(\(dup)42 b(fdes\))p -FA(.)e(The)26 b(port)g(has)g(its)h(r)o(e-)365 3931 y(vealed)22 -b(count)h(r)o(eset)e(to)i(zer)o(o)e(\(and)h(hence)g(becomes)h(eligible)g(for) -f(closing)h(on)g(GC\).)f(See)365 4030 y(discussion)30 b(below)-8 -b(.)50 b(T)-8 b(o)28 b(r)o(eally)f(put)h(a)g(stake)g(thr)o(ough)g(a)g -(descriptor)6 b('s)28 b(heart)f(without)365 4130 y(waiting)22 -b(for)e(associated)g(ports)h(to)g(be)g(GC'd,)f(you)i(must)f(say)g(one)g(of) -573 4302 y Fw(\(close)41 b(\(fdes->inport)d(fdes\)\))573 4402 -y(\(close)j(\(fdes->output)d(fdes\)\))490 4599 y FA(The)20 -b Fz(r)o(evealed)g FA(\256eld)h(is)g(an)f(aid)g(to)h(garbage)e(collection.)28 -b(It)21 b(is)g(an)f(integer)g(semaphor)o(e.)365 4699 y(If)c(it)g(is)g(zer)o -(o,)f(the)h(port's)g(\256le)g(descriptor)g(can)f(be)g(closed)h(when)h(the)f -(port)f(is)i(collected.)25 b(Es-)365 4799 y(sentially)-9 b(,)16 -b(the)e Fz(r)o(evealed)f FA(\256eld)h(r)o(e\257ects)f(whether)i(or)f(not)g -(the)g(port's)g(\256le)h(descriptor)e(has)h(es-)365 4898 y(caped)j(to)h(the)g -(Scheme)f(user)-6 b(.)27 b(If)17 b(the)h(Scheme)f(user)h(doesn't)g(know)h -(what)f(\256le)g(descriptor)365 5147 y FD(November)g(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1216 w FA(27)p eop +27 32 bop 365 614 a FB(small)29 b(integers)g(called)f +FA(\002le)h(descriptors)p FB(.)49 b(Open)29 b(\002le)g(descriptors)f +(ar)o(e)f(the)i(fundamen-)365 714 y(tal)e(way)h(i/o)g(r)o(edir)o +(ections)e(ar)o(e)g(passed)h(to)g(subpr)o(ocesses,)i(since)e(\002le)h +(descriptors)f(ar)o(e)365 814 y(pr)o(eserved)19 b(acr)o(oss)h(fork's)h +(and)g(exec's.)490 939 y(Scheme,)h(on)g(the)h(other)f(hand,)g(uses)g +(ports)h(for)f(specifying)g(i/o)h(sour)o(ces.)29 b(Ports)23 +b(ar)o(e)365 1039 y(garbage-collected)c(Scheme)h(objects,)h(not)g +(integers.)26 b(Ports)21 b(can)f(be)g(garbage)f(collected;)365 +1139 y(when)27 b(a)f(port)g(is)h(collected,)g(it)g(is)f(also)h(closed.) +42 b(Because)25 b(\002le)h(descriptors)h(ar)o(e)d(just)j(in-)365 +1238 y(tegers,)f(it's)f(impossible)h(to)f(garbage)f(collect)h +(them\227you)h(wouldn't)f(be)g(able)f(to)h(close)365 +1338 y(\002le)f(descriptor)f(3)g(unless)h(ther)o(e)f(wer)o(e)f(no)i +(3's)f(in)h(the)g(system,)h(and)e(you)h(could)f(further)365 +1437 y(pr)o(ove)j(that)h(your)f(pr)o(ogram)g(would)h(never)f(again)h +(compute)g(a)f(3.)42 b(This)27 b(is)g(dif)o(\002cult)f(at)365 +1537 y(best.)490 1663 y(If)d(a)f(Scheme)h(pr)o(ogram)g(only)h(used)f +(Scheme)f(ports,)i(and)f(never)g(actually)f(used)h(\002le)365 +1762 y(descriptors,)28 b(this)g(would)f(not)g(be)g(a)f(pr)o(oblem.)43 +b(But)27 b(Scheme)f(code)h(must)g(descend)f(to)365 1862 +y(the)21 b(\002le)g(descriptor)f(level)h(in)g(at)g(least)f(two)h(cir)o +(cumstances:)490 2055 y Ft(\017)41 b FB(when)21 b(interfacing)g(to)g +(for)o(eign)f(code)490 2223 y Ft(\017)41 b FB(when)21 +b(interfacing)g(to)g(a)f(subpr)o(ocess.)365 2416 y(This)30 +b(causes)f(a)g(pr)o(oblem.)50 b(Suppose)29 b(we)g(have)g(a)g(Scheme)g +(port)g(constr)o(ucted)g(on)h(top)365 2515 y(of)d(\002le)g(descriptor)g +(2.)44 b(W)-8 b(e)27 b(intend)g(to)h(fork)f(of)o(f)f(a)g(pr)o(ogram)g +(that)h(will)h(inherit)g(this)f(\002le)365 2615 y(descriptor)-6 +b(.)25 b(If)c(we)g(dr)o(op)f(r)o(efer)o(ences)e(to)j(the)g(port,)g(the) +g(garbage)e(collector)i(may)g(pr)o(ema-)365 2714 y(tur)o(ely)e(close)h +(\002le)g(2)f(befor)o(e)f(we)i(fork)f(the)h(subpr)o(ocess.)25 +b(The)19 b(interface)g(described)f(below)365 2814 y(is)24 +b(intended)g(to)g(\002x)f(this)h(and)g(other)f(pr)o(oblems)h(arising)g +(fr)o(om)f(the)g(mismatch)i(between)365 2914 y(ports)c(and)g(\002le)g +(descriptors.)490 3039 y(The)h(Scheme)g(kernel)g(maintains)h(a)e(port)h +(table)g(that)g(maps)g(a)g(\002le)g(descriptor)g(to)g(the)365 +3139 y(Scheme)33 b(port)g(allocated)f(for)h(it)h(\(or)-6 +b(,)35 b Fx(#f)e FB(if)g(ther)o(e)f(is)h(no)h(port)f(allocated)g(for)g +(this)g(\002le)365 3239 y(descriptor\).)e(This)23 b(is)g(used)f(to)h +(ensur)o(e)f(that)h(ther)o(e)e(is)i(at)g(most)g(one)g(open)g(port)g +(for)f(each)365 3338 y(open)f(\002le)g(descriptor)-6 +b(.)490 3464 y(The)25 b(port)f(data)g(str)o(uctur)o(e)g(for)h(\002le)g +(ports)g(has)g(two)g(\002elds)g(besides)f(the)h(descriptor:)365 +3564 y FA(r)o(evealed)h FB(and)f FA(closed?)p FB(.)41 +b(When)26 b(a)g(\002le)g(port)g(is)g(closed)g(with)h +Fx(\(close)41 b(port\))p FB(,)25 b(the)h(port's)365 3663 +y(\002le)32 b(descriptor)f(is)h(closed,)i(its)f(entry)e(in)h(the)g +(port)g(table)f(is)h(clear)o(ed,)g(and)f(the)h(port's)365 +3763 y FA(closed?)20 b FB(\002eld)h(is)g(set)g(to)g(tr)o(ue.)490 +3889 y(When)32 b(a)f(\002le)g(descriptor)h(is)f(closed)h(with)g +Fx(\(close)41 b(fdes\))p FB(,)32 b(any)g(associated)e(port)365 +3988 y(is)f(shifted)g(to)g(a)f(new)h(\002le)g(descriptor)f(cr)o(eated)f +(with)j Fx(\(dup)42 b(fdes\))p FB(.)47 b(The)29 b(port)f(has)h(its)365 +4088 y(r)o(evealed)e(count)i(r)o(eset)f(to)h(zer)o(o)e(\(and)h(hence)h +(becomes)g(eligible)f(for)h(closing)h(on)f(GC\).)365 +4187 y(See)16 b(discussion)i(below)-8 b(.)25 b(T)-8 b(o)17 +b(r)o(eally)e(put)i(a)f(stake)g(thr)o(ough)i(a)e(descriptor)6 +b('s)16 b(heart)g(without)365 4287 y(waiting)22 b(for)e(associated)g +(ports)h(to)g(be)g(GC'd,)f(you)i(must)f(say)g(one)g(of)573 +4480 y Fx(\(close)41 b(\(fdes->inport)d(fdes\)\))573 +4580 y(\(close)j(\(fdes->output)d(fdes\)\))490 4799 y +FB(The)20 b FA(r)o(evealed)h FB(\002eld)f(is)h(an)g(aid)f(to)h(garbage) +e(collection.)27 b(It)20 b(is)h(an)g(integer)f(semaphor)o(e.)365 +4898 y(If)25 b(it)g(is)h(zer)o(o,)e(the)i(port's)f(\002le)g(descriptor) +g(can)g(be)g(closed)g(when)g(the)h(port)f(is)g(collected.)365 +5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(27)p eop %%Page: 28 34 -28 33 bop 681 614 a FA(is)16 b(associated)f(with)i(a)e(given)h(port,)g(then)h -(he)f(can't)f(possibly)i(r)o(etain)e(an)g(\252integer)h(handle\272)681 -714 y(on)k(the)h(port)f(after)f(dr)o(opping)g(pointers)i(to)f(the)h(port)f -(itself,)g(so)g(the)g(garbage)f(collector)i(is)681 814 y(fr)o(ee)e(to)i -(close)g(the)g(\256le.)805 946 y(Ports)36 b(allocated)f(with)h -Fw(open-output-file)29 b FA(and)35 b Fw(open-input-file)29 -b FA(ar)o(e)34 b(unr)o(e-)681 1046 y(vealed)24 b(ports\320)p -Fz(i.e.)p FA(,)j Fz(r)o(evealed)e FA(is)h(initialised)g(to)g(0.)41 -b(No)26 b(one)g(knows)h(the)e(port's)h(\256le)g(de-)681 1146 -y(scriptor)-6 b(,)20 b(so)i(the)e(\256le)h(descriptor)g(can)f(be)h(closed)f -(when)i(the)f(port)g(is)g(collected.)805 1279 y(The)79 b(functions)g -Fw(fdes->output-por)o(t)p FA(,)86 b Fw(fdes->input-port)p FA(,)g -Fw(port->fdes)681 1378 y FA(ar)o(e)33 b(used)h(to)g(shift)h(back)e(and)h -(forth)g(between)g(\256le)h(descriptors)f(and)g(ports.)68 b(When)681 -1478 y Fw(port->fdes)31 b FA(r)o(eveals)j(a)h(port's)h(\256le)f(descriptor)-6 -b(,)38 b(it)e(incr)o(ements)f(the)h(port's)f Fz(r)o(evealed)681 -1577 y FA(\256eld.)121 b(When)52 b(the)h(user)e(is)i(thr)o(ough)f(with)h(the) -f(\256le)g(descriptor)-6 b(,)60 b(he)52 b(can)f(call)681 1677 -y Fw(\(release-port-ha)o(nd)o(le)37 b Fz(port)o Fw(\))p FA(,)47 -b(which)c(decr)o(ements)e(the)h(count.)92 b(The)42 b(function)681 -1777 y Fw(\(call/fdes)d(fdes/port)h Fz(pr)o(oc)o Fw(\))57 b -FA(automates)h(this)g(pr)o(otocol.)138 b Fw(call/fdes)54 b -FA(uses)681 1876 y Fw(dynamic-wind)28 b FA(to)34 b(enfor)o(ce)f(the)g(pr)o -(otocol.)66 b(If)33 b Fz(pr)o(oc)g FA(thr)o(ows)h(out)g(of)f(the)h -Fw(call/fdes)681 1976 y FA(application,)k(the)e(unwind)g(handler)f(r)o -(eleases)f(the)h(descriptor)g(handle;)43 b(if)35 b(the)g(user)681 -2076 y(subsequently)22 b(tries)f(to)g(thr)o(ow)g Fz(back)h -FA(into)f Fz(pr)o(oc)o FA('s)h(context,)f(the)g(wind)g(handler)g(raises)f(an) -681 2175 y(err)o(or)-6 b(.)43 b(When)27 b(the)g(user)f(maps)g(a)g(\256le)h -(descriptor)f(to)h(a)f(port)h(with)g Fw(fdes->outport)21 b -FA(or)681 2275 y Fw(fdes->inport)p FA(,)15 b(the)21 b(port)g(has)g(its)g(r)o -(evealed)e(\256eld)h(incr)o(emented.)805 2408 y(Not)k(all)e(\256le)h -(descriptors)g(ar)o(e)f(cr)o(eated)f(by)i(r)o(equests)f(to)i(make)e(ports.)35 -b(Some)22 b(ar)o(e)g(in-)681 2507 y(herited)27 b(on)i(pr)o(ocess)e -(invocation)i(via)e Fw(exec\(2\))p FA(,)g(and)g(ar)o(e)f(simply)j(part)e(of)h -(the)g(global)681 2607 y(envir)o(onment.)57 b(Subpr)o(ocesses)29 -b(may)h(depend)g(upon)h(them,)i(so)e(if)f(a)g(port)g(is)h(later)f(al-)681 -2707 y(located)e(for)h(these)g(\256le)g(descriptors,)i(is)e(should)h(be)e -(consider)o(ed)g(as)h(a)f(r)o(evealed)f(port.)681 2806 y(For)35 -b(example,)j(when)e(the)f(Scheme)g(shell's)h(pr)o(ocess)f(starts)f(up,)39 -b(it)c(opens)h(ports)f(on)681 2906 y(\256le)g(descriptors)g(0,)k(1,)f(and)d -(2)g(for)g(the)g(initial)h(values)f(of)h Fw(\(current-input-)o(por)o(t\))o -FA(,)681 3005 y Fw(\(current-output-)o(po)o(rt\))o FA(,)k(and)g -Fw(\(error-output-por)o(t\))o FA(.)82 b(These)41 b(ports)g(ar)o(e)f(ini-)681 -3105 y(tialised)15 b(with)h Fz(r)o(evealed)f FA(set)h(to)g(1,)g(so)g(that)f -(stdin,)i(stdout,)g(and)e(stderr)f(ar)o(e)h(not)h(closed)f(even)681 -3205 y(if)20 b(the)h(user)g(dr)o(ops)f(the)h(port.)805 3337 -y(Unr)o(evealed)14 b(\256le)h(ports)h(have)f(the)g(nice)h(pr)o(operty)e(that) -i(they)g(can)f(be)g(closed)g(when)h(all)681 3437 y(pointers)j(to)g(the)f -(port)h(ar)o(e)e(dr)o(opped.)25 b(This)19 b(can)g(happen)f(during)h(gc,)f(or) -h(at)f(an)h Fw(exec\(\))p FA(\320)681 3537 y(since)27 b(all)f(memory)i(is)f -(dr)o(opped)e(at)h(an)h Fw(exec\(\))p FA(.)43 b(No)27 b(one)g(knows)h(the)f -(\256le)f(descriptor)681 3636 y(associated)20 b(with)h(the)g(port,)g(so)g -(the)g(exec'd)f(pr)o(ocess)g(certainly)h(can't)f(r)o(efer)f(to)j(it.)805 -3769 y(This)17 b(facility)f(pr)o(eserves)e(the)i(transpar)o(ent)f -(close-on-collect)i(pr)o(operty)e(for)h(\256le)g(ports)681 -3869 y(that)h(ar)o(e)f(used)h(in)h(straightforwar)o(d)e(ways,)i(yet)g(allows) -g(access)f(to)h(the)f(underlying)h(Unix)681 3968 y(substrate)i(without)j -(interfer)o(ence)c(fr)o(om)i(the)g(garbage)f(collector)-6 b(.)29 -b(This)22 b(is)f(critical,)g(since)681 4068 y(shell)29 b(pr)o(ogramming)g -(absolutely)g(r)o(equir)o(es)f(access)g(to)h(the)g(Unix)f(\256le)h -(descriptors,)h(as)681 4168 y(their)21 b(numerical)f(values)h(ar)o(e)e(a)h -(critical)h(part)f(of)g(the)h(pr)o(ocess)g(interface.)805 4301 -y(A)d(port's)g(underlying)g(\256le)g(descriptor)f(can)g(be)g(shifted)h(ar)o -(ound)f(with)h Fw(dup\(2\))d FA(when)681 4400 y(convenient.)54 -b(That)29 b(is,)i(the)f(actual)e(\256le)h(descriptor)g(on)h(top)g(of)f(which) -h(a)f(port)g(is)h(con-)681 4500 y(str)o(ucted)e(can)f(be)h(shifted)g(ar)o +28 33 bop 681 614 a FB(Essentially)-9 b(,)31 b(the)f +FA(r)o(evealed)e FB(\002eld)i(r)o(e\003ects)e(whether)i(or)f(not)h(the) +f(port's)h(\002le)f(descriptor)681 714 y(has)21 b(escaped)e(to)i(the)g +(Scheme)g(user)-6 b(.)25 b(If)c(the)g(Scheme)f(user)h(doesn't)g(know)h +(what)f(\002le)g(de-)681 814 y(scriptor)i(is)h(associated)f(with)i(a)e +(given)h(port,)g(then)g(he)f(can't)h(possibly)g(r)o(etain)f(an)h +(\223inte-)681 913 y(ger)17 b(handle\224)f(on)i(the)f(port)g(after)f +(dr)o(opping)h(pointers)g(to)h(the)f(port)g(itself,)g(so)h(the)f +(garbage)681 1013 y(collector)k(is)g(fr)o(ee)e(to)i(close)g(the)g +(\002le.)805 1162 y(Ports)36 b(allocated)f(with)h Fx(open-output-file) +29 b FB(and)35 b Fx(open-input-file)29 b FB(ar)o(e)34 +b(unr)o(e-)681 1262 y(vealed)24 b(ports\227)p FA(i.e.)p +FB(,)j FA(r)o(evealed)e FB(is)h(initialised)g(to)h(0.)39 +b(No)26 b(one)g(knows)h(the)f(port's)g(\002le)g(de-)681 +1362 y(scriptor)-6 b(,)20 b(so)i(the)e(\002le)h(descriptor)g(can)f(be)h +(closed)f(when)i(the)f(port)g(is)g(collected.)805 1511 +y(The)44 b(functions)g Fx(fdes->output-port)o FB(,)g +Fx(fdes->input-por)o(t)p FB(,)f Fx(port->fdes)c FB(ar)o(e)681 +1611 y(used)45 b(to)h(shift)g(back)f(and)h(forth)f(between)h(\002le)g +(descriptors)f(and)g(ports.)101 b(When)681 1710 y Fx(port->fdes)31 +b FB(r)o(eveals)j(a)h(port's)h(\002le)f(descriptor)-6 +b(,)38 b(it)e(incr)o(ements)f(the)h(port's)f FA(r)o(evealed)681 +1810 y FB(\002eld.)119 b(When)53 b(the)f(user)g(is)h(thr)o(ough)f(with) +h(the)g(\002le)f(descriptor)-6 b(,)59 b(he)52 b(can)g(call)681 +1910 y Fx(\(release-port-ha)o(nd)o(le)37 b FA(port)o +Fx(\))p FB(,)65 b(which)58 b(decr)o(ements)d(the)i(count.)133 +b(The)57 b(func-)681 2009 y(tion)44 b Fx(\(call/fdes)39 +b(fd/port)i FA(pr)o(oc)o Fx(\))i FB(automates)g(this)h(pr)o(otocol.)94 +b Fx(call/fdes)40 b FB(uses)681 2109 y Fx(dynamic-wind)18 +b FB(to)23 b(enfor)o(ce)e(the)i(pr)o(otocol.)32 b(If)22 +b FA(pr)o(oc)g FB(thr)o(ows)h(out)g(of)g(the)g Fx(call/fdes)c +FB(ap-)681 2208 y(plication,)28 b(the)f(unwind)g(handler)f(r)o(eleases) +g(the)g(descriptor)h(handle;)i(if)d(the)h(user)f(sub-)681 +2308 y(sequently)32 b(tries)g(to)g(thr)o(ow)g FA(back)g +FB(into)h FA(pr)o(oc)n FB('s)f(context,)j(the)d(wind)g(handler)f +(raises)g(an)681 2408 y(err)o(or)-6 b(.)42 b(When)27 +b(the)f(user)h(maps)f(a)h(\002le)f(descriptor)g(to)h(a)g(port)f(with)i +Fx(fdes->outport)21 b FB(or)681 2507 y Fx(fdes->inport)p +FB(,)15 b(the)21 b(port)g(has)g(its)g(r)o(evealed)e(\002eld)h(incr)o +(emented.)805 2657 y(Not)k(all)f(\002le)g(descriptors)g(ar)o(e)e(cr)o +(eated)g(by)i(r)o(equests)g(to)h(make)f(ports.)32 b(Some)23 +b(ar)o(e)f(in-)681 2756 y(herited)27 b(on)i(pr)o(ocess)e(invocation)i +(via)e Fx(exec\(2\))p FB(,)g(and)g(ar)o(e)f(simply)j(part)e(of)h(the)g +(global)681 2856 y(envir)o(onment.)55 b(Subpr)o(ocesses)30 +b(may)g(depend)g(upon)h(them,)i(so)e(if)f(a)g(port)h(is)g(later)f(al-) +681 2956 y(located)e(for)h(these)g(\002le)g(descriptors,)i(is)e(should) +h(be)e(consider)o(ed)g(as)h(a)f(r)o(evealed)f(port.)681 +3055 y(For)35 b(example,)j(when)e(the)f(Scheme)g(shell's)h(pr)o(ocess)f +(starts)f(up,)39 b(it)c(opens)h(ports)f(on)681 3155 y(\002le)g +(descriptors)g(0,)k(1,)f(and)d(2)g(for)g(the)g(initial)h(values)f(of)h +Fx(\(current-input-)o(por)o(t\))o FB(,)681 3254 y Fx(\(current-output-) +o(po)o(rt\))o FB(,)k(and)h Fx(\(error-output-po)o(rt)o(\))p +FB(.)81 b(These)41 b(ports)g(ar)o(e)f(ini-)681 3354 y(tialised)28 +b(with)i FA(r)o(evealed)f FB(set)f(to)i(1,)g(so)f(that)g(stdin,)i +(stdout,)g(and)e(stderr)f(ar)o(e)f(not)j(closed)681 3454 +y(even)20 b(if)h(the)g(user)f(dr)o(ops)h(the)f(port.)805 +3603 y(Unr)o(evealed)i(\002le)j(ports)f(have)g(the)g(nice)g(pr)o +(operty)g(that)g(they)g(can)g(be)g(closed)g(when)681 +3703 y(all)34 b(pointers)i(to)f(the)g(port)f(ar)o(e)g(dr)o(opped.)66 +b(This)35 b(can)g(happen)f(during)h(gc,)j(or)d(at)f(an)681 +3802 y Fx(exec\(\))p FB(\227since)29 b(all)h(memory)i(is)f(dr)o(opped)f +(at)g(an)h Fx(exec\(\))p FB(.)53 b(No)31 b(one)h(knows)g(the)f(\002le) +681 3902 y(descriptor)25 b(associated)g(with)h(the)g(port,)g(so)g(the)g +(exec'd)e(pr)o(ocess)h(certainly)g(can't)h(r)o(efer)681 +4002 y(to)21 b(it.)805 4151 y(This)c(facility)f(pr)o(eserves)e(the)i +(transpar)o(ent)f(close-on-collect)i(pr)o(operty)e(for)h(\002le)g +(ports)681 4251 y(that)h(ar)o(e)f(used)h(in)h(straightforwar)o(d)e +(ways,)i(yet)g(allows)g(access)f(to)h(the)f(underlying)h(Unix)681 +4350 y(substrate)j(without)h(interfer)o(ence)e(fr)o(om)h(the)g(garbage) +f(collector)-6 b(.)28 b(This)21 b(is)h(critical,)f(since)681 +4450 y(shell)29 b(pr)o(ogramming)g(absolutely)g(r)o(equir)o(es)f +(access)g(to)h(the)g(Unix)f(\002le)h(descriptors,)h(as)681 +4550 y(their)21 b(numerical)f(values)h(ar)o(e)e(a)h(critical)h(part)f +(of)g(the)h(pr)o(ocess)g(interface.)805 4699 y(A)d(port's)g(underlying) +g(\002le)g(descriptor)f(can)g(be)g(shifted)h(ar)o(ound)f(with)h +Fx(dup\(2\))d FB(when)681 4799 y(convenient.)52 b(That)29 +b(is,)j(the)d(actual)g(\002le)g(descriptor)g(on)h(top)g(of)f(which)i(a) +e(port)g(is)h(con-)681 4898 y(str)o(ucted)e(can)f(be)h(shifted)g(ar)o (ound)f(underneath)h(the)g(port)g(by)h(the)f(scsh)g(kernel)g(when)681 -4599 y(necessary)-9 b(.)36 b(This)25 b(is)g(important,)g(because)e(when)h -(the)h(user)f(is)g(setting)h(up)f(\256le)g(descrip-)681 4699 -y(tors)e(prior)h(to)f(a)g Fw(exec\(2\))p FA(,)d(he)k(may)f(explicitly)g(use)h -(a)e(\256le)i(descriptor)e(that)i(has)f(alr)o(eady)681 4799 -y(been)j(allocated)f(to)i(some)g(port.)42 b(In)25 b(this)h(case,)g(the)g -(scsh)g(kernel)f(just)h(shifts)g(the)g(port's)681 4898 y(\256le)17 -b(descriptor)f(to)h(some)g(new)g(location)h(with)f Fw(dup)p -FA(,)f(fr)o(eeing)g(up)h(its)g(old)g(descriptor)-6 b(.)25 b(This)681 -5147 y(28)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +5147 y(28)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 29 35 -29 34 bop 365 614 a FA(pr)o(events)21 b(err)o(ors)g(fr)o(om)g(happening)h(in) -h(the)e(following)j(scenario.)30 b(Suppose)21 b(we)h(have)f(a)365 -714 y(\256le)i(open)g(on)h(port)f Fw(f)p FA(.)33 b(Now)23 b(we)g(want)g(to)g -(r)o(un)g(a)g(pr)o(ogram)f(that)g(r)o(eads)g(input)h(on)g(\256le)g(0,)365 -814 y(writes)f(output)f(to)h(\256le)f(1,)g(err)o(ors)f(to)i(\256le)f(2,)g -(and)g(logs)h(execution)f(information)h(on)g(\256le)f(3.)365 -913 y(W)-8 b(e)21 b(want)g(to)g(r)o(un)h(this)f(pr)o(ogram)f(with)i(input)f -(fr)o(om)f Fw(f)p FA(.)27 b(So)21 b(we)g(write:)573 1110 y -Fw(\(run)42 b(\(/usr/shivers/bi)o(n/)o(pro)o(g\))791 1210 y(\(>)h(1)g -(output.txt\))791 1309 y(\(>)g(2)g(error.log\))791 1409 y(\(>)g(3)g -(trace.log\))791 1509 y(\(=)g(0)g(,f\)\))365 1706 y FA(Now)-8 -b(,)25 b(suppose)e(by)g(ill)h(chance)f(that,)g(unbeknownst)i(to)e(us,)h(when) -g(the)f(operating)g(sys-)365 1805 y(tem)38 b(opened)f Fw(f)p -FA('s)g(\256le,)k(it)d(allocated)e(descriptor)h(3)g(for)g(it.)77 -b(If)37 b(we)g(blindly)h(r)o(edir)o(ect)365 1905 y Fw(trace.log)22 -b FA(into)k(\256le)g(descriptor)f(3,)h(we'll)g(clobber)f Fw(f)p -FA(!)42 b(However)-6 b(,)26 b(the)g(port-shuf)o(\257ing)365 -2005 y(machinery)e(saves)f(us:)34 b(when)24 b(the)g Fw(run)f -FA(form)g(tries)h(to)g(dup)f Fw(trace.log)p FA('s)e(\256le)j(descrip-)365 -2104 y(tor)g(to)h(3,)f Fw(dup)e FA(will)j(notice)g(that)e(\256le)h -(descriptor)g(3)f(is)i(alr)o(eady)d(associated)h(with)i(an)f(un-)365 -2204 y(r)o(evealed)c(port)h(\()p Fz(i.e.)p FA(,)g Fw(f)p FA(\).)29 -b(So,)22 b(it)f(will)i(\256rst)e(move)h Fw(f)f FA(to)h(some)g(other)g(\256le) -g(descriptor)-6 b(.)29 b(This)365 2303 y(keeps)18 b Fw(f)f -FA(alive)h(and)f(well)h(so)h(that)f(it)g(can)f(subsequently)i(be)f(dup'd)f -(into)i(descriptor)e(0)h(for)365 2403 y Fw(prog)p FA('s)i(stdin.)490 -2531 y(The)i(port-shifting)h(machinery)g(makes)f(the)h(following)h -(guarantee:)29 b(a)22 b(port)h(is)g(only)365 2631 y(moved)h(when)g(the)g -(underlying)g(\256le)f(descriptor)g(is)h(closed,)g(either)f(by)h(a)f -Fw(close\(\))d FA(or)k(a)365 2730 y Fw(dup2\(\))19 b FA(operation.)27 -b(Otherwise)21 b(a)g(port/\256le-descriptor)f(association)i(is)f(stable.)490 -2859 y(Under)38 b(normal)h(cir)o(cumstances,)j(all)d(this)g(machinery)g(just) -g(works)h(behind)e(the)365 2958 y(scenes)14 b(to)h(keep)e(things)i -(straightened)f(out.)26 b(The)14 b(only)g(time)h(the)f(user)f(has)h(to)h -(think)g(about)365 3058 y(it)27 b(is)f(when)h(he)g(starts)f(accessing)g -(\256le)g(descriptors)g(fr)o(om)g(ports,)i(which)f(he)f(should)h(al-)365 -3157 y(most)f(never)d(have)h(to)h(do.)38 b(If)24 b(a)g(user)g(starts)g -(asking)h(what)f(\256le)h(descriptors)f(have)g(been)365 3257 -y(allocated)h(to)h(what)g(ports,)h(he)e(has)h(to)g(take)f(r)o(esponsibility)h -(for)g(managing)g(this)g(infor)o(-)365 3357 y(mation.)365 3617 -y Fy(3.2.5)81 b(Port-mapping)19 b(machinery)365 3805 y FA(The)30 -b(pr)o(ocedur)o(es)e(pr)o(ovided)g(in)j(this)f(section)h(ar)o(e)d(almost)i -(never)f(needed.)54 b(Y)-8 b(ou)31 b(may)365 3904 y(safely)20 -b(skim)i(or)f(completely)g(skip)g(this)h(section)f(on)h(a)e(\256rst)h(r)o -(eading.)490 4032 y(Her)o(e)g(ar)o(e)f(the)i(r)o(outines)g(for)g -(manipulating)g(ports)g(in)g(scsh.)32 b(The)21 b(important)i(points)365 -4132 y(to)e(r)o(emember)f(ar)o(e:)490 4329 y Fs(\017)41 b FA(A)20 -b(\256le)h(port)g(is)g(associated)f(with)i(an)e(open)h(\256le,)g(not)g(a)g -(particular)e(\256le)i(descriptor)-6 b(.)490 4500 y Fs(\017)41 -b FA(The)16 b(association)h(between)f(a)f(\256le)i(port)f(and)g(a)f -(particular)g(\256le)i(descriptor)e(is)i(never)573 4599 y(changed)j -Fz(except)f FA(when)i(the)f(\256le)h(descriptor)f(is)g(explicitly)h(closed.) -27 b(\252Closing\272)20 b(in-)573 4699 y(cludes)i(being)i(used)e(as)h(the)g -(tar)o(get)e(of)i(a)g Fw(dup2)p FA(,)e(so)i(the)g(set)g(of)g(pr)o(ocedur)o -(es)e(below)573 4799 y(that)h(close)g(their)g(tar)o(gets)f(ar)o(e)f -Fw(close)p FA(,)g(two-ar)o(gument)i Fw(dup)p FA(,)f(and)g Fw(move->fdes)p -FA(.)27 b(If)573 4898 y(the)i(tar)o(get)f(\256le)h(descriptor)f(of)h(one)h -(of)f(these)g(r)o(outines)g(has)g(an)g(allocated)f(port,)365 -5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p -1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 -V 1636 5176 323 4 v 1216 w FA(29)p eop +29 34 bop 365 614 a FB(necessary)-9 b(.)35 b(This)25 +b(is)g(important,)g(because)e(when)i(the)g(user)f(is)g(setting)h(up)f +(\002le)h(descrip-)365 714 y(tors)e(prior)f(to)h(a)e +Fx(exec\(2\))p FB(,)f(he)i(may)g(explicitly)h(use)f(a)g(\002le)g +(descriptor)g(that)g(has)g(alr)o(eady)365 814 y(been)k(allocated)e(to)i +(some)g(port.)40 b(In)26 b(this)g(case,)g(the)g(scsh)g(kernel)f(just)h +(shifts)h(the)e(port's)365 913 y(\002le)17 b(descriptor)g(to)g(some)h +(new)f(location)g(with)h Fx(dup)p FB(,)e(fr)o(eeing)g(up)h(its)g(old)g +(descriptor)-6 b(.)24 b(This)365 1013 y(pr)o(events)d(err)o(ors)g(fr)o +(om)h(happening)g(in)g(the)g(following)i(scenario.)k(Suppose)22 +b(we)g(have)f(a)365 1112 y(\002le)i(open)h(on)f(port)g +Fx(f)p FB(.)31 b(Now)24 b(we)f(want)g(to)g(r)o(un)h(a)e(pr)o(ogram)g +(that)h(r)o(eads)e(input)j(on)f(\002le)g(0,)365 1212 +y(writes)f(output)f(to)h(\002le)f(1,)g(err)o(ors)f(to)i(\002le)f(2,)g +(and)g(logs)h(execution)f(information)h(on)g(\002le)f(3.)365 +1312 y(W)-8 b(e)21 b(want)g(to)g(r)o(un)h(this)f(pr)o(ogram)f(with)i +(input)f(fr)o(om)f Fx(f)p FB(.)25 b(So)c(we)g(write:)573 +1533 y Fx(\(run)42 b(\(/usr/shivers/bi)o(n/)o(pro)o(g\))791 +1632 y(\(>)h(1)g(output.txt\))791 1732 y(\(>)g(2)g(error.log\))791 +1832 y(\(>)g(3)g(trace.log\))791 1931 y(\(=)g(0)g(,f\)\))365 +2152 y FB(Now)-8 b(,)42 b(suppose)c(by)g(ill)f(chance)g(that,)42 +b(unbeknownst)d(to)f(us,)j(when)d(the)g(operating)365 +2252 y(system)31 b(opened)e Fx(f)p FB('s)h(\002le,)i(it)e(allocated)f +(descriptor)g(3)g(for)h(it.)52 b(If)30 b(we)f(blindly)i(r)o(edir)o(ect) +365 2351 y Fx(trace.log)22 b FB(into)27 b(\002le)f(descriptor)f(3,)h +(we'll)g(clobber)g Fx(f)p FB(!)40 b(However)-6 b(,)26 +b(the)g(port-shuf)o(\003ing)365 2451 y(machinery)18 b(saves)f(us:)24 +b(when)18 b(the)g Fx(run)e FB(form)i(tries)f(to)h(dup)f +Fx(trace.log)p FB('s)d(\002le)k(descriptor)365 2551 y(to)29 +b(3,)g Fx(dup)e FB(will)h(notice)h(that)f(\002le)g(descriptor)f(3)h(is) +g(alr)o(eady)f(associated)g(with)i(an)e(unr)o(e-)365 +2650 y(vealed)d(port)i(\()p FA(i.e.)o FB(,)h Fx(f)p FB(\).)38 +b(So,)26 b(it)g(will)g(\002rst)g(move)f Fx(f)g FB(to)h(some)g(other)g +(\002le)f(descriptor)-6 b(.)39 b(This)365 2750 y(keeps)27 +b Fx(f)f FB(alive)g(and)h(well)g(so)g(that)f(it)h(can)g(subsequently)h +(be)e(dup'd)g(into)i(descriptor)e(0)365 2849 y(for)21 +b Fx(prog)p FB('s)e(stdin.)490 2992 y(The)j(port-shifting)i(machinery)e +(makes)h(the)g(following)h(guarantee:)k(a)22 b(port)h(is)g(only)365 +3092 y(moved)h(when)g(the)g(underlying)g(\002le)f(descriptor)g(is)h +(closed,)g(either)f(by)h(a)f Fx(close\(\))d FB(or)k(a)365 +3191 y Fx(dup2\(\))19 b FB(operation.)25 b(Otherwise)d(a)e +(port/\002le-descriptor)g(association)i(is)f(stable.)490 +3334 y(Under)38 b(normal)h(cir)o(cumstances,)j(all)d(this)g(machinery)g +(just)g(works)h(behind)e(the)365 3433 y(scenes)31 b(to)f(keep)g(things) +h(straightened)f(out.)55 b(The)30 b(only)h(time)f(the)h(user)f(has)g +(to)h(think)365 3533 y(about)17 b(it)h(is)g(when)g(he)f(starts)g +(accessing)h(\002le)f(descriptors)g(fr)o(om)g(ports,)h(which)g(he)g +(should)365 3633 y(almost)j(never)f(have)g(to)g(do.)26 +b(If)20 b(a)f(user)h(starts)g(asking)h(what)g(\002le)f(descriptors)g +(have)g(been)365 3732 y(allocated)25 b(to)h(what)g(ports,)h(he)e(has)h +(to)g(take)f(r)o(esponsibility)h(for)g(managing)g(this)g(infor)o(-)365 +3832 y(mation.)365 4129 y Fz(3.2.5)81 b(Port-mapping)19 +b(machinery)365 4336 y FB(The)30 b(pr)o(ocedur)o(es)e(pr)o(ovided)h(in) +h(this)h(section)f(ar)o(e)f(almost)h(never)g(needed.)52 +b(Y)-8 b(ou)31 b(may)365 4435 y(safely)20 b(skim)i(or)f(completely)g +(skip)g(this)h(section)f(on)h(a)e(\002rst)h(r)o(eading.)490 +4578 y(Her)o(e)g(ar)o(e)f(the)i(r)o(outines)h(for)e(manipulating)i +(ports)f(in)h(scsh.)29 b(The)22 b(important)h(points)365 +4677 y(to)e(r)o(emember)f(ar)o(e:)490 4898 y Ft(\017)41 +b FB(A)20 b(\002le)h(port)g(is)g(associated)f(with)i(an)e(open)h +(\002le,)g(not)g(a)g(particular)e(\002le)i(descriptor)-6 +b(.)365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(29)p +eop %%Page: 30 36 -30 35 bop 888 614 a FA(the)30 b(port)f(will)h(be)f(shifted)h(to)f(another)h -(fr)o(eshly-allocated)d(\256le)j(descriptor)-6 b(,)30 b(and)888 -714 y(marked)18 b(as)g(unr)o(evealed,)e(thus)j(pr)o(eserving)f(the)g(port)g -(but)g(fr)o(eeing)g(its)g(old)h(\256le)f(de-)888 814 y(scriptor)-6 -b(.)681 1045 y(These)19 b(r)o(ules)i(ar)o(e)d(what)i(is)g(necessary)f(to)h -(\252make)f(things)i(work)f(out\272)g(with)h(no)f(surprises)681 -1145 y(in)h(the)g(general)f(case.)681 1311 y Fw(\(fdes->inport)38 -b Fz(fd)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(port)1324 b FA(pr)o(ocedur)o(e) -681 1410 y Fw(\(fdes->outport)38 b Fz(fd)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(port)1280 b FA(pr)o(ocedur)o(e)681 1510 y Fw(\(port->fdes)39 -b Fz(port)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(\256xnum)1233 -b FA(pr)o(ocedur)o(e)888 1668 y(These)21 b(incr)o(ement)g(the)g(port's)g(r)o -(evealed)d(count.)681 1907 y Fw(\(port-revealed)38 b Fz(port)p -Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(integer)21 b(or)g Fw(#f)911 -b FA(pr)o(ocedur)o(e)888 2065 y(Return)22 b(the)e(port's)i(r)o(evealed)c -(count)k(if)e(positive,)h(otherwise)h Fw(#f)p FA(.)681 2305 -y Fw(\(release-port-ha)o(nd)o(le)37 b Fz(port)p Fw(\))86 b -Fs(\000)-14 b(!)87 b Fz(unde\256ned)754 b FA(pr)o(ocedur)o(e)888 -2462 y(Decr)o(ement)21 b(the)f(port's)i(r)o(evealed)c(count.)681 -2702 y Fw(\(call/fdes)39 b Fz(fd/port)19 b(consumer)p Fw(\))88 -b Fs(\000)-15 b(!)88 b Fz(value\(s\))20 b(of)h(consumer)392 -b FA(pr)o(ocedur)o(e)888 2860 y(Calls)20 b Fz(consumer)g FA(on)g(a)g(\256le)f -(descriptor;)h(takes)f(car)o(e)f(of)i(r)o(evealed)d(bookkeeping.)28 -b(If)888 2959 y Fz(fd/port)16 b FA(is)i(a)f(\256le)g(descriptor)-6 -b(,)18 b(this)g(is)g(just)g Fw(\()p Fz(consumer)43 b(fd/port)o -Fw(\))p FA(.)26 b(If)17 b Fz(fd/port)f FA(is)h(a)g(port,)888 -3059 y(calls)e Fz(consumer)f FA(on)h(its)g(underlying)g(\256le)g(descriptor) --6 b(.)24 b(While)15 b Fz(consumer)g FA(is)g(r)o(unning,)888 -3159 y(the)21 b(port's)g(r)o(evealed)e(count)i(is)h(incr)o(emented.)888 -3308 y(When)30 b Fw(call/fdes)c FA(is)j(called)g(with)h(port)f(ar)o(gument,)i -(you)f(ar)o(e)d(not)j(allowed)g(to)888 3407 y(thr)o(ow)20 b(into)g -Fz(consumer)g FA(with)h(a)e(stor)o(ed)g(continuation,)i(as)e(that)g(would)h -(violate)g(the)888 3507 y(r)o(evealed-count)f(bookkeeping.)681 -3747 y Fw(\(move->fdes)39 b Fz(fd/port)19 b(tar)o(get-fd)p -Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(port)20 b(or)h(fdes)699 -b FA(pr)o(ocedur)o(e)888 3904 y(Maps)20 b(fd)p Fs(!)p FA(fd)g(and)g(port)p -Fs(!)p FA(port.)888 4054 y(If)27 b Fz(fd/port)e FA(is)i(a)f -(\256le-descriptor)g(not)h(equal)g(to)g Fz(tar)o(get-fd)n FA(,)h(dup)e(it)h -(to)g Fz(tar)o(get-fd)d FA(and)888 4153 y(close)d(it.)28 b(Returns)21 -b Fz(tar)o(get-fd)n FA(.)888 4302 y(If)k Fz(fd/port)e FA(is)j(a)e(port,)i(it) -f(is)g(shifted)g(to)g Fz(tar)o(get-fd)n FA(,)h(by)f(duping)g(its)h -(underlying)f(\256le-)888 4402 y(descriptor)18 b(if)h(necessary)-9 -b(.)26 b Fz(Fd/port)n FA('s)19 b(original)g(\256le)f(descriptor)g(is)h -(closed)g(\(if)e(it)i(was)888 4502 y(dif)o(fer)o(ent)j(fr)o(om)h -Fz(tar)o(get-fd)n FA(\).)37 b(Returns)24 b(the)g(port.)37 b(This)24 -b(operation)g(r)o(esets)f Fz(fd/port)o FA('s)888 4601 y(r)o(evealed)c(count)i -(to)h(1.)888 4750 y(In)e(all)f(cases)g(when)h Fz(fd/port)e -FA(is)i(actually)f(shifted,)g(if)g(ther)o(e)g(is)g(a)g(port)h(alr)o(eady)d -(using)888 4850 y Fz(tar)o(get-fd)n FA(,)k(it)g(is)g(\256rst)g(r)o(elocated)e -(to)i(some)h(other)f(\256le)g(descriptor)-6 b(.)681 5147 y(30)p -1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 -5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +30 35 bop 805 614 a Ft(\017)41 b FB(The)16 b(association)h(between)f(a) +g(\002le)g(port)h(and)e(a)h(particular)f(\002le)h(descriptor)g(is)g +(never)888 714 y(changed)31 b FA(except)g FB(when)h(the)g(\002le)f +(descriptor)h(is)f(explicitly)h(closed.)58 b(\223Closing\224)888 +814 y(includes)18 b(being)g(used)g(as)f(the)h(tar)o(get)e(of)i(a)f +Fx(dup2)p FB(,)f(so)j(the)e(set)h(of)g(pr)o(ocedur)o(es)e(below)888 +913 y(that)22 b(close)h(their)f(tar)o(gets)f(ar)o(e)g +Fx(close)p FB(,)f(two-ar)o(gument)i Fx(dup)p FB(,)f(and)g +Fx(move->fdes)p FB(.)k(If)888 1013 y(the)k(tar)o(get)f(\002le)h +(descriptor)g(of)g(one)g(of)g(these)g(r)o(outines)g(has)g(an)g +(allocated)f(port,)888 1112 y(the)i(port)f(will)h(be)f(shifted)h(to)f +(another)h(fr)o(eshly-allocated)d(\002le)j(descriptor)-6 +b(,)30 b(and)888 1212 y(marked)g(as)g(unr)o(evealed,)h(thus)g(pr)o +(eserving)f(the)g(port)h(but)f(fr)o(eeing)f(its)i(old)g(\002le)888 +1312 y(descriptor)-6 b(.)681 1492 y(These)19 b(r)o(ules)i(ar)o(e)d +(what)i(is)g(necessary)f(to)h(\223make)f(things)i(work)f(out\224)g +(with)h(no)f(surprises)681 1591 y(in)h(the)g(general)f(case.)681 +1735 y Fx(\(fdes->inport)38 b FA(fd)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(port)1324 b FB(pr)o(ocedur)o(e)681 1835 y +Fx(\(fdes->outport)38 b FA(fd)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(port)1280 b FB(pr)o(ocedur)o(e)681 1935 y +Fx(\(port->fdes)39 b FA(port)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(\002xnum)1233 b FB(pr)o(ocedur)o(e)888 2070 +y(These)21 b(incr)o(ement)g(the)g(port's)g(r)o(evealed)d(count.)681 +2253 y Fx(\(port-revealed)38 b FA(port)p Fx(\))86 b Ft(\000)-15 +b(!)88 b FA(integer)21 b(or)g Fx(#f)911 b FB(pr)o(ocedur)o(e)888 +2389 y(Return)22 b(the)e(port's)i(r)o(evealed)c(count)k(if)e(positive,) +h(otherwise)h Fx(#f)p FB(.)681 2572 y Fx(\(release-port-ha)o(nd)o(le)37 +b FA(port)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(unde\002ned)754 +b FB(pr)o(ocedur)o(e)888 2707 y(Decr)o(ement)21 b(the)f(port's)i(r)o +(evealed)c(count.)681 2890 y Fx(\(call/fdes)39 b FA(fd/port)19 +b(consumer)p Fx(\))88 b Ft(\000)-15 b(!)88 b FA(value\(s\))20 +b(of)h(consumer)392 b FB(pr)o(ocedur)o(e)888 3026 y(Calls)28 +b FA(consumer)g FB(on)g(a)f(\002le)h(descriptor;)j(takes)c(car)o(e)f +(of)i(r)o(evealed)d(bookkeeping.)888 3125 y(If)h FA(fd/port)f +FB(is)h(a)g(\002le)g(descriptor)-6 b(,)27 b(this)f(is)h(just)g +Fx(\()p FA(consumer)43 b(fd/port)o Fx(\))p FB(.)e(If)26 +b FA(fd/port)e FB(is)j(a)888 3225 y(port,)j(calls)d FA(consumer)h +FB(on)h(its)f(underlying)g(\002le)g(descriptor)-6 b(.)45 +b(While)29 b FA(consumer)f FB(is)888 3325 y(r)o(unning,)22 +b(the)f(port's)g(r)o(evealed)e(count)i(is)g(incr)o(emented.)888 +3455 y(When)30 b Fx(call/fdes)c FB(is)j(called)g(with)h(port)f(ar)o +(gument,)i(you)f(ar)o(e)d(not)j(allowed)g(to)888 3554 +y(thr)o(ow)20 b(into)g FA(consumer)g FB(with)h(a)e(stor)o(ed)g +(continuation,)i(as)e(that)g(would)h(violate)g(the)888 +3654 y(r)o(evealed-count)f(bookkeeping.)681 3837 y Fx(\(move->fdes)39 +b FA(fd/port)19 b(tar)o(get-fd)p Fx(\))85 b Ft(\000)-14 +b(!)87 b FA(port)20 b(or)h(fdes)699 b FB(pr)o(ocedur)o(e)888 +3973 y(Maps)20 b(fd)p Ft(!)p FB(fd)g(and)g(port)p Ft(!)p +FB(port.)888 4103 y(If)27 b FA(fd/port)e FB(is)i(a)f(\002le-descriptor) +g(not)h(equal)g(to)g FA(tar)o(get-fd)n FB(,)h(dup)e(it)h(to)g +FA(tar)o(get-fd)d FB(and)888 4202 y(close)d(it.)26 b(Returns)c +FA(tar)o(get-fd)n FB(.)888 4332 y(If)j FA(fd/port)e FB(is)j(a)e(port,)i +(it)f(is)g(shifted)g(to)g FA(tar)o(get-fd)n FB(,)h(by)f(duping)g(its)h +(underlying)f(\002le-)888 4432 y(descriptor)19 b(if)f(necessary)-9 +b(.)24 b FA(Fd/port)o FB('s)18 b(original)i(\002le)e(descriptor)h(is)g +(closed)f(\(if)g(it)h(was)888 4532 y(dif)o(fer)o(ent)j(fr)o(om)i +FA(tar)o(get-fd)n FB(\).)35 b(Returns)25 b(the)f(port.)36 +b(This)25 b(operation)f(r)o(esets)f FA(fd/port)o FB('s)888 +4631 y(r)o(evealed)c(count)i(to)h(1.)888 4761 y(In)e(all)f(cases)g +(when)h FA(fd/port)e FB(is)i(actually)f(shifted,)g(if)g(ther)o(e)g(is)g +(a)g(port)h(alr)o(eady)d(using)888 4861 y FA(tar)o(get-fd)n +FB(,)k(it)g(is)g(\002rst)g(r)o(elocated)e(to)i(some)h(other)f(\002le)g +(descriptor)-6 b(.)681 5147 y(30)p 1952 5071 323 4 v +1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 +5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 31 37 -31 36 bop 365 614 a Fy(3.2.6)81 b(Unix)20 b(I/O)365 828 y Fw(\(dup)42 -b Fz(port/fd)19 b([newfd])p Fw(\))86 b Fs(\000)-14 b(!)87 b -Fz(port/fd)1185 b FA(pr)o(ocedur)o(e)365 927 y Fw(\(dup->inport)39 -b Fz(port/fd)19 b([newfd])p Fw(\))86 b Fs(\000)-14 b(!)87 b -Fz(port)926 b FA(pr)o(ocedur)o(e)365 1027 y Fw(\(dup->outport)39 -b Fz(port/fd)19 b([newfd])p Fw(\))86 b Fs(\000)-14 b(!)87 b -Fz(port)882 b FA(pr)o(ocedur)o(e)365 1127 y Fw(\(dup->fdes)40 -b Fz(port/fd)19 b([newfd])p Fw(\))86 b Fs(\000)-14 b(!)87 b -Fz(fd)1087 b FA(pr)o(ocedur)o(e)573 1253 y(These)36 b(pr)o(ocedur)o(es)f(pr)o -(ovide)g(the)i(functionality)g(of)f(C's)h Fw(dup\(\))d FA(and)i -Fw(dup2\(\))p FA(.)573 1353 y(The)i(dif)o(fer)o(ent)e(r)o(outines)i(r)o -(eturn)f(dif)o(fer)o(ent)f(types)i(of)g(values:)61 b Fw(dup->inport)p -FA(,)573 1452 y Fw(dup->outport)p FA(,)22 b(and)k Fw(dup->fdes)c -FA(r)o(eturn)k(input)g(ports,)i(output)e(ports,)i(and)d(in-)573 -1552 y(teger)d(\256le)h(descriptors,)f(r)o(espectively)-9 b(.)32 -b Fw(dup)p FA('s)21 b(r)o(eturn)h(value)g(depends)g(on)h(on)g(the)573 -1651 y(type)d(of)h Fz(port/fd)o FA(\320it)g(maps)f(fd)p Fs(!)p -FA(fd)g(and)g(port)p Fs(!)p FA(port.)573 1788 y(These)h(pr)o(ocedur)o(es)f -(use)i(the)g(Unix)f Fw(dup\(\))f FA(syscall)i(to)g(r)o(eplicate)e(the)i -(\256le)g(descrip-)573 1888 y(tor)i(or)h(\256le)f(port)h Fz(port/fd)n -FA(.)38 b(If)24 b(a)g Fz(newfd)g FA(\256le)g(descriptor)g(is)h(given,)g(it)g -(is)f(used)g(as)g(the)573 1987 y(tar)o(get)i(of)h(the)g(dup)g(operation,)h -Fz(i.e.)p FA(,)h(the)e(operation)g(is)h(a)e Fw(dup2\(\))p FA(.)44 -b(In)28 b(this)f(case,)573 2087 y(pr)o(ocedur)o(es)18 b(that)i(r)o(eturn)g(a) -f(port)i(\(such)f(as)g Fw(dup->inport)p FA(\))15 b(will)21 -b(r)o(eturn)e(one)i(with)573 2186 y(the)c(r)o(evealed)e(count)i(set)g(to)h -(one.)26 b(For)17 b(example,)g Fw(\(dup)42 b(\(current-input-p)o(or)o(t\))573 -2286 y(5\))17 b FA(pr)o(oduces)f(a)h(new)h(port)g(with)h(underlying)f(\256le) -f(descriptor)h(5,)f(whose)i(r)o(evealed)573 2386 y(count)g(is)g(1.)26 -b(If)18 b Fz(newfd)h FA(is)g(not)g(speci\256ed,)f(then)h(the)g(operating)g -(system)g(chooses)g(the)573 2485 y(\256le)i(descriptor)-6 b(,)20 -b(and)g(any)h(r)o(eturned)e(port)i(is)g(marked)f(as)h(unr)o(evealed.)573 -2622 y(If)27 b(the)g Fz(newfd)g FA(tar)o(get)f(is)h(given,)i(and)e(some)g -(port)g(is)h(alr)o(eady)d(using)j(that)f(\256le)g(de-)573 2722 -y(scriptor)-6 b(,)23 b(the)g(port)g(is)g(\256rst)g(quietly)h(shifted)f -(\(with)g(another)g Fw(dup)p FA(\))f(to)h(some)g(other)573 -2821 y(\256le)e(descriptor)f(\(zer)o(oing)g(its)h(r)o(evealed)e(count\).)573 -2958 y(Since)54 b(Scheme)f(doesn't)i(pr)o(ovide)e(r)o(ead/write)g(ports,)62 -b Fw(dup->inport)50 b FA(and)573 3057 y Fw(dup->outport)27 -b FA(can)32 b(be)g(useful)h(for)f(getting)h(an)f(output)h(version)g(of)f(an)g -(input)573 3157 y(port,)19 b(or)h Fz(vice)f(versa)p FA(.)28 -b(For)19 b(example,)g(if)h Fw(p)f FA(is)h(an)f(input)h(port)g(open)g(on)g(a)f -(tty)-9 b(,)19 b(and)h(we)573 3257 y(would)f(like)g(to)g(do)g(output)g(to)h -(that)e(tty)-9 b(,)19 b(we)g(can)g(simply)g(use)g Fw(\(dup->outport)38 -b(p\))573 3356 y FA(to)21 b(pr)o(oduce)f(an)g(equivalent)h(output)g(port)g -(for)g(the)g(tty)-9 b(.)365 3558 y Fw(\(seek)42 b Fz(fd/port)19 -b(offset)i([whence])p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(integer)896 -b FA(pr)o(ocedur)o(e)573 3695 y(Reposition)36 b(the)e(I/O)g(cursor)g(for)g(a) -g(\256le)g(descriptor)f(or)i(port.)67 b Fz(whence)34 b FA(is)g(one)573 -3786 y(of)39 b Fs(f)p Fw(seek/set)p FA(,)h Fw(seek/delta)p -FA(,)f Fw(seek/end)p Fs(g)p FA(,)h(and)f(defaults)f(to)i Fw(seek/set)p -FA(.)79 b(If)573 3878 y Fw(seek/set)p FA(,)15 b(then)j Fz(offset)g -FA(is)h(an)f(absolute)g(index)f(into)i(the)f(\256le;)h(if)f -Fw(seek/delta)p FA(,)c(then)573 3969 y Fz(offset)g FA(is)h(a)f(r)o(elative)f -(of)o(fset)g(fr)o(om)h(the)g(curr)o(ent)g(I/O)g(cursor;)j(if)d -Fw(seek/end)p FA(,)e(then)i Fz(offset)573 4060 y FA(is)k(a)f(r)o(elative)f -(of)o(fset)h(fr)o(om)g(the)h(end)f(of)h(\256le.)27 b(The)17 -b Fz(fd/port)f FA(ar)o(gument)h(may)h(be)f(a)g(port)573 4151 -y(or)24 b(an)g(integer)g(\256le)h(descriptor)-6 b(.)37 b(Not)25 -b(all)f(such)g(values)g(ar)o(e)f(seekable;)i(this)g(is)f(de-)573 -4243 y(pendent)c(on)i(the)e(OS)h(implementation.)28 b(The)21 -b(r)o(eturn)f(value)g(is)h(the)g(r)o(esulting)g(po-)573 4334 -y(sition)h(of)f(the)f(I/O)i(cursor)f(in)g(the)g(I/O)g(str)o(eam.)756 -4499 y FD(Oops:)76 b Fj(The)24 b(curr)o(ent)g(implementation)h(doesn't)f -(handle)h Fg(offset)e Fj(ar)o(guments)756 4591 y(that)d(ar)o(e)e(not)h -(immediate)f(integers)g(\()p Fg(i.e.)o Fj(,)g(r)o(epr)o(esentable)f(in)i(30)g -(bits\).)365 4848 y Fw(\(tell)42 b Fz(fd/port)p Fw(\))85 b -Fs(\000)-14 b(!)87 b Fz(integer)1414 b FA(pr)o(ocedur)o(e)365 -5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p -1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 -V 1636 5176 323 4 v 1216 w FA(31)p eop +31 36 bop 365 614 a Fz(3.2.6)81 b(Unix)20 b(I/O)365 828 +y Fx(\(dup)42 b FA(fd/port)19 b([newfd])p Fx(\))86 b +Ft(\000)-14 b(!)87 b FA(fd/port)1185 b FB(pr)o(ocedur)o(e)365 +927 y Fx(\(dup->inport)39 b FA(fd/port)19 b([newfd])p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(port)926 b FB(pr)o(ocedur)o(e)365 +1027 y Fx(\(dup->outport)39 b FA(fd/port)19 b([newfd])p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(port)882 b FB(pr)o(ocedur)o(e)365 +1127 y Fx(\(dup->fdes)40 b FA(fd/port)19 b([newfd])p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(fd)1087 b FB(pr)o(ocedur)o(e)573 +1253 y(These)36 b(pr)o(ocedur)o(es)f(pr)o(ovide)g(the)i(functionality)g +(of)f(C's)h Fx(dup\(\))d FB(and)i Fx(dup2\(\))p FB(.)573 +1353 y(The)i(dif)o(fer)o(ent)e(r)o(outines)i(r)o(eturn)g(dif)o(fer)o +(ent)e(types)i(of)g(values:)60 b Fx(dup->inport)p FB(,)573 +1452 y Fx(dup->outport)p FB(,)22 b(and)k Fx(dup->fdes)c +FB(r)o(eturn)k(input)g(ports,)i(output)e(ports,)i(and)d(in-)573 +1552 y(teger)d(\002le)h(descriptors,)g(r)o(espectively)-9 +b(.)30 b Fx(dup)p FB('s)22 b(r)o(eturn)g(value)g(depends)g(on)h(on)g +(the)573 1651 y(type)d(of)h FA(fd/port)o FB(\227it)g(maps)f(fd)p +Ft(!)p FB(fd)g(and)g(port)p Ft(!)p FB(port.)573 1788 +y(These)h(pr)o(ocedur)o(es)f(use)i(the)g(Unix)f Fx(dup\(\))f +FB(syscall)i(to)g(r)o(eplicate)e(the)i(\002le)g(descrip-)573 +1888 y(tor)i(or)h(\002le)f(port)h FA(fd/port)n FB(.)37 +b(If)24 b(a)g FA(newfd)g FB(\002le)h(descriptor)f(is)g(given,)i(it)e +(is)h(used)f(as)g(the)573 1987 y(tar)o(get)i(of)h(the)g(dup)g +(operation,)i FA(i.e.)p FB(,)g(the)e(operation)g(is)h(a)f +Fx(dup2\(\))p FB(.)42 b(In)28 b(this)f(case,)573 2087 +y(pr)o(ocedur)o(es)18 b(that)i(r)o(eturn)g(a)f(port)i(\(such)f(as)g +Fx(dup->inport)p FB(\))15 b(will)21 b(r)o(eturn)e(one)i(with)573 +2186 y(the)c(r)o(evealed)e(count)j(set)f(to)h(one.)25 +b(For)17 b(example,)g Fx(\(dup)42 b(\(current-input-p)o(or)o(t\))573 +2286 y(5\))17 b FB(pr)o(oduces)f(a)h(new)h(port)g(with)h(underlying)f +(\002le)f(descriptor)h(5,)f(whose)i(r)o(evealed)573 2386 +y(count)g(is)g(1.)25 b(If)18 b FA(newfd)h FB(is)g(not)g(speci\002ed,)g +(then)g(the)g(operating)f(system)i(chooses)f(the)573 +2485 y(\002le)i(descriptor)-6 b(,)20 b(and)g(any)h(r)o(eturned)e(port)i +(is)g(marked)f(as)h(unr)o(evealed.)573 2622 y(If)27 b(the)g +FA(newfd)g FB(tar)o(get)f(is)h(given,)i(and)e(some)g(port)g(is)h(alr)o +(eady)d(using)j(that)f(\002le)g(de-)573 2722 y(scriptor)-6 +b(,)23 b(the)g(port)g(is)g(\002rst)g(quietly)h(shifted)f(\(with)g +(another)g Fx(dup)p FB(\))f(to)h(some)g(other)573 2821 +y(\002le)e(descriptor)f(\(zer)o(oing)g(its)h(r)o(evealed)e(count\).)573 +2958 y(Since)54 b(Scheme)f(doesn't)i(pr)o(ovide)e(r)o(ead/write)g +(ports,)62 b Fx(dup->inport)50 b FB(and)573 3057 y Fx(dup->outport)27 +b FB(can)32 b(be)g(useful)h(for)f(getting)h(an)f(output)h(version)g(of) +f(an)g(input)573 3157 y(port,)20 b(or)f FA(vice)h(versa)p +FB(.)25 b(For)20 b(example,)f(if)g Fx(p)h FB(is)g(an)f(input)h(port)g +(open)g(on)g(a)g(tty)-9 b(,)19 b(and)h(we)573 3257 y(would)f(like)g(to) +g(do)g(output)g(to)h(that)e(tty)-9 b(,)19 b(we)g(can)g(simply)g(use)g +Fx(\(dup->outport)38 b(p\))573 3356 y FB(to)21 b(pr)o(oduce)f(an)g +(equivalent)h(output)g(port)g(for)g(the)g(tty)-9 b(.)365 +3558 y Fx(\(seek)42 b FA(fd/port)19 b(offset)i([whence])p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(integer)896 b FB(pr)o(ocedur)o(e)573 +3695 y(Reposition)36 b(the)e(I/O)h(cursor)f(for)g(a)f(\002le)i +(descriptor)e(or)i(port.)65 b FA(whence)35 b FB(is)f(one)573 +3786 y(of)39 b Ft(f)p Fx(seek/set)p FB(,)h Fx(seek/delta)p +FB(,)g Fx(seek/end)p Ft(g)p FB(,)g(and)f(defaults)f(to)i +Fx(seek/set)p FB(.)78 b(If)573 3878 y Fx(seek/set)p FB(,)33 +b(then)i FA(offset)f FB(is)g(an)f(absolute)h(index)g(into)g(the)g +(\002le;)40 b(if)34 b Fx(seek/delta)p FB(,)573 3969 y(then)c +FA(offset)g FB(is)h(a)e(r)o(elative)g(of)o(fset)g(fr)o(om)g(the)h(curr) +o(ent)g(I/O)g(cursor;)k(if)c Fx(seek/end)p FB(,)573 4060 +y(then)e FA(offset)g FB(is)g(a)f(r)o(elative)f(of)o(fset)h(fr)o(om)g +(the)h(end)f(of)h(\002le.)46 b(The)28 b FA(fd/port)e +FB(ar)o(gument)573 4151 y(may)e(be)f(a)g(port)h(or)g(an)g(integer)f +(\002le)h(descriptor)-6 b(.)34 b(Not)24 b(all)g(such)g(values)g(ar)o(e) +e(seek-)573 4243 y(able;)c(this)h(is)g(dependent)e(on)i(the)g(OS)f +(implementation.)25 b(The)19 b(r)o(eturn)e(value)h(is)g(the)573 +4334 y(r)o(esulting)j(position)h(of)f(the)g(I/O)g(cursor)g(in)g(the)g +(I/O)g(str)o(eam.)756 4499 y FE(Oops:)74 b Fk(The)25 +b(curr)o(ent)f(implementation)h(doesn't)f(handle)h Fi(offset)f +Fk(ar)o(guments)756 4591 y(that)c(ar)o(e)e(not)h(immediate)f(integers)g +(\()p Fi(i.e.)o Fk(,)g(r)o(epr)o(esentable)f(in)i(30)g(bits\).)365 +4848 y Fx(\(tell)42 b FA(fd/port)p Fx(\))85 b Ft(\000)-14 +b(!)87 b FA(integer)1414 b FB(pr)o(ocedur)o(e)365 5147 +y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(31)p eop %%Page: 32 38 -32 37 bop 888 614 a FA(Returns)24 b(the)e(position)j(of)d(the)h(I/O)g(cursor) -g(in)g(the)g(the)g(I/O)g(str)o(eam.)32 b(Not)23 b(all)g(\256le)888 -714 y(descriptors)16 b(or)f(ports)h(support)g(cursor)o(-r)o(eporting;)g(this) -g(is)g(dependent)f(on)h(the)g(OS)888 814 y(implementation.)681 -1011 y Fw(\(open-file)39 b Fz(fname)21 b(\257ags)g([perms])p -Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(port)860 b FA(pr)o(ocedur)o(e)888 -1154 y Fz(Perms)22 b FA(defaults)e(to)i Fw(#o666)p FA(.)27 -b Fz(Flags)21 b FA(is)g(an)g(integer)h(bitmask,)f(composed)h(by)f(or)6 -b('ing)888 1253 y(together)21 b(the)g(following)i(constants:)1071 -1423 y Fw(open/read)737 b(;)43 b(You)g(may)f(only)1071 1523 -y(open/write)693 b(;)43 b(choose)f(one)1071 1623 y(open/read+write)473 -b(;)43 b(of)g(these)f(three)1071 1722 y(open/no-control-)o(tty)1071 -1822 y(open/nonblocking)1071 1921 y(open/append)1071 2021 y(open/create)1071 -2121 y(open/truncate)1071 2220 y(open/exclusive)1333 2320 y(.)827 -b(;)43 b(Your)f(Unix)g(may)h(have)1333 2420 y(.)827 b(;)43 -b(a)h(few)e(more.)888 2590 y FA(Returns)25 b(a)e(port.)37 b(The)24 -b(port)g(is)h(an)f(input)g(port)g(if)g(the)g Fz(\257ags)g FA(permit)g(it,)g -(otherwise)888 2689 y(an)f(output)h(port.)35 b(R4RS/Scheme)23 -b(48/scsh)g(do)h(not)g(have)e(input/output)j(ports,)888 2789 -y(so)20 b(it's)g(one)f(or)h(the)f(other)-6 b(.)27 b(This)20 -b(should)g(be)f(\256xed.)26 b(\(Y)-8 b(ou)20 b(can)f(hack)g(simultaneous)888 -2888 y(i/o)h(on)g(a)e(\256le)h(by)g(opening)h(it)f(r/w)-8 b(,)20 -b(taking)f(the)g(r)o(esult)g(input)g(port,)g(and)g(duping)g(it)888 -2988 y(to)i(an)g(output)g(port)g(with)h Fw(dup->outport)p FA(.\))681 -3285 y Fw(\(open-input-file)37 b Fz(fname)20 b([\257ags])p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(port)823 b FA(pr)o(ocedur)o(e)681 -3384 y Fw(\(open-output-fil)o(e)37 b Fz(fname)21 b([\257ags)f(perms])p -Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(port)555 b FA(pr)o(ocedur)o(e)888 -3527 y(These)24 b(ar)o(e)f(equivalent)h(to)g Fw(open-file)p -FA(,)d(after)i(\256rst)h(setting)h(the)f(r)o(ead/write)f(bits)888 -3627 y(of)d(the)g Fz(\257ags)g FA(ar)o(gument)f(to)h Fw(open/read)c -FA(or)k Fw(open/write)p FA(,)15 b(r)o(espectively)-9 b(.)26 -b Fz(Flags)20 b FA(de-)888 3727 y(faults)h(to)g(zer)o(o)f(for)g -Fw(open-input-file)p FA(,)14 b(and)1071 3870 y Fw(\(bitwise-ior)39 -b(open/create)g(open/truncate\))888 4013 y FA(for)23 b Fw(open-output-file)o -FA(.)28 b(These)23 b(defaults)e(make)i(the)g(pr)o(ocedur)o(es)e(backwar)o -(ds-)888 4113 y(compatible)g(with)h(their)e(unary)h(R4RS)g(de\256nitions.)681 -4409 y Fw(\(open-fdes)39 b Fz(fname)21 b(\257ags)g([perms])p -Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(integer)764 b FA(pr)o(ocedur)o(e)888 -4552 y(Returns)22 b(a)e(\256le)h(descriptor)-6 b(.)681 4849 -y Fw(\(pipe\))84 b Fs(\000)-14 b(!)87 b Fz([rport)20 b(wport])1474 -b FA(pr)o(ocedur)o(e)681 5147 y(32)p 1952 5071 323 4 v 1952 -5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 -v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +32 37 bop 888 614 a FB(Returns)24 b(the)f(position)h(of)f(the)g(I/O)g +(cursor)g(in)g(the)g(the)g(I/O)g(str)o(eam.)31 b(Not)23 +b(all)g(\002le)888 714 y(descriptors)29 b(or)g(ports)h(support)f +(cursor)o(-r)o(eporting;)j(this)e(is)g(dependent)e(on)i(the)888 +814 y(OS)21 b(implementation.)681 998 y Fx(\(open-file)39 +b FA(fname)21 b(\003ags)g([perms])p Fx(\))86 b Ft(\000)-15 +b(!)88 b FA(port)860 b FB(pr)o(ocedur)o(e)888 1135 y +FA(Perms)22 b FB(defaults)e(to)i Fx(#o666)p FB(.)k FA(Flags)21 +b FB(is)h(an)f(integer)g(bitmask,)h(composed)g(by)f(or)6 +b('ing)888 1235 y(together)34 b(constants)h(listed)f(in)g(table)f(3.1)f +(\(page)h(33\).)63 b(Y)-8 b(ou)35 b(must)f(use)g(exactly)888 +1334 y(one)d(of)f(the)h Fx(open/read)p FB(,)e Fx(open/write)p +FB(,)f(or)i Fx(open/read+write)24 b FB(\003ags.)55 b(The)30 +b(r)o(e-)888 1434 y(turned)h(port)g(is)h(an)f(input)g(port)g(if)g(the)g +FA(\003ags)g FB(permit)g(it,)j(otherwise)e(an)f(output)888 +1534 y(port.)h(R4RS/Scheme)23 b(48/scsh)f(do)h(not)h(have)e +(input/output)i(ports,)f(so)g(it's)h(one)888 1633 y(or)g(the)g(other)-6 +b(.)36 b(This)24 b(should)h(be)e(\002xed.)35 b(\(Y)-8 +b(ou)25 b(can)e(hack)h(simultaneous)h(i/o)g(on)g(a)888 +1733 y(\002le)i(by)g(opening)h(it)f(r/w)-8 b(,)28 b(taking)f(the)g(r)o +(esult)g(input)g(port,)h(and)e(duping)h(it)g(to)g(an)888 +1832 y(output)22 b(port)e(with)i Fx(dup->outport)p FB(.\))681 +2117 y Fx(\(open-input-file)37 b FA(fname)20 b([\003ags])p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(port)823 b FB(pr)o(ocedur)o(e)681 +2216 y Fx(\(open-output-fil)o(e)37 b FA(fname)21 b([\003ags)f(perms])p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(port)555 b FB(pr)o(ocedur)o(e)888 +2353 y(These)24 b(ar)o(e)f(equivalent)h(to)g Fx(open-file)p +FB(,)d(after)i(\002rst)h(setting)h(the)f(r)o(ead/write)f(bits)888 +2453 y(of)33 b(the)f FA(\003ags)h FB(ar)o(gument)f(to)g +Fx(open/read)d FB(or)k Fx(open/write)p FB(,)e(r)o(espectively)-9 +b(.)59 b FA(Flags)888 2552 y FB(defaults)20 b(to)h(zer)o(o)f(for)h +Fx(open-input-file)o FB(,)15 b(and)1071 2691 y Fx(\(bitwise-ior)39 +b(open/create)g(open/truncate\))888 2830 y FB(for)23 +b Fx(open-output-file)o FB(.)k(These)c(defaults)f(make)h(the)g(pr)o +(ocedur)o(es)e(backwar)o(ds-)888 2929 y(compatible)g(with)h(their)e +(unary)h(R4RS)g(de\002nitions.)681 3213 y Fx(\(open-fdes)39 +b FA(fname)21 b(\003ags)g([perms])p Fx(\))86 b Ft(\000)-15 +b(!)88 b FA(integer)764 b FB(pr)o(ocedur)o(e)888 3350 +y(Returns)22 b(a)e(\002le)h(descriptor)-6 b(.)681 3634 +y Fx(\(fdes-flags)39 b FA(fd/port)p Fx(\))85 b Ft(\000)-14 +b(!)87 b FA(integer)1152 b FB(pr)o(ocedur)o(e)681 3734 +y Fx(\(set-fdes-flags)37 b FA(fd/port)19 b(integer)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(unde\002ned)627 b +FB(pr)o(ocedur)o(e)888 3871 y(These)25 b(pr)o(ocedur)o(es)e(allow)h(r)o +(eading)g(and)g(writing)h(of)g(an)f(open)h(\002le's)g(\003ags.)37 +b(The)888 3971 y(only)27 b(such)g(\003ag)f(de\002ned)g(by)i(P)t +Fs(O)t(S)t(I)t(X)i FB(is)d Fx(fdflags/close-o)o(n-e)o(xe)o(c)p +FB(;)c(your)j(Unix)888 4070 y(implementation)c(may)f(pr)o(ovide)f +(others.)888 4201 y(These)d(pr)o(ocedur)o(es)e(should)j(not)f(be)g +(particularly)f(useful)h(to)g(the)g(pr)o(ogrammer)-6 +b(,)16 b(as)888 4301 y(the)22 b(scsh)f(r)o(untime)h(alr)o(eady)d(pr)o +(ovides)i(automatic)g(contr)o(ol)g(of)g(the)h(close-on-exec)888 +4400 y(pr)o(operty)-9 b(.)61 b(Unr)o(evealed)30 b(ports)k(always)e +(have)g(their)h(\002le)g(descriptors)g(marked)888 4500 +y(close-on-exec,)28 b(as)e(they)h(can)f(be)h(closed)f(when)h(the)g +(scsh)g(pr)o(ocess)g(execs)f(a)g(new)888 4599 y(pr)o(ogram.)48 +b(Whenever)28 b(the)h(user)f(r)o(eveals)f(or)h(unr)o(eveals)g(a)g +(port's)g(\002le)h(descrip-)888 4699 y(tor)-6 b(,)23 +b(the)f(r)o(untime)h(automatically)f(sets)g(or)g(clears)g(the)g(\003ag) +g(for)g(the)g(pr)o(ogrammer)-6 b(.)888 4799 y(Pr)o(ogrammers)29 +b(that)f(manipulate)h(this)h(\003ag)e(should)i(be)f(awar)o(e)e(of)h +(these)h(extra,)888 4898 y(automatic)21 b(operations.)681 +5147 y(32)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)e(10,)g +(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 33 39 -33 38 bop 573 614 a FA(Returns)21 b(two)h(ports,)e(the)h(r)o(ead)e(and)i -(write)g(end-points)g(of)f(a)h(Unix)f(pipe.)365 933 y Fw(\(read-string)39 -b Fz(nbytes)21 b([fd/port])p Fw(\))85 b Fs(\000)-15 b(!)87 -b Fz(string)21 b(or)g Fw(#f)648 b FA(pr)o(ocedur)o(e)365 1033 -y Fw(\(read-string!)39 b Fz(str)20 b([fd/port)f(start)i(end])p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(nr)o(ead)21 b(or)f Fw(#f)428 -b FA(pr)o(ocedur)o(e)573 1184 y(These)16 b(calls)h(r)o(ead)d(exactly)i(as)g -(much)h(data)f(as)g(you)h(r)o(equested,)f(unless)h(ther)o(e)f(is)h(not)573 -1283 y(enough)24 b(data)f(\(eof\).)35 b Fw(read-string!)19 -b FA(r)o(eads)j(the)i(data)e(into)j(string)f Fz(str)g FA(at)g(the)f(in-)573 -1383 y(dices)17 b(in)h(the)g(half-open)f(interval)g Fl([)p -Fz(start)p Fx(;)d Fz(end)o Fl(\))p FA(;)19 b(the)f(default)e(interval)h(is)h -(the)g(whole)573 1483 y(string:)38 b Fz(start)h Fl(=)h(0)25 -b FA(and)g Fz(end)40 b Fl(=)f Fw(\(string-length)f Fz(string)p -Fw(\))o FA(.)43 b(They)25 b(will)i(persis-)573 1582 y(tently)15 -b(r)o(etry)e(on)i(partial)f(r)o(eads)f(and)h(when)h(interr)o(upted)f(until)h -(\(1\))f(err)o(or)-6 b(,)14 b(\(2\))f(eof,)i(or)573 1682 y(\(3\))i(the)i -(input)g(r)o(equest)f(is)g(completely)h(satis\256ed.)27 b(Partial)18 -b(r)o(eads)e(can)j(occur)f(when)573 1781 y(r)o(eading)i(fr)o(om)g(an)g -(intermittent)i(sour)o(ce,)e(such)h(as)g(a)f(pipe)h(or)f(tty)-9 -b(.)573 1924 y Fw(read-string)21 b FA(r)o(eturns)k(the)h(string)g(r)o(ead;)g -Fw(read-string!)21 b FA(r)o(eturns)k(the)g(number)573 2023 -y(of)f(characters)g(r)o(ead.)37 b(They)24 b(both)h(r)o(eturn)f(false)g(at)g -(eof.)39 b(A)24 b(r)o(equest)g(to)h(r)o(ead)e(zer)o(o)573 2123 -y(bytes)e(r)o(eturns)f(immediately)-9 b(,)20 b(with)i(no)f(eof)g(check.)573 -2265 y(The)e(values)g(of)g Fz(start)g FA(and)g Fz(end)g FA(must)h(specify)f -(a)g(well-de\256ned)g(interval)g(in)g Fz(str)q FA(,)g Fz(i.e.)p -FA(,)573 2365 y Fl(0)j Fs(\024)h Fz(start)g Fs(\024)f Fz(end)i -Fs(\024)e Fw(\(string-length)38 b Fz(str)p Fw(\))p FA(.)573 -2507 y(Any)25 b(partially-r)o(ead)e(data)i(is)h(included)f(in)h(the)g(err)o -(or)e(exception)i(packet.)41 b(Err)o(or)573 2607 y(r)o(eturns)20 -b(on)i(non-blocking)g(input)f(ar)o(e)f(consider)o(ed)f(an)i(err)o(or)-6 -b(.)365 2826 y Fw(\(read-string/part)o(ia)o(l)38 b Fz(nbytes)21 -b([fd/port])p Fw(\))84 b Fs(\000)-14 b(!)87 b Fz(string)21 -b(or)g Fw(#f)299 b FA(pr)o(ocedur)o(e)365 2926 y Fw(\(read-string!/par)o(ti)o -(al)37 b Fz(str)21 b([fd/port)d(start)i(end])p Fw(\))84 b Fs(\000)-15 -b(!)85 b Fz(nr)o(ead)20 b(or)g Fw(#f)87 b FA(pr)o(ocedur)o(e)573 -3077 y(These)15 b(ar)o(e)e(atomic)i(best-ef)o(fort/forwar)o(d-pr)o(ogr)o(ess) -c(calls.)26 b(Best)14 b(ef)o(fort:)23 b(they)16 b(may)573 3176 -y(r)o(ead)i(less)h(than)h(you)g(r)o(equest)f(if)h(ther)o(e)e(is)i(a)f(lesser) -h(amount)g(of)f(data)f(immediately)573 3276 y(available)27 -b(\()p Fz(e.g.)o FA(,)k(because)d(you)h(ar)o(e)e(r)o(eading)h(fr)o(om)g(a)h -(pipe)f(or)h(a)f(tty\).)51 b(Forwar)o(d)573 3375 y(pr)o(ogr)o(ess:)28 -b(if)22 b(no)g(data)f(is)h(immediately)g(available)e(\()p Fz(e.g.)o -FA(,)i(empty)g(pipe\),)f(they)h(will)573 3475 y(block.)k(Ther)o(efor)o(e,)15 -b(if)h(you)h(r)o(equest)f(an)g Fx(n)23 b(>)g Fl(0)15 b FA(byte)h(r)o(ead,)g -(while)h(you)f(may)h(not)g(get)573 3575 y(everything)k(you)g(asked)f(for)-6 -b(,)21 b(you)g(will)g(always)g(get)g(something)h(\(barring)e(eof\).)573 -3717 y(Ther)o(e)25 b(is)h(one)g(case)f(in)h(which)g(the)g(forwar)o(d-pr)o -(ogr)o(ess)d(guarantee)i(is)h(cancelled:)573 3817 y(when)19 -b(the)g(pr)o(ogrammer)e(explicitly)i(sets)g(the)g(port)f(to)h(non-blocking)i -(i/o.)27 b(In)19 b(this)573 3916 y(case,)e(if)g(no)h(data)d(is)j(immediately) -f(available,)f(the)i(pr)o(ocedur)o(e)d(will)j(not)f(block,)i(but)573 -4016 y(will)i(immediately)g(r)o(eturn)f(a)g(zer)o(o-byte)g(r)o(ead.)573 -4158 y Fw(read-string/part)o(ia)o(l)38 b FA(r)o(eads)k(the)i(data)e(into)j(a) -e(fr)o(eshly)g(allocated)g(string,)573 4258 y(which)23 b(it)g(r)o(eturns)f -(as)h(its)g(value.)32 b Fw(read-string!/par)o(tia)o(l)16 b -FA(r)o(eads)21 b(the)i(data)f(into)573 4357 y(string)d Fz(str)f -FA(at)f(the)i(indices)f(in)g(the)g(half-open)g(interval)g Fl([)p -Fz(start)o Fx(;)c Fz(end)p Fl(\))p FA(;)19 b(the)f(default)f(in-)573 -4457 y(terval)22 b(is)i(the)g(whole)g(string:)33 b Fz(start)e -Fl(=)h(0)23 b FA(and)f Fz(end)32 b Fl(=)f Fw(\(string-length)38 -b Fz(string)p Fw(\))p FA(.)573 4557 y(The)19 b(values)g(of)g -Fz(start)g FA(and)g Fz(end)g FA(must)h(specify)f(a)g(well-de\256ned)g -(interval)g(in)g Fz(str)q FA(,)g Fz(i.e.)p FA(,)573 4656 y -Fl(0)31 b Fs(\024)g Fz(start)h Fs(\024)f Fz(end)h Fs(\024)f -Fw(\(string-length)38 b Fz(str)p Fw(\))p FA(.)d(It)23 b(r)o(eturns)g(the)h -(number)f(of)g(bytes)573 4756 y(r)o(ead.)573 4898 y(A)d(r)o(equest)h(to)g(r)o -(ead)e(zer)o(o)g(bytes)i(r)o(eturns)g(immediatedly)-9 b(,)20 -b(with)h(no)h(eof)e(check.)365 5147 y FD(November)e(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1216 w FA(33)p eop +33 38 bop 1158 601 a FB(Allowed)21 b(operations)272 b +Fx(Status)41 b(flag)p 1108 634 1999 4 v 488 701 a Fz(Open+Get+Set)97 +b FB(These)21 b(\003ags)g(can)f(be)h(used)1158 800 y(in)g +Fx(open-file)p FB(,)1158 900 y Fx(fdes-status)p FB(,)16 +b(and)1158 1000 y Fx(set-fdes-status)f FB(calls.)2158 +701 y Fx(open/append)2158 800 y(open/non-blockin)o(g)2158 +900 y(open/async)39 b FB(\(Non-)r(P)t Fs(O)t(S)t(I)t(X)r +FB(\))2158 1000 y Fx(open/fsync)g FB(\(Non-)r(P)t Fs(O)t(S)t(I)t(X)r +FB(\))p 1108 1033 V 658 1099 a Fz(Open+Get)98 b FB(These)21 +b(\003ags)g(can)f(be)h(used)1158 1199 y(in)g Fx(open-file)c +FB(and)1158 1298 y Fx(fdes-status)f FB(calls,)21 b(but)1158 +1398 y(ar)o(e)e(ignor)o(ed)i(by)1158 1498 y Fx(set-fdes-status)p +FB(.)2158 1099 y Fx(open/read)2158 1199 y(open/write)2158 +1298 y(open/read+write)2158 1398 y(open/access-mask)p +1108 1531 V 846 1597 a Fz(Open)99 b FB(These)21 b(\003ags)g(ar)o(e)e +(only)1158 1697 y(r)o(elevant)h(in)h Fx(open-file)1158 +1797 y FB(calls;)g(they)g(ar)o(e)e(ignor)o(ed)1158 1896 +y(by)i Fx(fdes-status)16 b FB(and)1158 1996 y Fx(set-fdes-status)f +FB(calls.)2158 1597 y Fx(open/create)2158 1697 y(open/exclusive)2158 +1797 y(open/no-control-)o(tt)o(y)2158 1896 y(open/truncate)365 +2166 y FB(T)-8 b(able)38 b(3.1:)60 b(Status)38 b(\003ags)g(for)g +Fx(open-file)p FB(,)h Fx(fdes-status)34 b FB(and)k Fx(set-fdes-status)p +FB(.)365 2266 y(Only)23 b(P)t Fs(O)t(S)t(I)t(X)g FB(\003ags)d(ar)o(e)e +(guaranteed)h(to)h(be)f(pr)o(esent;)h(your)g(operating)f(system)i(may)e +(de-)365 2365 y(\002ne)25 b(others.)37 b(The)24 b Fx(open/access-mask) +18 b FB(value)24 b(is)g(not)i(an)e(actual)f(\003ag,)j(but)e(a)g(bit)g +(mask)365 2465 y(used)j(to)g(select)g(the)f(\002eld)h(for)g(the)g +Fx(open/read)p FB(,)d Fx(open/write)e FB(and)27 b Fx(open/read+write) +365 2565 y FB(bits.)365 2965 y Fx(\(fdes-status)39 b +FA(fd/port)p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(integer)1109 +b FB(pr)o(ocedur)o(e)365 3064 y Fx(\(set-fdes-status)37 +b FA(fd/port)19 b(integer)p Fx(\))88 b Ft(\000)-15 b(!)87 +b FA(unde\002ned)584 b FB(pr)o(ocedur)o(e)573 3205 y(These)20 +b(pr)o(ocedur)o(es)f(allow)i(r)o(eading)e(and)i(writing)g(of)f(an)h +(open)g(\002le's)g(status)f(\003ags)573 3305 y(\(table)g(3.1\).)573 +3438 y(Note)j(that)h(this)g(\002le-descriptor)f(state)g(is)h(shar)o(ed) +e(between)h(\002le)h(descriptors)f(cr)o(e-)573 3537 y(ated)h(by)h +Fx(dup)p FB(\227if)e(you)j(cr)o(eate)d(port)i FA(b)g +FB(by)g(applying)g Fx(dup)f FB(to)h(port)g FA(a)p FB(,)g(and)g(change) +573 3637 y FA(b)p FB('s)c(status)g(\003ags,)g(you)g(will)h(also)f(have) +f(changed)g FA(a)p FB('s)h(status)g(\003ags.)365 3927 +y Fx(\(pipe\))85 b Ft(\000)-14 b(!)87 b FA([rport)20 +b(wport)o(])1475 b FB(pr)o(ocedur)o(e)573 4068 y(Returns)21 +b(two)h(ports,)e(the)h(r)o(ead)e(and)i(write)g(end-points)g(of)f(a)h +(Unix)f(pipe.)365 4359 y Fx(\(read-string)39 b FA(nbytes)21 +b([fd/port])p Fx(\))85 b Ft(\000)-15 b(!)87 b FA(string)21 +b(or)g Fx(#f)648 b FB(pr)o(ocedur)o(e)365 4458 y Fx(\(read-string!)39 +b FA(str)20 b([fd/port)f(start)i(end])p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(nr)o(ead)21 b(or)f Fx(#f)428 b FB(pr)o(ocedur)o(e)573 +4599 y(These)28 b(calls)f(r)o(ead)f(exactly)i(as)f(much)i(data)d(as)i +(you)g(r)o(equested,)h(unless)f(ther)o(e)f(is)573 4699 +y(not)33 b(enough)h(data)e(\(eof\).)61 b Fx(read-string!)28 +b FB(r)o(eads)k(the)h(data)e(into)j(string)g FA(str)f +FB(at)573 4799 y(the)21 b(indices)g(in)h(the)f(half-open)g(interval)g +Fm([)p FA(start)p Fy(;)14 b FA(end)o Fm(\))p FB(;)22 +b(the)f(default)f(interval)h(is)g(the)573 4898 y(whole)30 +b(string:)42 b FA(start)c Fm(=)f(0)29 b FB(and)f FA(end)38 +b Fm(=)g Fx(\(string-length)g FA(string)o Fx(\))p FB(.)50 +b(They)29 b(will)365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(33)p +eop %%Page: 34 40 -34 39 bop 888 614 a FA(In)26 b(sum,)h(ther)o(e)e(ar)o(e)f(only)j(thr)o(ee)d -(ways)i(you)g(can)f(get)h(a)f(zer)o(o-byte)f(r)o(ead:)35 b(\(1\))24 -b(you)888 714 y(r)o(equest)17 b(one,)h(\(2\))d(you)j(turn)f(on)h -(non-blocking)g(i/o,)g(or)f(\(3\))f(you)i(try)f(to)g(r)o(ead)e(at)i(eof.)888 -855 y(These)i(ar)o(e)e(the)i(r)o(outines)g(to)g(use)g(for)f(non-blocking)j -(input.)27 b(They)19 b(ar)o(e)e(also)i(useful)888 954 y(when)j(you)g(wish)g -(to)f(ef)o(\256ciently)g(pr)o(ocess)g(data)f(in)h(lar)o(ge)f(blocks,)i(and)f -(your)g(algo-)888 1054 y(rithm)h(is)f(insensitive)h(to)f(the)g(block)g(size)f -(of)h(any)g(particular)e(r)o(ead)g(operation.)681 1268 y Fw(\(select)84 -b Fz(rvec)21 b(wvec)f(evec)h([timeout])p Fw(\))85 b Fs(\000)-14 -b(!)87 b Fz(rvec')21 b(wvec')f(evec')364 b FA(pr)o(ocedur)o(e)681 -1368 y Fw(\(select!)40 b Fz(rvec)21 b(wvec)f(evec)h([timeout])p -Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(nr)21 b(nw)g(ne)618 b FA(pr)o(ocedur)o(e) -888 1517 y(The)27 b Fw(select)d FA(pr)o(ocedur)o(e)g(allows)j(a)f(pr)o(ocess) -g(to)h(block)f(and)g(wait)h(for)f(events)g(on)888 1617 y(multiple)31 -b(I/O)g(channels.)55 b(The)30 b Fz(rvec)g FA(and)g Fz(evec)g -FA(ar)o(guments)f(ar)o(e)g(vectors)h(of)g(in-)888 1716 y(put)19 -b(ports)g(and)g(integer)g(\256le)g(descriptors;)g Fz(wvec)f -FA(is)h(a)g(vector)f(of)h(output)g(ports)g(and)888 1816 y(integer)27 -b(\256le)f(descriptors.)45 b(The)26 b(pr)o(ocedur)o(e)e(r)o(eturns)i(thr)o -(ee)g(vectors)g(whose)i(ele-)888 1916 y(ments)17 b(ar)o(e)e(subsets)i(of)f -(the)g(corr)o(esponding)g(ar)o(guments.)26 b(Every)16 b(element)g(of)g -Fz(rvec')888 2015 y FA(is)25 b(r)o(eady)e(for)h(input;)i(every)e(element)g -(of)g Fz(wvec')g FA(is)h(r)o(eady)e(for)h(output;)i(every)e(ele-)888 -2115 y(ment)e(of)e Fz(evec')h FA(has)g(an)f(exceptional)h(condition)h -(pending.)888 2255 y(The)d Fw(select)e FA(call)i(will)h(block)f(until)h(at)f -(least)f(one)i(of)f(the)g(I/O)h(channels)f(passed)g(to)888 -2355 y(it)h(is)g(r)o(eady)e(for)h(operation.)27 b(The)20 b -Fz(timeout)f FA(value)g(can)g(be)g(used)g(to)h(for)o(ce)f(the)g(call)h(to)888 -2455 y(time-out)i(after)d(a)i(given)g(number)g(of)g(seconds.)29 -b(It)21 b(defaults)f(to)h(the)g(special)g(value)888 2554 y -Fw(#f)p FA(,)k(meaning)h(wait)f(inde\256nitely)-9 b(.)41 b(A)25 -b(zer)o(o)f(value)h(can)f(be)h(used)g(to)h(poll)f(the)g(I/O)888 -2654 y(channels.)888 2795 y(If)31 b(an)f(I/O)i(channel)f(appears)e(mor)o(e)i -(than)g(once)g(in)g(a)g(given)g(vector)o(\320per)o(haps)888 -2894 y(occuring)26 b(once)e(as)h(a)f(Scheme)g(port,)i(and)e(once)h(as)f(the)h -(port's)g(underlying)g(inte-)888 2994 y(ger)i(\256le)f(descriptor)o(\320only) -h(one)g(of)f(these)h(two)g(r)o(efer)o(ences)d(may)j(appear)e(in)i(the)888 -3094 y(r)o(eturned)h(vector)-6 b(.)51 b(Buf)o(fer)o(ed)26 b(I/O)j(ports)g(ar) -o(e)e(handled)i(specially\320if)f(an)h(input)888 3193 y(port's)c(buf)o(fer)d -(is)i(not)h(empty)-9 b(,)24 b(or)g(an)g(output)h(port's)f(buf)o(fer)e(is)i -(not)h(yet)f(full,)h(then)888 3293 y(these)17 b(ports)h(ar)o(e)d(immediately) -i(consider)o(ed)f(eligible)i(for)e(I/O)i(without)g(using)g(the)888 -3392 y(actual,)i(primitive)i Fw(select)c FA(system)k(call)f(to)g(check)g(the) -g(underlying)h(\256le)f(descrip-)888 3492 y(tor)-6 b(.)26 b(This)16 -b(works)h(pr)o(etty)e(well)h(for)f(buf)o(fer)o(ed)e(input)k(ports,)g(but)e -(is)h(a)g(little)g(pr)o(oblem-)888 3592 y(atic)21 b(for)f(buf)o(fer)o(ed)e -(output)k(ports.)888 3732 y(The)j Fw(select!)d FA(pr)o(ocedur)o(e)i(is)h -(similar)-6 b(,)26 b(but)f(indicates)g(the)g(subset)g(of)g(active)f(I/O)888 -3832 y(channels)k(by)g(side-ef)o(fecting)d(the)j(ar)o(gument)f(vectors.)47 -b(Non-active)27 b(I/O)g(chan-)888 3932 y(nels)c(in)g(the)f(ar)o(gument)g -(vectors)g(ar)o(e)e(overwritten)j(with)g Fw(#f)e FA(values.)31 -b(The)22 b(call)g(r)o(e-)888 4031 y(turns)16 b(the)g(number)f(of)h(active)f -(elements)g(r)o(emaining)h(in)g(each)f(vector)-6 b(.)25 b(As)15 -b(a)g(conve-)888 4131 y(nience,)21 b(the)f(vectors)g(passed)f(in)i(to)f -Fw(select!)d FA(ar)o(e)i(allowed)h(to)h(contain)f Fw(#f)f FA(values)888 -4230 y(as)i(well)g(as)f(integers)h(and)g(ports.)1071 4424 y -FD(Remark:)59 b Fj(I)20 b(have)g(found)g(the)h Fi(select!)g -Fj(interface)f(to)g(be)g(the)g(mor)o(e)f(useful)g(of)1071 4516 -y(the)26 b(two.)44 b(After)25 b(the)h(system)e(call,)j(it)e(allows)g(you)f -(to)i(check)f(a)g(speci\256c)g(I/O)1071 4607 y(channel)20 b(in)f(constant)h -(time.)681 4846 y Fw(\(write-string)38 b Fz(string)21 b([fd/port)e(start)h -(end])p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)373 -b FA(pr)o(ocedur)o(e)681 5147 y(34)p 1952 5071 323 4 v 1952 -5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 -v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +34 39 bop 888 614 a FB(persistently)29 b(r)o(etry)e(on)i(partial)e(r)o +(eads)g(and)h(when)h(interr)o(upted)f(until)g(\(1\))f(err)o(or)-6 +b(,)888 714 y(\(2\))24 b(eof,)h(or)g(\(3\))e(the)i(input)g(r)o(equest)g +(is)g(completely)g(satis\002ed.)37 b(Partial)24 b(r)o(eads)f(can)888 +814 y(occur)e(when)g(r)o(eading)f(fr)o(om)g(an)h(intermittent)h(sour)o +(ce,)e(such)h(as)f(a)h(pipe)f(or)h(tty)-9 b(.)888 944 +y Fx(read-string)21 b FB(r)o(eturns)k(the)h(string)g(r)o(ead;)g +Fx(read-string!)21 b FB(r)o(eturns)k(the)h(number)888 +1044 y(of)f(characters)e(r)o(ead.)36 b(They)25 b(both)h(r)o(eturn)e +(false)g(at)g(eof.)37 b(A)25 b(r)o(equest)f(to)h(r)o(ead)e(zer)o(o)888 +1143 y(bytes)e(r)o(eturns)f(immediately)-9 b(,)21 b(with)g(no)h(eof)e +(check.)888 1274 y(The)g(values)e(of)i FA(start)f FB(and)g +FA(end)g FB(must)h(specify)f(a)f(well-de\002ned)h(interval)g(in)h +FA(str)p FB(,)f FA(i.e.)p FB(,)888 1373 y Fm(0)k Ft(\024)g +FA(start)f Ft(\024)h FA(end)g Ft(\024)g Fx(\(string-length)37 +b FA(str)q Fx(\))o FB(.)888 1504 y(Any)26 b(partially-r)o(ead)d(data)i +(is)h(included)f(in)h(the)g(err)o(or)f(exception)h(packet.)39 +b(Err)o(or)888 1604 y(r)o(eturns)21 b(on)g(non-blocking)h(input)g(ar)o +(e)d(consider)o(ed)h(an)h(err)o(or)-6 b(.)681 1787 y +Fx(\(read-string/par)o(ti)o(al)37 b FA(nbytes)21 b([fd/port])p +Fx(\))85 b Ft(\000)-15 b(!)88 b FA(string)20 b(or)h Fx(#f)299 +b FB(pr)o(ocedur)o(e)681 1887 y Fx(\(read-string!/pa)o(rt)o(ial)37 +b FA(str)20 b([fd/port)f(start)h(end])p Fx(\))83 b Ft(\000)-14 +b(!)84 b FA(nr)o(ead)20 b(or)h Fx(#f)86 b FB(pr)o(ocedur)o(e)888 +2024 y(These)36 b(ar)o(e)d(atomic)j(best-ef)o(fort/forwar)o(d-pr)o(ogr) +o(ess)31 b(calls.)69 b(Best)35 b(ef)o(fort:)54 b(they)888 +2123 y(may)31 b(r)o(ead)e(less)i(than)g(you)h(r)o(equest)e(if)h(ther)o +(e)f(is)h(a)f(lesser)h(amount)h(of)e(data)g(im-)888 2223 +y(mediately)d(available)e(\()p FA(e.g.)o FB(,)i(because)f(you)h(ar)o(e) +e(r)o(eading)h(fr)o(om)g(a)g(pipe)h(or)f(a)g(tty\).)888 +2322 y(Forwar)o(d)c(pr)o(ogr)o(ess:)28 b(if)23 b(no)g(data)e(is)i +(immediately)g(available)e(\()p FA(e.g.)o FB(,)i(empty)g(pipe\),)888 +2422 y(they)i(will)g(block.)35 b(Ther)o(efor)o(e,)23 +b(if)h(you)h(r)o(equest)e(an)h Fy(n)29 b(>)g Fm(0)24 +b FB(byte)g(r)o(ead,)f(while)h(you)888 2522 y(may)32 +b(not)f(get)h(everything)f(you)h(asked)e(for)-6 b(,)34 +b(you)d(will)h(always)f(get)g(something)888 2621 y(\(barring)20 +b(eof\).)888 2752 y(Ther)o(e)25 b(is)h(one)g(case)f(in)h(which)h(the)f +(forwar)o(d-pr)o(ogr)o(ess)d(guarantee)h(is)i(cancelled:)888 +2851 y(when)20 b(the)f(pr)o(ogrammer)e(explicitly)i(sets)g(the)g(port)g +(to)g(non-blocking)i(i/o.)k(In)19 b(this)888 2951 y(case,)31 +b(if)f(no)g(data)f(is)h(immediately)f(available,)i(the)e(pr)o(ocedur)o +(e)f(will)i(not)h(block,)888 3051 y(but)21 b(will)h(immediately)e(r)o +(eturn)g(a)h(zer)o(o-byte)e(r)o(ead.)888 3181 y Fx(read-string/parti)o +(al)37 b FB(r)o(eads)42 b(the)i(data)f(into)h(a)g(fr)o(eshly)f +(allocated)g(string,)888 3281 y(which)24 b(it)f(r)o(eturns)f(as)h(its)g +(value.)31 b Fx(read-string!/par)o(ti)o(al)16 b FB(r)o(eads)22 +b(the)h(data)e(into)888 3380 y(string)30 b FA(str)e FB(at)g(the)h +(indices)g(in)g(the)f(half-open)g(interval)g Fm([)p FA(start)p +Fy(;)14 b FA(end)p Fm(\))p FB(;)32 b(the)d(default)888 +3480 y(interval)18 b(is)h(the)g(whole)g(string:)25 b +FA(start)e Fm(=)f(0)c FB(and)g FA(end)23 b Fm(=)g Fx(\(string-length)38 +b FA(string)p Fx(\))o FB(.)888 3580 y(The)20 b(values)e(of)i +FA(start)f FB(and)g FA(end)g FB(must)h(specify)f(a)f(well-de\002ned)h +(interval)g(in)h FA(str)p FB(,)f FA(i.e.)p FB(,)888 3679 +y Fm(0)30 b Ft(\024)g FA(start)g Ft(\024)g FA(end)g Ft(\024)g +Fx(\(string-length)38 b FA(str)p Fx(\))p FB(.)f(It)25 +b(r)o(eturns)f(the)g(number)h(of)g(bytes)888 3779 y(r)o(ead.)888 +3909 y(A)c(r)o(equest)f(to)h(r)o(ead)e(zer)o(o)h(bytes)h(r)o(eturns)f +(immediatedly)-9 b(,)20 b(with)i(no)f(eof)g(check.)888 +4040 y(In)26 b(sum,)i(ther)o(e)c(ar)o(e)h(only)h(thr)o(ee)f(ways)h(you) +g(can)f(get)h(a)f(zer)o(o-byte)f(r)o(ead:)34 b(\(1\))24 +b(you)888 4139 y(r)o(equest)k(one,)h(\(2\))d(you)i(turn)g(on)g +(non-blocking)h(i/o,)h(or)e(\(3\))e(you)i(try)g(to)g(r)o(ead)d(at)888 +4239 y(eof.)888 4370 y(These)g(ar)o(e)e(the)i(r)o(outines)f(to)h(use)g +(for)f(non-blocking)i(input.)38 b(They)24 b(ar)o(e)g(also)g(use-)888 +4469 y(ful)k(when)h(you)f(wish)h(to)f(ef)o(\002ciently)g(pr)o(ocess)f +(data)g(in)h(lar)o(ge)f(blocks,)j(and)e(your)888 4569 +y(algorithm)20 b(is)f(insensitive)h(to)f(the)g(block)g(size)g(of)g(any) +f(particular)g(r)o(ead)f(operation.)681 4753 y Fx(\(select)84 +b FA(rvec)21 b(wvec)f(evec)h([timeout])p Fx(\))85 b Ft(\000)-14 +b(!)87 b FA([rvec')20 b(wvec')h(evec'])308 b FB(pr)o(ocedur)o(e)681 +4852 y Fx(\(select!)40 b FA(rvec)21 b(wvec)f(evec)h([timeout])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA([nr)21 b(nw)g(ne])562 +b FB(pr)o(ocedur)o(e)681 5147 y(34)p 1952 5071 323 4 +v 1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 +5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 35 41 -35 40 bop 573 614 a FA(This)18 b(pr)o(ocedur)o(e)e(writes)j(all)e(the)h(data) -f(r)o(equested.)26 b(If)17 b(the)i(pr)o(ocedur)o(e)d(cannot)i(per)o(-)573 -714 y(form)c(the)g(write)g(with)h(a)e(single)i(kernel)f(call)f(\(due)g(to)i -(interr)o(upts)f(or)g(partial)f(writes\),)573 814 y(it)18 b(will)g(perform)g -(multiple)g(write)g(operations)g(until)h(all)f(the)g(data)e(is)j(written)f -(or)g(an)573 913 y(err)o(or)j(has)i(occurr)o(ed.)31 b(A)22 -b(non-blocking)i(i/o)f(err)o(or)e(is)i(consider)o(ed)f(an)g(err)o(or)-6 -b(.)31 b(\(Er)o(-)573 1013 y(r)o(or)19 b(exception)g(packets)g(for)g(this)h -(syscall)g(include)f(the)h(amount)g(of)f(data)f(partially)573 -1112 y(transferr)o(ed)g(befor)o(e)i(the)h(err)o(or)f(occurr)o(ed.\))573 -1265 y(The)35 b(data)f(written)i(ar)o(e)d(the)j(characters)e(of)h -Fz(string)g FA(in)h(the)f(half-open)g(interval)573 1365 y Fl([)p -Fz(start)p Fx(;)14 b Fz(end)p Fl(\))p FA(.)36 b(The)24 b(default)e(interval)i -(is)g(the)g(whole)g(string:)34 b Fz(start)f Fl(=)g(0)23 b FA(and)g -Fz(end)33 b Fl(=)573 1464 y Fw(\(string-length)38 b Fz(string)p -Fw(\))o FA(.)27 b(The)19 b(values)f(of)h Fz(start)g FA(and)f -Fz(end)h FA(must)h(specify)e(a)h(well-)573 1564 y(de\256ned)25 -b(interval)g(in)h Fz(str)p FA(,)g Fz(i.e.)p FA(,)g Fl(0)39 -b Fs(\024)f Fz(start)g Fs(\024)g Fz(end)h Fs(\024)f Fw(\(string-length)g -Fz(str)p Fw(\))p FA(.)j(A)573 1663 y(zer)o(o-byte)19 b(write)i(r)o(eturns)f -(immediately)-9 b(,)20 b(with)i(no)f(err)o(or)-6 b(.)573 1816 -y(Output)27 b(to)g(buf)o(fer)o(ed)d(ports:)39 b Fw(write-string)p -FA('s)22 b(ef)o(forts)k(end)g(as)h(soon)h(as)e(all)g(the)573 -1915 y(data)16 b(has)h(been)g(placed)f(in)h(the)g(output)h(buf)o(fer)-6 -b(.)24 b(Err)o(ors)17 b(and)f(tr)o(ue)h(output)h(may)f(not)573 -2015 y(happen)j(until)i(a)e(later)g(time,)h(of)g(course.)365 -2295 y Fw(\(write-string/par)o(ti)o(al)37 b Fz(string)19 b([fd/port)e(start)i -(end])p Fw(\))75 b Fs(\000)-15 b(!)76 b Fz(nwritten)88 b FA(pr)o(ocedur)o(e) -573 2456 y(This)61 b(r)o(outine)g(is)g(the)g(atomic)g(best-ef)o(fort/forwar)o -(d-pr)o(ogr)o(ess)56 b(analog)61 b(to)573 2555 y Fw(write-string)p -FA(.)d(It)32 b(r)o(eturns)g(the)h(number)f(of)h(bytes)f(written,)k(which)d -(may)g(be)573 2655 y(less)28 b(than)g(you)g(asked)f(for)-6 -b(.)48 b(Partial)27 b(writes)g(can)h(occur)f(when)i(\(1\))d(we)i(write)f(of)o -(f)573 2755 y(the)22 b(physical)h(end)f(of)h(the)f(media,)g(\(2\))f(the)i -(write)f(is)h(interrr)o(upted,)f(or)h(\(3\))e(the)h(\256le)573 -2854 y(descriptor)e(is)h(set)g(for)g(non-blocking)h(i/o.)573 -3007 y(If)h(the)h(\256le)f(descriptor)g(is)h(not)g(set)g(up)f(for)h -(non-blocking)h(i/o,)g(then)f(a)f(successful)573 3106 y(r)o(eturn)d(fr)o(om)g -(these)h(pr)o(ocedur)o(es)e(makes)h(a)h(forwar)o(d)e(pr)o(ogr)o(ess)h -(guarantee\320that)573 3206 y(is,)h(a)f(partial)g(write)h(took)g(place)f(of)h -(at)f(least)h(one)g(byte:)672 3411 y Fs(\017)42 b FA(If)22 -b(we)h(ar)o(e)f(at)h(the)g(end)g(of)g(physical)h(media,)f(and)f(no)i(write)f -(takes)g(place,)g(an)756 3511 y(err)o(or)c(exception)i(is)g(raised.)27 -b(So)20 b(a)h(r)o(eturn)f(implies)h(we)g(wr)o(ote)f Fz(something)p -FA(.)672 3663 y Fs(\017)42 b FA(If)28 b(the)g(call)h(is)f(interr)o(upted)h -(after)e(a)h(partial)g(transfer)-6 b(,)29 b(it)f(r)o(eturns)g(immedi-)756 -3763 y(ately)-9 b(.)31 b(But)22 b(if)g(the)g(call)g(is)g(interr)o(upted)g -(befor)o(e)f(any)h(data)f(transfer)-6 b(,)22 b(then)g(the)756 -3862 y(write)e(is)h(r)o(etried.)573 4067 y(If)e(we)g(r)o(equest)f(a)h(zer)o -(o-byte)e(write,)i(then)h(the)f(call)g(immediately)g(r)o(eturns)f(0.)27 -b(If)18 b(the)573 4167 y(\256le)24 b(descriptor)f(is)h(set)g(for)g -(non-blocking)h(i/o,)g(then)f(the)g(call)g(may)f(r)o(eturn)g(0)h(if)f(it)573 -4267 y(was)f(unable)g(to)h(immediately)f(write)g(anything)i(\()p -Fz(e.g.)o FA(,)e(full)g(pipe\).)32 b(Barring)21 b(these)573 -4366 y(two)d(cases,)f(a)g(write)h(either)f(r)o(eturns)g Fz(nwritten)23 -b Fx(>)g Fl(0)p FA(,)17 b(or)h(raises)f(an)g(err)o(or)g(exception.)573 -4519 y(Non-blocking)36 b(i/o)f(is)f(only)i(available)c(on)j(\256le)g -(descriptors)f(and)g(unbuf)o(fer)o(ed)573 4618 y(ports.)27 -b(Doing)21 b(non-blocking)h(i/o)e(to)g(a)f(buf)o(fer)o(ed)e(port)j(is)g(not)h -(well-de\256ned,)e(and)573 4718 y(is)i(an)g(err)o(or)e(\(the)i(pr)o(oblem)f -(is)h(the)g(subsequent)h(\257ush)g(operation\).)365 5147 y -FD(November)c(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 -323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 -5176 323 4 v 1216 w FA(35)p eop +35 40 bop 573 614 a FB(The)26 b Fx(select)e FB(pr)o(ocedur)o(e)h +(allows)i(a)e(pr)o(ocess)h(to)h(block)g(and)f(wait)g(for)g(events)h(on) +573 714 y(multiple)c(I/O)g(channels.)31 b(The)23 b FA(rvec)f +FB(and)g FA(evec)h FB(ar)o(guments)f(ar)o(e)f(vectors)i(of)f(input)573 +814 y(ports)31 b(and)f(integer)h(\002le)f(descriptors;)36 +b FA(wvec)30 b FB(is)h(a)f(vector)g(of)h(output)g(ports)g(and)573 +913 y(integer)f(\002le)g(descriptors.)54 b(The)30 b(pr)o(ocedur)o(e)f +(r)o(eturns)g(thr)o(ee)h(vectors)g(whose)h(el-)573 1013 +y(ements)f(ar)o(e)f(subsets)i(of)f(the)g(corr)o(esponding)g(ar)o +(guments.)54 b(Every)29 b(element)i(of)573 1112 y FA(rvec')22 +b FB(is)g(r)o(eady)f(for)g(input;)i(every)f(element)g(of)g +FA(wvec')g FB(is)g(r)o(eady)e(for)i(output;)h(every)573 +1212 y(element)e(of)f FA(evec')h FB(has)g(an)g(exceptional)f(condition) +i(pending.)573 1350 y(The)d Fx(select)e FB(call)h(will)i(block)g(until) +f(at)g(least)g(one)g(of)g(the)h(I/O)f(channels)h(passed)e(to)573 +1450 y(it)i(is)g(r)o(eady)e(for)h(operation.)26 b(The)19 +b FA(timeout)g FB(value)g(can)h(be)f(used)g(to)h(for)o(ce)f(the)h(call) +f(to)573 1549 y(time-out)i(after)f(a)h(given)g(number)g(of)h(seconds.)k +(It)c(defaults)e(to)h(the)h(special)e(value)573 1649 +y Fx(#f)p FB(,)25 b(meaning)h(wait)f(inde\002nitely)-9 +b(.)40 b(A)25 b(zer)o(o)f(value)g(can)h(be)g(used)g(to)h(poll)g(the)f +(I/O)573 1749 y(channels.)573 1886 y(If)30 b(an)h(I/O)g(channel)g +(appears)f(mor)o(e)g(than)h(once)h(in)f(a)f(given)h(vector)o(\227per)o +(haps)573 1986 y(occuring)25 b(once)g(as)f(a)g(Scheme)h(port,)g(and)f +(once)h(as)g(the)f(port's)h(underlying)h(inte-)573 2086 +y(ger)g(\002le)h(descriptor)o(\227only)f(one)h(of)g(these)g(two)g(r)o +(efer)o(ences)d(may)i(appear)f(in)i(the)573 2185 y(r)o(eturned)h +(vector)-6 b(.)49 b(Buf)o(fer)o(ed)26 b(I/O)k(ports)f(ar)o(e)e(handled) +i(specially\227if)f(an)h(input)573 2285 y(port's)24 b(buf)o(fer)e(is)j +(not)f(empty)-9 b(,)25 b(or)f(an)g(output)g(port's)g(buf)o(fer)f(is)h +(not)h(yet)f(full,)g(then)573 2385 y(these)32 b(ports)g(ar)o(e)e +(immediately)h(consider)o(ed)g(eligible)h(for)g(I/O)g(without)h(using) +573 2484 y(the)25 b(actual,)g(primitive)g Fx(select)d +FB(system)j(call)g(to)g(check)g(the)g(underlying)g(\002le)g(de-)573 +2584 y(scriptor)-6 b(.)51 b(This)29 b(works)h(pr)o(etty)f(well)g(for)g +(buf)o(fer)o(ed)e(input)i(ports,)j(but)d(is)g(a)g(little)573 +2683 y(pr)o(oblematic)20 b(for)g(buf)o(fer)o(ed)e(output)k(ports.)573 +2821 y(The)j Fx(select!)d FB(pr)o(ocedur)o(e)h(is)i(similar)-6 +b(,)26 b(but)f(indicates)g(the)g(subset)h(of)f(active)f(I/O)573 +2921 y(channels)k(by)f(side-ef)o(fecting)f(the)i(ar)o(gument)f +(vectors.)46 b(Non-active)27 b(I/O)h(chan-)573 3021 y(nels)k(in)g(the)g +(ar)o(gument)f(vectors)g(ar)o(e)g(overwritten)g(with)i +Fx(#f)e FB(values.)57 b(The)32 b(call)573 3120 y(r)o(eturns)f(the)g +(number)g(of)h(active)e(elements)i(r)o(emaining)f(in)h(each)e(vector)-6 +b(.)57 b(As)31 b(a)573 3220 y(convenience,)24 b(the)g(vectors)g(passed) +f(in)h(to)g Fx(select!)d FB(ar)o(e)h(allowed)i(to)g(contain)g +Fx(#f)573 3319 y FB(values)c(as)h(well)g(as)f(integers)h(and)g(ports.) +756 3506 y FE(Remark:)56 b Fk(I)20 b(have)h(found)f(the)g +Fh(select!)i Fk(interface)e(to)g(be)h(the)f(mor)o(e)f(useful)g(of)756 +3598 y(the)25 b(two.)44 b(After)24 b(the)i(system)f(call,)h(it)g +(allows)f(you)f(to)i(check)f(a)h(speci\002c)f(I/O)756 +3689 y(channel)20 b(in)f(constant)h(time.)365 3917 y +Fx(\(write-string)39 b FA(string)20 b([fd/port)f(start)i(end])p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(unde\002ned)373 b +FB(pr)o(ocedur)o(e)573 4063 y(This)33 b(pr)o(ocedur)o(e)e(writes)i(all) +f(the)h(data)e(r)o(equested.)60 b(If)33 b(the)g(pr)o(ocedur)o(e)d +(cannot)573 4163 y(perform)d(the)h(write)g(with)h(a)e(single)i(kernel)f +(call)g(\(due)f(to)h(interr)o(upts)g(or)g(partial)573 +4262 y(writes\),)18 b(it)f(will)i(perform)e(multiple)h(write)f +(operations)h(until)g(all)g(the)f(data)g(is)h(writ-)573 +4362 y(ten)25 b(or)h(an)f(err)o(or)f(has)h(occurr)o(ed.)38 +b(A)25 b(non-blocking)i(i/o)f(err)o(or)f(is)g(consider)o(ed)g(an)573 +4462 y(err)o(or)-6 b(.)24 b(\(Err)o(or)17 b(exception)j(packets)e(for)h +(this)h(syscall)f(include)h(the)f(amount)h(of)f(data)573 +4561 y(partially)h(transferr)o(ed)f(befor)o(e)g(the)i(err)o(or)f +(occurr)o(ed.\))573 4699 y(The)35 b(data)f(written)i(ar)o(e)d(the)j +(characters)e(of)h FA(string)g FB(in)h(the)f(half-open)g(interval)573 +4799 y Fm([)p FA(start)p Fy(;)14 b FA(end)p Fm(\))p FB(.)83 +b(The)40 b(default)e(interval)i(is)g(the)g(whole)h(string:)64 +b FA(start)59 b Fm(=)f(0)39 b FB(and)573 4898 y FA(end)26 +b Fm(=)f Fx(\(string-length)38 b FA(string)p Fx(\))p +FB(.)30 b(The)22 b(values)g(of)h FA(start)f FB(and)g +FA(end)g FB(must)h(specify)365 5147 y FE(Mar)o(ch)c(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v +540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w +FB(35)p eop %%Page: 36 42 -36 41 bop 681 614 a Fy(3.2.7)81 b(Buf)o(fered)20 b(I/O)681 -805 y FA(Scheme)30 b(48)f(ports)i(use)f(buf)o(fer)o(ed)e(I/O\320data)i(is)g -(transferr)o(ed)f(to)h(or)h(fr)o(om)f(the)g(OS)h(in)681 904 -y(blocks.)44 b(Scsh)26 b(pr)o(ovides)g(contr)o(ol)g(of)g(this)h(mechanism:)39 -b(the)27 b(pr)o(ogrammer)e(may)h(for)o(ce)681 1004 y(saved-up)13 -b(output)i(data)e(to)i(be)f(transferr)o(ed)e(to)j(the)f(OS)h(when)g(he)f -(chooses,)j(and)c(may)i(also)681 1104 y(choose)i(which)g(I/O)g(buf)o(fering)e -(policy)i(to)g(employ)g(for)f(a)f(given)i(port)f(\(or)h(turn)f(buf)o(fering) -681 1203 y(of)o(f)k(completely\).)805 1333 y(It)d(can)e(be)h(useful)g(to)h -(turn)f(I/O)h(buf)o(fering)e(of)o(f)g(in)i(some)g(cases,)f(for)g(example)f -(when)i(an)681 1433 y(I/O)j(str)o(eam)f(is)h(to)g(be)f(shar)o(ed)g(by)h -(multiple)g(subpr)o(ocesses.)27 b(For)19 b(this)i(r)o(eason,)e(scsh)h(allo-) -681 1532 y(cates)15 b(an)i(unbuf)o(fer)o(ed)d(port)i(for)g(\256le)g -(descriptor)g(0)g(at)g(start-up)f(time.)26 b(Because)16 b(shells)h(fr)o(e-) -681 1632 y(quently)i(shar)o(e)f(stdin)g(with)i(subpr)o(ocesses,)e(if)g(the)g -(shell)h(does)g(buf)o(fer)o(ed)c(r)o(eads,)i(it)i(might)681 -1732 y(\252steal\272)d(input)h(intended)g(for)g(a)g(subpr)o(ocess.)26 -b(For)17 b(this)h(r)o(eason,)f(all)g(shells,)i(including)f(sh,)681 -1831 y(csh,)29 b(and)e(scsh,)i(r)o(ead)d(stdin)h(unbuf)o(fer)o(ed.)45 -b(Applications)28 b(that)f(can)g(tolerate)g(buf)o(fer)o(ed)681 -1931 y(input)f(on)g(stdin)h(can)e(r)o(eset)g Fw(\(current-input-p)o(or)o(t\)) -19 b FA(to)26 b(block)g(buf)o(fering)f(for)h(higher)681 2031 -y(performance.)681 2184 y Fw(\(set-port-buffer)o(in)o(g)38 -b Fz(port)20 b(policy)f([size])p Fw(\))87 b Fs(\000)-15 b(!)88 -b Fz(unde\256ned)376 b FA(pr)o(ocedur)o(e)888 2329 y(This)21 -b(pr)o(ocedur)o(e)e(allows)i(the)g(pr)o(ogrammer)e(to)i(assign)g(a)f -(particular)g(I/O)h(buf)o(fer)o(-)888 2428 y(ing)e(policy)g(to)g(a)f(port,)g -(and)g(to)h(choose)g(the)g(size)f(of)g(the)g(associated)g(buf)o(fer)-6 -b(.)25 b(It)18 b(may)888 2528 y(only)f(be)e(used)h(on)g(new)g(ports,)h -Fz(i.e.)p FA(,)f(befor)o(e)f(I/O)h(is)g(performed)f(on)h(the)g(port.)26 -b(Ther)o(e)888 2628 y(ar)o(e)20 b(thr)o(ee)g(buf)o(fering)f(policies)j(that)e -(may)h(be)g(chosen:)1121 2777 y Fw(bufpol/block)161 b FA(General)20 -b(block)h(buf)o(fering)f(\(general)g(default\))1121 2876 y -Fw(bufpol/line)205 b FA(Line)21 b(buf)o(fering)e(\(tty)i(default\))1121 -2976 y Fw(bufpol/none)205 b FA(Dir)o(ect)20 b(I/O\320no)i(buf)o(fering)888 -3122 y(The)28 b(line)g(buf)o(fering)e(policy)i(\257ushes)h(output)f(whenever) -g(a)f(newline)h(is)g(output;)888 3222 y(whenever)18 b(the)h(buf)o(fer)d(is)j -(full;)g(or)f(whenever)g(an)g(input)h(is)g(r)o(ead)d(fr)o(om)i(stdin.)27 -b(Line)888 3321 y(buf)o(fering)20 b(is)h(the)g(default)f(for)g(ports)h(open)g -(on)h(terminal)f(devices.)888 3458 y(The)30 b Fz(size)h FA(ar)o(gument)f(r)o -(equests)f(an)h(I/O)h(buf)o(fer)d(of)i Fz(size)h FA(bytes.)56 -b(If)29 b(not)i(given,)i(a)888 3558 y(r)o(easonable)22 b(default)g(is)h -(used;)h(if)f(given)g(and)f(zer)o(o,)h(buf)o(fering)f(is)h(turned)g(of)o(f)f -(\()p Fz(i.e.)o FA(,)888 3657 y Fz(size)i Fl(=)f(0)d FA(for)g(any)h(policy)g -(is)h(equivalent)e(to)i Fz(policy)g Fl(=)g Fw(bufpol/none)l -FA(\).)681 3959 y Fw(\(force-output)38 b Fz([fd/port])p Fw(\))85 -b Fs(\000)-15 b(!)87 b Fz(no)21 b(r)o(eturn)g(value)725 b FA(pr)o(ocedur)o(e) -888 4104 y(This)18 b(pr)o(ocedur)o(e)e(does)h(nothing)i(when)f(applied)f(to)h -(an)f(integer)g(\256le)h(descriptor)f(or)888 4204 y(unbuf)o(fer)o(ed)25 -b(port.)45 b(It)27 b(\257ushes)g(buf)o(fer)o(ed)d(output)j(when)h(applied)d -(to)j(a)e(buf)o(fer)o(ed)888 4303 y(port,)21 b(and)f(raises)h(a)f(write-err)o -(or)f(exception)i(on)g(err)o(or)-6 b(.)27 b(Returns)21 b(no)h(value.)681 -4605 y Fw(\(flush-all-ports)o(\))81 b Fs(\000)-14 b(!)87 b -Fz(no)21 b(r)o(eturn)g(value)920 b FA(pr)o(ocedur)o(e)888 4750 -y(This)22 b(pr)o(ocedur)o(e)c(\257ushes)k(all)f(open)g(output)g(ports)g(with) -h(buf)o(fer)o(ed)c(data.)681 5147 y(36)p 1952 5071 323 4 v -1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 -4 v 435 w FD(November)g(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +36 41 bop 888 614 a FB(a)17 b(well-de\002ned)f(interval)g(in)i +FA(str)p FB(,)f FA(i.e.)p FB(,)g Fm(0)23 b Ft(\024)g +FA(start)f Ft(\024)h FA(end)g Ft(\024)g Fx(\(string-length)37 +b FA(str)q Fx(\))o FB(.)888 714 y(A)21 b(zer)o(o-byte)e(write)i(r)o +(eturns)f(immediately)-9 b(,)20 b(with)i(no)f(err)o(or)-6 +b(.)888 849 y(Output)28 b(to)f(buf)o(fer)o(ed)d(ports:)38 +b Fx(write-string)p FB('s)22 b(ef)o(forts)k(end)g(as)h(soon)h(as)e(all) +h(the)888 949 y(data)g(has)h(been)f(placed)g(in)h(the)g(output)g(buf)o +(fer)-6 b(.)45 b(Err)o(ors)27 b(and)g(tr)o(ue)h(output)g(may)888 +1048 y(not)22 b(happen)e(until)i(a)e(later)g(time,)h(of)g(course.)681 +1294 y Fx(\(write-string/pa)o(rt)o(ial)37 b FA(string)19 +b([fd/port)f(start)h(end])p Fx(\))74 b Ft(\000)-14 b(!)75 +b FA(nwritten)87 b FB(pr)o(ocedur)o(e)888 1437 y(This)62 +b(r)o(outine)e(is)h(the)g(atomic)g(best-ef)o(fort/forwar)o(d-pr)o(ogr)o +(ess)c(analog)k(to)888 1537 y Fx(write-string)p FB(.)c(It)32 +b(r)o(eturns)g(the)h(number)g(of)g(bytes)f(written,)k(which)e(may)e(be) +888 1637 y(less)c(than)g(you)h(asked)e(for)-6 b(.)46 +b(Partial)27 b(writes)h(can)g(occur)f(when)i(\(1\))d(we)i(write)g(of)o +(f)888 1736 y(the)23 b(physical)g(end)f(of)g(the)h(media,)f(\(2\))f +(the)h(write)h(is)g(interrr)o(upted,)f(or)g(\(3\))f(the)i(\002le)888 +1836 y(descriptor)e(is)g(set)g(for)f(non-blocking)j(i/o.)888 +1971 y(If)g(the)h(\002le)g(descriptor)f(is)h(not)g(set)f(up)h(for)f +(non-blocking)i(i/o,)g(then)f(a)f(successful)888 2071 +y(r)o(eturn)d(fr)o(om)h(these)f(pr)o(ocedur)o(es)f(makes)i(a)f(forwar)o +(d)f(pr)o(ogr)o(ess)h(guarantee\227that)888 2170 y(is,)h(a)f(partial)g +(write)h(took)h(place)e(of)g(at)h(least)f(one)h(byte:)988 +2341 y Ft(\017)41 b FB(If)23 b(we)g(ar)o(e)f(at)g(the)i(end)f(of)g +(physical)g(media,)g(and)g(no)h(write)f(takes)g(place,)f(an)1071 +2441 y(err)o(or)e(exception)g(is)i(raised.)i(So)d(a)f(r)o(eturn)g +(implies)i(we)e(wr)o(ote)h FA(something)p FB(.)988 2576 +y Ft(\017)41 b FB(If)28 b(the)h(call)f(is)h(interr)o(upted)f(after)f(a) +h(partial)g(transfer)-6 b(,)29 b(it)g(r)o(eturns)f(immedi-)1071 +2675 y(ately)-9 b(.)30 b(But)22 b(if)g(the)g(call)g(is)h(interr)o +(upted)f(befor)o(e)f(any)i(data)e(transfer)-6 b(,)21 +b(then)i(the)1071 2775 y(write)e(is)g(r)o(etried.)888 +2946 y(If)e(we)g(r)o(equest)g(a)g(zer)o(o-byte)f(write,)h(then)g(the)h +(call)f(immediately)g(r)o(eturns)g(0.)24 b(If)19 b(the)888 +3045 y(\002le)24 b(descriptor)g(is)g(set)g(for)f(non-blocking)i(i/o,)h +(then)e(the)g(call)f(may)h(r)o(eturn)f(0)g(if)h(it)888 +3145 y(was)f(unable)f(to)h(immediately)f(write)h(anything)g(\()p +FA(e.g.)o FB(,)g(full)f(pipe\).)30 b(Barring)22 b(these)888 +3245 y(two)c(cases,)g(a)f(write)g(either)h(r)o(eturns)f +FA(nwritten)23 b Fy(>)f Fm(0)p FB(,)c(or)f(raises)h(an)f(err)o(or)f +(exception.)888 3380 y(Non-blocking)36 b(i/o)f(is)g(only)g(available)e +(on)i(\002le)f(descriptors)g(and)g(unbuf)o(fer)o(ed)888 +3479 y(ports.)26 b(Doing)21 b(non-blocking)h(i/o)e(to)h(a)e(buf)o(fer)o +(ed)e(port)j(is)h(not)f(well-de\002ned,)f(and)888 3579 +y(is)i(an)g(err)o(or)f(\(the)g(pr)o(oblem)h(is)g(the)g(subsequent)g +(\003ush)h(operation\).)681 3985 y Fz(3.2.7)81 b(Buf)o(fered)20 +b(I/O)681 4172 y FB(Scheme)30 b(48)f(ports)i(use)f(buf)o(fer)o(ed)e +(I/O\227data)i(is)g(transferr)o(ed)f(to)h(or)h(fr)o(om)f(the)g(OS)h(in) +681 4272 y(blocks.)43 b(Scsh)26 b(pr)o(ovides)g(contr)o(ol)h(of)g(this) +g(mechanism:)37 b(the)27 b(pr)o(ogrammer)f(may)g(for)o(ce)681 +4372 y(saved-up)f(output)i(data)f(to)h(be)f(transferr)o(ed)f(to)i(the)g +(OS)g(when)g(he)g(chooses,)i(and)d(may)681 4471 y(also)31 +b(choose)h(which)h(I/O)e(buf)o(fering)g(policy)g(to)h(employ)g(for)f(a) +g(given)g(port)h(\(or)f(turn)681 4571 y(buf)o(fering)20 +b(of)o(f)f(completely\).)805 4699 y(It)24 b(can)g(be)f(useful)h(to)g +(turn)g(I/O)g(buf)o(fering)f(of)o(f)g(in)h(some)g(cases,)g(for)f +(example)g(when)681 4799 y(an)16 b(I/O)i(str)o(eam)e(is)h(to)g(be)f +(shar)o(ed)g(by)h(multiple)g(subpr)o(ocesses.)24 b(For)17 +b(this)h(r)o(eason,)e(scsh)i(al-)681 4898 y(locates)k(an)g(unbuf)o(fer) +o(ed)f(port)h(for)g(\002le)h(descriptor)f(0)g(at)g(start-up)g(time.)31 +b(Because)21 b(shells)681 5147 y(36)p 1952 5071 323 4 +v 1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 +5176 323 4 v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 37 43 -37 42 bop 365 614 a Fy(3.2.8)81 b(File)20 b(locking)365 820 -y FA(Scsh)i(pr)o(ovides)h(P)t Fr(O)t(S)t(I)t(X)i FA(advisory)d(\256le)g -(locking.)32 b Fz(Advisory)20 b FA(locks)j(ar)o(e)d(locks)j(that)e(can)h(be) -365 920 y(checked)i(by)g(user)g(code,)g(but)g(do)h(not)f(af)o(fect)f(other)h -(I/O)h(operations.)37 b(For)25 b(example,)f(if)365 1020 y(a)d(pr)o(ocess)f -(has)h(an)f(exclusive)h(lock)g(on)h(a)e(r)o(egion)h(of)f(a)h(\256le,)g(other) -g(pr)o(ocesses)f(will)h(not)h(be)365 1119 y(able)h(to)g(obtain)g(locks)h(on)g -(that)f(r)o(egion)g(of)g(the)g(\256le,)g(but)g(they)g(will)h(still)g(be)f -(able)f(to)h(r)o(ead)365 1219 y(and)16 b(write)f(the)h(\256le)g(with)h(no)f -(hindrance.)26 b(Using)16 b(advisory)g(locks)g(r)o(equir)o(es)f(cooperation) -365 1319 y(amongst)22 b(the)f(agents)g(accessing)f(the)h(shar)o(ed)f(r)o -(esour)o(ce.)573 1520 y FD(Remark:)96 b Fj(Unfortunately)-8 -b(,)24 b(P)t Ff(O)t(S)t(I)t(X)f Fj(\256le)e(locks)g(ar)o(e)g(associated)g -(with)h(actual)h(\256les,)573 1611 y(not)c(with)g(associated)f(open)h(\256le) -f(descriptors.)k(Once)d(a)g(pr)o(ocess)d(locks)i(a)h(\256le,)e(using)573 -1703 y(some)f(\256le)i(descriptor)d Fg(fd)p Fj(,)i(the)h(next)g(time)f -Fg(any)g Fj(\256le)h(descriptor)d(r)o(efer)o(encing)g(that)k(\256le)573 -1794 y(is)h(closed,)g(all)g(associated)g(locks)g(ar)o(e)g(r)o(eleased.)29 -b(Scsh)21 b(moves)f(Scheme)h(ports)f(fr)o(om)573 1885 y(\256le)e(descriptor)e -(to)i(\256le)g(descriptor)e(with)j Fi(dup\(\))h Fj(and)e Fi(close\(\))i -Fj(as)e(r)o(equir)o(ed)d(by)j(the)573 1976 y(r)o(untime,)e(so)f(it)h(is)f -(impossible)f(to)i(keep)f(\256le)g(locks)g(open)g(acr)o(oss)g(one)g(of)h -(these)f(shifts.)573 2068 y(Hence)h(we)g(can)g(only)f(of)o(fer)i(P)t -Ff(O)t(S)t(I)t(X)f Fj(advisory)e(\256le)i(locking)e(dir)o(ectly)g(on)i(raw)g -(integer)573 2159 y(\256le)h(descriptors;)f(r)o(egr)o(ettably)-8 -b(,)15 b(ther)o(e)j(ar)o(e)f(no)h(facilities)f(for)g(locking)g(Scheme)h -(ports.)573 2273 y(Note)h(that)h(once)f(a)g(Scheme)g(port)f(is)g(r)o(evealed) -g(in)h(scsh,)f(the)h(r)o(untime)g(will)g(not)g(shift)573 2364 -y(the)h(port)g(ar)o(ound)f(with)i Fi(dup\(\))g Fj(and)f Fi(close\(\))p -Fj(.)30 b(This)19 b(means)h(the)h(\256le-locking)d(pr)o(o-)573 -2456 y(cedur)o(es)f(can)j(then)f(be)g(applied)f(to)h(the)g(port's)f -(associated)g(\256le)g(descriptor)-6 b(.)573 2569 y(NeXTSTEP)13 -b(users)g(should)h(also)g(note)h(that)g(even)g(minimalist)h(P)t -Ff(O)t(S)t(I)t(X)f Fj(\256le)f(locking)g(is)573 2661 y(not)j(supported)f(for) -g(NFS-mounted)g(\256les)h(in)g(NeXTSTEP;)f(NeXT)g(claims)g(they)h(will)573 -2752 y(\256x)h(this)h(in)g(NS)g(r)o(elease)e(4.)492 2962 y -FA(P)t Fr(O)t(S)t(I)t(X)29 b FA(allows)d(the)g(user)f(to)h(lock)g(a)g(r)o -(egion)f(of)h(a)f(\256le)h(with)g(either)g(an)f(exclusive)g(or)365 -3061 y(shar)o(ed)20 b(lock.)28 b(Locked)20 b(r)o(egions)h(ar)o(e)e(described) -h(by)h(the)g Fz(lock-r)o(egion)f FA(r)o(ecor)o(d:)573 3282 -y Fw(\(define-record)38 b(lock-region)660 3381 y(exclusive?)660 -3481 y(start)660 3580 y(len)660 3680 y(whence)660 3780 y(pid\))455 -4000 y FA(The)23 b Fw(exclusive?)18 b FA(\256eld)23 b(is)g(tr)o(ue)f(if)h -(the)f(lock)h(is)g(exclusive;)g(false)f(if)g(it)h(is)g(shar)o(ed.)32 -b(The)365 4100 y Fw(whence)20 b FA(\256eld)j(is)f(one)h(of)f(the)h(values)f -(fr)o(om)g(the)h Fw(seek)d FA(call:)31 b Fw(seek/set)p FA(,)19 -b Fw(seek/delta)p FA(,)f(or)365 4199 y Fw(seek/end)p FA(,)f(and)k(determines) -f(the)h(interpr)o(etation)g(of)f(the)h Fw(start)e FA(\256eld:)490 -4420 y Fs(\017)41 b FA(If)20 b Fw(seek/set)p FA(,)d(the)k Fw(start)e -FA(value)h(is)h(simply)h(an)f(absolute)f(index)h(into)g(the)g(\256le.)490 -4609 y Fs(\017)41 b FA(If)22 b Fw(seek/delta)p FA(,)c(the)k -Fw(start)e FA(value)i(is)h(an)f(of)o(fset)f(fr)o(om)h(the)g(\256le)g -(descriptor)6 b('s)23 b(cur)o(-)573 4709 y(r)o(ent)d(position)i(in)f(the)g -(\256le.)490 4898 y Fs(\017)41 b FA(If)20 b Fw(seek/end)p FA(,)d(the)k -Fw(start)e FA(value)h(is)h(an)g(of)o(fset)f(fr)o(om)g(the)h(end)g(of)f(the)h -(\256le.)365 5147 y FD(November)d(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1216 w FA(37)p eop +37 42 bop 365 614 a FB(fr)o(equently)31 b(shar)o(e)e(stdin)i(with)h +(subpr)o(ocesses,)g(if)f(the)f(shell)i(does)e(buf)o(fer)o(ed)e(r)o +(eads,)j(it)365 714 y(might)e(\223steal\224)d(input)j(intended)e(for)h +(a)f(subpr)o(ocess.)46 b(For)28 b(this)g(r)o(eason,)h(all)e(shells,)j +(in-)365 814 y(cluding)20 b(sh,)h(csh,)f(and)f(scsh,)h(r)o(ead)e(stdin) +i(unbuf)o(fer)o(ed.)j(Applications)d(that)g(can)f(tolerate)365 +913 y(buf)o(fer)o(ed)d(input)j(on)g(stdin)g(can)g(r)o(eset)e +Fx(\(current-input-po)o(rt)o(\))12 b FB(to)19 b(block)g(buf)o(fering)f +(for)365 1013 y(higher)k(performance.)365 1169 y Fx(\(set-port-bufferi) +o(ng)37 b FA(port)20 b(policy)g([size])p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(unde\002ned)377 b FB(pr)o(ocedur)o(e)573 +1316 y(This)21 b(pr)o(ocedur)o(e)d(allows)k(the)e(pr)o(ogrammer)g(to)h +(assign)g(a)f(particular)f(I/O)i(buf)o(fer)o(-)573 1416 +y(ing)30 b(policy)h(to)f(a)g(port,)i(and)d(to)i(choose)f(the)g(size)g +(of)g(the)g(associated)f(buf)o(fer)-6 b(.)52 b(It)573 +1516 y(may)20 b(only)h(be)f(used)g(on)g(new)h(ports,)f +FA(i.e.)p FB(,)g(befor)o(e)f(I/O)h(is)h(performed)e(on)h(the)h(port.) +573 1615 y(Ther)o(e)f(ar)o(e)f(thr)o(ee)h(buf)o(fering)g(policies)h +(that)g(may)f(be)h(chosen:)805 1771 y Fx(bufpol/block)161 +b FB(General)21 b(block)g(buf)o(fering)f(\(general)g(default\))805 +1870 y Fx(bufpol/line)205 b FB(Line)21 b(buf)o(fering)f(\(tty)h +(default\))805 1970 y Fx(bufpol/none)205 b FB(Dir)o(ect)21 +b(I/O\227no)h(buf)o(fering)573 2123 y(The)27 b(line)h(buf)o(fering)f +(policy)h(\003ushes)h(output)f(whenever)f(a)g(newline)h(is)g(output;) +573 2222 y(whenever)18 b(the)h(buf)o(fer)d(is)j(full;)g(or)g(whenever)f +(an)g(input)h(is)g(r)o(ead)d(fr)o(om)i(stdin.)26 b(Line)573 +2322 y(buf)o(fering)20 b(is)h(the)g(default)e(for)i(ports)g(open)g(on)g +(terminal)g(devices.)573 2461 y(The)30 b FA(size)h FB(ar)o(gument)e(r)o +(equests)i(an)f(I/O)g(buf)o(fer)f(of)h FA(size)h FB(bytes.)54 +b(If)29 b(not)i(given,)i(a)573 2561 y(r)o(easonable)22 +b(default)g(is)h(used;)g(if)g(given)g(and)g(zer)o(o,)f(buf)o(fering)g +(is)h(turned)g(of)o(f)f(\()p FA(i.e.)p FB(,)573 2660 +y FA(size)h Fm(=)g(0)d FB(for)h(any)g(policy)g(is)g(equivalent)g(to)g +FA(policy)h Fm(=)h Fx(bufpol/none)-5 b FB(\).)365 2970 +y Fx(\(force-output)39 b FA([fd/port])p Fx(\))84 b Ft(\000)-14 +b(!)87 b FA(unde\002ned)915 b FB(pr)o(ocedur)o(e)573 +3118 y(This)27 b(pr)o(ocedur)o(e)e(does)i(nothing)i(when)f(applied)e +(to)h(an)g(integer)g(\002le)g(descriptor)573 3218 y(or)18 +b(unbuf)o(fer)o(ed)e(port.)25 b(It)18 b(\003ushes)h(buf)o(fer)o(ed)d +(output)j(when)g(applied)e(to)h(a)g(buf)o(fer)o(ed)573 +3317 y(port,)i(and)h(raises)f(a)g(write-err)o(or)g(exception)h(on)g +(err)o(or)-6 b(.)24 b(Returns)e(no)f(value.)365 3627 +y Fx(\(flush-all-ports\))80 b Ft(\000)-14 b(!)87 b FA(unde\002ned)1111 +b FB(pr)o(ocedur)o(e)573 3775 y(This)21 b(pr)o(ocedur)o(e)e(\003ushes)j +(all)e(open)h(output)h(ports)f(with)g(buf)o(fer)o(ed)d(data.)365 +4205 y Fz(3.2.8)81 b(File)20 b(locking)365 4400 y FB(Scsh)i(pr)o +(ovides)h(P)t Fs(O)t(S)t(I)t(X)j FB(advisory)c(\002le)g(locking.)30 +b FA(Advisory)21 b FB(locks)h(ar)o(e)f(locks)h(that)g(can)g(be)365 +4500 y(checked)i(by)g(user)g(code,)h(but)f(do)g(not)h(af)o(fect)e +(other)h(I/O)h(operations.)36 b(For)25 b(example,)f(if)365 +4599 y(a)d(pr)o(ocess)f(has)h(an)f(exclusive)h(lock)g(on)h(a)e(r)o +(egion)h(of)f(a)h(\002le,)g(other)g(pr)o(ocesses)f(will)h(not)h(be)365 +4699 y(able)h(to)g(obtain)g(locks)h(on)g(that)f(r)o(egion)g(of)g(the)g +(\002le,)g(but)g(they)g(will)h(still)g(be)f(able)f(to)h(r)o(ead)365 +4799 y(and)16 b(write)g(the)g(\002le)g(with)h(no)g(hindrance.)23 +b(Using)17 b(advisory)e(locks)i(r)o(equir)o(es)e(cooperation)365 +4898 y(amongst)22 b(the)f(agents)g(accessing)f(the)h(shar)o(ed)f(r)o +(esour)o(ce.)365 5147 y FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(37)p +eop %%Page: 38 44 -38 43 bop 681 614 a FA(The)17 b(r)o(egion)h(of)f(the)h(\256le)g(being)f -(locked)h(is)g(given)f(by)h(the)g Fw(start)d FA(and)i Fw(len)f -FA(\256elds.)27 b(The)17 b Fw(pid)681 714 y FA(\256eld)j(gives)h(the)g(pr)o -(ocess)f(id)g(of)h(the)f(pr)o(ocess)g(holding)i(the)f(r)o(egion)f(lock,)h -(when)g(r)o(elevant)681 814 y(\(see)f Fw(get-lock-region)14 -b FA(below\).)681 958 y Fw(\(make-lock-regio)o(n)37 b Fz(exclusive?)16 -b(start)g(len)h([whence])p Fw(\))56 b Fs(\000)-14 b(!)58 b -Fz(lock-r)o(egion)86 b FA(pr)o(ocedur)o(e)888 1094 y(This)24 -b(pr)o(ocedur)o(e)d(makes)i(a)f(lock-r)o(egion)h(r)o(ecor)o(d.)32 -b(The)23 b Fw(whence)e FA(\256eld)i(defaults)f(to)888 1194 -y Fw(seek/set)p FA(.)681 1477 y Fw(\(lock-region)38 b Fz(fdes)21 -b(lock)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)960 -b FA(pr)o(ocedur)o(e)681 1576 y Fw(\(lock-region/no-)o(bl)o(ock)37 -b Fz(fdes)21 b(lock)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(boolean)648 -b FA(pr)o(ocedur)o(e)888 1712 y(These)31 b(pr)o(ocedur)o(es)d(lock)j(a)f(r)o -(egion)h(of)f(the)h(\256le)g(r)o(efer)o(enced)c(by)k(\256le)f(descriptor)888 -1812 y Fz(fdes)q FA(.)25 b(The)16 b Fw(lock-region)c FA(pr)o(ocedur)o(e)i -(blocks)i(until)h(the)f(lock)g(is)h(granted;)f(the)g(non-)888 -1912 y(blocking)j(variant)e(r)o(eturns)f(a)h(boolean)h(indicating)g(whether)g -(or)f(not)i(the)e(lock)h(was)888 2011 y(granted.)681 2195 y -Fw(\(get-lock-region)37 b Fz(fdes)21 b(lock)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(lock-r)o(egion)20 b(or)h Fw(#f)548 b FA(pr)o(ocedur)o(e)888 -2331 y(Return)20 b(the)f(\256rst)h(lock)g(r)o(egion)f(on)h -Fz(fdes)f FA(that)g(overlaps)g(with)h(the)g(lock)f(r)o(egion)h -Fz(lock)o FA(.)888 2430 y(If)h(ther)o(e)f(is)h(no)h(such)f(lock,)g(r)o(eturn) -f(false.)27 b(This)22 b(pr)o(ocedur)o(e)d(\256lls)i(out)h(the)f -Fw(pid)e FA(\256eld)888 2530 y(of)24 b(the)g(r)o(eturned)f(lock)h(r)o(egion,) -h(and)e(is)h(the)h(only)f(pr)o(ocedur)o(e)e(that)i(has)g(anything)888 -2630 y(to)d(do)g(with)h(this)f(\256eld.)681 2913 y Fw(\(unlock-region)38 -b Fz(fdes)21 b(lock)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)873 -b FA(pr)o(ocedur)o(e)888 3049 y(Release)21 b(a)f(lock)h(fr)o(om)g(a)f -(\256le.)681 3332 y Fw(\(with-region-loc)o(k*)37 b Fz(fdes)21 -b(lock)f(thunk)p Fw(\))87 b Fs(\000)-15 b(!)88 b Fz(value\(s\))20 -b(of)h(thunk)241 b FA(pr)o(ocedur)o(e)681 3431 y Fw(\(with-region-loc)o(k)37 -b Fz(fdes)21 b(lock)g(body)f Fx(:)14 b(:)g(:)f Fw(\))87 b Fs(\000)-14 -b(!)87 b Fz(value\(s\))20 b(of)h(body)368 b FA(syntax)888 3567 -y(This)22 b(pr)o(ocedur)o(e)d(obtains)i(the)g(r)o(equested)f(lock,)h(and)f -(then)i(calls)e Fw(\()p Fz(thunk)o Fw(\))p FA(.)28 b(When)888 -3667 y Fz(thunk)g FA(r)o(eturns,)h(the)g(lock)g(is)f(r)o(eleased.)49 -b(A)28 b(non-local)h(exit)f(\()p Fz(e.g.)o FA(,)i(thr)o(owing)f(to)g(a)888 -3767 y(saved)22 b(continuation)h(or)f(raising)h(an)f(exception\))f(also)i -(causes)e(the)i(lock)f(to)h(be)e(r)o(e-)888 3866 y(leased.)888 -3997 y(After)40 b(a)g(normal)i(r)o(eturn)e(fr)o(om)g Fz(thunk)p -FA(,)45 b(its)c(r)o(eturn)f(values)h(ar)o(e)e(r)o(eturned)h(by)888 -4096 y Fw(with-region-lock*)o FA(.)g(The)27 b Fw(with-region-lock)20 -b FA(special)27 b(form)g(is)g(equivalent)888 4196 y(syntactic)21 -b(sugar)-6 b(.)681 4485 y Fu(3.3)99 b(File)25 b(system)681 -4699 y FA(Besides)14 b(the)h(following)i(pr)o(ocedur)o(es,)d(which)i(allow)f -(access)g(to)g(the)g(computer)6 b('s)16 b(\256le)f(sys-)681 -4799 y(tem,)20 b(scsh)g(also)g(pr)o(ovides)f(a)g(set)h(of)f(pr)o(ocedur)o(es) -f(which)j(manipulate)e(\256le)h Fz(names)p FA(.)27 b(These)681 -4898 y(string-pr)o(ocessing)21 b(pr)o(ocedur)o(es)e(ar)o(e)g(documented)i(in) -g(section)h(5.1.3.)681 5147 y(38)p 1952 5071 323 4 v 1952 5173 -4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 -w FD(November)c(1,)h(1995)h(\261)f(15)13 b(:)f(58)p eop +38 43 bop 888 614 a FE(Remark:)94 b Fk(Unfortunately)-8 +b(,)24 b(P)t Fg(O)t(S)t(I)t(X)f Fk(\002le)f(locks)f(ar)o(e)g +(associated)h(with)g(actual)h(\002les,)888 706 y(not)d(with)f +(associated)f(open)h(\002le)f(descriptors.)j(Once)e(a)g(pr)o(ocess)d +(locks)i(a)h(\002le,)f(using)888 797 y(some)f(\002le)g(descriptor)e +Fi(fd)q Fk(,)i(the)h(next)f(time)h Fi(any)f Fk(\002le)g(descriptor)e(r) +o(efer)o(encing)h(that)j(\002le)888 888 y(is)e(closed,)f(all)i +(associated)f(locks)f(ar)o(e)h(r)o(eleased.)j(This)d(sever)o(ely)e +(limits)i(the)h(utility)f(of)890 980 y(P)t Fg(O)t(S)t(I)t(X)i +Fk(advisory)d(\002le)i(locks,)e(and)j(we'd)e(r)o(ecommend)f(caution)j +(when)g(using)e(them.)888 1071 y(It)30 b(is)f(not)g(without)i(r)o +(eason)d(that)j(the)e(Fr)o(eeBSD)f(man)i(pages)e(r)o(efer)f(to)32 +b(P)t Fg(O)t(S)t(I)t(X)e Fk(\002le)888 1162 y(locking)18 +b(as)h(\223completely)f(stupid.\224)888 1270 y(Scsh)i(moves)e(Scheme)h +(ports)g(fr)o(om)e(\002le)i(descriptor)e(to)i(\002le)g(descriptor)e +(with)i Fh(dup\(\))888 1361 y Fk(and)c Fh(close\(\))h +Fk(as)f(r)o(equir)o(ed)c(by)j(the)h(r)o(untime,)h(so)d(it)i(is)f +(impossible)f(to)h(keep)f(\002le)i(locks)888 1452 y(open)25 +b(acr)o(oss)e(one)i(of)f(these)h(shifts.)40 b(Hence)25 +b(we)g(can)g(only)f(of)o(fer)h(P)t Fg(O)t(S)t(I)t(X)h +Fk(advisory)888 1544 y(\002le)17 b(locking)g(dir)o(ectly)e(on)j(raw)f +(integer)f(\002le)h(descriptors;)f(r)o(egr)o(ettably)-8 +b(,)15 b(ther)o(e)i(ar)o(e)f(no)888 1635 y(facilities)i(for)g(locking)g +(Scheme)h(ports.)888 1742 y(Note)g(that)h(once)f(a)g(Scheme)g(port)g +(is)f(r)o(evealed)f(in)i(scsh,)f(the)i(r)o(untime)f(will)f(not)h(shift) +888 1834 y(the)i(port)e(ar)o(ound)h(with)h Fh(dup\(\))g +Fk(and)f Fh(close\(\))p Fk(.)29 b(This)19 b(means)i(the)f +(\002le-locking)f(pr)o(o-)888 1925 y(cedur)o(es)e(can)j(then)g(be)f +(applied)e(to)i(the)h(port's)d(associated)i(\002le)f(descriptor)-6 +b(.)888 2032 y(NeXTSTEP)21 b(users)e(should)i(also)f(note)i(that)h +(even)e(minimalist)i(P)t Fg(O)t(S)t(I)t(X)f Fk(\002le)e(locking)888 +2124 y(is)k(not)h(supported)e(for)g(NFS-mounted)h(\002les)g(in)g +(NeXTSTEP;)g(NeXT)f(claims)h(they)888 2215 y(will)19 +b(\002x)g(this)h(in)f(NS)h(r)o(elease)d(4.)25 b(W)-7 +b(e'd)19 b(appr)o(eciate)f(hearing)i(fr)o(om)e(users)g(when)i(and)888 +2306 y(if)f(this)g(happens.)807 2479 y FB(P)t Fs(O)t(S)t(I)t(X)29 +b FB(allows)e(the)e(user)h(to)g(lock)g(a)f(r)o(egion)h(of)f(a)g(\002le) +h(with)h(either)e(an)h(exclusive)f(or)681 2578 y(shar)o(ed)19 +b(lock.)26 b(Locked)21 b(r)o(egions)g(ar)o(e)e(described)h(by)g(the)h +FA(lock-r)o(egion)f FB(r)o(ecor)o(d:)888 2767 y Fx(\(define-record)38 +b(lock-region)976 2867 y(exclusive?)976 2966 y(start)976 +3066 y(len)976 3166 y(whence)976 3265 y(proc\))805 3642 +y Ft(\017)j FB(The)21 b Fx(exclusive?)c FB(\002eld)j(is)h(tr)o(ue)g(if) +g(the)g(lock)g(is)g(exclusive;)f(false)g(if)h(it)g(is)g(shar)o(ed.)805 +3807 y Ft(\017)41 b FB(The)e Fx(whence)d FB(\002eld)j(is)g(one)h(of)e +(the)h(values)g(fr)o(om)f(the)h Fx(seek)e FB(call:)62 +b Fx(seek/set)p FB(,)888 3907 y Fx(seek/delta)p FB(,)15 +b(or)20 b Fx(seek/end)p FB(,)c(and)i(determines)i(the)f(interpr)o +(etation)g(of)g(the)g Fx(start)888 4006 y FB(\002eld:)988 +4171 y Fz(\226)41 b FB(If)30 b Fx(seek/set)p FB(,)f(the)i +Fx(start)d FB(value)i(is)h(simply)g(an)f(absolute)g(index)h(into)g(the) +1071 4271 y(\002le.)988 4403 y Fz(\226)41 b FB(If)21 +b Fx(seek/delta)p FB(,)16 b(the)21 b Fx(start)e FB(value)h(is)i(an)e +(of)o(fset)g(fr)o(om)h(the)g(\002le)g(descriptor)6 b('s)1071 +4502 y(curr)o(ent)20 b(position)i(in)f(the)g(\002le.)988 +4634 y Fz(\226)41 b FB(If)20 b Fx(seek/end)p FB(,)e(the)i +Fx(start)f FB(value)h(is)h(an)g(of)o(fset)f(fr)o(om)g(the)h(end)g(of)f +(the)h(\002le.)888 4799 y(The)k(r)o(egion)h(of)f(the)g(\002le)g(being)g +(locked)h(is)f(given)g(by)g(the)h Fx(start)d FB(and)h +Fx(len)g FB(\002elds;)888 4898 y(if)33 b Fx(len)e FB(is)i(zer)o(o,)h +(it)f(means)g(\223in\002nity)-9 b(,\224)36 b(that)c(is,)k(the)d(r)o +(egion)f(extends)h(fr)o(om)f(the)681 5147 y(38)p 1952 +5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 +5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21) +13 b(:)f(47)p eop %%Page: 39 45 -39 44 bop 365 614 a Fw(\(create-directory)37 b Fz(fname)21 -b([perms)f(override?])p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)207 -b FA(pr)o(ocedur)o(e)365 714 y Fw(\(create-fifo)39 b Fz(fname)21 -b([perms)f(override?])p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)425 -b FA(pr)o(ocedur)o(e)365 814 y Fw(\(create-hard-link)37 b Fz(oldname)15 -b(newname)h([override?])p Fw(\))54 b Fs(\000)-15 b(!)55 b Fz(unde\256ned)88 -b FA(pr)o(ocedur)o(e)365 913 y Fw(\(create-symlink)38 b Fz(old-name)17 -b(new-name)g([override?])p Fw(\))68 b Fs(\000)-14 b(!)68 b -Fz(unde\256ned)88 b FA(pr)o(ocedur)o(e)573 1043 y(These)21 -b(pr)o(ocedur)o(es)e(cr)o(eate)g(objects)i(of)g(various)f(kinds)i(in)f(the)g -(\256le)g(system.)573 1171 y(The)h Fz(override?)g FA(ar)o(gument)f(contr)o -(ols)i(the)f(action)h(if)f(ther)o(e)f(is)h(alr)o(eady)f(an)h(object)g(in)573 -1270 y(the)f(\256le)g(system)g(with)h(the)f(new)g(name:)756 -1407 y Fw(#f)273 b FA(signal)21 b(an)f(err)o(or)g(\(default\))756 -1556 y Fw('query)97 b FA(pr)o(ompt)20 b(the)h(user)756 1706 -y Fz(other)190 b FA(delete)29 b(the)h(old)g(object)g(\(with)g -Fw(delete-file)25 b FA(or)1117 1805 y Fw(delete-director)o(y,)h -FA(as)31 b(appr)o(opriate\))f(befor)o(e)1117 1905 y(cr)o(eating)20 -b(the)g(new)i(object.)573 2064 y Fz(Perms)f FA(defaults)f(to)h -Fw(#o777)e FA(\(but)h(is)h(masked)g(by)f(the)h(curr)o(ent)f(umask\).)756 -2222 y FD(Remark:)53 b Fj(Curr)o(ently)-8 b(,)15 b(if)i(you)g(try)g(to)h(cr)o -(eate)f(a)h(har)o(d)f(or)g(symbolic)f(link)h(fr)o(om)g(a)756 -2313 y(\256le)k(to)g(itself,)g(you)g(will)g(err)o(or)e(out)j(with)g -Fg(override?)h Fj(false,)e(and)h(simply)e(delete)756 2404 y(your)j(\256le)i -(with)h Fg(override?)h Fj(tr)o(ue.)44 b(Catching)26 b(this)f(will)g(r)o -(equir)o(e)d(some)j(sort)f(of)756 2496 y(tr)o(ue-name)19 b(pr)o(ocedur)o(e,)d -(which)k(I)e(curr)o(ently)g(do)g(not)h(have.)365 2825 y Fw -(\(delete-directory)37 b Fz(fname)p Fw(\))87 b Fs(\000)-15 -b(!)88 b Fz(unde\256ned)820 b FA(pr)o(ocedur)o(e)365 2925 y -Fw(\(delete-file)39 b Fz(fname)p Fw(\))87 b Fs(\000)-15 b(!)88 -b Fz(unde\256ned)1038 b FA(pr)o(ocedur)o(e)365 3024 y Fw(\(delete-filesys-o)o -(bj)o(ect)37 b Fz(fname)p Fw(\))87 b Fs(\000)-15 b(!)87 b Fz(unde\256ned)603 -b FA(pr)o(ocedur)o(e)573 3155 y(These)42 b(pr)o(ocedur)o(es)f(delete)h -(objects)h(fr)o(om)f(the)h(\256le)f(system.)94 b(The)42 b Fw(delete-)573 -3254 y(filesys-object)15 b FA(pr)o(ocedur)o(e)j(will)j(delete)f(an)g(object)h -(of)g(any)f(type)h(fr)o(om)f(the)g(\256le)573 3354 y(system:)28 -b(\256les,)21 b(\(empty\))f(dir)o(ectories,)g(symlinks,)i(\256fos,)f -Fz(etc.)p FA(.)365 3589 y Fw(\(read-symlink)39 b Fz(fname)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(string)1122 b FA(pr)o(ocedur)o(e)573 -3719 y(Return)21 b(the)g(\256lename)g(r)o(efer)o(enced)d(by)j(symbolic)g -(link)h Fw(fname)p FA(.)365 3954 y Fw(\(rename-file)39 b Fz(old-fname)20 -b(new-fname)h([override?])p Fw(\))85 b Fs(\000)-14 b(!)87 b -Fz(unde\256ned)130 b FA(pr)o(ocedur)o(e)573 4085 y(If)34 b(you)g(override)f -(an)h(existing)h(object,)j(then)c Fz(old-fname)f FA(and)h Fz(new-fname)g -FA(must)573 4184 y(type-match\320either)26 b(both)h(dir)o(ectories,)f(or)h -(both)g(non-dir)o(ectories.)44 b(This)27 b(is)g(r)o(e-)573 -4284 y(quir)o(ed)20 b(by)h(the)g(semantics)g(of)g(Unix)f Fw(rename\(\))p -FA(.)756 4442 y FD(Remark:)189 b Fj(Ther)o(e)36 b(is)g(an)i(unfortunate)g -(atomicity)g(pr)o(oblem)d(with)j(the)756 4533 y Fi(rename-file)c -Fj(pr)o(ocedur)o(e:)49 b(if)31 b(you)h(specify)f(no-override,)i(but)g(cr)o -(eate)e(\256le)756 4624 y Fi(new-fname)21 b Fj(sometime)d(between)j -Fi(rename-file)p Fj('s)g(existence)e(check)g(and)h(the)756 -4716 y(actual)i(r)o(ename)g(operation,)g(your)e(\256le)i(will)f(be)h(clobber) -o(ed)f(with)h Fi(old-fname)p Fj(.)756 4807 y(Ther)o(e)33 b(is)g(no)i(way)f -(to)h(\256x)f(this)g(pr)o(oblem,)j(given)d(the)h(semantics)f(of)g(Unix)756 -4898 y Fi(rename\(\))p Fj(;)20 b(at)f(least)g(it)f(is)h(highly)f(unlikely)f -(to)i(occur)f(in)h(practice.)365 5147 y FD(November)f(1,)h(1995)h(\261)f(15) -14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1216 w FA(39)p eop +39 44 bop 573 614 a FB(starting)24 b(point)h(thr)o(ough)f(the)g(end)g +(of)g(the)g(\002le,)g(even)g(as)f(the)h(\002le)g(is)h(extended)d(by)573 +714 y(subsequent)f(write)g(operations.)490 866 y Ft(\017)41 +b FB(The)21 b Fx(proc)e FB(\002eld)i(gives)g(the)g(pr)o(ocess)g(object) +g(for)g(the)g(pr)o(ocess)f(holding)i(the)g(r)o(egion)573 +965 y(lock,)f(when)g(r)o(elevant)f(\(see)g Fx(get-lock-region)15 +b FB(below\).)365 1138 y Fx(\(make-lock-region)37 b FA(exclusive?)17 +b(start)g(len)g([whence])p Fx(\))55 b Ft(\000)-14 b(!)56 +b FA(lock-r)o(egion)87 b FB(pr)o(ocedur)o(e)573 1264 +y(This)24 b(pr)o(ocedur)o(e)d(makes)i(a)f(lock-r)o(egion)i(r)o(ecor)o +(d.)30 b(The)23 b Fx(whence)e FB(\002eld)i(defaults)f(to)573 +1364 y Fx(seek/set)p FB(.)365 1633 y Fx(\(lock-region)39 +b FA(fdes)21 b(lock)p Fx(\))87 b Ft(\000)-15 b(!)88 b +FA(unde\002ned)960 b FB(pr)o(ocedur)o(e)365 1733 y Fx +(\(lock-region/no-b)o(lo)o(ck)37 b FA(fdes)21 b(lock)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(boolean)648 b FB(pr)o(ocedur)o(e)573 +1859 y(These)30 b(pr)o(ocedur)o(es)f(lock)i(a)f(r)o(egion)g(of)h(the)f +(\002le)h(r)o(efer)o(enced)d(by)i(\002le)h(descriptor)573 +1959 y FA(fdes)p FB(.)60 b(The)32 b Fx(lock-region)c +FB(pr)o(ocedur)o(e)i(blocks)j(until)g(the)g(lock)g(is)f(granted;)37 +b(the)573 2059 y(non-blocking)18 b(variant)e(r)o(eturns)h(a)f(boolean)h +(indicating)g(whether)h(or)f(not)g(the)g(lock)573 2158 +y(was)29 b(granted.)51 b(T)-8 b(o)30 b(take)f(an)g(exclusive)g +(\(write\))f(lock,)k(you)e(must)g(have)f(the)g(\002le)573 +2258 y(descriptor)21 b(open)g(with)i(write)e(access;)g(to)g(take)g(a)g +(shar)o(ed)f(\(r)o(ead\))f(lock,)j(you)g(must)573 2357 +y(have)e(the)h(\002le)g(descriptor)f(open)h(with)h(r)o(ead)d(access.) +365 2527 y Fx(\(get-lock-region)37 b FA(fdes)21 b(lock)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(lock-r)o(egion)20 +b(or)h Fx(#f)548 b FB(pr)o(ocedur)o(e)573 2653 y(Return)27 +b(the)g(\002rst)h(lock)f(r)o(egion)g(on)h FA(fdes)f FB(that)g(would)g +(con\003ict)h(with)g(lock)g(r)o(egion)573 2753 y FA(lock)o +FB(.)34 b(If)22 b(ther)o(e)h(is)h(no)g(such)f(lock)h(r)o(egion,)g(r)o +(eturn)e(false.)33 b(This)24 b(pr)o(ocedur)o(e)d(\002lls)j(out)573 +2853 y(the)e Fx(proc)f FB(\002eld)h(of)g(the)g(r)o(eturned)f(lock)i(r)o +(egion,)f(and)g(is)g(the)g(only)h(pr)o(ocedur)o(e)e(that)573 +2952 y(has)k(anything)h(to)f(do)g(with)g(this)h(\002eld.)37 +b(\(See)24 b(section)i(3.4.1)d(for)h(a)g(description)i(of)573 +3052 y(pr)o(ocess)i(objects.\))48 b(Note)29 b(that)f(if)g(you)h(apply)f +(this)h(pr)o(ocedur)o(e)e(to)h(a)g(\002le)h(system)573 +3152 y(that)19 b(is)g(shar)o(ed)f(acr)o(oss)g(multiple)i(operating)f +(systems)g(\()p FA(i.e.)p FB(,)g(an)g(NFS)f(\002le)h(system\),)573 +3251 y(the)27 b Fx(proc)e FB(\002eld)h(may)h(be)f(ambiguous.)44 +b(W)-8 b(e)27 b(note,)h(again,)g(that)h(P)t Fs(O)t(S)t(I)t(X)h +FB(advisory)573 3351 y(\002le)21 b(locking)h(is)f(not)g(a)g(terribly)f +(useful)h(or)g(well-designed)f(facility)-9 b(.)365 3620 +y Fx(\(unlock-region)38 b FA(fdes)21 b(lock)p Fx(\))87 +b Ft(\000)-14 b(!)87 b FA(unde\002ned)873 b FB(pr)o(ocedur)o(e)573 +3746 y(Release)20 b(a)h(lock)g(fr)o(om)f(a)g(\002le.)365 +4015 y Fx(\(with-region-lock)o(*)37 b FA(fdes)21 b(lock)g(thunk)p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(value\(s\))20 b(of)h(thunk)242 +b FB(pr)o(ocedur)o(e)365 4115 y Fx(\(with-region-lock)37 +b FA(fdes)21 b(lock)f(body)g(.)12 b(.)g(.)g Fx(\))88 +b Ft(\000)-15 b(!)88 b FA(value\(s\))20 b(of)g(body)379 +b FB(syntax)573 4242 y(This)21 b(pr)o(ocedur)o(e)e(obtains)j(the)f(r)o +(equested)f(lock,)i(and)e(then)i(calls)e Fx(\()p FA(thunk)o +Fx(\))p FB(.)26 b(When)573 4341 y FA(thunk)i FB(r)o(eturns,)h(the)g +(lock)g(is)g(r)o(eleased.)46 b(A)28 b(non-local)i(exit)e(\()p +FA(e.g.)o FB(,)i(thr)o(owing)f(to)g(a)573 4441 y(saved)j(continuation)j +(or)e(raising)g(an)g(exception\))g(also)g(causes)g(the)g(lock)g(to)h +(be)573 4541 y(r)o(eleased.)573 4666 y(After)40 b(a)g(normal)h(r)o +(eturn)f(fr)o(om)h FA(thunk)o FB(,)46 b(its)41 b(r)o(eturn)f(values)g +(ar)o(e)g(r)o(eturned)f(by)573 4766 y Fx(with-region-lock)o(*)p +FB(.)f(The)28 b Fx(with-region-loc)o(k)21 b FB(special)27 +b(form)g(is)g(equivalent)573 4865 y(syntactic)21 b(sugar)-6 +b(.)365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(39)p +eop %%Page: 40 46 -40 45 bop 681 769 a Fw(\(set-file-mode)38 b Fz(fname/fd/port)18 -b(mode)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)503 -b FA(pr)o(ocedur)o(e)681 869 y Fw(\(set-file-owner)37 b Fz(fname/fd/port)19 -b(uid)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)524 -b FA(pr)o(ocedur)o(e)681 968 y Fw(\(set-file-group)37 b Fz(fname/fd/port)19 -b(gid)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)528 -b FA(pr)o(ocedur)o(e)888 1115 y(These)18 b(pr)o(ocedur)o(es)f(set)h(the)g -(permission)h(bits,)g(owner)f(id,)g(and)g(gr)o(oup)g(id)g(of)g(a)f(\256le,) -888 1215 y(r)o(espectively)-9 b(.)26 b(The)18 b(\256le)h(can)g(be)f -(speci\256ed)g(by)h(giving)h(the)e(\256le)h(name,)g(or)g(either)f(an)888 -1314 y(integer)i(\256le)f(descriptor)g(or)h(a)f(port)g(open)h(on)g(the)f -(\256le.)28 b(Setting)19 b(\256le)h(user)f(or)g(gr)o(oup)888 -1414 y(ownership)j(usually)f(r)o(equir)o(es)f(r)o(oot)h(privileges.)681 -1621 y Fw(\(set-file-times)37 b Fz(fname)21 b([access-time)f(mod-time])p -Fw(\))85 b Fs(\000)-15 b(!)87 b Fz(unde\256ned)116 b FA(pr)o(ocedur)o(e)888 -1768 y(This)20 b(pr)o(ocedur)o(e)d(sets)i(the)g(access)f(and)h(modi\256ed)g -(times)g(for)g(the)g(\256le)g Fz(fname)g FA(to)g(the)888 1867 -y(supplied)26 b(values)g(\(see)f(section)i(3.10)e(for)g(the)i(scsh)f(r)o(epr) -o(esentation)f(of)h(time\).)43 b(If)888 1967 y(neither)24 b(time)h(ar)o -(gument)e(is)h(supplied,)h(they)f(ar)o(e)f(both)h(taken)g(to)g(be)g(the)g -(curr)o(ent)888 2066 y(time.)j(Y)-8 b(ou)20 b(must)f(pr)o(ovide)e(both)i -(times)g(or)f(neither)-6 b(.)27 b(If)18 b(the)g(pr)o(ocedur)o(e)f(completes) -888 2166 y(successfully)-9 b(,)24 b(the)f(\256le's)h(time)f(of)g(last)g -(status-change)g(\()p Fw(ctime)p FA(\))e(is)i(set)g(to)h(the)f(cur)o(-)888 -2266 y(r)o(ent)e(time.)681 2473 y Fw(\(sync-file)39 b Fz(fd/port)p -Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)1101 b FA(pr)o(ocedur)o(e)681 -2572 y Fw(\(sync-file-syste)o(m\))81 b Fs(\000)-15 b(!)87 b -Fz(unde\256ned)1067 b FA(pr)o(ocedur)o(e)888 2719 y(Calling)28 -b Fw(sync-file)c FA(causes)j(Unix)h(to)g(update)e(the)i(disk)g(data)e(str)o -(uctur)o(es)h(for)h(a)888 2819 y(given)17 b(\256le.)26 b(If)17 -b Fz(fd/port)e FA(is)i(a)f(port,)h(any)g(buf)o(fer)o(ed)d(data)h(it)i(may)g -(have)f(is)h(\256rst)g(\257ushed.)888 2918 y(Calling)34 b Fw -(sync-file-system)26 b FA(synchr)o(onises)35 b(the)e(kernel's)g(entir)o(e)g -(\256le)g(system)888 3018 y(with)22 b(the)f(disk.)888 3156 -y(These)43 b(pr)o(ocedur)o(es)e(ar)o(e)g(not)k(P)t Fr(O)t(S)t(I)t(X)r -FA(.)94 b(Inter)o(estingly)43 b(enough,)49 b Fw(sync-file-)888 -3256 y(system)23 b FA(doesn't)k(actually)e(do)g(what)h(it)g(is)g(claimed)f -(to)h(do.)42 b(W)-8 b(e)26 b(just)g(thr)o(ew)g(it)g(in)888 -3355 y(for)21 b(humor)g(value.)27 b(See)20 b(the)h Fw(sync\(2\))d -FA(man)j(page)f(for)g(Unix)h(enlightenment.)681 3562 y Fw(\(truncate-file)38 -b Fz(fname/fd/port)18 b(len)p Fw(\))88 b Fs(\000)-15 b(!)88 -b Fz(unde\256ned)576 b FA(pr)o(ocedur)o(e)888 3709 y(The)21 -b(speci\256ed)f(\256le)h(is)g(tr)o(uncated)g(to)g Fz(len)g -FA(bytes)g(in)g(length.)681 4016 y Fw(\(file-info)39 b Fz(fname/fd/port)19 -b([chase?])p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(\256le-info-r)o(ecord)417 -b FA(pr)o(ocedur)o(e)888 4162 y(The)32 b Fw(file-info)d FA(pr)o(ocedur)o(e)h -(r)o(eturns)h(a)h(r)o(ecor)o(d)e(str)o(uctur)o(e)i(containing)h(every-)888 -4262 y(thing)25 b(ther)o(e)d(is)i(to)g(know)g(about)f(a)g(\256le.)35 -b(If)23 b(the)h Fz(chase?)e FA(\257ag)i(is)f(tr)o(ue)h(\(the)f(default\),)888 -4362 y(then)c(the)e(pr)o(ocedur)o(e)f(chases)i(symlinks)h(and)e(r)o(eports)h -(on)g(the)g(\256les)g(to)g(which)h(they)888 4461 y(r)o(efer)-6 -b(.)24 b(If)17 b Fz(chase?)f FA(is)h(false,)f(then)h(the)g(pr)o(ocedur)o(e)e -(checks)i(the)f(actual)g(\256le)h(itself,)g(even)888 4561 y(if)j(it's)g(a)f -(symlink.)29 b(The)20 b Fz(chase?)f FA(\257ag)h(is)g(ignor)o(ed)f(if)h(the)g -(\256le)f(ar)o(gument)h(is)g(a)f(\256le)h(de-)888 4660 y(scriptor)h(or)g -(port.)888 4799 y(The)c(value)f(r)o(eturned)g(is)h(a)g Fz(\256le-info)g(r)o -(ecord)p FA(,)g(de\256ned)f(to)h(have)g(the)g(following)h(str)o(uc-)888 -4898 y(tur)o(e:)681 5147 y(40)p 1952 5071 323 4 v 1952 5173 -4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 -w FD(November)g(1,)h(1995)h(\261)f(15)13 b(:)f(58)p eop +40 45 bop 681 614 a Fv(3.3)99 b(File)25 b(system)681 +828 y FB(Besides)30 b(the)h(following)h(pr)o(ocedur)o(es,)g(which)f +(allow)g(access)g(to)g(the)g(computer)6 b('s)31 b(\002le)681 +928 y(system,)j(scsh)d(also)g(pr)o(ovides)f(a)g(set)h(of)g(pr)o(ocedur) +o(es)e(which)j(manipulate)e(\002le)h FA(names)p FB(.)681 +1028 y(These)20 b(string-pr)o(ocessing)i(pr)o(ocedur)o(es)d(ar)o(e)g +(documented)i(in)g(section)g(5.1.3.)681 1172 y Fx(\(create-director)o +(y)37 b FA(fname)21 b([perms)f(override?])p Fx(\))87 +b Ft(\000)-15 b(!)87 b FA(unde\002ned)207 b FB(pr)o(ocedur)o(e)681 +1271 y Fx(\(create-fifo)38 b FA(fname)21 b([perms)g(override?])p +Fx(\))86 b Ft(\000)-15 b(!)88 b FA(unde\002ned)424 b +FB(pr)o(ocedur)o(e)681 1371 y Fx(\(create-hard-lin)o(k)37 +b FA(oldname)17 b(newname)g([override?])p Fx(\))52 b +Ft(\000)-14 b(!)54 b FA(unde\002ned)87 b FB(pr)o(ocedur)o(e)681 +1471 y Fx(\(create-symlink)37 b FA(old-name)18 b(new-name)g +([override?])p Fx(\))67 b Ft(\000)-14 b(!)68 b FA(unde\002ned)87 +b FB(pr)o(ocedur)o(e)888 1607 y(These)21 b(pr)o(ocedur)o(es)e(cr)o +(eate)g(objects)i(of)g(various)g(kinds)g(in)g(the)g(\002le)g(system.) +888 1737 y(The)h FA(override?)g FB(ar)o(gument)g(contr)o(ols)g(the)h +(action)f(if)g(ther)o(e)f(is)i(alr)o(eady)d(an)i(object)h(in)888 +1836 y(the)e(\002le)g(system)h(with)f(the)g(new)g(name:)1071 +1973 y Fx(#f)273 b FB(signal)21 b(an)g(err)o(or)f(\(default\))1071 +2122 y Fx('query)97 b FB(pr)o(ompt)21 b(the)g(user)1071 +2272 y FA(other)190 b FB(delete)29 b(the)h(old)g(object)g(\(with)h +Fx(delete-file)25 b FB(or)1432 2371 y Fx(delete-directory,)g +FB(as)32 b(appr)o(opriate\))d(befor)o(e)1432 2471 y(cr)o(eating)20 +b(the)h(new)g(object.)888 2633 y FA(Perms)g FB(defaults)f(to)h +Fx(#o777)e FB(\(but)h(is)i(masked)e(by)h(the)g(curr)o(ent)f(umask\).) +1071 2799 y FE(Remark:)50 b Fk(Curr)o(ently)-8 b(,)16 +b(if)h(you)g(try)h(to)f(cr)o(eate)h(a)g(har)o(d)f(or)g(symbolic)g(link) +g(fr)o(om)g(a)1071 2890 y(\002le)k(to)h(itself,)f(you)f(will)h(err)o +(or)f(out)h(with)h Fi(override?)h Fk(false,)e(and)h(simply)e(delete) +1071 2982 y(your)k(\002le)h(with)h Fi(override?)h Fk(tr)o(ue.)42 +b(Catching)27 b(this)e(will)g(r)o(equir)o(e)e(some)h(sort)h(of)1071 +3073 y(tr)o(ue-name)19 b(pr)o(ocedur)o(e,)d(which)k(I)f(curr)o(ently)e +(do)i(not)g(have.)681 3417 y Fx(\(delete-director)o(y)37 +b FA(fname)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(unde\002ned)820 +b FB(pr)o(ocedur)o(e)681 3516 y Fx(\(delete-file)38 b +FA(fname)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(unde\002ned)1038 +b FB(pr)o(ocedur)o(e)681 3616 y Fx(\(delete-filesys-)o(ob)o(jec)o(t)37 +b FA(fname)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(unde\002ned)602 +b FB(pr)o(ocedur)o(e)888 3752 y(These)43 b(pr)o(ocedur)o(es)e(delete)h +(objects)h(fr)o(om)f(the)h(\002le)g(system.)92 b(The)43 +b Fx(delete-)888 3852 y(filesys-object)15 b FB(pr)o(ocedur)o(e)k(will)i +(delete)f(an)g(object)h(of)f(any)h(type)f(fr)o(om)g(the)h(\002le)888 +3951 y(system:)27 b(\002les,)20 b(\(empty\))h(dir)o(ectories,)e +(symlinks,)j(\002fos,)f FA(etc.)p FB(.)681 4189 y Fx(\(read-symlink)38 +b FA(fname)p Fx(\))87 b Ft(\000)-15 b(!)88 b FA(string)1121 +b FB(pr)o(ocedur)o(e)888 4325 y(Return)22 b(the)e(\002lename)h(r)o +(efer)o(enced)d(by)j(symbolic)h(link)f Fx(fname)p FB(.)681 +4563 y Fx(\(rename-file)38 b FA(old-fname)20 b(new-fname)h([override?]) +p Fx(\))86 b Ft(\000)-15 b(!)88 b FA(unde\002ned)129 +b FB(pr)o(ocedur)o(e)888 4699 y(If)34 b(you)h(override)e(an)h(existing) +h(object,)i(then)e FA(old-fname)e FB(and)g FA(new-fname)h +FB(must)888 4799 y(type-match\227either)26 b(both)i(dir)o(ectories,)f +(or)f(both)h(non-dir)o(ectories.)43 b(This)27 b(is)g(r)o(e-)888 +4898 y(quir)o(ed)21 b(by)f(the)h(semantics)g(of)g(Unix)g +Fx(rename\(\))p FB(.)681 5147 y(40)p 1952 5071 323 4 +v 1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 +5176 323 4 v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 41 47 -41 46 bop 756 614 a Fw(\(define-record)37 b(file-info)843 714 -y(type)260 b(;)43 b Fs(f)p Fw(block-special,)37 b(char-special,)h(directory,) -1279 814 y(;)217 b(fifo,)42 b(regular,)e(socket,)h(symlink)p -Fs(g)843 913 y Fw(device)172 b(;)43 b(Device)e(file)h(resides)e(on.)843 -1013 y(inode)216 b(;)43 b(File's)e(inode.)843 1112 y(mode)260 -b(;)43 b(File's)e(mode)h(bits:)f(permissions,)e(setuid,)i(setgid)843 -1212 y(nlinks)172 b(;)43 b(Number)e(of)i(hard)e(links)h(to)h(this)f(file.)843 -1312 y(uid)304 b(;)43 b(Owner)e(of)i(file.)843 1411 y(gid)304 -b(;)43 b(File's)e(group)g(id.)843 1511 y(size)260 b(;)43 b(Size)f(of)g(file,) -g(in)h(bytes.)843 1611 y(atime)216 b(;)43 b(Time)f(of)g(last)g(access.)843 -1710 y(mtime)216 b(;)43 b(Time)f(of)g(last)g(mod.)843 1810 -y(ctime\))172 b(;)43 b(Time)f(of)g(last)g(status)f(change.)573 -1985 y FA(The)21 b(uid)f(\256eld)h(of)g(a)f(\256le-info)h(r)o(ecor)o(d)e(is)i -(accessed)f(with)h(the)g(pr)o(ocedur)o(e)756 2134 y Fw(\(file-info:uid)37 -b(x\))573 2283 y FA(and)28 b(similarly)i(for)e(the)h(other)h(\256elds.)51 -b(The)29 b Fw(type)e FA(\256eld)i(is)g(a)g(symbol;)34 b(all)28 -b(other)573 2383 y(\256elds)14 b(ar)o(e)f(integers.)26 b(A)14 -b(\256le-info)g(r)o(ecor)o(d)f(is)i(discriminated)f(with)h(the)g -Fw(file-info?)573 2483 y FA(pr)o(edicate.)573 2620 y(The)g(following)i(pr)o -(ocedur)o(es)d(all)h(r)o(eturn)f(selected)h(information)h(about)f(a)g -(\256le;)i(they)573 2720 y(ar)o(e)c(built)i(on)g(top)g(of)f -Fw(file-info)p FA(,)e(and)i(ar)o(e)f(called)h(with)h(the)g(same)f(ar)o -(guments)h(that)573 2819 y(ar)o(e)k(passed)h(to)h(it.)805 2970 -y(Pr)o(ocedur)o(e)725 b(r)o(eturns)p 756 3003 1467 4 v 805 -3073 a Fw(file-type)706 b FA(type)805 3173 y Fw(file-inode)662 -b FA(inode)805 3272 y Fw(file-mode)706 b FA(mode)805 3372 y -Fw(file-nlinks)618 b FA(nlinks)805 3472 y Fw(file-owner)662 -b FA(uid)805 3571 y Fw(file-group)g FA(gid)805 3671 y Fw(file-size)706 -b FA(size)805 3770 y Fw(file-last-access)398 b FA(atime)805 -3870 y Fw(file-last-mod)530 b FA(mtime)805 3970 y Fw(file-last-status-)o(ch)o -(ang)o(e)93 b FA(ctime)573 4118 y(Example:)756 4293 y Fw(;;)42 -b(All)h(my)f(files)g(in)h(/usr/tmp:)756 4393 y(\(filter)d(\()p -Fx(\025)f Fw(\(f\))j(\(=)h(\(file-owner)c(f\))k(\(user-uid\)\)\))1104 -4492 y(\(directory-files)37 b("/usr/tmp"\)\)\))756 4716 y FD(Remark:)116 -b Fi(file-info)36 b Fj(was)f(named)f Fi(file-attributes)k Fj(in)c(r)o -(eleases)e(of)756 4807 y(scsh)h(prior)e(to)i(r)o(elease)e(0.4.)68 -b(W)-7 b(e)33 b(changed)g(the)h(name)g(to)f Fi(file-info)i -Fj(for)756 4898 y(consistency)27 b(with)h(the)g(other)g(information-r)o -(etrieval)e(pr)o(ocedur)o(es)f(in)i(scsh:)365 5147 y FD(November)18 -b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 -5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v -1216 w FA(41)p eop +41 46 bop 756 614 a FE(Remark:)186 b Fk(Ther)o(e)37 b(is)f(an)j +(unfortunate)f(atomicity)g(pr)o(oblem)e(with)i(the)756 +706 y Fh(rename-file)c Fk(pr)o(ocedur)o(e:)48 b(if)31 +b(you)h(specify)f(no-override,)i(but)g(cr)o(eate)f(\002le)756 +797 y Fh(new-fname)21 b Fk(sometime)d(between)j Fh(rename-file)p +Fk('s)g(existence)e(check)g(and)h(the)756 888 y(actual)i(r)o(ename)g +(operation,)g(your)e(\002le)i(will)f(be)h(clobber)o(ed)f(with)h +Fh(old-fname)p Fk(.)756 980 y(Ther)o(e)33 b(is)g(no)i(way)f(to)h(\002x) +f(this)g(pr)o(oblem,)j(given)d(the)h(semantics)f(of)g(Unix)756 +1071 y Fh(rename\(\))p Fk(;)20 b(at)f(least)g(it)f(is)h(highly)f +(unlikely)f(to)i(occur)f(in)h(practice.)365 1487 y Fx(\(set-file-mode) +38 b FA(fname/fd/port)19 b(mode)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(unde\002ned)503 b FB(pr)o(ocedur)o(e)365 +1587 y Fx(\(set-file-owner)38 b FA(fname/fd/port)18 b(uid)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(unde\002ned)524 b +FB(pr)o(ocedur)o(e)365 1687 y Fx(\(set-file-group)38 +b FA(fname/fd/port)18 b(gid)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(unde\002ned)529 b FB(pr)o(ocedur)o(e)573 +1840 y(These)18 b(pr)o(ocedur)o(es)e(set)i(the)g(permission)h(bits,)g +(owner)g(id,)f(and)f(gr)o(oup)h(id)g(of)g(a)g(\002le,)573 +1939 y(r)o(espectively)-9 b(.)23 b(The)c(\002le)g(can)g(be)f +(speci\002ed)h(by)g(giving)g(the)g(\002le)g(name,)g(or)g(either)g(an) +573 2039 y(integer)g(\002le)h(descriptor)f(or)h(a)f(port)h(open)f(on)i +(the)e(\002le.)25 b(Setting)20 b(\002le)g(user)f(or)h(gr)o(oup)573 +2138 y(ownership)i(usually)f(r)o(equir)o(es)e(r)o(oot)i(privileges.)365 +2365 y Fx(\(set-file-times)38 b FA(fname)20 b([access-time)g(mod-time]) +p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(unde\002ned)116 +b FB(pr)o(ocedur)o(e)573 2518 y(This)19 b(pr)o(ocedur)o(e)e(sets)i(the) +g(access)g(and)f(modi\002ed)h(times)h(for)e(the)h(\002le)g +FA(fname)g FB(to)g(the)573 2618 y(supplied)26 b(values)g(\(see)f +(section)i(3.10)e(for)h(the)g(scsh)h(r)o(epr)o(esentation)e(of)h +(time\).)42 b(If)573 2717 y(neither)24 b(time)g(ar)o(gument)g(is)g +(supplied,)g(they)h(ar)o(e)d(both)j(taken)e(to)i(be)e(the)h(curr)o(ent) +573 2817 y(time.)h(Y)-8 b(ou)20 b(must)f(pr)o(ovide)f(both)h(times)h +(or)e(neither)-6 b(.)25 b(If)19 b(the)f(pr)o(ocedur)o(e)f(completes)573 +2917 y(successfully)-9 b(,)23 b(the)h(\002le's)f(time)h(of)f(last)g +(status-change)g(\()p Fx(ctime)p FB(\))d(is)k(set)f(to)g(the)h(cur)o(-) +573 3016 y(r)o(ent)c(time.)365 3243 y Fx(\(sync-file)40 +b FA(fd/port)p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(unde\002ned)1101 +b FB(pr)o(ocedur)o(e)365 3342 y Fx(\(sync-file-system)o(\))81 +b Ft(\000)-14 b(!)87 b FA(unde\002ned)1067 b FB(pr)o(ocedur)o(e)573 +3495 y(Calling)28 b Fx(sync-file)c FB(causes)j(Unix)g(to)h(update)f +(the)g(disk)h(data)e(str)o(uctur)o(es)i(for)f(a)573 3595 +y(given)17 b(\002le.)24 b(If)17 b FA(fd/port)e FB(is)i(a)f(port,)i(any) +e(buf)o(fer)o(ed)f(data)g(it)i(may)g(have)f(is)h(\002rst)g(\003ushed.) +573 3695 y(Calling)33 b Fx(sync-file-system)27 b FB(synchr)o(onises)34 +b(the)g(kernel's)f(entir)o(e)g(\002le)g(system)573 3794 +y(with)21 b(the)g(disk.)573 3939 y(These)43 b(pr)o(ocedur)o(es)e(ar)o +(e)g(not)k(P)t Fs(O)t(S)t(I)t(X)r FB(.)93 b(Inter)o(estingly)44 +b(enough,)49 b Fx(sync-file-)573 4039 y(system)30 b FB(doesn't)i +(actually)g(do)h(what)f(it)h(is)f(claimed)g(to)h(do.)60 +b(W)-8 b(e)32 b(just)h(thr)o(ew)f(it)573 4138 y(in)21 +b(for)g(humor)g(value.)k(See)20 b(the)h Fx(sync\(2\))d +FB(man)j(page)f(for)g(Unix)h(enlightenment.)365 4365 +y Fx(\(truncate-file)38 b FA(fname/fd/port)19 b(len)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(unde\002ned)577 b +FB(pr)o(ocedur)o(e)573 4518 y(The)21 b(speci\002ed)f(\002le)h(is)g(tr)o +(uncated)f(to)h FA(len)h FB(bytes)f(in)g(length.)365 +4844 y Fx(\(file-info)40 b FA(fname/fd/port)19 b([chase?])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(\002le-info-r)o(ecord)417 +b FB(pr)o(ocedur)o(e)365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v +540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w +FB(41)p eop %%Page: 42 48 -42 47 bop 1071 614 a Fi(user-info)p Fj(,)31 b Fi(group-info)p -Fj(,)h Fi(host-info)p Fj(,)g Fi(network-info)42 b Fj(,)29 b -Fi(service-info)p Fj(,)1071 706 y(and)19 b Fi(protocol-info)p -Fj(.)1071 817 y(The)g Fi(file-attributes)j Fj(binding)c(is)g(still)g -(supported)f(in)i(the)g(curr)o(ent)f(r)o(elease)1071 909 y(of)g(scsh,)h(but)g -(is)f(depr)o(ecated,)f(and)i(may)g(go)f(away)h(in)g(a)g(futur)o(e)f(r)o -(elease.)681 1302 y Fw(\(file-directory?)37 b Fz(fname/fd/port)19 -b([chase?])p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(boolean)397 -b FA(pr)o(ocedur)o(e)681 1401 y Fw(\(file-fifo?)39 b Fz(fname/fd/port)19 -b([chase?])p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(boolean)615 -b FA(pr)o(ocedur)o(e)681 1501 y Fw(\(file-regular?)38 b Fz(fname/fd/port)18 -b([chase?])p Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(boolean)484 -b FA(pr)o(ocedur)o(e)681 1601 y Fw(\(file-socket?)38 b Fz(fname/fd/port)19 -b([chase?])p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(boolean)528 -b FA(pr)o(ocedur)o(e)681 1700 y Fw(\(file-special?)38 b Fz(fname/fd/port)18 -b([chase?])p Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(boolean)484 -b FA(pr)o(ocedur)o(e)681 1800 y Fw(\(file-symlink?)38 b Fz(fname/fd/port)p -Fw(\))84 b Fs(\000)-14 b(!)87 b Fz(boolean)779 b FA(pr)o(ocedur)o(e)888 -1948 y(These)20 b(pr)o(ocedur)o(es)d(ar)o(e)h(\256le-type)h(pr)o(edicates)f -(that)i(test)f(the)h(type)f(of)g(a)g(given)h(\256le.)888 2048 -y(They)k(ar)o(e)e(applied)g(to)i(the)g(same)f(ar)o(guments)g(to)h(which)g -Fw(file-info)19 b FA(is)24 b(applied;)888 2148 y(the)30 b(sole)h(exception)f -(is)g Fw(file-symlink?)p FA(,)d(which)k(does)f(not)h(take)e(the)h(optional) -888 2247 y Fz(chase?)20 b FA(second)h(ar)o(gument.)888 2558 -y(For)g(example,)1071 2714 y Fw(\(file-directory?)37 b("/usr/dalbertz"\))168 -b Fl(=)-14 b Fs(\))217 b Fw(#t)681 3003 y(\(file-not-readab)o(le)o(?)38 -b Fz(fname)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(boolean)813 -b FA(pr)o(ocedur)o(e)681 3102 y Fw(\(file-not-writab)o(le)o(?)38 -b Fz(fname)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(boolean)813 -b FA(pr)o(ocedur)o(e)681 3202 y Fw(\(file-not-execut)o(ab)o(le?)37 -b Fz(fname)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(boolean)726 -b FA(pr)o(ocedur)o(e)888 3350 y(Returns:)1071 3465 y(V)-8 b(alue)502 -b(meaning)p 1071 3513 1909 4 v 1071 3618 a Fw(#f)622 b FA(Access)20 -b(permitted)1071 3767 y Fw('search-denied)94 b FA(Can't)20 -b(stat\320a)h(pr)o(otected)e(dir)o(ectory)1781 3867 y(is)i(blocking)h -(access.)1071 4001 y Fw('permission)226 b FA(Permission)22 -b(denied.)1071 4151 y Fw('no-directory)138 b FA(Some)21 b(dir)o(ectory)e -(doesn't)j(exist.)1071 4300 y Fw('nonexistent)182 b FA(File)21 -b(doesn't)g(exist.)911 4414 y(A)h(\256le)g(is)h(consider)o(ed)f(writeable)g -(if)g(either)g(\(1\))g(it)g(exists)h(and)f(is)h(writeable)f(or)g(\(2\))888 -4513 y(it)j(doesn't)f(exist)g(and)g(the)g(dir)o(ectory)f(is)i(writeable.)37 -b(Since)23 b(symlink)j(permission)888 4613 y(bits)21 b(ar)o(e)f(ignor)o(ed)g -(by)h(the)g(\256lesystem,)g(these)g(calls)g(do)g(not)g(take)f(a)h -Fz(chase?)f FA(\257ag.)1071 4805 y FD(Oops:)105 b Fi(file-not-writeable?)36 -b Fj(does)30 b(not)i(curr)o(ently)f(do)g(the)h(dir)o(ectory)1071 -4897 y(check.)681 5147 y FA(42)p 1952 5071 323 4 v 1952 5173 -4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 -w FD(November)18 b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p eop +42 47 bop 888 614 a FB(The)32 b Fx(file-info)d FB(pr)o(ocedur)o(e)h(r)o +(eturns)h(a)h(r)o(ecor)o(d)e(str)o(uctur)o(e)i(containing)h(every-)888 +714 y(thing)25 b(ther)o(e)d(is)i(to)g(know)g(about)g(a)f(\002le.)33 +b(If)23 b(the)h FA(chase?)f FB(\003ag)g(is)h(tr)o(ue)f(\(the)h +(default\),)888 814 y(then)19 b(the)e(pr)o(ocedur)o(e)f(chases)i +(symlinks)h(and)e(r)o(eports)h(on)g(the)g(\002les)g(to)g(which)h(they) +888 913 y(r)o(efer)-6 b(.)23 b(If)16 b FA(chase?)g FB(is)h(false,)g +(then)g(the)g(pr)o(ocedur)o(e)e(checks)i(the)g(actual)f(\002le)h +(itself,)g(even)888 1013 y(if)j(it's)g(a)g(symlink.)26 +b(The)20 b FA(chase?)f FB(\003ag)h(is)h(ignor)o(ed)e(if)h(the)g(\002le) +g(ar)o(gument)f(is)i(a)e(\002le)h(de-)888 1112 y(scriptor)h(or)g(port.) +888 1252 y(The)c(value)f(r)o(eturned)g(is)h(a)g FA(\002le-info)g(r)o +(ecord)p FB(,)g(de\002ned)f(to)h(have)g(the)g(following)h(str)o(uc-)888 +1352 y(tur)o(e:)1071 1531 y Fx(\(define-record)38 b(file-info)1158 +1631 y(type)260 b(;)43 b Ft(f)p Fx(block-special,)37 +b(char-special,)i(directory,)1594 1731 y(;)218 b(fifo,)41 +b(regular,)f(socket,)h(symlink)p Ft(g)1158 1830 y Fx(device)172 +b(;)43 b(Device)e(file)h(resides)f(on.)1158 1930 y(inode)216 +b(;)43 b(File's)e(inode.)1158 2030 y(mode)260 b(;)43 +b(File's)e(mode)h(bits:)g(permissions,)c(setuid,)j(setgid)1158 +2129 y(nlinks)172 b(;)43 b(Number)e(of)i(hard)f(links)g(to)g(this)g +(file.)1158 2229 y(uid)304 b(;)43 b(Owner)f(of)g(file.)1158 +2328 y(gid)304 b(;)43 b(File's)e(group)h(id.)1158 2428 +y(size)260 b(;)43 b(Size)f(of)h(file,)e(in)i(bytes.)1158 +2528 y(atime)216 b(;)43 b(Time)f(of)h(last)f(access.)1158 +2627 y(mtime)216 b(;)43 b(Time)f(of)h(last)f(mod.)1158 +2727 y(ctime\))172 b(;)43 b(Time)f(of)h(last)f(status)f(change.)888 +2907 y FB(The)21 b(uid)g(\002eld)f(of)h(a)f(\002le-info)h(r)o(ecor)o(d) +e(is)j(accessed)d(with)j(the)f(pr)o(ocedur)o(e)1071 3061 +y Fx(\(file-info:uid)38 b(x\))888 3216 y FB(and)44 b(similarly)h(for)f +(the)h(other)f(\002elds.)97 b(The)44 b Fx(type)f FB(\002eld)h(is)g(a)g +(symbol;)57 b(all)888 3315 y(other)37 b(\002elds)f(ar)o(e)f(integers.) +72 b(A)36 b(\002le-info)g(r)o(ecor)o(d)e(is)j(discriminated)f(with)h +(the)888 3415 y Fx(file-info?)17 b FB(pr)o(edicate.)888 +3555 y(The)35 b(following)i(pr)o(ocedur)o(es)c(all)i(r)o(eturn)g +(selected)f(information)i(about)f(a)g(\002le;)888 3654 +y(they)29 b(ar)o(e)e(built)h(on)h(top)g(of)f Fx(file-info)p +FB(,)e(and)i(ar)o(e)f(called)g(with)i(the)f(same)g(ar)o(gu-)888 +3754 y(ments)22 b(that)e(ar)o(e)g(passed)g(to)h(it.)1121 +3910 y(Pr)o(ocedur)o(e)725 b(r)o(eturns)p 1071 3944 1467 +4 v 1121 4013 a Fx(file-type)706 b FB(type)1121 4113 +y Fx(file-inode)662 b FB(inode)1121 4213 y Fx(file-mode)706 +b FB(mode)1121 4312 y Fx(file-nlinks)618 b FB(nlinks)1121 +4412 y Fx(file-owner)662 b FB(uid)1121 4511 y Fx(file-group)g +FB(gid)1121 4611 y Fx(file-size)706 b FB(size)1121 4711 +y Fx(file-last-access)398 b FB(atime)1121 4810 y Fx(file-last-mod)530 +b FB(mtime)1121 4910 y Fx(file-last-status)o(-c)o(han)o(ge)93 +b FB(ctime)681 5147 y(42)p 1952 5071 323 4 v 1952 5173 +4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 +v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 43 49 -43 48 bop 365 614 a Fw(\(file-readable?)38 b Fz(fname)p Fw(\))86 -b Fs(\000)-14 b(!)87 b Fz(boolean)988 b FA(pr)o(ocedur)o(e)365 -714 y Fw(\(file-writable?)38 b Fz(fname)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(boolean)988 b FA(pr)o(ocedur)o(e)365 814 y Fw(\(file-executable?) -37 b Fz(fname)p Fw(\))87 b Fs(\000)-15 b(!)88 b Fz(boolean)900 -b FA(pr)o(ocedur)o(e)573 960 y(These)15 b(pr)o(ocedur)o(es)f(ar)o(e)g(the)i -(logical)g(negation)g(of)g(the)f(pr)o(eceding)g Fw(file-not-)p -Fx(:)f(:)g(:)c Fw(?)573 1060 y FA(pr)o(ocedur)o(es.)365 1268 -y Fw(\(file-not-exists?)37 b Fz(fname)21 b([chase?])p Fw(\))85 -b Fs(\000)-14 b(!)87 b Fz(object)664 b FA(pr)o(ocedur)o(e)573 -1415 y(Returns:)756 1530 y Fw(#f)621 b FA(Exists.)756 1679 -y Fw(#t)g FA(Doesn't)22 b(exist.)756 1829 y Fw('search-denied)93 -b FA(Some)21 b(pr)o(otected)f(dir)o(ectory)g(is)1465 1928 y(blocking)i(the)f -(sear)o(ch.)365 2168 y Fw(\(file-exists?)39 b Fz(fname)20 b([chase?])p -Fw(\))86 b Fs(\000)-15 b(!)87 b Fz(boolean)781 b FA(pr)o(ocedur)o(e)573 -2315 y(This)21 b(is)g(simply)h Fw(\(not)42 b(\(file-not-exists)o(?)37 -b Fz(fname)44 b([chase?])o Fw(\)\))365 2622 y(\(directory-files)37 -b Fz([dir)21 b(dot\256les?])p Fw(\))85 b Fs(\000)-14 b(!)87 -b Fz(string)21 b(list)615 b FA(pr)o(ocedur)o(e)573 2769 y(Return)18 -b(the)g(list)h(of)f(\256les)g(in)g(dir)o(ectory)f Fz(dir)p -FA(,)h(which)h(defaults)e(to)h(the)g(curr)o(ent)f(work-)573 -2869 y(ing)j(dir)o(ectory)-9 b(.)26 b(The)19 b Fz(dot\256les?)f -FA(\257ag)h(\(default)f Fw(#f)p FA(\))g(causes)h(dot)h(\256les)f(to)h(be)f -(included)573 2968 y(in)25 b(the)g(list.)39 b(Regar)o(dless)24 -b(of)h(the)g(value)f(of)g Fz(dot\256les?)o FA(,)i(the)e(two)i(\256les)f -Fw(.)f FA(and)g Fw(..)g FA(ar)o(e)573 3068 y Fz(never)d FA(r)o(eturned.)573 -3207 y(The)c(dir)o(ectory)g Fz(dir)h FA(is)g(not)g(pr)o(epended)e(to)i(each)f -(\256le)h(name)g(in)g(the)g(r)o(esult)f(list.)27 b(That)573 -3306 y(is,)756 3458 y Fw(\(directory-file)o(s)37 b("/etc"\))573 -3610 y FA(r)o(eturns)756 3762 y Fw(\("chown")j("exports")g("fstab")g -Fx(:)14 b(:)g(:)g Fw(\))573 3914 y Fz(not)756 4066 y Fw(\("/etc/chown")38 -b("/etc/exports")f("/etc/fstab")i Fx(:)14 b(:)g(:)g Fw(\))573 -4218 y FA(T)-8 b(o)35 b(use)g(the)g(\256les)g(in)g(r)o(eturned)f(list,)k(the) -d(pr)o(ogrammer)f(can)h(either)f(manually)573 4317 y(pr)o(epend)19 -b(the)i(dir)o(ectory:)756 4469 y Fw(\(map)41 b(\()p Fx(\025)e -Fw(\(f\))k(\(string-append)37 b(dir)43 b("/")f(f\)\))g(files\))573 -4621 y FA(or)21 b(cd)f(to)h(the)g(dir)o(ectory)f(befor)o(e)g(using)h(the)g -(\256le)g(names:)756 4799 y Fw(\(with-cwd)39 b(dir)843 4898 -y(\(for-each)h(delete-file)f(\(directory-file)o(s\)\))o(\))365 -5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p -1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 -V 1636 5176 323 4 v 1216 w FA(43)p eop +43 48 bop 573 614 a FB(Example:)756 769 y Fx(;;)42 b(All)h(my)f(files)g +(in)h(/usr/tmp:)756 869 y(\(filter)d(\()p Fy(\025)f Fx(\(f\))j(\(=)h +(\(file-owner)c(f\))k(\(user-uid\)\)\))1104 969 y(\(directory-files)37 +b("/usr/tmp"\)\)\))756 1154 y FE(Remark:)114 b Fh(file-info)36 +b Fk(was)f(named)g Fh(file-attributes)j Fk(in)d(r)o(eleases)d(of)756 +1246 y(scsh)h(prior)e(to)i(r)o(elease)f(0.4.)66 b(W)-7 +b(e)33 b(changed)h(the)g(name)f(to)h Fh(file-info)h Fk(for)756 +1337 y(consistency)27 b(with)h(the)g(other)g(information-r)o(etrieval)e +(pr)o(ocedur)o(es)f(in)i(scsh:)756 1428 y Fh(user-info)p +Fk(,)k Fh(group-info)p Fk(,)h Fh(host-info)p Fk(,)f Fh(network-info)42 +b Fk(,)29 b Fh(service-info)p Fk(,)756 1520 y(and)19 +b Fh(protocol-info)p Fk(.)756 1622 y(The)f Fh(file-attributes)k +Fk(binding)d(is)f(still)f(supported)h(in)g(the)h(curr)o(ent)g(r)o +(elease)756 1713 y(of)f(scsh,)g(but)i(is)e(depr)o(ecated,)f(and)i(may)g +(go)f(away)h(in)g(a)g(futur)o(e)f(r)o(elease.)365 2043 +y Fx(\(file-directory?)37 b FA(fname/fd/port)19 b([chase?])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(boolean)398 b FB(pr)o(ocedur)o(e)365 +2142 y Fx(\(file-fifo?)39 b FA(fname/fd/port)19 b([chase?])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(boolean)616 b FB(pr)o(ocedur)o(e)365 +2242 y Fx(\(file-regular?)38 b FA(fname/fd/port)19 b([chase?])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(boolean)485 b FB(pr)o(ocedur)o(e)365 +2342 y Fx(\(file-socket?)39 b FA(fname/fd/port)18 b([chase?])p +Fx(\))86 b Ft(\000)-15 b(!)88 b FA(boolean)528 b FB(pr)o(ocedur)o(e)365 +2441 y Fx(\(file-special?)38 b FA(fname/fd/port)19 b([chase?])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(boolean)485 b FB(pr)o(ocedur)o(e)365 +2541 y Fx(\(file-symlink?)38 b FA(fname/fd/port)p Fx(\))85 +b Ft(\000)-14 b(!)87 b FA(boolean)779 b FB(pr)o(ocedur)o(e)573 +2671 y(These)19 b(pr)o(ocedur)o(es)f(ar)o(e)g(\002le-type)h(pr)o +(edicates)f(that)h(test)h(the)f(type)h(of)f(a)g(given)h(\002le.)573 +2771 y(They)j(ar)o(e)f(applied)h(to)h(the)f(same)g(ar)o(guments)g(to)h +(which)g Fx(file-info)c FB(is)k(applied;)573 2870 y(the)30 +b(sole)g(exception)g(is)h Fx(file-symlink?)p FB(,)c(which)j(does)g(not) +h(take)f(the)g(optional)573 2970 y FA(chase?)20 b FB(second)h(ar)o +(gument.)573 3247 y(For)g(example,)756 3386 y Fx(\(file-directory)o(?) +37 b("/usr/dalbertz"\))168 b Fm(=)-14 b Ft(\))218 b Fx(#t)365 +3616 y(\(file-not-readabl)o(e?)37 b FA(fname)p Fx(\))87 +b Ft(\000)-15 b(!)88 b FA(boolean)813 b FB(pr)o(ocedur)o(e)365 +3715 y Fx(\(file-not-writabl)o(e?)37 b FA(fname)p Fx(\))87 +b Ft(\000)-15 b(!)88 b FA(boolean)813 b FB(pr)o(ocedur)o(e)365 +3815 y Fx(\(file-not-executa)o(bl)o(e?)37 b FA(fname)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(boolean)726 b FB(pr)o(ocedur)o(e)573 +3945 y(Returns:)756 4060 y(V)-8 b(alue)501 b(meaning)p +756 4108 1909 4 v 756 4213 a Fx(#f)621 b FB(Access)21 +b(permitted)756 4362 y Fx('search-denied)93 b FB(Can't)21 +b(stat\227a)f(pr)o(otected)g(dir)o(ectory)1465 4462 y(is)h(blocking)h +(access.)756 4596 y Fx('permission)225 b FB(Permission)22 +b(denied.)756 4746 y Fx('no-directory)137 b FB(Some)21 +b(dir)o(ectory)f(doesn't)h(exist.)756 4895 y Fx('nonexistent)181 +b FB(File)21 b(doesn't)h(exist.)365 5147 y FE(Mar)o(ch)d(10,)g(1997)h +(\226)f(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 +4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 +v 1216 w FB(43)p eop %%Page: 44 50 -44 49 bop 888 614 a FA(or)21 b(use)g(the)g Fw(glob)e FA(pr)o(ocedur)o(e,)g -(de\256ned)h(below)-8 b(.)888 751 y(A)21 b(dir)o(ectory)f(list)h(can)f(be)h -(generated)f(by)g Fw(\(run/strings)39 b(\(ls\)\))p FA(,)19 -b(but)h(this)i(is)f(un-)888 850 y(r)o(eliable,)15 b(as)h(\256lenames)g(with)g -(whitespace)f(in)h(their)g(names)g(will)g(be)f(split)h(into)h(sep-)888 -950 y(arate)j(entries.)27 b(Using)21 b Fw(directory-files)15 -b FA(is)21 b(r)o(eliable.)681 1152 y Fw(\(glob)41 b Fz(pat)1048 -1179 y Ft(1)1106 1152 y Fx(:)14 b(:)g(:)g Fw(\))87 b Fs(\000)-14 -b(!)87 b Fz(string)20 b(list)1272 b FA(pr)o(ocedur)o(e)888 -1297 y(Glob)27 b(each)f(pattern)g(against)g(the)g(\256lesystem)h(and)f(r)o -(eturn)f(the)i(sorted)f(list.)44 b(Du-)888 1396 y(plicates)31 -b(ar)o(e)e(not)i(r)o(emoved.)57 b(Patterns)31 b(matching)g(nothing)h(ar)o(e)e -(not)h(included)888 1496 y(literally)-9 b(.)1184 1466 y Ft(2)1249 -1496 y FA(C)20 b(shell)i Fw({a,b,c})c FA(patterns)i(ar)o(e)f(expanded.)26 -b(Backslash)21 b(quotes)g(char)o(-)888 1596 y(acters,)f(turning)i(of)o(f)e -(the)g(special)h(meaning)g(of)g Fw({)p FA(,)f Fw(})p FA(,)g -Fw(*)p FA(,)g Fw([)p FA(,)g Fw(])p FA(,)g(and)h Fw(?)p FA(.)888 -1732 y(Note)15 b(that)f(the)h(r)o(ules)g(of)f(backslash)h(for)f(Scheme)g -(strings)h(and)f(glob)h(patterns)g(work)888 1832 y(together)31 -b(to)g(r)o(equir)o(e)e(four)h(backslashes)g(in)h(a)f(r)o(ow)g(to)h(specify)f -(a)g(single)h(literal)888 1931 y(backslash.)d(Fortunately)-9 -b(,)20 b(this)i(should)f(be)g(a)f(rar)o(e)f(occurr)o(ence.)888 -2068 y(A)c(glob)g(subpattern)f(will)i(not)f(match)g(against)f(dot)h(\256les)g -(unless)h(the)f(\256rst)g(character)888 2167 y(of)20 b(the)g(subpattern)g(is) -g(a)f(literal)h(\252)p Fw(.)p FA(\272.)25 b(Further)-6 b(,)20 -b(a)f(dot)h(subpattern)g(will)g(not)h(match)888 2267 y(the)i(\256les)g -Fw(.)e FA(or)i Fw(..)e FA(unless)i(it)g(is)g(a)f(constant)h(pattern,)e(as)i -(in)f Fw(\(glob)42 b("../*/*.c"\))p FA(.)888 2367 y(So)26 b(a)g(dir)o -(ectory's)g(dot)g(\256les)h(can)e(be)h(r)o(eliably)g(generated)f(with)i(the)f -(simple)g(glob)888 2466 y(pattern)21 b Fw(".*")p FA(.)888 2603 -y(Some)g(examples:)1071 2750 y Fw(\(glob)42 b("*.c")f("*.h"\))1245 -2849 y(;;)i(All)f(the)h(C)g(and)f(#include)f(files)g(in)i(my)g(directory.) -1071 3049 y(\(glob)f("*.c")f("*/*.c"\))1245 3148 y(;;)i(All)f(the)h(C)g -(files)e(in)i(this)f(directory)e(and)1245 3248 y(;;)j(its)f(immediate)e -(subdirectories.)1071 3447 y(\(glob)i("lexer/*.c")d("parser/*.c"\))1071 -3547 y(\(glob)j("{lexer,parser})o(/*)o(.c")o(\))1245 3646 y(;;)h(All)f(the)h -(C)g(files)e(in)i(the)g(lexer)e(and)h(parser)g(dirs.)1071 3846 -y(\(glob)g("\\\\{lexer,parse)o(r\\)o(\\}/)o(*.)o(c"\))1245 -3945 y(;;)h(All)f(the)h(C)g(files)e(in)i(the)g(strange)1245 -4045 y(;;)g(directory)d("{lexer,parser}")o(.)1071 4244 y(\(glob)i("*\\\\*"\)) -1245 4344 y(;;)h(All)f(the)h(files)e(ending)g(in)i("*",)f(e.g.)1245 -4443 y(;;)h(\("foo*")e("bar*"\))1071 4643 y(\(glob)h("*lexer*"\))1245 -4742 y(\("mylexer.c")d("lexer1.notes"\))p 681 4821 1146 4 v -766 4875 a Fo(2)800 4898 y Fr(Why)17 b(bother)f(to)g(mention)g(such)h(a)g -(silly)g(possibility?)24 b(Because)17 b(that)f(is)h(what)f(sh)h(does.)681 -5147 y FA(44)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)h(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +44 49 bop 911 614 a FB(A)22 b(\002le)g(is)h(consider)o(ed)f(writeable)g +(if)g(either)g(\(1\))g(it)g(exists)h(and)f(is)h(writeable)f(or)g(\(2\)) +888 714 y(it)j(doesn't)g(exist)f(and)g(the)g(dir)o(ectory)f(is)i +(writeable.)35 b(Since)24 b(symlink)i(permission)888 +814 y(bits)21 b(ar)o(e)f(ignor)o(ed)g(by)h(the)g(\002lesystem,)g(these) +g(calls)g(do)g(not)g(take)f(a)h FA(chase?)f FB(\003ag.)1071 +989 y FE(Oops:)103 b Fh(file-not-writeable?)36 b Fk(does)31 +b(not)h(curr)o(ently)f(do)g(the)i(dir)o(ectory)1071 1081 +y(check.)681 1341 y Fx(\(file-readable?)k FA(fname)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(boolean)987 b FB(pr)o(ocedur)o(e)681 +1440 y Fx(\(file-writable?)37 b FA(fname)p Fx(\))87 b +Ft(\000)-14 b(!)87 b FA(boolean)987 b FB(pr)o(ocedur)o(e)681 +1540 y Fx(\(file-executable)o(?)37 b FA(fname)p Fx(\))87 +b Ft(\000)-14 b(!)87 b FA(boolean)900 b FB(pr)o(ocedur)o(e)888 +1681 y(These)86 b(pr)o(ocedur)o(es)e(ar)o(e)h(the)h(logical)g(negation) +g(of)g(the)g(pr)o(eceding)888 1781 y Fx(file-not-...?)16 +b FB(pr)o(ocedur)o(es.)681 1974 y Fx(\(file-not-exists)o(?)37 +b FA(fname)21 b([chase?])p Fx(\))85 b Ft(\000)-14 b(!)87 +b FA(object)664 b FB(pr)o(ocedur)o(e)888 2115 y(Returns:)1071 +2230 y Fx(#f)622 b FB(Exists.)1071 2379 y Fx(#t)g FB(Doesn't)22 +b(exist.)1071 2529 y Fx('search-denied)94 b FB(Some)21 +b(pr)o(otected)e(dir)o(ectory)h(is)1781 2628 y(blocking)i(the)f(sear)o +(ch.)681 2853 y Fx(\(file-exists?)38 b FA(fname)21 b([chase?])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(boolean)780 b FB(pr)o(ocedur)o(e)888 +2994 y(This)22 b(is)f(simply)g Fx(\(not)42 b(\(file-not-exists?)37 +b FA(fname)43 b([chase?])o Fx(\)\))681 3286 y(\(directory-files)37 +b FA([dir)20 b(dot\002les?])p Fx(\))85 b Ft(\000)-14 +b(!)87 b FA(string)21 b(list)615 b FB(pr)o(ocedur)o(e)888 +3428 y(Return)19 b(the)f(list)g(of)g(\002les)g(in)h(dir)o(ectory)e +FA(dir)p FB(,)h(which)h(defaults)e(to)h(the)g(curr)o(ent)f(work-)888 +3528 y(ing)j(dir)o(ectory)-9 b(.)24 b(The)c FA(dot\002les?)e +FB(\003ag)i(\(default)e Fx(#f)p FB(\))g(causes)h(dot)h(\002les)f(to)h +(be)f(included)888 3627 y(in)26 b(the)e(list.)39 b(Regar)o(dless)24 +b(of)g(the)h(value)f(of)h FA(dot\002les?)o FB(,)h(the)e(two)i(\002les)f +Fx(.)f FB(and)h Fx(..)e FB(ar)o(e)888 3727 y FA(never)f +FB(r)o(eturned.)888 3860 y(The)c(dir)o(ectory)f FA(dir)h +FB(is)g(not)g(pr)o(epended)e(to)j(each)e(\002le)h(name)g(in)g(the)g(r)o +(esult)f(list.)25 b(That)888 3960 y(is,)1071 4100 y Fx +(\(directory-files)37 b("/etc"\))888 4240 y FB(r)o(eturns)1071 +4379 y Fx(\("chown")j("exports")g("fstab")h(...\))888 +4519 y FA(not)1071 4659 y Fx(\("/etc/chown")d("/etc/exports")g +("/etc/fstab")h(...\))888 4799 y FB(T)-8 b(o)36 b(use)e(the)h(\002les)h +(in)f(r)o(eturned)e(list,)39 b(the)c(pr)o(ogrammer)f(can)g(either)h +(manually)888 4898 y(pr)o(epend)20 b(the)h(dir)o(ectory:)681 +5147 y(44)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)e(10,)g +(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 45 51 -45 50 bop 930 614 a Fw(;;)43 b(All)f(files)f(containing)f(the)i(string)f -("lexer".)756 814 y(\(glob)g("lexer"\))930 913 y(;;)i(Either)e(\("lexer"\))f -(or)i(\(\).)573 1063 y FA(If)21 b(the)h(\256rst)f(character)f(of)i(the)g -(pattern)e(\(after)g(expanding)i(braces\))e(is)i(a)f(slash,)g(the)573 -1162 y(sear)o(ch)d(begins)h(at)g(r)o(oot;)g(otherwise,)h(the)f(sear)o(ch)f -(begins)i(in)f(the)g(curr)o(ent)f(working)573 1262 y(dir)o(ectory)-9 -b(.)573 1399 y(If)19 b(the)g(last)g(character)e(of)j(the)f(pattern)f(\(after) -g(expanding)h(braces\))e(is)j(a)f(slash,)g(then)573 1499 y(the)i(r)o(esult)f -(matches)h(must)g(be)g(dir)o(ectories,)e Fz(e.g.)p FA(,)756 -1674 y Fw(\(glob)41 b("/usr/man/man?/")o(\))d Fl(=)-14 b Fs(\))1104 -1774 y Fw(\("/usr/man/man1/")37 b("/usr/man/man2/")g Fx(:)14 -b(:)g(:)f Fw(\))573 1987 y FA(Globbing)29 b(can)e(sometimes)h(be)f(useful)h -(when)g(we)f(need)g(a)g(list)h(of)f(a)g(dir)o(ectory's)573 -2087 y(\256les)k(wher)o(e)g(each)f(element)h(in)h(the)f(list)h(includes)f -(the)g(pathname)g(for)f(the)i(\256le.)573 2186 y(Compar)o(e:)756 -2362 y Fw(\(directory-file)o(s)37 b("../include"\))i Fl(=)-14 -b Fs(\))930 2461 y Fw(\("cig.h")40 b("decls.h")g Fx(:)14 b(:)g(:)g -Fw(\))756 2661 y(\(glob)41 b("../include/*"\))c Fl(=)-14 b -Fs(\))930 2760 y Fw(\("../include/cig)o(.h)o(")38 b("../include/dec)o(ls.)o -(h")f Fx(:)14 b(:)g(:)g Fw(\))365 3060 y(\(glob-quote)39 b -Fz(str)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(string)1320 b FA(pr)o(ocedur)o(e) -573 3206 y(Returns)29 b(a)e(constant)i(glob)g(pattern)e(that)h(exactly)g -(matches)g Fz(str)p FA(.)49 b(All)28 b(wild-car)o(d)573 3305 -y(characters)19 b(in)j Fz(str)f FA(ar)o(e)e(quoted)i(with)h(a)e(backslash.) -756 3481 y Fw(\(glob-quote)39 b("Any)i(*.c)i(files?"\))930 -3580 y Fl(=)-14 b Fs(\))43 b Fw("Any)f(\\*.c)g(files\\?")365 -3880 y(\(file-match)d Fz(r)o(oot)20 b(dot-\256les?)g(pat)1475 -3907 y Ft(1)1533 3880 y Fz(pat)1639 3907 y Ft(2)1697 3880 y -Fx(:)14 b(:)g(:)34 b Fz(pat)1934 3907 y Fm(n)1979 3880 y Fw(\))87 -b Fs(\000)-14 b(!)87 b Fz(string)21 b(list)194 b FA(pr)o(ocedur)o(e)573 -4026 y Fw(file-match)25 b FA(pr)o(ovides)k(a)h(mor)o(e)f(powerful)h -(\256le-matching)g(service,)h(at)e(the)h(ex-)573 4125 y(pense)22 -b(of)h(a)f(less)h(convenient)h(notation.)34 b(It)23 b(is)g(intermediate)f(in) -h(power)g(between)573 4225 y(most)f(shell)f(matching)g(machinery)g(and)g(r)o -(ecursive)e Fw(find\(1\))p FA(.)573 4362 y(Each)g(pattern)h(is)g(a)g(r)o -(egexp.)26 b(The)20 b(pr)o(ocedur)o(e)e(sear)o(ches)h(fr)o(om)h -Fz(r)o(oot)o FA(,)g(matching)g(the)573 4462 y(\256rst-level)d(\256les)g -(against)h(pattern)e Fz(pat)1775 4489 y Ft(1)1812 4462 y FA(,)i(the)f -(second-level)g(\256les)h(against)f Fz(pat)3013 4489 y Ft(2)3050 -4462 y FA(,)h(and)573 4562 y(so)23 b(forth.)34 b(The)23 b(list)h(of)e -(\256les)i(matching)f(the)g(whole)h(path)f(pattern)f(is)h(r)o(eturned,)f(in) -573 4661 y(sorted)e(or)o(der)-6 b(.)27 b(The)20 b(matcher)h(uses)g(Spencer)6 -b('s)20 b(r)o(egular)f(expr)o(ession)i(package.)573 4799 y(The)g(\256les)h -Fw(.)f FA(and)g Fw(..)f FA(ar)o(e)g(never)h(matched.)29 b(Other)21 -b(dot)h(\256les)g(ar)o(e)e(only)i(matched)f(if)573 4898 y(the)g -Fz(dot-\256les?)e FA(ar)o(gument)h(is)i Fw(#t)p FA(.)365 5147 -y FD(November)c(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 -323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 -5176 323 4 v 1216 w FA(45)p eop +45 50 bop 756 614 a Fx(\(map)41 b(\()p Fy(\025)e Fx(\(f\))k +(\(string-append)37 b(dir)43 b("/")f(f\)\))g(files\))573 +764 y FB(or)21 b(cd)f(to)h(the)g(dir)o(ectory)f(befor)o(e)g(using)h +(the)g(\002le)g(names:)756 940 y Fx(\(with-cwd)39 b(dir)843 +1040 y(\(for-each)h(delete-file)f(\(directory-file)o(s\)\))o(\))573 +1215 y FB(or)21 b(use)g(the)f Fx(glob)g FB(pr)o(ocedur)o(e,)e +(de\002ned)i(below)-8 b(.)573 1353 y(A)20 b(dir)o(ectory)g(list)i(can)e +(be)g(generated)g(by)h Fx(\(run/strings)39 b(\(ls\)\))p +FB(,)18 b(but)j(this)g(is)h(un-)573 1453 y(r)o(eliable,)32 +b(as)e(\002lenames)h(with)g(whitespace)g(in)g(their)g(names)g(will)g +(be)g(split)g(into)573 1552 y(separate)19 b(entries.)26 +b(Using)21 b Fx(directory-files)14 b FB(is)22 b(r)o(eliable.)365 +1758 y Fx(\(glob)42 b FA(pat)733 1785 y Fu(1)791 1758 +y FA(.)12 b(.)g(.)g Fx(\))87 b Ft(\000)-14 b(!)87 b FA(string)21 +b(list)1283 b FB(pr)o(ocedur)o(e)573 1904 y(Glob)27 b(each)f(pattern)g +(against)g(the)g(\002lesystem)h(and)f(r)o(eturn)g(the)h(sorted)f(list.) +43 b(Du-)573 2004 y(plicates)30 b(ar)o(e)g(not)i(r)o(emoved.)55 +b(Patterns)30 b(matching)i(nothing)h(ar)o(e)c(not)j(included)573 +2103 y(literally)-9 b(.)869 2073 y Fu(2)932 2103 y FB(C)21 +b(shell)h Fx({a,b,c})c FB(patterns)j(ar)o(e)e(expanded.)25 +b(Backslash)c(quotes)h(char)o(-)573 2203 y(acters,)e(turning)h(of)o(f)f +(the)h(special)f(meaning)i(of)e Fx({)p FB(,)g Fx(})p +FB(,)h Fx(*)p FB(,)f Fx([)p FB(,)g Fx(])p FB(,)g(and)g +Fx(?)p FB(.)573 2340 y(Note)33 b(that)h(the)f(r)o(ules)h(of)f +(backslash)h(for)f(Scheme)g(strings)h(and)f(glob)h(patterns)573 +2440 y(work)e(together)h(to)f(r)o(equir)o(e)f(four)h(backslashes)g(in)g +(a)g(r)o(ow)g(to)g(specify)g(a)g(single)573 2540 y(literal)20 +b(backslash.)26 b(Fortunately)-9 b(,)20 b(this)i(should)f(be)g(a)f(rar) +o(e)f(occurr)o(ence.)573 2677 y(A)27 b(glob)h(subpattern)f(will)h(not)g +(match)f(against)h(dot)f(\002les)h(unless)g(the)f(\002rst)h(char)o(-) +573 2777 y(acter)k(of)i(the)f(subpattern)h(is)f(a)g(literal)h(\223)p +Fx(.)p FB(\224.)62 b(Further)-6 b(,)36 b(a)d(dot)h(subpattern)f(will) +573 2877 y(not)g(match)f(the)h(\002les)f Fx(.)g FB(or)g +Fx(..)g FB(unless)h(it)f(is)h(a)f(constant)h(pattern,)h(as)e(in)h +Fx(\(glob)573 2976 y("../*/*.c"\))p FB(.)20 b(So)g(a)f(dir)o(ectory's)g +(dot)h(\002les)g(can)f(be)h(r)o(eliably)e(generated)h(with)h(the)573 +3076 y(simple)h(glob)g(pattern)g Fx(".*")p FB(.)573 3214 +y(Some)g(examples:)756 3364 y Fx(\(glob)41 b("*.c")h("*.h"\))930 +3463 y(;;)h(All)f(the)g(C)h(and)g(#include)d(files)i(in)g(my)h +(directory.)756 3662 y(\(glob)e("*.c")h("*/*.c"\))930 +3762 y(;;)h(All)f(the)g(C)h(files)f(in)h(this)f(directory)e(and)930 +3862 y(;;)j(its)f(immediate)e(subdirectories.)756 4061 +y(\(glob)h("lexer/*.c")e("parser/*.c"\))756 4161 y(\(glob)i +("{lexer,parser}/)o(*.c)o("\))930 4260 y(;;)i(All)f(the)g(C)h(files)f +(in)h(the)f(lexer)g(and)g(parser)f(dirs.)756 4459 y(\(glob)g +("\\\\{lexer,parser)o(\\\\})o(/*)o(.c)o("\))930 4559 +y(;;)i(All)f(the)g(C)h(files)f(in)h(the)f(strange)930 +4659 y(;;)h(directory)c("{lexer,parser}".)p 365 4821 +1146 4 v 450 4875 a Fp(2)485 4898 y Fs(Why)16 b(bother)g(to)h(mention)f +(such)g(a)h(silly)h(possibility?)k(Because)17 b(that)f(is)h(what)f(sh)h +(does.)365 5147 y FE(Mar)o(ch)i(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(45)p +eop %%Page: 46 52 -46 51 bop 888 614 a FA(A)16 b(given)h Fz(pat)1297 641 y Fm(i)1341 -614 y FA(pattern)f(is)h(matched)f(as)g(a)g(r)o(egexp,)f(so)i(it)g(is)g(not)g -(for)o(ced)e(to)h(match)h(the)888 714 y(entir)o(e)22 b(\256le)h(name.)33 -b Fz(E.g.)n FA(,)23 b(pattern)f Fw("t")f FA(matches)i(any)f(\256le)h -(containing)h(a)e(\252t\272)g(in)h(its)888 814 y(name,)e(while)g(pattern)f -Fw("^t$")f FA(matches)i(only)h(a)e(\256le)h(whose)g(entir)o(e)f(name)h(is)g -(\252)p Fw(t)p FA(\272.)888 963 y(The)g Fz(pat)1154 990 y Fm(i)1202 -963 y FA(patterns)g(can)f(be)h(mor)o(e)f(general)g(than)h(stated)f(above.)988 -1162 y Fs(\017)41 b FA(A)e(single)g(pattern)g(can)f(specify)h(multiple)h -(levels)e(of)h(the)h(path)e(by)h(em-)1071 1262 y(bedding)27 -b Fw(/)h FA(characters)e(within)j(the)e(pattern.)48 b(For)28 -b(example,)g(the)g(pattern)1071 1362 y Fw("a/b/c")12 b FA(gives)j(a)f(match)h -(equivalent)g(to)g(the)g(list)g(of)g(patterns)f Fw("a")42 b("b")h("c")p -FA(.)988 1511 y Fs(\017)e FA(A)25 b Fz(pat)1267 1538 y Fm(i)1320 -1511 y FA(pattern)f(can)h(be)g(a)g(pr)o(ocedur)o(e,)f(which)i(is)g(used)f(as) -g(a)f(match)i(pr)o(edi-)1071 1611 y(cate.)37 b(It)24 b(will)h(be)f(r)o -(epeatedly)f(called)g(with)i(a)f(candidate)f(\256le-name)h(to)g(test.)1071 -1710 y(The)e(\256le-name)g(will)h(be)f(the)g(entir)o(e)g(path)g(accumulated.) -31 b(If)22 b(the)g(pr)o(ocedur)o(e)1071 1810 y(raises)c(an)f(err)o(or)g -(condition,)j Fw(file-match)14 b FA(will)19 b(catch)e(the)i(err)o(or)e(and)g -(tr)o(eat)g(it)1071 1910 y(as)24 b(a)g(failed)g(match.)39 b(This)25 -b(keeps)f Fw(file-match)d FA(fr)o(om)j(being)h(blown)g(out)g(of)1071 -2009 y(the)f(water)f(by)h(applying)g(tests)g(to)g(dangling)h(symlinks)g(and)f -(other)g(similar)1071 2109 y(situations.)888 2308 y(Some)d(examples:)1226 -2408 y Fw(\(file-match)39 b("/usr/lib")h(#f)i("m$")g("^tab"\))f -Fl(=)-14 b Fs(\))1401 2507 y Fw(\("/usr/lib/term)o(/ta)o(b3)o(00)o(")38 -b("/usr/lib/term/)o(tab)o(30)o(0-1)o(2")f Fx(:)14 b(:)g(:)g -Fw(\))1226 2707 y(\(file-match)39 b(".")k(#f)86 b("^lex|parse|code)o(gen)o -($")37 b("\\\\.c$"\))j Fl(=)-14 b Fs(\))1401 2806 y Fw(\("lex/lex.c")38 -b("lex/lexinit.c")g("lex/test.c")1444 2906 y("parse/actions.c")f -("parse/error.c")g(parse/test.c")1444 3005 y("codegen/io.c")h -("codegen/walk.c")o(\))1226 3205 y(\(file-match)h(".")k(#f)86 -b("^lex|parse|code)o(gen)o($/)o(\\\\)o(.c$)o("\))1444 3304 -y(;;)43 b(The)f(same.)1226 3504 y(\(file-match)d(".")k(#f)86 -b(file-directory?\))1401 3603 y(;;)42 b(Return)f(all)i(subdirs)d(of)j(the)g -(current)d(directory.)1226 3802 y(\(file-match)f("/")k(#f)86 -b(file-directory?\))37 b Fl(=)-14 b Fs(\))1401 3902 y Fw(\("/bin")40 -b("/dev")h("/etc")g("/tmp")h("/usr"\))1401 4002 y(;;)g(All)h(subdirs)d(of)j -(root.)1226 4201 y(\(file-match)c(".")k(#f)86 b("\\\\.c"\))1401 -4301 y(;;)42 b(All)h(the)f(C)h(files)f(in)g(my)h(directory.)1226 -4500 y(\(define)e(\(ext)h(extension\))1313 4599 y(\()p Fx(\025)d -Fw(\(fn\))j(\(string-suffix?)37 b(fn)43 b(extension\)\)\))1226 -4799 y(\(define)e(\(true)g(.)j(x\))e(#t\))681 5147 y FA(46)p -1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 -5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +46 51 bop 1071 614 a Fx(\(glob)42 b("*\\\\*"\))1245 714 +y(;;)h(All)f(the)h(files)e(ending)g(in)i("*",)f(e.g.)1245 +814 y(;;)h(\("foo*")e("bar*"\))1071 1013 y(\(glob)h("*lexer*"\))1245 +1112 y(\("mylexer.c")d("lexer1.notes"\))1245 1212 y(;;)k(All)f(files)g +(containing)d(the)k(string)e("lexer".)1071 1411 y(\(glob)h("lexer"\)) +1245 1511 y(;;)h(Either)e(\("lexer"\))f(or)j(\(\).)888 +1650 y FB(If)21 b(the)h(\002rst)g(character)e(of)h(the)h(pattern)f +(\(after)f(expanding)h(braces\))f(is)i(a)f(slash,)h(the)888 +1749 y(sear)o(ch)c(begins)i(at)e(r)o(oot;)i(otherwise,)f(the)h(sear)o +(ch)e(begins)h(in)h(the)f(curr)o(ent)f(working)888 1849 +y(dir)o(ectory)-9 b(.)888 1980 y(If)19 b(the)g(last)g(character)f(of)h +(the)g(pattern)g(\(after)e(expanding)i(braces\))f(is)h(a)g(slash,)h +(then)888 2080 y(the)h(r)o(esult)g(matches)f(must)i(be)e(dir)o +(ectories,)g FA(e.g.)o FB(,)1071 2243 y Fx(\(glob)42 +b("/usr/man/man?/)o("\))37 b Fm(=)-14 b Ft(\))1420 2342 +y Fx(\("/usr/man/man1)o(/")37 b("/usr/man/man2/")g(...\))888 +2537 y FB(Globbing)29 b(can)e(sometimes)i(be)e(useful)g(when)h(we)f +(need)g(a)g(list)h(of)g(a)f(dir)o(ectory's)888 2636 y(\002les)32 +b(wher)o(e)e(each)h(element)g(in)g(the)g(list)h(includes)f(the)g +(pathname)g(for)g(the)g(\002le.)888 2736 y(Compar)o(e:)1071 +2899 y Fx(\(directory-files)37 b("../include"\))h Fm(=)-14 +b Ft(\))1245 2999 y Fx(\("cig.h")41 b("decls.h")e(...\))1071 +3198 y(\(glob)j("../include/*"\))37 b Fm(=)-14 b Ft(\))1245 +3298 y Fx(\("../include/cig.)o(h")37 b("../include/decl)o(s.h)o(")g +(...\))681 3564 y(\(glob-quote)i FA(str)p Fx(\))87 b +Ft(\000)-14 b(!)87 b FA(string)1319 b FB(pr)o(ocedur)o(e)888 +3702 y(Returns)29 b(a)f(constant)h(glob)g(pattern)e(that)i(exactly)e +(matches)h FA(str)q FB(.)48 b(All)28 b(wild-car)o(d)888 +3801 y(characters)20 b(in)h FA(str)g FB(ar)o(e)e(quoted)j(with)f(a)f +(backslash.)1071 3964 y Fx(\(glob-quote)39 b("Any)j(*.c)g(files?"\)) +1245 4064 y Fm(=)-14 b Ft(\))44 b Fx("Any)e(\\*.c)g(files\\?")681 +4330 y(\(file-match)d FA(r)o(oot)20 b(dot-\002les?)f(pat)1790 +4357 y Fu(1)1848 4330 y FA(pat)1954 4357 y Fu(2)2012 +4330 y FA(.)12 b(.)g(.)34 b(pat)2239 4357 y Fn(n)2284 +4330 y Fx(\))87 b Ft(\000)-15 b(!)87 b FA(string)21 b(list)205 +b FB(pr)o(ocedur)o(e)888 4468 y Fx(file-match)26 b FB(pr)o(ovides)j(a)g +(mor)o(e)h(powerful)f(\002le-matching)h(service,)i(at)d(the)h(ex-)888 +4568 y(pense)23 b(of)g(a)f(less)h(convenient)h(notation.)33 +b(It)23 b(is)g(intermediate)f(in)h(power)g(between)888 +4667 y(most)f(shell)f(matching)h(machinery)f(and)f(r)o(ecursive)g +Fx(find\(1\))p FB(.)888 4799 y(Each)g(pattern)g(is)g(a)g(r)o(egexp.)k +(The)c(pr)o(ocedur)o(e)f(sear)o(ches)g(fr)o(om)h FA(r)o(oot)o +FB(,)g(matching)h(the)888 4898 y(\002rst-level)c(\002les)h(against)f +(pattern)g FA(pat)2091 4925 y Fu(1)2128 4898 y FB(,)h(the)f +(second-level)g(\002les)g(against)h FA(pat)3329 4925 +y Fu(2)3366 4898 y FB(,)f(and)681 5147 y(46)p 1952 5071 +323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 +V 1952 5176 323 4 v 538 w FE(Mar)o(ch)i(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 47 53 -47 52 bop 911 614 a Fw(\(file-match)39 b(".")j(#f)86 b("./\\\\.c"\))911 -714 y(\(file-match)39 b(".")j(#f)86 b("")43 b("\\\\.c"\))911 -814 y(\(file-match)c(".")j(#f)86 b(true)42 b("\\\\.c"\))911 -913 y(\(file-match)d(".")j(#f)86 b(true)42 b(\(ext)g("c"\)\))1085 -1013 y(;;)h(All)f(the)h(C)g(files)e(of)i(all)f(my)h(immediate)d(subdirs.)911 -1212 y(\(file-match)f(".")j(#f)h("lexer"\))d Fl(=)-14 b Fs(\))1085 -1312 y Fw(\("mylexer.c")39 b("lexer.notes"\))1085 1411 y(;;)k(Compare)e(with) -g(\(glob)h("lexer"\),)e(above.)573 1674 y FA(Note)17 b(that)h(when)g -Fz(r)o(oot)e FA(is)i(the)f(curr)o(ent)g(working)h(dir)o(ectory)e(\()p -Fw(".")p FA(\),)g(when)i(it)g(is)f(con-)573 1773 y(verted)g(to)h(dir)o -(ectory)f(form,)i(it)f(becomes)g Fw("")p FA(,)f(and)h(doesn't)g(show)i(up)d -(in)i(the)f(r)o(esult)573 1873 y(\256le-names.)573 2014 y(It)23 -b(is)g(r)o(egr)o(ettable)e(that)i(the)g(r)o(egexp)f(wild)h(car)o(d)f(char)-6 -b(,)22 b(\252)p Fw(.)p FA(\272,)g(is)i(such)f(an)g(important)573 -2114 y(\256le)e(name)f(literal,)h(as)f(dot-\256le)h(pr)o(e\256x)e(and)i -(extension)g(delimiter)-6 b(.)365 2431 y Fw(\(create-temp-file)37 -b Fz([pr)o(e\256x])p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(string)905 -b FA(pr)o(ocedur)o(e)573 2581 y Fw(Create-temp-file)11 b FA(cr)o(eates)16 -b(a)i(new)g(temporary)f(\256le)h(and)g(r)o(eturn)f(its)h(name.)27 -b(The)573 2680 y(optional)k(ar)o(gument)f(speci\256es)h(the)g(\256lename)g -(pr)o(e\256x)e(to)i(use,)i(and)d(defaults)g(to)573 2780 y Fw("/usr/tmp/)p -Fz(pid)-5 b Fw(")p FA(,)19 b(wher)o(e)h Fz(pid)f FA(is)h(the)g(curr)o(ent)f -(pr)o(ocess')h(id.)27 b(The)20 b(pr)o(ocedur)o(e)e(gen-)573 -2880 y(erates)j(a)g(sequence)h(of)g(\256lenames)g(that)g(have)g -Fz(pr)o(e\256x)f FA(as)g(a)h(common)h(pr)o(e\256x,)e(look-)573 -2979 y(ing)27 b(for)g(a)f(\256lename)h(that)f(doesn't)i(alr)o(eady)c(exist)j -(in)g(the)g(\256le)g(system.)46 b(When)27 b(it)573 3079 y(\256nds)f(one,)i -(it)f(cr)o(eates)d(it,)k(with)f(permission)g Fw(#o600)d FA(and)i(r)o(eturns)f -(the)i(\256lename.)573 3178 y(\(The)14 b(\256le)h(permission)h(can)e(be)h -(changed)f(to)h(a)g(mor)o(e)f(permissive)h(permission)h(with)573 -3278 y Fw(set-file-mode)f FA(after)20 b(being)h(cr)o(eated\).)573 -3420 y(This)30 b(\256le)g(is)g(guaranteed)e(to)i(be)f(brand)g(new)-8 -b(.)54 b(No)30 b(other)g(pr)o(ocess)f(will)h(have)f(it)573 -3519 y(open.)d(This)18 b(pr)o(ocedur)o(e)d(does)i(not)g(simply)h(r)o(eturn)f -(a)f(\256lename)h(that)g(is)g(very)g(likely)573 3619 y(to)j(be)g(unused.)27 -b(It)20 b(r)o(eturns)f(a)h(\256lename)g(that)f(de\256nitely)i(did)e(not)i -(exist)f(at)f(the)h(mo-)573 3719 y(ment)h Fw(create-temp-file)14 -b FA(cr)o(eated)19 b(it.)573 3860 y(It)j(is)g(not)g(necessary)f(for)h(the)f -(pr)o(ocess')h(pid)f(to)h(be)g(a)f(part)g(of)g(the)h(\256lename)g(for)f(the) -573 3960 y(uniqueness)j(guarantees)d(to)i(hold.)33 b(The)22 -b(pid)h(component)g(of)g(the)f(default)g(pr)o(e\256x)573 4059 -y(simply)c(serves)f(to)g(scatter)g(the)g(name)g(sear)o(ches)f(into)i(sparse)f -(r)o(egions,)h(so)f(that)h(col-)573 4159 y(lisions)24 b(ar)o(e)d(less)j -(likely)f(to)g(occur)-6 b(.)33 b(This)23 b(speeds)g(things)h(up,)f(but)f -(does)h(not)h(af)o(fect)573 4259 y(corr)o(ectness.)573 4400 -y(Security)19 b(note:)27 b(doing)21 b(i/o)f(to)g(\256les)g(cr)o(eated)e(this) -i(way)g(in)g Fw(/usr/tmp/)c FA(is)k(not)g(nec-)573 4500 y(essarily)i(secur)o -(e.)31 b(General)21 b(users)i(have)e(write)h(access)g(to)h -Fw(/usr/tmp/)p FA(,)18 b(so)23 b(even)f(if)573 4599 y(an)i(attacker)e(cannot) -j(access)e(the)h(new)h(temp)f(\256le,)g(he)h(can)e(delete)h(it)g(and)f(r)o -(eplace)573 4699 y(it)d(with)h(one)f(of)g(his)h(own.)28 b(A)19 -b(subsequent)i(open)f(of)g(this)h(\256lename)f(will)g(then)h(give)573 -4799 y(you)16 b(his)g(\256le,)g(to)g(which)g(he)g(has)f(access)g(rights.)26 -b(Ther)o(e)14 b(ar)o(e)g(several)h(ways)g(to)h(defeat)573 4898 -y(this)21 b(attack,)365 5147 y FD(November)d(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1216 w FA(47)p eop +47 52 bop 573 614 a FB(so)23 b(forth.)33 b(The)23 b(list)g(of)g +(\002les)h(matching)f(the)h(whole)f(path)g(pattern)g(is)g(r)o(eturned,) +f(in)573 714 y(sorted)e(or)o(der)-6 b(.)25 b(The)20 b(matcher)h(uses)g +(Spencer)6 b('s)20 b(r)o(egular)g(expr)o(ession)g(package.)573 +839 y(The)h(\002les)h Fx(.)f FB(and)g Fx(..)g FB(ar)o(e)f(never)h +(matched.)27 b(Other)22 b(dot)f(\002les)h(ar)o(e)e(only)j(matched)e(if) +573 939 y(the)g FA(dot-\002les?)e FB(ar)o(gument)h(is)i +Fx(#t)p FB(.)573 1065 y(A)j(given)g FA(pat)999 1092 y +Fn(i)1052 1065 y FB(pattern)f(is)i(matched)f(as)f(a)h(r)o(egexp,)g(so)g +(it)h(is)f(not)h(for)o(ced)e(to)h(match)573 1164 y(the)c(entir)o(e)f +(\002le)h(name.)k FA(E.g.)o FB(,)c(pattern)f Fx("t")f +FB(matches)i(any)g(\002le)g(containing)h(a)e(\223t\224)g(in)573 +1264 y(its)27 b(name,)h(while)g(pattern)e Fx("^t$")f +FB(matches)i(only)h(a)e(\002le)h(whose)h(entir)o(e)e(name)h(is)573 +1363 y(\223)p Fx(t)p FB(\224.)573 1489 y(The)21 b FA(pat)839 +1516 y Fn(i)887 1489 y FB(patterns)f(can)h(be)f(mor)o(e)h(general)f +(than)h(stated)f(above.)672 1640 y Ft(\017)42 b FB(A)c(single)i +(pattern)e(can)h(specify)f(multiple)i(levels)f(of)g(the)g(path)g(by)g +(em-)756 1740 y(bedding)27 b Fx(/)g FB(characters)g(within)i(the)f +(pattern.)46 b(For)28 b(example,)g(the)g(pattern)756 +1839 y Fx("a/b/c")j FB(gives)j(a)g(match)g(equivalent)h(to)f(the)h +(list)f(of)h(patterns)e Fx("a")43 b("b")756 1939 y("c")p +FB(.)672 2057 y Ft(\017)f FB(A)24 b FA(pat)951 2084 y +Fn(i)1004 2057 y FB(pattern)h(can)g(be)g(a)f(pr)o(ocedur)o(e,)g(which)j +(is)e(used)g(as)g(a)g(match)g(pr)o(edi-)756 2157 y(cate.)35 +b(It)25 b(will)g(be)f(r)o(epeatedly)e(called)i(with)h(a)f(candidate)f +(\002le-name)h(to)h(test.)756 2256 y(The)d(\002le-name)g(will)h(be)f +(the)h(entir)o(e)e(path)i(accumulated.)29 b(If)22 b(the)h(pr)o(ocedur)o +(e)756 2356 y(raises)h(an)h(err)o(or)f(condition,)j Fx(file-match)20 +b FB(will)26 b(catch)e(the)i(err)o(or)d(and)i(tr)o(eat)756 +2456 y(it)19 b(as)f(a)h(failed)f(match.)25 b(This)19 +b(keeps)g Fx(file-match)c FB(fr)o(om)j(being)h(blown)h(out)g(of)756 +2555 y(the)j(water)h(by)g(applying)g(tests)g(to)g(dangling)g(symlinks)i +(and)d(other)h(similar)756 2655 y(situations.)573 2806 +y(Some)d(examples:)911 2906 y Fx(\(file-match)39 b("/usr/lib")g(#f)k +("m$")f("^tab"\))f Fm(=)-14 b Ft(\))1085 3005 y Fx(\("/usr/lib/term/)o +(tab)o(30)o(0")37 b("/usr/lib/term/ta)o(b3)o(00)o(-12)o(")g(...\))911 +3205 y(\(file-match)i(".")j(#f)86 b("^lex|parse|codeg)o(en$)o(")37 +b("\\\\.c$"\))k Fm(=)-14 b Ft(\))1085 3304 y Fx(\("lex/lex.c")39 +b("lex/lexinit.c")e("lex/test.c")1129 3404 y("parse/actions.)o(c")g +("parse/error.c")h(parse/test.c")1129 3504 y("codegen/io.c")f +("codegen/walk.c"\))911 3703 y(\(file-match)i(".")j(#f)86 +b("^lex|parse|codeg)o(en$)o(/\\)o(\\.c)o($")o(\))1129 +3802 y(;;)42 b(The)h(same.)911 4002 y(\(file-match)c(".")j(#f)86 +b(file-directory?\))1085 4101 y(;;)43 b(Return)e(all)h(subdirs)f(of)i +(the)f(current)f(directory.)911 4301 y(\(file-match)e("/")j(#f)86 +b(file-directory?\))37 b Fm(=)-14 b Ft(\))1085 4400 y +Fx(\("/bin")41 b("/dev")g("/etc")g("/tmp")g("/usr"\))1085 +4500 y(;;)i(All)f(subdirs)f(of)i(root.)911 4699 y(\(file-match)c(".")j +(#f)86 b("\\\\.c"\))1085 4799 y(;;)43 b(All)f(the)h(C)g(files)e(in)i +(my)g(directory.)365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(47)p +eop %%Page: 48 54 -48 53 bop 967 614 a FA(1.)41 b(Use)32 b Fw(temp-file-iterate)o -FA(,)d(below)-8 b(,)37 b(to)c(r)o(eturn)e(the)i(\256le)g(descriptor)f(allo-) -1071 714 y(cated)24 b(when)h(the)g(\256le)g(is)g(opened.)39 -b(This)25 b(will)h(work)f(if)g(the)g(\256le)g(only)g(needs)1071 -814 y(to)c(be)g(opened)f(once.)967 932 y(2.)41 b(If)23 b(the)h(\256le)f -(needs)g(to)h(be)f(opened)h(twice)f(or)h(mor)o(e,)f(cr)o(eate)f(it)h(in)h(a)f -(pr)o(otected)1071 1031 y(dir)o(ectory)-9 b(,)19 b Fz(e.g.)p -FA(,)h Fw($HOME)p FA(.)967 1150 y(3.)41 b(Ensur)o(e)21 b(that)g -Fw(/usr/tmp)e FA(has)i(its)h(sticky)h(bit)e(set.)30 b(This)22 -b(r)o(equir)o(es)f(system)h(ad-)1071 1249 y(ministrator)f(privileges.)888 -1401 y(The)39 b(actual)f(default)g(pr)o(e\256x)g(used)g(is)i(contr)o(olled)f -(by)f(the)h(dynamic)g(variable)888 1500 y Fw(*temp-file-templa)o(te)o(*)p -FA(,)31 b(and)j(can)g(be)g(overridden)g(for)g(incr)o(eased)e(security)-9 -b(.)888 1600 y(See)20 b Fw(temp-file-iterate)o FA(.)681 1833 -y Fw(\(temp-file-itera)o(te)37 b Fz(maker)21 b([template])p -Fw(\))85 b Fs(\000)-15 b(!)87 b Fz(object)2617 1803 y Ft(+)3170 -1833 y FA(pr)o(ocedur)o(e)681 1933 y Fw(*temp-file-templ)o(at)o(e*)1783 -b Fz(string)888 2060 y FA(This)20 b(pr)o(ocedur)o(e)d(can)i(be)g(used)g(to)g -(perform)g(certain)f(atomic)i(transactions)f(on)h(the)888 2159 -y(\256le)h(system)h(involving)g(\256lenames.)28 b(Some)20 b(examples:)988 -2311 y Fs(\017)41 b FA(Linking)22 b(a)e(\256le)h(to)g(a)f(fr)o(esh)g(backup)g -(temp)h(name.)988 2429 y Fs(\017)41 b FA(Cr)o(eating)20 b(and)g(opening)i(an) -e(unused,)h(secur)o(e)f(temp)h(\256le.)988 2547 y Fs(\017)41 -b FA(Cr)o(eating)20 b(an)g(unused)h(temporary)g(dir)o(ectory)-9 -b(.)888 2698 y(This)41 b(pr)o(ocedur)o(e)e(uses)i Fz(template)e -FA(to)i(generate)f(a)g(series)g(of)g(trial)h(\256le)f(names.)888 -2798 y Fz(T)-9 b(emplate)20 b FA(is)h(a)f Fw(format)f FA(contr)o(ol)i -(string,)g(and)f(defaults)g(to)1071 2937 y Fw("/usr/tmp/)p -Fz(pid)-5 b Fw(.~a")888 3075 y FA(wher)o(e)22 b Fz(pid)f FA(is)h(the)g(curr)o -(ent)f(pr)o(ocess')h(pr)o(ocess)f(id.)31 b(File)23 b(names)f(ar)o(e)e -(generated)h(by)888 3175 y(calling)f Fw(format)d FA(to)j(instantiate)g(the)f -(template's)h Fw(~a)e FA(\256eld)i(with)g(a)f(varying)h(string.)888 -3300 y Fz(Maker)g FA(is)g(a)e(pr)o(ocedur)o(e)f(which)j(is)g(serially)f -(called)f(on)i(each)e(\256le)h(name)g(generated.)888 3400 y(It)30 -b(must)g(r)o(eturn)f(at)f(least)i(one)f(value;)k(it)d(may)f(r)o(eturn)g -(multiple)h(values.)53 b(If)29 b(the)888 3500 y(\256rst)i(r)o(eturn)e(value)h -(is)g Fw(#f)f FA(or)i(if)f Fz(maker)g FA(raises)f(the)i Fw(errno/exist)25 -b FA(errno)30 b(excep-)888 3599 y(tion,)23 b Fw(temp-file-iterat)o(e)16 -b FA(will)22 b(loop,)h(generating)e(a)h(new)g(\256le)g(name)f(and)h(call-)888 -3699 y(ing)28 b Fz(maker)f FA(again.)45 b(If)27 b(the)g(\256rst)g(r)o(eturn)g -(value)f(is)h(tr)o(ue,)i(the)e(loop)g(is)h(terminated,)888 -3798 y(r)o(eturning)21 b(whatever)f(value\(s\))g Fz(maker)g -FA(r)o(eturned.)888 3924 y(After)k(a)h(number)g(of)g(unsuccessful)g(trials,)h -Fw(temp-file-iterat)o(e)19 b FA(may)25 b(give)g(up)888 4024 -y(and)c(signal)g(an)f(err)o(or)-6 b(.)888 4149 y(Thus,)22 b(if)f(we)g(ignor)o -(e)g(its)h(optional)g Fz(pr)o(e\256x)e FA(ar)o(gument,)g Fw(create-temp-file) -15 b FA(could)888 4249 y(be)21 b(de\256ned)f(as:)1071 4400 -y Fw(\(define)41 b(\(create-temp-fi)o(le\))1158 4500 y(\(let)h(\(\(flags)f -(\(bitwise-ior)d(open/create)h(open/exclusive\)\)\))1245 4599 -y(\(temp-file-iterat)o(e)1420 4699 y(\()p Fx(\025)f Fw(\(f\))1507 -4799 y(\(close)j(\(open-output-fil)o(e)d(f)43 b(flags)e(#o600\)\))1507 -4898 y(f\)\)\)\))681 5147 y FA(48)p 1952 5071 323 4 v 1952 -5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 -v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +48 53 bop 1226 614 a Fx(\(define)41 b(\(ext)h(extension\))1313 +714 y(\()p Fy(\025)d Fx(\(fn\))j(\(string-suffix?)37 +b(fn)43 b(extension\)\)\))1226 913 y(\(define)e(\(true)g(.)j(x\))e +(#t\))1226 1112 y(\(file-match)d(".")k(#f)86 b("./\\\\.c"\))1226 +1212 y(\(file-match)39 b(".")k(#f)86 b("")43 b("\\\\.c"\))1226 +1312 y(\(file-match)c(".")k(#f)86 b(true)42 b("\\\\.c"\))1226 +1411 y(\(file-match)d(".")k(#f)86 b(true)42 b(\(ext)g("c"\)\))1401 +1511 y(;;)g(All)h(the)f(C)h(files)f(of)g(all)h(my)g(immediate)c +(subdirs.)1226 1710 y(\(file-match)g(".")k(#f)f("lexer"\))f +Fm(=)-14 b Ft(\))1401 1810 y Fx(\("mylexer.c")38 b("lexer.notes"\))1401 +1910 y(;;)k(Compare)f(with)h(\(glob)f("lexer"\),)f(above.)888 +2156 y FB(Note)32 b(that)g(when)g FA(r)o(oot)f FB(is)h(the)g(curr)o +(ent)f(working)i(dir)o(ectory)e(\()p Fx(".")p FB(\),)h(when)h(it)f(is) +888 2255 y(converted)26 b(to)g(dir)o(ectory)f(form,)i(it)f(becomes)g +Fx("")p FB(,)f(and)h(doesn't)g(show)h(up)f(in)g(the)888 +2355 y(r)o(esult)21 b(\002le-names.)888 2486 y(It)i(is)h(r)o(egr)o +(ettable)d(that)i(the)g(r)o(egexp)f(wild)h(car)o(d)e(char)-6 +b(,)23 b(\223)p Fx(.)p FB(\224,)f(is)h(such)h(an)f(important)888 +2586 y(\002le)e(name)g(literal,)f(as)g(dot-\002le)h(pr)o(e\002x)f(and)g +(extension)i(delimiter)-6 b(.)681 2872 y Fx(\(create-temp-fil)o(e)37 +b FA([pr)o(e\002x])p Fx(\))85 b Ft(\000)-14 b(!)87 b +FA(string)905 b FB(pr)o(ocedur)o(e)888 3010 y Fx(Create-temp-file)12 +b FB(cr)o(eates)k(a)i(new)g(temporary)g(\002le)g(and)g(r)o(eturn)f(its) +i(name.)24 b(The)888 3110 y(optional)32 b(ar)o(gument)e(speci\002es)h +(the)f(\002lename)h(pr)o(e\002x)f(to)h(use,)i(and)d(defaults)g(to)888 +3209 y Fx("/usr/tmp/)p FA(pid)-5 b Fx(")p FB(,)20 b(wher)o(e)f +FA(pid)h FB(is)g(the)h(curr)o(ent)e(pr)o(ocess')h(id.)25 +b(The)20 b(pr)o(ocedur)o(e)e(gen-)888 3309 y(erates)j(a)h(sequence)g +(of)g(\002lenames)g(that)g(have)f FA(pr)o(e\002x)g FB(as)h(a)f(common)i +(pr)o(e\002x,)e(look-)888 3408 y(ing)28 b(for)e(a)h(\002lename)g(that)g +(doesn't)g(alr)o(eady)e(exist)i(in)g(the)g(\002le)g(system.)45 +b(When)27 b(it)888 3508 y(\002nds)g(one,)h(it)e(cr)o(eates)f(it,)i +(with)g(permission)g Fx(#o600)e FB(and)g(r)o(eturns)h(the)g +(\002lename.)888 3608 y(\(The)33 b(\002le)g(permission)i(can)d(be)h +(changed)g(to)g(a)g(mor)o(e)g(permissive)g(permission)888 +3707 y(with)22 b Fx(set-file-mode)15 b FB(after)20 b(being)h(cr)o +(eated\).)888 3839 y(This)31 b(\002le)e(is)h(guaranteed)f(to)h(be)f +(brand)g(new)-8 b(.)53 b(No)30 b(other)g(pr)o(ocess)f(will)i(have)e(it) +888 3938 y(open.)c(This)18 b(pr)o(ocedur)o(e)d(does)i(not)h(simply)g(r) +o(eturn)e(a)h(\002lename)g(that)g(is)h(very)e(likely)888 +4038 y(to)32 b(be)f(unused.)57 b(It)31 b(r)o(eturns)g(a)g(\002lename)g +(that)g(de\002nitely)h(did)f(not)h(exist)f(at)g(the)888 +4138 y(moment)22 b Fx(create-temp-file)14 b FB(cr)o(eated)19 +b(it.)888 4269 y(It)j(is)g(not)g(necessary)g(for)f(the)h(pr)o(ocess')f +(pid)h(to)g(be)f(a)g(part)g(of)h(the)g(\002lename)f(for)h(the)888 +4368 y(uniqueness)i(guarantees)e(to)h(hold.)31 b(The)23 +b(pid)f(component)i(of)f(the)f(default)g(pr)o(e\002x)888 +4468 y(simply)32 b(serves)e(to)i(scatter)e(the)g(name)h(sear)o(ches)f +(into)h(sparse)g(r)o(egions,)i(so)e(that)888 4568 y(collisions)i(ar)o +(e)d(less)h(likely)h(to)f(occur)-6 b(.)56 b(This)31 b(speeds)g(things)h +(up,)h(but)e(does)g(not)888 4667 y(af)o(fect)19 b(corr)o(ectness.)888 +4799 y(Security)33 b(note:)51 b(doing)34 b(i/o)g(to)f(\002les)h(cr)o +(eated)d(this)j(way)f(in)g Fx(/usr/tmp/)d FB(is)j(not)888 +4898 y(necessarily)18 b(secur)o(e.)23 b(General)17 b(users)g(have)g +(write)g(access)g(to)g Fx(/usr/tmp/)p FB(,)d(so)k(even)681 +5147 y(48)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)h(10,)g +(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 49 55 -49 54 bop 573 614 a FA(T)-8 b(o)21 b(r)o(ename)f(a)g(\256le)h(to)g(a)g -(temporary)f(name:)756 779 y Fw(\(temp-file-iter)o(at)o(e)38 -b(\()p Fx(\025)g Fw(\(backup\))1671 878 y(\(create-hard-lin)o(k)f(old-file)k -(backup\))1671 978 y(backup\))1584 1078 y(".#temp.~a"\))d(;)43 -b(Keep)f(link)g(in)h(cwd.)756 1177 y(\(delete-file)38 b(old-file\))573 -1342 y FA(Recall)15 b(that)h(scsh)g(r)o(eports)f(syscall)h(failur)o(e)e(by)i -(raising)g(an)f(err)o(or)g(exception,)h(not)g(by)573 1441 y(r)o(eturning)21 -b(an)g(err)o(or)f(code.)29 b(This)21 b(is)h(critical)f(to)g(to)h(this)g -(example\320the)f(pr)o(ogram-)573 1541 y(mer)16 b(can)g(assume)g(that)g(if)h -(the)f Fw(temp-file-iterat)o(e)10 b FA(call)16 b(r)o(eturns,)h(it)f(r)o -(eturns)g(suc-)573 1641 y(cessully)-9 b(.)32 b(So)22 b(the)h(following)h -Fw(delete-file)17 b FA(call)22 b(can)g(be)g(r)o(eliably)g(invoked,)g(safe)573 -1740 y(in)f(the)g(knowledge)g(that)g(the)g(backup)f(link)i(has)e -(de\256nitely)i(been)e(established.)573 1872 y(T)-8 b(o)21 -b(cr)o(eate)e(a)h(unique)i(temporary)e(dir)o(ectory:)756 2037 -y Fw(\(temp-file-iter)o(at)o(e)38 b(\()p Fx(\025)g Fw(\(dir\))k -(\(create-director)o(y)37 b(dir\))42 b(dir\))1584 2136 y("/usr/tmp/tempd)o -(ir.)o(~a)o("\))573 2301 y FA(Similar)21 b(operations)h(can)g(be)f(used)g(to) -h(generate)f(unique)i(symlinks)g(and)e(\256fos,)h(or)573 2401 -y(to)f(r)o(eturn)e(values)h(other)h(than)f(the)h(new)f(\256lename)h(\()p -Fz(e.g.)o FA(,)f(an)g(open)h(\256le)f(descriptor)573 2500 y(or)h(port\).)573 -2632 y(The)h(default)f(template)h(is)h(in)f(fact)g(taken)g(fr)o(om)g(the)g -(value)g(of)g(the)g(dynamic)h(vari-)573 2732 y(able)16 b Fw -(*temp-file-templa)o(te)o(*)p FA(,)11 b(which)18 b(itself)f(defaults)f(to)h -Fw("/usr/tmp/)p Fz(pid)-5 b Fw(.~a")p FA(,)573 2831 y(wher)o(e)17 -b Fz(pid)f FA(is)i(the)g(scsh)g(pr)o(ocess')f(pid.)26 b(For)18 -b(incr)o(eased)e(security)-9 b(,)18 b(a)f(user)g(may)h(wish)573 -2931 y(to)h(change)g(the)g(template)g(to)g(use)g(a)g(dir)o(ectory)f(not)i -(allowing)g(world)f(write)g(access)573 3031 y(\()p Fz(e.g.)o -FA(,)h(his)i(home)f(dir)o(ectory\).)365 3219 y Fw(\(temp-file-channe)o(l\))81 -b Fs(\000)-15 b(!)88 b Fz([inp)20 b(outp])1013 b FA(pr)o(ocedur)o(e)573 -3359 y(This)26 b(pr)o(ocedur)o(e)d(can)j(be)f(used)g(to)h(pr)o(ovide)e(an)i -(interpr)o(ocess)f(communications)573 3458 y(channel)k(with)h -(arbitrary-sized)d(buf)o(fering.)51 b(It)29 b(r)o(eturns)f(two)i(values,)g -(an)f(input)573 3558 y(port)23 b(and)f(an)h(output)h(port,)f(both)h(open)f -(on)h(a)e(new)h(temp)g(\256le.)35 b(The)23 b(temp)g(\256le)g(it-)573 -3658 y(self)e(is)i(deleted)d(fr)o(om)i(the)g(Unix)f(\256le)h(tr)o(ee)f(befor) -o(e)g Fw(temp-file-chann)o(el)15 b FA(r)o(eturns,)573 3757 -y(so)h(the)g(\256le)g(is)g(essentially)h(unnamed,)f(and)f(its)i(disk)f -(storage)f(is)i(r)o(eclaimed)d(as)h(soon)573 3857 y(as)20 b(the)h(two)h -(ports)f(ar)o(e)e(closed.)573 3989 y Fw(Temp-file-channe)o(l)c -FA(is)21 b(analogous)g(to)g Fw(port-pipe)c FA(with)22 b(two)f(exceptions:)672 -4153 y Fs(\017)42 b FA(If)16 b(the)h(writer)f(pr)o(ocess)g(gets)h(ahead)f(of) -g(the)h(r)o(eader)e(pr)o(ocess,)i(it)f(will)i(not)f(hang)756 -4253 y(waiting)i(for)f(some)h(small)g(pipe)g(buf)o(fer)e(to)i(drain.)26 -b(It)19 b(will)g(simply)g(buf)o(fer)e(the)756 4353 y(data)i(on)i(disk.)28 -b(This)21 b(is)h(good.)672 4484 y Fs(\017)42 b FA(If)19 b(the)h(r)o(eader)d -(pr)o(ocess)i(gets)h(ahead)f(of)g(the)h(writer)g(pr)o(ocess,)f(it)h(will)g -(also)g(not)756 4584 y(hang)e(waiting)g(for)g(data)f(fr)o(om)h(the)g(writer)g -(pr)o(ocess.)26 b(It)18 b(will)g(simply)h(see)f(and)756 4683 -y(r)o(eport)h(an)i(end)g(of)f(\256le.)28 b(This)21 b(is)g(bad.)756 -4799 y(In)i(or)o(der)e(to)j(ensur)o(e)e(that)h(an)g(end-of-\256le)f(r)o -(eturned)f(to)j(the)f(r)o(eader)d(is)k(legit-)756 4898 y(imate,)j(the)g(r)o -(eader)e(and)h(writer)g(must)i(serialise)e(their)h(i/o.)46 -b(The)27 b(simplest)365 5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1216 w FA(49)p eop +49 54 bop 573 614 a FB(if)18 b(an)h(attacker)e(cannot)i(access)f(the)h +(new)g(temp)f(\002le,)h(he)g(can)f(delete)g(it)h(and)f(r)o(eplace)573 +714 y(it)32 b(with)h(one)f(of)g(his)h(own.)60 b(A)32 +b(subsequent)g(open)h(of)f(this)g(\002lename)g(will)h(then)573 +814 y(give)21 b(you)g(his)g(\002le,)g(to)g(which)h(he)f(has)g(access)f +(rights.)26 b(Ther)o(e)20 b(ar)o(e)f(several)h(ways)h(to)573 +913 y(defeat)e(this)j(attack,)652 1083 y(1.)41 b(Use)32 +b Fx(temp-file-itera)o(te)p FB(,)d(below)-8 b(,)36 b(to)d(r)o(eturn)f +(the)h(\002le)g(descriptor)f(allo-)756 1182 y(cated)23 +b(when)j(the)f(\002le)g(is)g(opened.)38 b(This)25 b(will)h(work)f(if)g +(the)g(\002le)g(only)h(needs)756 1282 y(to)21 b(be)f(opened)h(once.)652 +1416 y(2.)41 b(If)23 b(the)g(\002le)h(needs)f(to)h(be)f(opened)g(twice) +h(or)f(mor)o(e,)h(cr)o(eate)d(it)j(in)g(a)f(pr)o(otected)756 +1516 y(dir)o(ectory)-9 b(,)19 b FA(e.g.)o FB(,)i Fx($HOME)p +FB(.)652 1651 y(3.)41 b(Ensur)o(e)21 b(that)g Fx(/usr/tmp)e +FB(has)i(its)i(sticky)f(bit)g(set.)28 b(This)22 b(r)o(equir)o(es)f +(system)i(ad-)756 1750 y(ministrator)e(privileges.)573 +1920 y(The)39 b(actual)f(default)f(pr)o(e\002x)h(used)h(is)g(contr)o +(olled)g(by)g(the)g(dynamic)g(variable)573 2019 y Fx(*temp-file-templ)o +(at)o(e*)p FB(,)31 b(and)j(can)g(be)g(overridden)f(for)h(incr)o(eased)f +(security)-9 b(.)573 2119 y(See)20 b Fx(temp-file-iterat)o(e)p +FB(.)365 2363 y Fx(\(temp-file-iterat)o(e)37 b FA(maker)21 +b([template])p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(object)2302 +2333 y Fu(+)2855 2363 y FB(pr)o(ocedur)o(e)365 2463 y +Fx(*temp-file-templa)o(te)o(*)1784 b FA(string)573 2606 +y FB(This)20 b(pr)o(ocedur)o(e)d(can)h(be)h(used)g(to)h(perform)e +(certain)h(atomic)g(transactions)h(on)f(the)573 2705 +y(\002le)i(system)g(involving)h(\002lenames.)k(Some)21 +b(examples:)672 2875 y Ft(\017)42 b FB(Linking)21 b(a)g(\002le)f(to)i +(a)e(fr)o(esh)g(backup)g(temp)h(name.)672 3009 y Ft(\017)42 +b FB(Cr)o(eating)19 b(and)i(opening)g(an)g(unused,)g(secur)o(e)e(temp)i +(\002le.)672 3144 y Ft(\017)42 b FB(Cr)o(eating)19 b(an)i(unused)g +(temporary)f(dir)o(ectory)-9 b(.)573 3313 y(This)41 b(pr)o(ocedur)o(e)d +(uses)j FA(template)f FB(to)g(generate)g(a)g(series)g(of)h(trial)f +(\002le)h(names.)573 3413 y FA(T)-9 b(emplate)19 b FB(is)j(a)e +Fx(format)e FB(contr)o(ol)j(string,)g(and)g(defaults)f(to)756 +3555 y Fx("/usr/tmp/)p FA(pid)-6 b Fx(.~a")573 3698 y +FB(wher)o(e)21 b FA(pid)h FB(is)g(the)g(curr)o(ent)g(pr)o(ocess')f(pr)o +(ocess)h(id.)29 b(File)23 b(names)f(ar)o(e)f(generated)f(by)573 +3797 y(calling)g Fx(format)d FB(to)j(instantiate)f(the)h(template's)f +Fx(~a)g FB(\002eld)g(with)i(a)e(varying)g(string.)573 +3932 y FA(Maker)32 b FB(is)h(a)e(pr)o(ocedur)o(e)f(which)j(is)f +(serially)g(called)f(on)h(each)g(\002le)g(name)g(gener)o(-)573 +4031 y(ated.)k(It)24 b(must)i(r)o(eturn)d(at)h(least)h(one)g(value;)g +(it)g(may)g(r)o(eturn)e(multiple)i(values.)37 b(If)573 +4131 y(the)29 b(\002rst)g(r)o(eturn)f(value)g(is)h Fx(#f)f +FB(or)g(if)h FA(maker)f FB(raises)h(the)g Fx(errno/exist)24 +b FB(errno)k(ex-)573 4231 y(ception,)h Fx(temp-file-itera)o(te)20 +b FB(will)28 b(loop,)h(generating)e(a)g(new)g(\002le)g(name)g(and)573 +4330 y(calling)18 b FA(maker)h FB(again.)24 b(If)18 b(the)g(\002rst)h +(r)o(eturn)e(value)h(is)h(tr)o(ue,)f(the)h(loop)g(is)f(terminated,)573 +4430 y(r)o(eturning)j(whatever)f(value\(s\))f FA(maker)i +FB(r)o(eturned.)573 4565 y(After)j(a)g(number)h(of)g(unsuccessful)h +(trials,)g Fx(temp-file-itera)o(te)19 b FB(may)25 b(give)g(up)573 +4664 y(and)20 b(signal)h(an)g(err)o(or)-6 b(.)573 4799 +y(Thus,)21 b(if)g(we)h(ignor)o(e)f(its)g(optional)h FA(pr)o(e\002x)e +FB(ar)o(gument,)h Fx(create-temp-file)14 b FB(could)573 +4898 y(be)20 b(de\002ned)h(as:)365 5147 y FE(Mar)o(ch)e(10,)g(1997)h +(\226)f(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 +4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 +v 1216 w FB(49)p eop %%Page: 50 56 -50 55 bop 1071 614 a FA(way)21 b(to)g(do)g(this)h(is)g(for)e(the)h(r)o(eader) -e(to)j(delay)e(doing)i(input)f(until)h(the)f(writer)1071 714 -y(has)g(completely)g(\256nished)g(doing)h(output,)f(or)g(exited.)681 -1043 y Fu(3.4)99 b(Processes)681 1273 y Fw(\(exec)41 b Fz(pr)o(og)20 -b(ar)o(g1)f Fx(:)14 b(:)g(:)g Fz(ar)o(gn)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(no)21 b(r)o(eturn)g(value)747 b FA(pr)o(ocedur)o(e)681 -1372 y Fw(\(exec-path)39 b Fz(pr)o(og)20 b(ar)o(g1)f Fx(:)14 -b(:)g(:)g Fz(ar)o(gn)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(no)21 -b(r)o(eturn)g(value)529 b FA(pr)o(ocedur)o(e)681 1472 y Fw(\(exec/env)40 -b Fz(pr)o(og)19 b(env)i(ar)o(g1)e Fx(:)14 b(:)g(:)g Fz(ar)o(gn)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(no)21 b(r)o(eturn)g(value)432 -b FA(pr)o(ocedur)o(e)681 1572 y Fw(\(exec-path/env)38 b Fz(pr)o(og)19 -b(env)i(ar)o(g1)e Fx(:)14 b(:)g(:)g Fz(ar)o(gn)p Fw(\))86 b -Fs(\000)-14 b(!)87 b Fz(no)21 b(r)o(eturn)g(value)214 b FA(pr)o(ocedur)o(e) -888 1691 y(The)17 b Fx(:)d(:)g(:)g Fw(/env)h FA(variants)i(take)f(an)h(envir) -o(onment)h(speci\256ed)e(as)h(a)f(string)p Fs(!)p FA(string)j(al-)888 -1791 y(ist.)33 b(An)22 b(envir)o(onment)h(of)f Fw(#t)f FA(is)i(taken)f(to)g -(mean)h(the)f(curr)o(ent)f(pr)o(ocess')h(envir)o(on-)888 1891 -y(ment)g(\()p Fz(i.e.)o FA(,)f(the)f(value)h(of)f(the)h(external)f(char)h -Fw(**environ)p FA(\).)888 2018 y([Rationale:)35 b Fw(#f)23 -b FA(is)i(a)e(mor)o(e)h(convenient)h(marker)f(for)g(the)g(curr)o(ent)f(envir) -o(onment)888 2118 y(than)h Fw(#t)p FA(,)f(but)g(would)g(cause)g(an)g -(ambiguity)h(on)g(Schemes)f(that)g(identify)g Fw(#f)f FA(and)888 -2218 y Fw(\(\))p FA(.])888 2346 y(The)h(path-sear)o(ching)f(variants)g(sear)o -(ch)g(the)h(dir)o(ectories)f(in)h(the)g(list)g Fw(exec-path-)888 -2445 y(list)30 b FA(for)h(the)g(pr)o(ogram.)57 b(A)31 b(path-sear)o(ch)e(is)j -(not)g(performed)e(if)h(the)g(pr)o(ogram)888 2545 y(name)22 -b(contains)g(a)e(slash)i(character)o(\320it)d(is)j(used)f(dir)o(ectly)-9 -b(.)28 b(So)21 b(a)g(pr)o(ogram)f(with)j(a)888 2645 y(name)d(like)g -Fw("bin/prog")15 b FA(always)20 b(executes)f(the)h(pr)o(ogram)f -Fw(bin/prog)d FA(in)k(the)g(cur)o(-)888 2744 y(r)o(ent)h(working)g(dir)o -(ectory)-9 b(.)27 b(See)20 b Fw($path)e FA(and)j Fw(exec-path-list)p -FA(,)14 b(below)-8 b(.)888 2872 y(Note)25 b(that)f(ther)o(e)f(is)i(no)f -(analog)g(to)h(the)f(C)g(function)h Fw(execv\(\))p FA(.)35 -b(T)-8 b(o)24 b(get)h(the)f(ef)o(fect)888 2972 y(just)e(do)1071 -3110 y Fw(\(apply)41 b(exec)h(prog)g(arglist\))888 3277 y FA(All)20 -b(of)g(these)h(pr)o(ocedur)o(es)d(\257ush)j(buf)o(fer)o(ed)d(output)i(and)g -(close)g(unr)o(evealed)f(ports)888 3377 y(befor)o(e)k(executing)h(the)g(new)g -(binary)-9 b(.)37 b(T)-8 b(o)24 b(avoid)g(\257ushing)h(buf)o(fer)o(ed)c -(output,)k(see)888 3476 y Fw(\045exec)19 b FA(below)-8 b(.)888 -3604 y(Note)22 b(that)f(the)h(C)f Fw(exec\(\))e FA(pr)o(ocedur)o(e)g(allows)j -(the)f(zer)o(oth)g(element)h(of)f(the)g(ar)o(gu-)888 3704 y(ment)h(vector)e -(to)h(be)g(dif)o(fer)o(ent)d(fr)o(om)j(the)g(\256le)f(being)h(executed,)f -Fz(e.g.)1071 3843 y Fw(char)42 b(*argv[])f(=)i({"-",)e("-f",)h(0};)1071 -3942 y(exec\("/bin/csh",)37 b(argv,)k(envp\);)888 4081 y FA(The)22 -b(scsh)g Fw(exec)p FA(,)d Fw(exec-path)p FA(,)f Fw(exec/env)p -FA(,)g(and)i Fw(exec-path/env)c FA(pr)o(ocedur)o(es)k(do)888 -4180 y(not)25 b(give)f(this)g(functionality\320element)h(0)e(of)h(the)g(ar)o -(g)f(vector)g(is)i(always)e(identi-)888 4280 y(cal)e(to)g(the)g -Fw(prog)e FA(ar)o(gument.)28 b(In)21 b(the)g(rar)o(e)e(case)i(the)g(user)g -(wishes)g(to)h(dif)o(fer)o(entiate)888 4380 y(these)k(two)f(items,)i(he)e -(can)g(use)g(the)h(low-level)f Fw(\045exec)e FA(and)i Fw(exec-path-searc)o(h) -888 4479 y FA(pr)o(ocedur)o(es.)g(These)20 b(pr)o(ocedur)o(es)d(never)i(r)o -(eturn)g(under)g(any)g(cir)o(cumstances.)26 b(As)888 4579 y(with)c(any)f -(other)g(system)g(call,)f(if)h(ther)o(e)f(is)h(an)g(err)o(or)-6 -b(,)19 b(they)i(raise)f(an)h(exception.)681 4755 y Fw(\(\045exec)41 -b Fz(pr)o(og)19 b(ar)o(glist)h(env)p Fw(\))87 b Fs(\000)-14 -b(!)87 b Fz(unde\256ned)975 b FA(pr)o(ocedur)o(e)681 4855 y -Fw(\(exec-path-searc)o(h)37 b Fz(fname)21 b(pathlist)p Fw(\))85 -b Fs(\000)-14 b(!)87 b Fz(string)21 b(or)g Fw(#f)474 b FA(pr)o(ocedur)o(e)681 -5147 y(50)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +50 55 bop 1071 614 a Fx(\(define)41 b(\(create-temp-fi)o(le\))1158 +714 y(\(let)h(\(\(flags)f(\(bitwise-ior)d(open/create)h +(open/exclusive\)\)\))1245 814 y(\(temp-file-iterat)o(e)1420 +913 y(\()p Fy(\025)f Fx(\(f\))1507 1013 y(\(close)j(\(open-output-fil)o +(e)d(f)43 b(flags)e(#o600\)\))1507 1112 y(f\)\)\)\))888 +1328 y FB(T)-8 b(o)22 b(r)o(ename)d(a)i(\002le)g(to)g(a)f(temporary)g +(name:)1071 1505 y Fx(\(temp-file-itera)o(te)37 b(\()p +Fy(\025)i Fx(\(backup\))1986 1605 y(\(create-hard-link)e(old-file)j +(backup\))1986 1705 y(backup\))1899 1804 y(".#temp.~a"\))f(;)k(Keep)f +(link)g(in)h(cwd.)1071 1904 y(\(delete-file)c(old-file\))888 +2081 y FB(Recall)26 b(that)f(scsh)h(r)o(eports)f(syscall)g(failur)o(e)f +(by)i(raising)f(an)h(err)o(or)e(exception,)i(not)888 +2181 y(by)i(r)o(eturning)f(an)f(err)o(or)h(code.)44 b(This)27 +b(is)h(critical)f(to)g(to)h(this)f(example\227the)g(pr)o(o-)888 +2280 y(grammer)j(can)g(assume)f(that)h(if)g(the)g Fx(temp-file-iterate) +23 b FB(call)30 b(r)o(eturns,)h(it)f(r)o(e-)888 2380 +y(turns)d(successully)-9 b(.)44 b(So)27 b(the)g(following)h +Fx(delete-file)22 b FB(call)k(can)h(be)f(r)o(eliably)g(in-)888 +2480 y(voked,)34 b(safe)c(in)h(the)h(knowledge)f(that)g(the)g(backup)g +(link)h(has)f(de\002nitely)g(been)888 2579 y(established.)888 +2718 y(T)-8 b(o)22 b(cr)o(eate)d(a)h(unique)i(temporary)e(dir)o +(ectory:)1071 2895 y Fx(\(temp-file-itera)o(te)37 b(\()p +Fy(\025)i Fx(\(dir\))i(\(create-directory)c(dir\))42 +b(dir\))1899 2994 y("/usr/tmp/tempdir)o(.~)o(a")o(\))888 +3171 y FB(Similar)22 b(operations)g(can)f(be)g(used)h(to)g(generate)f +(unique)h(symlinks)i(and)d(\002fos,)h(or)888 3271 y(to)f(r)o(eturn)f +(values)g(other)g(than)h(the)f(new)h(\002lename)f(\()p +FA(e.g.)o FB(,)g(an)g(open)h(\002le)f(descriptor)888 +3371 y(or)h(port\).)888 3509 y(The)i(default)e(template)h(is)g(in)h +(fact)e(taken)h(fr)o(om)g(the)g(value)g(of)g(the)h(dynamic)f(vari-)888 +3609 y(able)17 b Fx(*temp-file-temp)o(lat)o(e*)o FB(,)12 +b(which)18 b(itself)f(defaults)f(to)h Fx("/usr/tmp/)p +FA(pid)-5 b Fx(.~a")p FB(,)888 3708 y(wher)o(e)17 b FA(pid)g +FB(is)h(the)g(scsh)g(pr)o(ocess')g(pid.)24 b(For)18 b(incr)o(eased)e +(security)-9 b(,)18 b(a)f(user)g(may)h(wish)888 3808 +y(to)i(change)f(the)g(template)f(to)i(use)f(a)f(dir)o(ectory)h(not)g +(allowing)h(world)g(write)f(access)888 3908 y(\()p FA(e.g.)o +FB(,)i(his)g(home)h(dir)o(ectory\).)681 4115 y Fx(\(temp-file-chann)o +(el)o(\))81 b Ft(\000)-14 b(!)87 b FA([inp)20 b(outp])1013 +b FB(pr)o(ocedur)o(e)888 4262 y(This)26 b(pr)o(ocedur)o(e)e(can)h(be)g +(used)g(to)h(pr)o(ovide)f(an)g(interpr)o(ocess)g(communications)888 +4361 y(channel)30 b(with)g(arbitrary-sized)d(buf)o(fering.)49 +b(It)29 b(r)o(eturns)g(two)h(values,)h(an)e(input)888 +4461 y(port)17 b(and)f(an)h(output)g(port,)g(both)g(open)g(on)g(a)f +(new)h(temp)g(\002le.)24 b(The)17 b(temp)f(\002le)h(itself)888 +4561 y(is)27 b(deleted)e(fr)o(om)h(the)h(Unix)f(\002le)g(tr)o(ee)f +(befor)o(e)g Fx(temp-file-channel)20 b FB(r)o(eturns,)27 +b(so)888 4660 y(the)d(\002le)g(is)h(essentially)f(unnamed,)g(and)g(its) +g(disk)g(storage)g(is)g(r)o(eclaimed)e(as)i(soon)888 +4760 y(as)d(the)g(two)g(ports)g(ar)o(e)e(closed.)888 +4898 y Fx(Temp-file-channel)14 b FB(is)21 b(analogous)h(to)f +Fx(port-pipe)c FB(with)k(two)h(exceptions:)681 5147 y(50)p +1952 5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)d(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p eop %%Page: 51 57 -51 56 bop 573 614 a FA(The)30 b Fw(\045exec)f FA(pr)o(ocedur)o(e)f(is)j(the)f -(low-level)h(interface)e(to)i(the)f(system)i(call.)56 b(The)573 -714 y Fz(ar)o(glist)26 b FA(parameter)g(is)h(a)g(list)h(of)f(ar)o(guments;)i -Fz(env)f FA(is)f(either)g(a)g(string)p Fs(!)p FA(string)h(al-)573 -814 y(ist)e(or)g Fw(#t)p FA(.)41 b(The)26 b(new)g(pr)o(ogram's)f -Fw(argv[0])e FA(will)j(be)f(taken)h(fr)o(om)f Fw(\(car)42 b -Fz(ar)o(glist)o Fw(\))p FA(,)573 913 y Fz(not)19 b FA(fr)o(om)g -Fz(pr)o(og)o FA(.)27 b(An)20 b(envir)o(onment)g(of)f Fw(#t)g -FA(means)h(the)g(curr)o(ent)f(pr)o(ocess')g(envir)o(on-)573 -1013 y(ment.)28 b Fw(\045exec)18 b FA(does)j(not)h(\257ush)f(buf)o(fer)o(ed)e -(output)i(\(see)f Fw(flush-all-ports)p FA(\))o(.)573 1152 y(All)j(exec)g(pr)o -(ocedur)o(es,)g(including)h Fw(\045exec)p FA(,)e(coer)o(ce)h(the)g -Fw(prog)f FA(and)i Fw(arg)e FA(values)h(to)573 1251 y(strings)g(using)f(the)g -(usual)g(conversion)h(r)o(ules:)29 b(numbers)23 b(ar)o(e)d(converted)h(to)h -(deci-)573 1351 y(mal)f(numerals,)f(and)h(symbols)h(converted)e(to)h(their)g -(print-names.)573 1490 y Fw(exec-path-search)f FA(sear)o(ches)25 -b(the)h(dir)o(ectories)g(of)g Fz(pathlist)f FA(looking)j(for)f(an)f(oc-)573 -1590 y(curr)o(ence)31 b(of)h(\256le)h Fw(fname)p FA(.)60 b(If)31 -b(no)i(executable)e(\256le)i(is)f(found,)j(it)e(r)o(eturns)f -Fw(#f)p FA(.)61 b(If)573 1689 y Fw(fname)27 b FA(contains)j(a)f(slash)h -(character)-6 b(,)30 b(the)f(path)h(sear)o(ch)e(is)i(short-cir)o(cuited,)h -(but)573 1789 y(the)19 b(pr)o(ocedur)o(e)d(still)k(checks)e(to)i(ensur)o(e)e -(that)g(the)h(\256le)g(exists)g(and)f(is)h(executable\320)573 -1889 y(if)29 b(not,)j(it)e(still)g(r)o(eturns)f Fw(#f)p FA(.)52 -b(Users)29 b(of)g(this)h(pr)o(ocedur)o(e)e(should)i(be)f(awar)o(e)f(that)573 -1988 y(it)41 b(invites)g(a)f(potential)i(race)d(condition:)69 -b(between)41 b(checking)g(the)g(\256le)g(with)573 2088 y Fw(exec-path-search) -24 b FA(and)31 b(executing)g(it)g(with)h Fw(\045exec)p FA(,)g(the)f(\256le's) -g(status)h(might)573 2188 y(change.)k(The)24 b(only)g(atomic)g(way)g(to)g(do) -g(the)g(sear)o(ch)e(is)i(to)h(loop)f(over)f(the)h(candi-)573 -2287 y(date)f(\256le)h(names,)h(exec'ing)f(each)g(one)g(and)g(looping)h(when) -g(the)f(exec)f(operation)573 2387 y(fails.)573 2526 y(See)d -Fw($path)e FA(and)j Fw(exec-path-list)p FA(,)14 b(below)-8 -b(.)365 2735 y Fw(\(exit)42 b Fz([status])p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(no)20 b(r)o(eturn)i(value)1098 b FA(pr)o(ocedur)o(e)365 -2835 y Fw(\(\045exit)41 b Fz([status])p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(no)21 b(r)o(eturn)g(value)1055 b FA(pr)o(ocedur)o(e)573 -2982 y(These)24 b(pr)o(ocedur)o(es)e(terminate)h(the)h(curr)o(ent)f(pr)o -(ocess)g(with)i(a)e(given)h(exit)g(status.)573 3082 y(The)f(default)g(exit)g -(status)h(is)g(0.)35 b(The)24 b(low-level)f Fw(\045exit)f FA(pr)o(ocedur)o(e) -f(immediately)573 3181 y(terminates)g(the)f(pr)o(ocess)h(without)h -(\257ushing)g(buf)o(fer)o(ed)c(output.)365 3391 y Fw(\(call-terminally)37 -b Fz(thunk)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(no)20 b(r)o(eturn)i(value)678 -b FA(pr)o(ocedur)o(e)573 3538 y Fw(call-terminally)10 b FA(calls)16 -b(its)h(thunk.)27 b(When)17 b(the)g(thunk)g(r)o(eturns,)g(the)f(pr)o(ocess)g -(ex-)573 3638 y(its.)28 b(Although)21 b Fw(call-terminally)15 -b FA(could)21 b(be)f(implemented)h(as)756 3791 y Fw(\()p Fx(\025)38 -b Fw(\(thunk\))j(\(thunk\))g(\(exit)g(0\)\))573 3944 y FA(an)34 -b(implementation)h(can)f(take)f(advantage)g(of)h(the)g(fact)g(that)g(this)h -(pr)o(ocedur)o(e)573 4043 y(never)22 b(r)o(eturns.)34 b(For)23 -b(example,)g(the)g(r)o(untime)h(can)e(start)h(with)h(a)e(fr)o(esh)g(stack)h -(and)573 4143 y(also)g(start)g(with)h(a)e(fr)o(esh)g(dynamic)h(envir)o -(onment,)h(wher)o(e)f(shadowed)g(bindings)573 4243 y(ar)o(e)d(discar)o(ded.) -27 b(This)22 b(can)f(allow)h(the)g(old)f(stack)h(and)f(dynamic)g(envir)o -(onment)h(to)573 4342 y(be)h(collected)g(\(assuming)h(this)g(data)e(is)i(not) -g(r)o(eachable)d(thr)o(ough)j(some)g(live)f(con-)573 4442 y(tinuation\).)365 -4751 y Fw(\(suspend\))84 b Fs(\000)-15 b(!)88 b Fz(unde\256ned)1459 -b FA(pr)o(ocedur)o(e)573 4898 y(Suspend)20 b(the)h(curr)o(ent)f(pr)o(ocess)g -(with)i(a)e(SIGST)o(OP)g(signal.)365 5147 y FD(November)e(1,)h(1995)h(\261)f -(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w -FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FA(51)p eop +51 56 bop 672 614 a Ft(\017)42 b FB(If)16 b(the)h(writer)f(pr)o(ocess)g +(gets)h(ahead)f(of)g(the)h(r)o(eader)e(pr)o(ocess,)i(it)f(will)i(not)f +(hang)756 714 y(waiting)i(for)f(some)i(small)f(pipe)g(buf)o(fer)e(to)i +(drain.)24 b(It)19 b(will)h(simply)f(buf)o(fer)e(the)756 +814 y(data)i(on)i(disk.)26 b(This)c(is)f(good.)672 949 +y Ft(\017)42 b FB(If)19 b(the)h(r)o(eader)d(pr)o(ocess)i(gets)h(ahead)f +(of)g(the)h(writer)g(pr)o(ocess,)f(it)h(will)g(also)g(not)756 +1049 y(hang)e(waiting)h(for)f(data)f(fr)o(om)g(the)i(writer)f(pr)o +(ocess.)24 b(It)18 b(will)h(simply)g(see)f(and)756 1148 +y(r)o(eport)h(an)i(end)g(of)f(\002le.)26 b(This)21 b(is)g(bad.)756 +1266 y(In)i(or)o(der)e(to)j(ensur)o(e)e(that)h(an)g(end-of-\002le)f(r)o +(eturned)f(to)j(the)f(r)o(eader)d(is)k(legit-)756 1365 +y(imate,)j(the)g(r)o(eader)e(and)i(writer)f(must)i(serialise)e(their)h +(i/o.)45 b(The)27 b(simplest)756 1465 y(way)20 b(to)i(do)f(this)h(is)f +(for)g(the)g(r)o(eader)e(to)i(delay)g(doing)g(input)h(until)g(the)f +(writer)756 1565 y(has)f(completely)i(\002nished)f(doing)g(output,)g +(or)g(exited.)365 1924 y Fv(3.4)99 b(Processes)365 2167 +y Fx(\(exec)42 b FA(pr)o(og)19 b(ar)o(g1)h(.)12 b(.)g(.)g(ar)o(gn)p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(no)21 b(r)o(eturn)g(value)759 +b FB(pr)o(ocedur)o(e)365 2266 y Fx(\(exec-path)40 b FA(pr)o(og)19 +b(ar)o(g1)h(.)12 b(.)g(.)g(ar)o(gn)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(no)21 b(r)o(eturn)g(value)541 b FB(pr)o(ocedur)o(e)365 +2366 y Fx(\(exec/env)40 b FA(pr)o(og)20 b(env)g(ar)o(g1)g(.)12 +b(.)g(.)g(ar)o(gn)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(no)21 +b(r)o(eturn)g(value)444 b FB(pr)o(ocedur)o(e)365 2466 +y Fx(\(exec-path/env)38 b FA(pr)o(og)20 b(env)g(ar)o(g1)g(.)12 +b(.)g(.)g(ar)o(gn)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(no)21 +b(r)o(eturn)g(value)226 b FB(pr)o(ocedur)o(e)573 2591 +y(The)27 b Fx(.../env)d FB(variants)i(take)h(an)g(envir)o(onment)g +(speci\002ed)g(as)g(a)f(string)p Ft(!)p FB(string)573 +2691 y(alist.)43 b(An)27 b(envir)o(onment)g(of)f Fx(#t)g +FB(is)h(taken)f(to)h(mean)g(the)g(curr)o(ent)f(pr)o(ocess')g(envi-)573 +2791 y(r)o(onment)21 b(\()p FA(i.e.)p FB(,)f(the)h(value)f(of)h(the)g +(external)f(char)g Fx(**environ)p FB(\).)573 2926 y([Rationale:)33 +b Fx(#f)23 b FB(is)i(a)f(mor)o(e)g(convenient)h(marker)f(for)g(the)g +(curr)o(ent)g(envir)o(onment)573 3026 y(than)f Fx(#t)p +FB(,)g(but)g(would)h(cause)f(an)g(ambiguity)g(on)h(Schemes)f(that)g +(identify)h Fx(#f)e FB(and)573 3125 y Fx(\(\))p FB(.])573 +3261 y(The)h(path-sear)o(ching)e(variants)i(sear)o(ch)e(the)i(dir)o +(ectories)f(in)h(the)g(list)h Fx(exec-path-)573 3360 +y(list)29 b FB(for)i(the)h(pr)o(ogram.)56 b(A)31 b(path-sear)o(ch)e(is) +j(not)g(performed)e(if)h(the)g(pr)o(ogram)573 3460 y(name)26 +b(contains)h(a)f(slash)g(character)o(\227it)f(is)h(used)g(dir)o(ectly) +-9 b(.)41 b(So)26 b(a)g(pr)o(ogram)g(with)573 3560 y(a)j(name)i(like)f +Fx("bin/prog")c FB(always)k(executes)f(the)i(pr)o(ogram)e +Fx(bin/prog)e FB(in)j(the)573 3659 y(curr)o(ent)20 b(working)i(dir)o +(ectory)-9 b(.)24 b(See)c Fx($path)f FB(and)h Fx(exec-path-list)p +FB(,)15 b(below)-8 b(.)573 3795 y(Note)24 b(that)g(ther)o(e)g(is)h(no)f +(analog)h(to)f(the)h(C)f(function)h Fx(execv\(\))p FB(.)33 +b(T)-8 b(o)25 b(get)f(the)g(ef)o(fect)573 3894 y(just)d(do)756 +4039 y Fx(\(apply)41 b(exec)h(prog)f(arglist\))573 4220 +y FB(All)20 b(of)g(these)g(pr)o(ocedur)o(es)f(\003ush)i(buf)o(fer)o(ed) +c(output)k(and)e(close)i(unr)o(evealed)d(ports)573 4319 +y(befor)o(e)23 b(executing)h(the)g(new)g(binary)-9 b(.)35 +b(T)-8 b(o)25 b(avoid)f(\003ushing)h(buf)o(fer)o(ed)d(output,)j(see)573 +4419 y Fx(\045exec)19 b FB(below)-8 b(.)573 4554 y(Note)21 +b(that)h(the)f(C)g Fx(exec\(\))e FB(pr)o(ocedur)o(e)h(allows)h(the)h +(zer)o(oth)f(element)g(of)g(the)h(ar)o(gu-)573 4654 y(ment)f(vector)g +(to)g(be)f(dif)o(fer)o(ent)f(fr)o(om)h(the)h(\002le)g(being)g +(executed,)e FA(e.g.)756 4799 y Fx(char)41 b(*argv[])g(=)i({"-",)f +("-f",)f(0};)756 4898 y(exec\("/bin/csh")o(,)c(argv,)42 +b(envp\);)365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(51)p +eop %%Page: 52 58 -52 57 bop 681 766 a Fw(\(fork)41 b Fz([thunk])p Fw(\))86 b -Fs(\000)-15 b(!)88 b Fz(pr)o(oc)19 b(or)i Fw(#f)1281 b FA(pr)o(ocedur)o(e)681 -866 y Fw(\(\045fork)41 b Fz([thunk])p Fw(\))85 b Fs(\000)-14 -b(!)87 b Fz(pr)o(oc)20 b(or)h Fw(#f)1237 b FA(pr)o(ocedur)o(e)888 -1009 y Fw(fork)17 b FA(with)j(no)g(ar)o(guments)e(is)h(like)g(C)g -Fw(fork\(\))p FA(.)24 b(In)19 b(the)g(par)o(ent)f(pr)o(ocess,)g(it)i(r)o -(eturns)888 1109 y(the)26 b(child's)g Fz(pr)o(ocess)f(object)h -FA(\(see)f(below)h(for)f(mor)o(e)g(information)i(on)f(pr)o(ocess)f(ob-)888 -1208 y(jects\).)j(In)21 b(the)g(child)g(pr)o(ocess,)f(it)h(r)o(eturns)f -Fw(#f)p FA(.)888 1343 y Fw(fork)i FA(with)i(an)f(ar)o(gument)f(only)i(r)o -(eturns)f(in)h(the)f(par)o(ent)f(pr)o(ocess,)h(r)o(eturning)g(the)888 -1443 y(child's)f(pr)o(ocess)e(object.)28 b(The)20 b(child)h(pr)o(ocess)g -(calls)f Fz(thunk)g FA(and)h(then)g(exits.)888 1578 y Fw(fork)28 -b FA(\257ushes)h(buf)o(fer)o(ed)e(output)i(befor)o(e)f(forking,)j(and)d(sets) -h(the)g(child)g(pr)o(ocess)888 1677 y(to)e(non-interactive.)44 -b Fw(\045fork)24 b FA(does)j(not)g(perform)f(this)h(bookkeeping;)j(it)c -(simply)888 1777 y(forks.)681 1975 y Fw(\(fork/pipe)39 b Fz([thunk])p -Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(pr)o(oc)19 b(or)i Fw(#f)1063 -b FA(pr)o(ocedur)o(e)681 2074 y Fw(\(\045fork/pipe)39 b Fz([thunk])p -Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(pr)o(oc)20 b(or)h Fw(#f)1019 -b FA(pr)o(ocedur)o(e)888 2218 y(Like)27 b Fw(fork)f FA(and)g -Fw(\045fork)p FA(,)h(but)g(the)g(par)o(ent)f(and)h(child)g(communicate)h(via) -f(a)f(pipe)888 2317 y(connecting)18 b(the)e(par)o(ent's)f(stdin)i(to)f(the)g -(child's)h(stdout.)26 b(These)16 b(pr)o(ocedur)o(es)f(side-)888 -2417 y(ef)o(fect)k(the)i(par)o(ent)f(by)h(changing)g(his)h(stdin.)888 -2552 y(In)28 b(ef)o(fect,)f Fw(fork/pipe)d FA(splices)k(a)f(pr)o(ocess)g -(into)h(the)g(data)e(str)o(eam)h(immediately)888 2651 y(upstr)o(eam)35 -b(of)g(the)h(curr)o(ent)e(pr)o(ocess.)71 b(This)36 b(is)g(the)g(basic)f -(function)h(for)f(cr)o(eat-)888 2751 y(ing)j(pipelines.)76 -b(Long)38 b(pipelines)f(ar)o(e)f(built)h(by)g(performing)g(a)g(sequence)g(of) -888 2851 y Fw(fork/pipe)22 b FA(calls.)41 b(For)26 b(example,)g(to)g(cr)o -(eate)d(a)i(backgr)o(ound)g(two-pr)o(ocess)g(pipe)888 2950 -y Fw(a)44 b(|)f(b)p FA(,)20 b(we)h(write:)1071 3121 y Fw(\(fork)42 -b(\()p Fx(\025)c Fw(\(\))43 b(\(fork/pipe)c(a\))k(\(b\)\)\))888 -3291 y FA(which)22 b(r)o(eturns)e(the)h(pid)g(of)f Fw(b)p FA('s)h(pr)o -(ocess.)888 3426 y(T)-8 b(o)22 b(cr)o(eate)d(a)h(backgr)o(ound)g(thr)o(ee-pr) -o(ocess)f(pipe)i Fw(a)43 b(|)g(b)g(|)g(c)p FA(,)20 b(we)h(write:)1071 -3597 y Fw(\(fork)42 b(\()p Fx(\025)c Fw(\(\))43 b(\(fork/pipe)c(a\))1594 -3696 y(\(fork/pipe)g(b\))1594 3796 y(\(c\)\)\))888 3966 y FA(which)22 -b(r)o(eturns)e(the)h(pid)g(of)f Fw(c)p FA('s)h(pr)o(ocess.)888 -4101 y(Note)26 b(that)e(these)i(pr)o(ocedur)o(es)d(af)o(fect)g(\256le)i -(descriptors,)h(not)f(ports.)41 b(That)25 b(is,)h(the)888 4201 -y(pipe)18 b(is)g(allocated)f(connecting)j(the)e(child's)g(\256le)g -(descriptor)g(1)f(to)i(the)f(par)o(ent's)f(\256le)888 4301 -y(descriptor)i(0.)26 b Fz(Any)19 b(pr)o(evious)f(Scheme)g(port)h(built)g -(over)g(these)g(affected)f(\256le)h(descriptors)888 4400 y(is)h(shifted)e(to) -g(a)h(new)-5 b(,)19 b(unused)h(\256le)f(descriptor)f(with)g -Fw(dup)g Fz(befor)o(e)h(allocating)f(the)g(I/O)g(pipe.)888 -4500 y FA(This)h(means,)g(for)g(example,)f(that)g(the)h(ports)g(bound)f(to)h -Fw(\(current-input-po)o(rt)o(\))888 4599 y FA(and)f Fw(\(current-output)o(-p) -o(ort)o(\))11 b FA(in)19 b(either)e(pr)o(ocess)g(ar)o(e)f(not)j(af)o -(fected\320they)c(still)888 4699 y(r)o(efer)21 b(to)h(the)g(same)g(I/O)g -(sour)o(ces)g(and)f(sinks)i(as)f(befor)o(e.)29 b(Remember)22 -b(the)h(simple)888 4799 y(scsh)17 b(r)o(ule:)24 b(Scheme)16 -b(ports)g(ar)o(e)e(bound)i(to)g(I/O)g(sour)o(ces)f(and)g(sinks,)j -Fz(not)d FA(particular)888 4898 y(\256le)21 b(descriptors.)681 -5147 y(52)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)d(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +52 57 bop 888 614 a FB(The)22 b(scsh)g Fx(exec)p FB(,)d +Fx(exec-path)p FB(,)f Fx(exec/env)p FB(,)g(and)i Fx(exec-path/env)c +FB(pr)o(ocedur)o(es)k(do)888 714 y(not)e(give)f(this)h +(functionality\227element)g(0)e(of)h(the)g(ar)o(g)f(vector)h(is)h +(always)e(identical)888 814 y(to)31 b(the)f Fx(prog)e +FB(ar)o(gument.)52 b(In)30 b(the)g(rar)o(e)f(case)g(the)h(user)g +(wishes)g(to)h(dif)o(fer)o(entiate)888 913 y(these)26 +b(two)f(items,)i(he)e(can)g(use)g(the)h(low-level)f Fx(\045exec)e +FB(and)i Fx(exec-path-searc)o(h)888 1013 y FB(pr)o(ocedur)o(es.)f +(These)c(pr)o(ocedur)o(es)e(never)h(r)o(eturn)g(under)h(any)g(cir)o +(cumstances.)k(As)888 1112 y(with)e(any)f(other)g(system)g(call,)f(if)h +(ther)o(e)f(is)h(an)g(err)o(or)-6 b(,)19 b(they)i(raise)f(an)h +(exception.)681 1307 y Fx(\(\045exec)41 b FA(pr)o(og)19 +b(ar)o(glist)h(env)p Fx(\))87 b Ft(\000)-14 b(!)87 b +FA(unde\002ned)975 b FB(pr)o(ocedur)o(e)681 1406 y Fx +(\(exec-path-searc)o(h)37 b FA(fname)21 b(pathlist)p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(string)21 b(or)g Fx(#f)474 +b FB(pr)o(ocedur)o(e)888 1549 y(The)31 b Fx(\045exec)d +FB(pr)o(ocedur)o(e)h(is)i(the)f(low-level)h(interface)f(to)h(the)f +(system)i(call.)54 b(The)888 1648 y FA(ar)o(glist)27 +b FB(parameter)e(is)j(a)e(list)i(of)f(ar)o(guments;)j +FA(env)d FB(is)h(either)f(a)f(string)p Ft(!)p FB(string)j(al-)888 +1748 y(ist)e(or)e Fx(#t)p FB(.)40 b(The)26 b(new)g(pr)o(ogram's)g +Fx(argv[0])c FB(will)27 b(be)e(taken)h(fr)o(om)f Fx(\(car)42 +b FA(ar)o(glist)p Fx(\))p FB(,)888 1848 y FA(not)20 b +FB(fr)o(om)f FA(pr)o(og)o FB(.)25 b(An)20 b(envir)o(onment)g(of)g +Fx(#t)f FB(means)h(the)g(curr)o(ent)f(pr)o(ocess')g(envir)o(on-)888 +1947 y(ment.)26 b Fx(\045exec)19 b FB(does)i(not)g(\003ush)h(buf)o(fer) +o(ed)c(output)j(\(see)f Fx(flush-all-ports)p FB(\).)888 +2081 y(All)33 b(exec)f(pr)o(ocedur)o(es,)i(including)f +Fx(\045exec)p FB(,)h(coer)o(ce)e(the)g Fx(prog)g FB(and)g +Fx(arg)f FB(values)888 2181 y(to)h(strings)h(using)f(the)g(usual)g +(conversion)h(r)o(ules:)47 b(numbers)32 b(ar)o(e)e(converted)i(to)888 +2280 y(decimal)21 b(numerals,)f(and)h(symbols)h(converted)e(to)h(their) +g(print-names.)888 2414 y Fx(exec-path-search)f FB(sear)o(ches)25 +b(the)i(dir)o(ectories)e(of)i FA(pathlist)e FB(looking)j(for)e(an)g +(oc-)888 2514 y(curr)o(ence)32 b(of)g(\002le)h Fx(fname)p +FB(.)58 b(If)33 b(no)g(executable)e(\002le)i(is)f(found,)k(it)c(r)o +(eturns)g Fx(#f)p FB(.)60 b(If)888 2614 y Fx(fname)28 +b FB(contains)i(a)f(slash)h(character)-6 b(,)29 b(the)h(path)f(sear)o +(ch)g(is)g(short-cir)o(cuited,)i(but)888 2713 y(the)19 +b(pr)o(ocedur)o(e)e(still)i(checks)g(to)g(ensur)o(e)f(that)h(the)f +(\002le)h(exists)g(and)f(is)h(executable\227)888 2813 +y(if)30 b(not,)i(it)d(still)i(r)o(eturns)e Fx(#f)p FB(.)51 +b(Users)29 b(of)g(this)h(pr)o(ocedur)o(e)e(should)i(be)f(awar)o(e)f +(that)888 2912 y(it)42 b(invites)f(a)f(potential)i(race)e(condition:)67 +b(between)41 b(checking)g(the)g(\002le)g(with)888 3012 +y Fx(exec-path-search)25 b FB(and)30 b(executing)i(it)f(with)h +Fx(\045exec)p FB(,)f(the)g(\002le's)h(status)f(might)888 +3112 y(change.)k(The)24 b(only)h(atomic)f(way)f(to)i(do)e(the)h(sear)o +(ch)f(is)h(to)h(loop)f(over)g(the)g(candi-)888 3211 y(date)f(\002le)i +(names,)f(exec'ing)h(each)e(one)i(and)e(looping)j(when)e(the)h(exec)e +(operation)888 3311 y(fails.)888 3445 y(See)d Fx($path)f +FB(and)h Fx(exec-path-list)p FB(,)15 b(below)-8 b(.)681 +3639 y Fx(\(exit)41 b FA([status])p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(no)21 b(r)o(eturn)g(value)1098 b FB(pr)o(ocedur)o(e)681 +3739 y Fx(\(\045exit)41 b FA([status])p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(no)21 b(r)o(eturn)g(value)1054 b FB(pr)o(ocedur)o(e)888 +3881 y(These)24 b(pr)o(ocedur)o(es)e(terminate)i(the)f(curr)o(ent)g(pr) +o(ocess)h(with)g(a)g(given)g(exit)f(status.)888 3981 +y(The)h(default)f(exit)g(status)h(is)g(0.)34 b(The)24 +b(low-level)g Fx(\045exit)d FB(pr)o(ocedur)o(e)h(immediately)888 +4080 y(terminates)f(the)g(pr)o(ocess)f(without)i(\003ushing)h(buf)o +(fer)o(ed)18 b(output.)681 4274 y Fx(\(call-terminally)37 +b FA(thunk)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(no)21 +b(r)o(eturn)g(value)678 b FB(pr)o(ocedur)o(e)888 4417 +y Fx(call-terminally)23 b FB(calls)29 b(its)h(thunk.)51 +b(When)30 b(the)f(thunk)h(r)o(eturns,)g(the)f(pr)o(ocess)888 +4516 y(exits.)d(Although)c Fx(call-terminally)14 b FB(could)21 +b(be)f(implemented)h(as)1071 4658 y Fx(\()p Fy(\025)39 +b Fx(\(thunk\))h(\(thunk\))h(\(exit)h(0\)\))888 4799 +y FB(an)34 b(implementation)i(can)d(take)h(advantage)f(of)h(the)g(fact) +f(that)h(this)h(pr)o(ocedur)o(e)888 4898 y(never)23 b(r)o(eturns.)32 +b(For)23 b(example,)g(the)g(r)o(untime)h(can)f(start)g(with)h(a)e(fr)o +(esh)h(stack)f(and)681 5147 y(52)p 1952 5071 323 4 v +1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 +5176 323 4 v 538 w FE(Mar)o(ch)d(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 53 59 -53 58 bop 573 614 a FA(If)25 b(the)g(child)g(pr)o(ocess)g(wishes)h(to)f(r)o -(ebind)g(the)g(curr)o(ent)f(output)i(port)f(to)h(the)f(pipe)573 -714 y(on)39 b(\256le)g(descriptor)g(1,)j(it)d(can)g(do)f(this)i(using)f -Fw(with-current-outp)o(ut-)o(po)o(rt)573 814 y FA(or)e(a)f(r)o(elated)g -(form.)76 b(Similarly)-9 b(,)40 b(if)d(the)g(par)o(ent)f(wishes)h(to)h -(change)f(the)g(cur)o(-)573 913 y(r)o(ent)h(input)h(port)g(to)g(the)g(pipe)g -(on)g(\256le)g(descriptor)f(0,)43 b(it)c(can)f(do)h(this)h(using)573 -1013 y Fw(set-current-inpu)o(t-)o(por)o(t!)16 b FA(or)23 b(a)f(r)o(elated)f -(form.)33 b(Her)o(e)21 b(is)i(an)g(example)f(show-)573 1112 -y(ing)f(how)h(to)f(set)g(up)g(the)f(I/O)i(ports)f(on)g(both)h(sides)e(of)h -(the)g(pipe:)756 1272 y Fw(\(fork/pipe)39 b(\()p Fx(\025)g -Fw(\(\))1322 1372 y(\(with-current-ou)o(tpu)o(t-)o(por)o(t)e(\(fdes->outport) -h(1\))1409 1472 y(\(display)j("Hello,)f(world.\\n"\)\)\)\))756 -1671 y(\(set-current-in)o(pu)o(t-p)o(or)o(t!)d(\(fdes->inport)h(0\))756 -1770 y(\(read-line\))344 b(;)43 b(Read)f(the)g(string)f(output)g(by)i(the)f -(child.)573 1930 y FA(None)14 b(of)g(this)h(is)f(necessary)f(when)i(the)f -(I/O)g(is)h(performed)e(by)h(an)f(exec'd)g(pr)o(ogram)573 2030 -y(in)25 b(the)g(child)g(or)f(par)o(ent)g(pr)o(ocess,)h(only)g(when)h(the)f -(pipe)f(will)h(be)g(r)o(efer)o(enced)c(by)573 2129 y(Scheme)f(code)h(thr)o -(ough)g(one)g(of)g(the)g(default)e(curr)o(ent)h(I/O)i(ports.)365 -2311 y Fw(\(fork/pipe+)39 b Fz(conns)21 b([thunk])p Fw(\))86 -b Fs(\000)-15 b(!)88 b Fz(pr)o(oc)19 b(or)i Fw(#f)804 b FA(pr)o(ocedur)o(e) -365 2411 y Fw(\(\045fork/pipe+)39 b Fz(conns)21 b([thunk])p -Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(pr)o(oc)20 b(or)h Fw(#f)760 -b FA(pr)o(ocedur)o(e)573 2545 y(Like)25 b Fw(fork/pipe)p FA(,)e(but)j(the)g -(pipe)f(connections)i(between)f(the)g(child)f(and)h(par)o(ent)573 -2645 y(ar)o(e)19 b(speci\256ed)i(by)f(the)h(connection)h(list)g -Fz(conns)p FA(.)27 b(See)20 b(the)756 2784 y Fw(\(|+)42 b Fz(conns)i(pf)1222 -2811 y Ft(1)1303 2784 y Fx(:)14 b(:)g(:)57 b Fz(pf)1510 2811 -y Fm(n)1556 2784 y Fw(\))573 2922 y FA(pr)o(ocess)20 b(form)h(for)g(a)f -(description)h(of)g(connection)h(lists.)365 3184 y Fy(3.4.1)81 -b(Process)20 b(objects)g(and)f(process)h(reaping)365 3367 y -FA(Scsh)27 b(uses)g Fz(pr)o(ocess)g(objects)g FA(to)g(r)o(epr)o(esent)e(Unix) -i(pr)o(ocesses.)45 b(They)27 b(ar)o(e)e(cr)o(eated)g(by)h(the)365 -3466 y Fw(fork)19 b FA(pr)o(ocedur)o(e,)g(and)h(have)g(the)h(following)i -(exposed)d(str)o(uctur)o(e:)573 3645 y Fw(\(define-record)38 -b(proc)922 3744 y(pid\))379 3923 y FA(The)15 b(only)g(exposed)e(slot)i(in)g -(a)f(pr)o(oc)f(r)o(ecor)o(d)f(is)j(the)f(pr)o(ocess')g(pid,)h(the)f(integer)g -(id)h(assigned)365 4022 y(by)k(Unix)g(to)g(the)f(pr)o(ocess.)27 -b(The)18 b(only)i(exported)e(primitive)h(pr)o(ocedur)o(es)e(for)h(manipulat-) -365 4122 y(ing)e(pr)o(ocess)f(objects)h(ar)o(e)e Fw(proc?)f -FA(and)i Fw(proc:pid)p FA(.)23 b(Pr)o(ocess)15 b(objects)h(ar)o(e)e(cr)o -(eated)f(with)j(the)365 4222 y Fw(fork)j FA(pr)o(ocedur)o(e.)365 -4365 y Fw(\(pid->proc)40 b Fz(pid)20 b([pr)o(obe?])p Fw(\))85 -b Fs(\000)-14 b(!)87 b Fz(pr)o(oc)1111 b FA(pr)o(ocedur)o(e)573 -4500 y(This)24 b(pr)o(ocedur)o(e)e(maps)i(integer)g(Unix)f(pr)o(ocess)h(ids)g -(to)g(scsh)g(pr)o(ocess)f(objects.)38 b(It)573 4599 y(is)22 -b(intended)f(for)h(use)f(in)h(interactive)f(and)h(debugging)g(code,)f(and)g -(is)h(depr)o(ecated)573 4699 y(for)g(use)g(in)h(pr)o(oduction)g(code.)32 -b(If)22 b(ther)o(e)f(is)i(no)g(pr)o(ocess)f(object)h(in)g(the)f(system)h(in-) -573 4799 y(dexed)i(by)h(the)g(given)g(pid,)h Fw(pid->proc)p -FA('s)22 b(action)k(is)h(determined)e(by)h(the)g Fz(pr)o(obe?)573 -4898 y FA(parameter)19 b(\(default)g Fw(#f)p FA(\):)365 5147 -y FD(November)f(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 -323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 -5176 323 4 v 1216 w FA(53)p eop +53 58 bop 573 614 a FB(also)23 b(start)g(with)h(a)e(fr)o(esh)g(dynamic) +h(envir)o(onment,)h(wher)o(e)f(shadowed)g(bindings)573 +714 y(ar)o(e)28 b(discar)o(ded.)49 b(This)30 b(can)f(allow)h(the)g(old) +f(stack)h(and)f(dynamic)g(envir)o(onment)573 814 y(to)i(be)g(collected) +g(\(assuming)h(this)g(data)e(is)h(not)h(r)o(eachable)d(thr)o(ough)j +(some)g(live)573 913 y(continuation\).)365 1240 y Fx(\(suspend\))84 +b Ft(\000)-15 b(!)88 b FA(unde\002ned)1459 b FB(pr)o(ocedur)o(e)573 +1393 y(Suspend)20 b(the)h(curr)o(ent)f(pr)o(ocess)g(with)i(a)e(SIGST)o +(OP)g(signal.)365 1720 y Fx(\(fork)42 b FA([thunk])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(pr)o(oc)20 b(or)h +Fx(#f)1281 b FB(pr)o(ocedur)o(e)365 1820 y Fx(\(\045fork)41 +b FA([thunk])p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(pr)o(oc)19 +b(or)i Fx(#f)1238 b FB(pr)o(ocedur)o(e)573 1973 y Fx(fork)28 +b FB(with)j(no)g(ar)o(guments)f(is)h(like)f(C)g Fx(fork\(\))p +FB(.)52 b(In)30 b(the)g(par)o(ent)g(pr)o(ocess,)h(it)g(r)o(e-)573 +2073 y(turns)19 b(the)g(child's)g FA(pr)o(ocess)g(object)g +FB(\(see)f(below)h(for)f(mor)o(e)h(information)h(on)f(pr)o(ocess)573 +2172 y(objects\).)26 b(In)21 b(the)g(child)f(pr)o(ocess,)h(it)g(r)o +(eturns)f Fx(#f)p FB(.)573 2317 y Fx(fork)h FB(with)j(an)f(ar)o(gument) +g(only)h(r)o(eturns)e(in)i(the)f(par)o(ent)f(pr)o(ocess,)h(r)o +(eturning)g(the)573 2417 y(child's)e(pr)o(ocess)f(object.)26 +b(The)21 b(child)g(pr)o(ocess)f(calls)h FA(thunk)f FB(and)g(then)i +(exits.)573 2562 y Fx(fork)27 b FB(\003ushes)j(buf)o(fer)o(ed)c(output) +k(befor)o(e)d(forking,)k(and)e(sets)g(the)g(child)g(pr)o(ocess)573 +2661 y(to)e(non-interactive.)42 b Fx(\045fork)25 b FB(does)h(not)i +(perform)e(this)h(bookkeeping;)j(it)d(simply)573 2761 +y(forks.)365 2988 y Fx(\(fork/pipe)40 b FA([thunk])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(pr)o(oc)20 b(or)h +Fx(#f)1063 b FB(pr)o(ocedur)o(e)365 3088 y Fx(\(\045fork/pipe)39 +b FA([thunk])p Fx(\))86 b Ft(\000)-15 b(!)88 b FA(pr)o(oc)19 +b(or)i Fx(#f)1020 b FB(pr)o(ocedur)o(e)573 3241 y(Like)27 +b Fx(fork)e FB(and)i Fx(\045fork)p FB(,)f(but)i(the)f(par)o(ent)f(and)g +(child)i(communicate)f(via)g(a)g(pipe)573 3341 y(connecting)17 +b(the)g(par)o(ent's)e(stdin)i(to)g(the)f(child's)h(stdout.)24 +b(These)17 b(pr)o(ocedur)o(es)d(side-)573 3440 y(ef)o(fect)19 +b(the)i(par)o(ent)e(by)i(changing)h(his)f(stdin.)573 +3585 y(In)28 b(ef)o(fect,)f Fx(fork/pipe)d FB(splices)j(a)g(pr)o(ocess) +g(into)i(the)e(data)g(str)o(eam)f(immediately)573 3685 +y(upstr)o(eam)35 b(of)g(the)h(curr)o(ent)e(pr)o(ocess.)70 +b(This)36 b(is)g(the)g(basic)f(function)h(for)f(cr)o(eat-)573 +3784 y(ing)j(pipelines.)75 b(Long)37 b(pipelines)h(ar)o(e)e(built)h(by) +g(performing)h(a)e(sequence)i(of)573 3884 y Fx(fork/pipe)16 +b FB(calls.)25 b(For)20 b(example,)f(to)h(cr)o(eate)e(a)h(backgr)o +(ound)g(two-pr)o(ocess)h(pipe)f Fx(a)573 3984 y(|)43 +b(b)p FB(,)20 b(we)h(write:)756 4174 y Fx(\(fork)41 b(\()p +Fy(\025)e Fx(\(\))k(\(fork/pipe)c(a\))k(\(b\)\)\))573 +4364 y FB(which)22 b(r)o(eturns)e(the)h(pr)o(ocess)f(object)h(for)g +Fx(b)p FB('s)f(pr)o(ocess.)573 4509 y(T)-8 b(o)21 b(cr)o(eate)e(a)h +(backgr)o(ound)h(thr)o(ee-pr)o(ocess)e(pipe)h Fx(a)43 +b(|)h(b)f(|)g(c)p FB(,)20 b(we)h(write:)756 4699 y Fx(\(fork)41 +b(\()p Fy(\025)e Fx(\(\))k(\(fork/pipe)c(a\))1279 4799 +y(\(fork/pipe)g(b\))1279 4898 y(\(c\)\)\))365 5147 y +FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(53)p eop %%Page: 54 60 -54 59 bop 1490 535 1455 4 v 1490 634 4 100 v 1543 604 a Fz(pr)o(obe?)p -1981 634 V 269 w FA(Return)p 2940 634 V 1490 638 1455 4 v 1490 -654 V 1490 754 4 100 v 1543 724 a Fw(#f)p 1981 754 V 403 w -Fz(signal)21 b(err)o(or)g(condition.)p 2940 754 V 1490 757 -1455 4 v 1490 857 4 100 v 1543 827 a Fw('create)p 1981 857 -V 183 w FA(Cr)o(eate)e(new)i(pr)o(oc)f(object.)p 2940 857 V -1490 860 1455 4 v 1490 960 4 100 v 1543 930 a(T)-7 b(r)o(ue)20 -b(value)p 1981 960 V 102 w Fw(#f)p 2940 960 V 1490 963 1455 -4 v 805 1169 a FA(Sometime)h(after)e(a)h(child)h(pr)o(ocess)f(terminates,)g -(scsh)h(will)g(perform)f(a)g Fw(wait)e FA(system)681 1269 y(call)25 -b(on)h(the)g(child)g(in)g(backgr)o(ound,)g(caching)g(the)g(pr)o(ocess')f -(exit)h(status)g(in)g(the)g(child's)681 1369 y(pr)o(oc)33 b(object.)66 -b(This)34 b(is)g(called)f(\252r)o(eaping\272)f(the)i(pr)o(ocess.)65 -b(Once)34 b(the)g(child)g(has)f(been)681 1468 y(waited,)19 -b(the)g(Unix)g(kernel)h(can)f(fr)o(ee)f(the)h(storage)g(allocated)g(for)g -(the)g(dead)f(pr)o(ocess')h(exit)681 1568 y(information,)g(so)g(pr)o(ocess)e -(r)o(eaping)h(pr)o(events)f(the)h(pr)o(ocess)g(table)g(fr)o(om)f(becoming)i -(clut-)681 1668 y(ter)o(ed)j(with)i(un-waited)f(dead)g(child)g(pr)o(ocesses)g -(\(a.k.a.)34 b(\252zombies\272\).)h(This)24 b(can)f(be)g(es-)681 -1767 y(pecially)j(sever)o(e)f(if)h(the)g(scsh)h(pr)o(ocess)f(never)g(waits)h -(on)g(child)f(pr)o(ocesses)g(at)g(all;)j(if)d(the)681 1867 -y(pr)o(ocess)c(table)g(over\257ows)h(with)g(for)o(gotten)g(zombies,)g(the)f -(OS)h(may)f(be)g(unable)g(to)h(fork)681 1966 y(further)d(pr)o(ocesses.)805 -2105 y(Reaping)28 b(a)e(child)h(pr)o(ocess)g(moves)g(its)h(exit)e(status)h -(information)h(fr)o(om)f(the)g(kernel)681 2204 y(into)22 b(the)f(scsh)g(pr)o -(ocess,)g(wher)o(e)f(it)i(is)f(cached)f(inside)h(the)h(child's)f(pr)o(ocess)g -(object.)28 b(If)21 b(the)681 2304 y(scsh)g(user)g(dr)o(ops)f(all)g(pointers) -i(to)f(the)g(pr)o(ocess)f(object,)h(it)g(will)g(simply)h(be)e(garbage)g(col-) -681 2404 y(lected.)33 b(On)24 b(the)f(other)g(hand,)g(if)g(the)g(scsh)h(pr)o -(ogram)e(r)o(etains)g(a)h(pointer)g(to)g(the)g(pr)o(ocess)681 -2503 y(object,)i(it)f(can)f(use)h(scsh's)h Fw(wait)d FA(system)j(call)f(to)g -(synchr)o(onise)h(with)g(the)f(child)g(and)f(r)o(e-)681 2603 -y(trieve)15 b(its)i(exit)f(status)g(multiple)h(times)g(\(this)f(is)h(not)g -(possible)f(with)h(simple)g(Unix)f(integer)681 2702 y(pids)21 -b(in)g(C\320the)g(pr)o(ogrammer)e(can)i(only)h(wait)e(on)i(a)e(pid)h(once\).) -805 2841 y(Thus,)h(pr)o(ocess)e(objects)i(allow)f(scsh)g(pr)o(ogrammer)f(to)i -(do)f(two)g(things)i(not)e(allowed)681 2940 y(in)g(other)g(pr)o(ogramming)g -(envir)o(onments:)805 3154 y Fs(\017)41 b FA(Subpr)o(ocesses)30 -b(that)h(ar)o(e)e(never)h(waited)g(on)h(ar)o(e)f(still)h(r)o(emoved)f(fr)o -(om)g(the)h(pr)o(o-)888 3254 y(cess)16 b(table,)g(and)g(their)g(associated)f -(exit)h(status)g(data)e(is)i(eventually)g(automatically)888 -3353 y(garbage)k(collected.)805 3538 y Fs(\017)41 b FA(Subpr)o(ocesses)20 -b(can)h(be)f(waited)g(on)i(multiple)f(times.)805 3752 y(However)-6 -b(,)27 b(note)f(that)f(once)h(a)g(child)g(has)f(exited,)h(if)g(the)f(scsh)i -(pr)o(ogrammer)e(dr)o(ops)681 3851 y(all)d(pointers)h(to)g(the)g(child's)f -(pr)o(oc)g(object,)h(the)g(child's)g(exit)f(status)h(will)g(be)f(r)o(eaped)e -(and)681 3951 y(thr)o(own)d(away)-9 b(.)25 b(This)18 b(is)f(the)g(intended)g -(behaviour)-6 b(,)17 b(and)f(it)h(means)g(that)g(integer)g(pids)f(ar)o(e)681 -4050 y(not)24 b(enough)g(to)g(cause)f(a)g(pr)o(ocess's)g(exit)g(status)h(to)f -(be)h(r)o(etained)e(by)h(the)h(scsh)f(r)o(untime.)681 4150 -y(\(This)e(is)g(because)f(it)h(is)g(clearly)f(impossible)i(to)f(GC)g(data)e -(r)o(efer)o(enced)f(by)j(integers.\))805 4288 y(As)15 b(a)g(convenience)g -(for)g(interactive)g(use)g(and)g(debugging,)h(all)f(pr)o(ocedur)o(es)e(that)j -(take)681 4388 y(pr)o(ocess)21 b(objects)h(will)g(also)g(accept)e(integer)h -(Unix)h(pids)f(as)g(ar)o(guments,)g(coer)o(cing)h(them)681 -4488 y(to)h(the)g(corr)o(esponding)g(pr)o(ocess)f(objects.)34 -b(Since)22 b(integer)h(pr)o(ocess)f(ids)h(ar)o(e)e(not)i(r)o(eliable)681 -4587 y(ways)17 b(to)g(keep)g(a)f(child's)i(exit)f(status)g(fr)o(om)f(being)h -(r)o(eaped)e(and)i(garbage)f(collected,)h(pr)o(o-)681 4687 -y(grammers)j(ar)o(e)g(encouraged)g(to)h(use)g(pr)o(ocess)f(objects)h(in)h(pr) -o(oduction)e(code.)681 4845 y Fw(\(autoreap-policy)37 b Fz([policy])p -Fw(\))85 b Fs(\000)-15 b(!)88 b Fz(old-policy)810 b FA(pr)o(ocedur)o(e)681 -5147 y(54)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +54 59 bop 888 614 a FB(which)22 b(r)o(eturns)e(the)h(pr)o(ocess)f +(object)i(for)e Fx(c)p FB('s)h(pr)o(ocess.)888 749 y(Note)26 +b(that)f(these)g(pr)o(ocedur)o(es)e(af)o(fect)h(\002le)h(descriptors,)h +(not)g(ports.)39 b(That)25 b(is,)h(the)888 849 y(pipe)18 +b(is)g(allocated)f(connecting)j(the)e(child's)g(\002le)g(descriptor)g +(1)f(to)i(the)f(par)o(ent's)f(\002le)888 948 y(descriptor)i(0.)24 +b FA(Any)19 b(pr)o(evious)g(Scheme)f(port)h(built)g(over)g(these)g +(affected)g(\002le)g(descriptors)888 1048 y(is)h(shifted)e(to)g(a)h +(new)-5 b(,)19 b(unused)h(\002le)f(descriptor)f(with)g +Fx(dup)g FA(befor)o(e)h(allocating)f(the)g(I/O)g(pipe.)888 +1148 y FB(This)h(means,)g(for)g(example,)f(that)g(the)h(ports)g(bound)f +(to)h Fx(\(current-input-po)o(rt)o(\))888 1247 y FB(and)f +Fx(\(current-output)o(-p)o(ort)o(\))11 b FB(in)19 b(either)e(pr)o +(ocess)g(ar)o(e)f(not)j(af)o(fected\227they)c(still)888 +1347 y(r)o(efer)21 b(to)h(the)g(same)g(I/O)h(sour)o(ces)f(and)f(sinks)i +(as)f(befor)o(e.)28 b(Remember)22 b(the)h(simple)888 +1446 y(scsh)17 b(r)o(ule:)23 b(Scheme)15 b(ports)h(ar)o(e)f(bound)h(to) +g(I/O)g(sour)o(ces)g(and)f(sinks,)j FA(not)d FB(particular)888 +1546 y(\002le)21 b(descriptors.)888 1681 y(If)k(the)g(child)h(pr)o +(ocess)e(wishes)i(to)g(r)o(ebind)e(the)h(curr)o(ent)g(output)g(port)h +(to)f(the)g(pipe)888 1780 y(on)40 b(\002le)f(descriptor)f(1,)43 +b(it)c(can)f(do)h(this)g(using)h Fx(with-current-out)o(put)o(-p)o(or)o +(t)888 1880 y FB(or)e(a)e(r)o(elated)f(form.)75 b(Similarly)-9 +b(,)41 b(if)36 b(the)i(par)o(ent)e(wishes)i(to)f(change)g(the)g(cur)o +(-)888 1980 y(r)o(ent)i(input)g(port)g(to)g(the)g(pipe)f(on)i(\002le)f +(descriptor)f(0,)k(it)d(can)g(do)g(this)g(using)888 2079 +y Fx(set-current-input)o(-p)o(ort)o(!)17 b FB(or)23 b(a)f(r)o(elated)f +(form.)32 b(Her)o(e)21 b(is)j(an)e(example)g(show-)888 +2179 y(ing)g(how)f(to)h(set)e(up)h(the)g(I/O)g(ports)g(on)h(both)f +(sides)g(of)g(the)f(pipe:)1071 2349 y Fx(\(fork/pipe)39 +b(\()p Fy(\025)g Fx(\(\))1638 2448 y(\(with-current-o)o(utp)o(ut)o(-po) +o(rt)e(\(fdes->outport)h(1\))1725 2548 y(\(display)i("Hello,)h +(world.\\n"\)\)\)\))1071 2747 y(\(set-current-inp)o(ut-)o(po)o(rt)o(!)d +(\(fdes->inport)g(0\))1071 2847 y(\(read-line\))344 b(;)43 +b(Read)f(the)h(string)e(output)g(by)i(the)f(child.)888 +3017 y FB(None)27 b(of)g(this)g(is)h(necessary)e(when)h(the)g(I/O)g(is) +g(performed)f(by)h(an)f(exec'd)g(pr)o(o-)888 3116 y(gram)17 +b(in)g(the)g(child)g(or)g(par)o(ent)f(pr)o(ocess,)h(only)h(when)f(the)g +(pipe)g(will)g(be)g(r)o(efer)o(enced)888 3216 y(by)k(Scheme)g(code)f +(thr)o(ough)h(one)g(of)g(the)g(default)f(curr)o(ent)g(I/O)h(ports.)681 +3413 y Fx(\(fork/pipe+)39 b FA(conns)21 b([thunk])p Fx(\))85 +b Ft(\000)-14 b(!)87 b FA(pr)o(oc)20 b(or)h Fx(#f)803 +b FB(pr)o(ocedur)o(e)681 3512 y Fx(\(\045fork/pipe+)38 +b FA(conns)21 b([thunk])p Fx(\))86 b Ft(\000)-14 b(!)87 +b FA(pr)o(oc)19 b(or)i Fx(#f)760 b FB(pr)o(ocedur)o(e)888 +3655 y(Like)26 b Fx(fork/pipe)p FB(,)d(but)i(the)h(pipe)g(connections)h +(between)e(the)h(child)g(and)f(par)o(ent)888 3755 y(ar)o(e)20 +b(speci\002ed)g(by)h(the)g(connection)h(list)f FA(conns)p +FB(.)26 b(See)20 b(the)1071 3898 y Fx(\(|+)42 b FA(conns)i(pf)1537 +3925 y Fu(1)1618 3898 y Fx(...)f FA(pf)1846 3925 y Fn(n)1891 +3898 y Fx(\))888 4041 y FB(pr)o(ocess)21 b(form)f(for)h(a)f +(description)h(of)g(connection)h(lists.)681 4317 y Fz(3.4.1)81 +b(Process)20 b(objects)f(and)h(process)g(reaping)681 +4503 y FB(Scsh)27 b(uses)g FA(pr)o(ocess)f(objects)i +FB(to)f(r)o(epr)o(esent)e(Unix)i(pr)o(ocesses.)44 b(They)27 +b(ar)o(e)e(cr)o(eated)g(by)i(the)681 4603 y Fx(fork)19 +b FB(pr)o(ocedur)o(e,)f(and)j(have)f(the)h(following)h(exposed)e(str)o +(uctur)o(e:)888 4799 y Fx(\(define-record)38 b(proc)1237 +4898 y(pid\))681 5147 y FB(54)p 1952 5071 323 4 v 1952 +5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 5176 +323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 55 61 -55 60 bop 573 614 a FA(The)20 b(scsh)g(pr)o(ogrammer)f(can)g(choose)i(dif)o -(fer)o(ent)d(policies)i(for)f(automatic)h(pr)o(ocess)573 714 -y(r)o(eaping.)40 b(The)25 b(policy)h(is)f(determined)g(by)g(applying)g(this)h -(pr)o(ocedur)o(e)d(to)j(one)g(of)573 814 y(the)21 b(values)f -Fw('early)p FA(,)e Fw('late)p FA(,)h(or)h Fw(#f)g FA(\()p Fz(i.e.)p -FA(,)g(no)i(autor)o(eap\).)573 996 y Fy(early)40 b FA(The)17 -b(child)g(is)g(r)o(eaped)e(fr)o(om)h(the)h(Unix)f(kernel's)h(pr)o(ocess)f -(table)g(into)i(scsh)f(as)756 1096 y(soon)k(as)f(possible)h(after)e(it)i -(dies.)27 b(In)21 b(the)f(curr)o(ent)g(r)o(elease)f(of)h(scsh,)h(this)g(hap-) -756 1195 y(pens)c(at)h(the)f(next)h(call)f(to)h Fw(wait)p FA(\320when)f(scsh) -h(is)g(asked)f(to)h(wait)g(for)f(a)h(partic-)756 1295 y(ular)k(child)i(to)f -(exit,)g(it)h(will)g(r)o(eap)d Fz(all)j FA(outstanding)g(zombies.)34 -b(When)24 b(signal)756 1395 y(handlers)17 b(ar)o(e)f(added)g(to)j(a)e(futur)o -(e)f(r)o(elease)h(of)g(scsh,)i(early)e(autor)o(eaping)g(will)756 -1494 y(use)j(the)h Fw(SIGCHLD)d FA(signal)j(to)g(r)o(eap)f(zombies)h(with)g -(minimum)i(delay)-9 b(.)573 1635 y Fy(late)40 b FA(The)21 b(child)g(is)h(not) -g(autor)o(eaped)d(until)j(it)f(dies)g Fz(and)g FA(the)g(scsh)h(pr)o(ogram)e -(dr)o(ops)756 1735 y(all)g(pointers)i(to)f(its)g(pr)o(ocess)g(object.)28 -b(That)21 b(is,)g(the)g(pr)o(ocess)g(table)f(is)h(cleaned)756 -1835 y(out)g(during)g(garbage)e(collection.)573 1976 y Fw(#f)41 -b FA(If)19 b(autor)o(eaping)g(is)h(turned)g(of)o(f,)f(pr)o(ocess)g(r)o -(eaping)g(is)h(completely)h(under)e(con-)756 2075 y(tr)o(ol)29 -b(of)h(the)g(pr)o(ogrammer)-6 b(,)30 b(who)h(can)f(for)o(ce)e(outstanding)j -(zombies)f(to)g(be)756 2175 y(r)o(eaped)h(by)i(manually)g(calling)h(the)f -Fw(reap-zombies)28 b FA(pr)o(ocedur)o(e)k(\(see)g(be-)756 2275 -y(low\).)573 2457 y(Note)18 b(that)f(under)g(any)h(of)f(the)h(autor)o(eap)e -(policies,)j(a)e(particular)f(pr)o(ocess)h Fx(p)h FA(can)f(be)573 -2557 y(manually)24 b(r)o(eaped)f(into)i(scsh)g(by)g(simply)g(calling)g -Fw(\(wait)41 b Fx(p)p Fw(\))p FA(.)d Fz(All)24 b FA(zombies)h(can)573 -2656 y(be)20 b(manually)h(r)o(eaped)e(with)i Fw(reap-zombies)p -FA(.)573 2798 y(The)40 b Fw(autoreap-policy)33 b FA(pr)o(ocedur)o(e)38 -b(r)o(eturns)h(the)h(policy's)h(pr)o(evious)e(value.)573 2897 -y(Calling)26 b Fw(autoreap-policy)20 b FA(with)27 b(no)f(ar)o(guments)g(r)o -(eturns)g(the)g(curr)o(ent)f(policy)573 2997 y(without)d(no)f(change.)365 -3312 y Fw(\(reap-zombies\))82 b Fs(\000)-15 b(!)88 b Fz(boolean)1321 -b FA(pr)o(ocedur)o(e)573 3462 y(This)25 b(pr)o(ocedur)o(e)d(r)o(eaps)h(all)i -(outstanding)g(exited)f(child)g(pr)o(ocesses)g(into)i(scsh.)39 -b(It)573 3561 y(r)o(eturns)25 b(tr)o(ue)i(if)f(ther)o(e)f(ar)o(e)g(no)h(mor)o -(e)g(child)h(pr)o(ocesses)e(to)i(wait)f(on,)i(and)d(false)h(if)573 -3661 y(ther)o(e)20 b(ar)o(e)f(outstanding)j(pr)o(ocesses)e(still)i(r)o -(unning)g(or)f(suspended.)365 4101 y Fy(Issues)f(with)g(process)g(reaping)365 -4301 y FA(Reaping)26 b(a)f(pr)o(ocess)h(does)f(not)i(r)o(eveal)d(its)i(pr)o -(ocess)f(gr)o(oup)h(at)f(the)h(time)g(of)g(death;)h(this)365 -4400 y(information)g(is)f(lost)h(when)f(the)g(pr)o(ocess)g(r)o(eaped.)40 -b(This)27 b(means)f(that)g(a)f(dead,)h(r)o(eaped)365 4500 y(pr)o(ocess)h(is)h -Fz(not)f(eligible)h FA(as)f(a)g(r)o(eturn)g(value)g(for)g(a)g(futur)o(e)f -Fw(wait-process-grou)o(p)21 b FA(call.)365 4599 y(This)f(is)f(not)h(likely)f -(to)g(be)g(a)f(pr)o(oblem)h(for)f(most)i(code,)f(as)f(pr)o(ograms)h(almost)g -(never)g(wait)365 4699 y(on)f(exited)f(pr)o(ocesses)g(by)h(pr)o(ocess)e(gr)o -(oup.)27 b(Pr)o(ocess)17 b(gr)o(oup)g(waiting)h(is)g(usually)f(applied)365 -4799 y(to)j Fz(stopped)e FA(pr)o(ocesses,)h(which)h(ar)o(e)e(never)h(r)o -(eaped.)25 b(So)19 b(it)h(is)f(unlikely)i(that)e(this)h(will)g(be)f(a)365 -4898 y(pr)o(oblem)i(for)f(most)i(pr)o(ograms.)365 5147 y FD(November)c(1,)h -(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 -4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 -w FA(55)p eop +55 60 bop 393 614 a FB(The)28 b(only)g(exposed)f(slot)i(in)f(a)f(pr)o +(oc)g(r)o(ecor)o(d)f(is)i(the)g(pr)o(ocess')f(pid,)i(the)f(integer)g +(id)f(as-)365 714 y(signed)20 b(by)f(Unix)g(to)g(the)g(pr)o(ocess.)25 +b(The)19 b(only)h(exported)e(primitive)h(pr)o(ocedur)o(es)e(for)i(ma-) +365 814 y(nipulating)j(pr)o(ocess)e(objects)i(ar)o(e)d +Fx(proc?)g FB(and)h Fx(proc:pid)p FB(.)j(Pr)o(ocess)e(objects)g(ar)o(e) +f(cr)o(eated)365 913 y(with)i(the)f Fx(fork)e FB(pr)o(ocedur)o(e.)365 +1065 y Fx(\(pid->proc)40 b FA(pid)20 b([pr)o(obe?])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(pr)o(oc)1111 b FB(pr)o(ocedur)o(e) +573 1208 y(This)24 b(pr)o(ocedur)o(e)e(maps)i(integer)g(Unix)g(pr)o +(ocess)f(ids)i(to)f(scsh)g(pr)o(ocess)g(objects.)36 b(It)573 +1308 y(is)22 b(intended)f(for)h(use)f(in)h(interactive)f(and)h +(debugging)g(code,)f(and)g(is)h(depr)o(ecated)573 1407 +y(for)30 b(use)h(in)g(pr)o(oduction)g(code.)55 b(If)30 +b(ther)o(e)g(is)h(no)h(pr)o(ocess)e(object)h(in)g(the)g(system)573 +1507 y(indexed)19 b(by)g(the)h(given)f(pid,)h Fx(pid->proc)p +FB('s)c(action)j(is)h(determined)f(by)h(the)f FA(pr)o(obe?)573 +1607 y FB(parameter)g(\(default)g Fx(#f)p FB(\):)p 1174 +1677 1455 4 v 1174 1777 4 100 v 1227 1747 a FA(pr)o(obe?)p +1666 1777 V 270 w FB(Return)p 2625 1777 V 1174 1780 1455 +4 v 1174 1796 V 1174 1896 4 100 v 1227 1866 a Fx(#f)p +1666 1896 V 404 w FA(signal)i(err)o(or)g(condition.)p +2625 1896 V 1174 1899 1455 4 v 1174 1999 4 100 v 1227 +1969 a Fx('create)p 1666 1999 V 184 w FB(Cr)o(eate)e(new)i(pr)o(oc)f +(object.)p 2625 1999 V 1174 2002 1455 4 v 1174 2102 4 +100 v 1227 2072 a(T)-7 b(r)o(ue)20 b(value)p 1666 2102 +V 103 w Fx(#f)p 2625 2102 V 1174 2105 1455 4 v 490 2287 +a FB(Sometime)h(after)e(a)h(child)g(pr)o(ocess)g(terminates,)g(scsh)h +(will)g(perform)f(a)g Fx(wait)f FB(system)365 2387 y(call)26 +b(on)g(the)g(child)g(in)g(backgr)o(ound,)g(caching)g(the)g(pr)o(ocess') +f(exit)g(status)h(in)g(the)g(child's)365 2486 y(pr)o(oc)34 +b(object.)65 b(This)34 b(is)g(called)f(\223r)o(eaping\224)f(the)i(pr)o +(ocess.)65 b(Once)34 b(the)g(child)g(has)g(been)365 2586 +y(waited,)g(the)e(Unix)g(kernel)g(can)f(fr)o(ee)g(the)h(storage)g +(allocated)f(for)g(the)h(dead)f(pr)o(ocess')365 2685 +y(exit)21 b(information,)i(so)f(pr)o(ocess)f(r)o(eaping)f(pr)o(events)h +(the)g(pr)o(ocess)g(table)g(fr)o(om)g(becoming)365 2785 +y(clutter)o(ed)h(with)i(un-waited)e(dead)g(child)h(pr)o(ocesses)f +(\(a.k.a.)31 b(\223zombies\224\).)g(This)23 b(can)g(be)365 +2885 y(especially)e(sever)o(e)f(if)h(the)g(scsh)h(pr)o(ocess)f(never)f +(waits)i(on)g(child)f(pr)o(ocesses)g(at)f(all;)h(if)g(the)365 +2984 y(pr)o(ocess)h(table)g(over\003ows)i(with)f(for)o(gotten)f +(zombies,)h(the)g(OS)f(may)g(be)h(unable)f(to)h(fork)365 +3084 y(further)d(pr)o(ocesses.)490 3212 y(Reaping)27 +b(a)g(child)g(pr)o(ocess)f(moves)i(its)f(exit)g(status)g(information)h +(fr)o(om)e(the)i(kernel)365 3311 y(into)j(the)f(scsh)h(pr)o(ocess,)h +(wher)o(e)d(it)i(is)f(cached)f(inside)i(the)f(child's)g(pr)o(ocess)g +(object.)54 b(If)365 3411 y(the)23 b(scsh)f(user)g(dr)o(ops)g(all)g +(pointers)g(to)h(the)f(pr)o(ocess)f(object,)i(it)f(will)h(simply)g(be)f +(garbage)365 3511 y(collected.)35 b(On)24 b(the)g(other)h(hand,)f(if)g +(the)g(scsh)g(pr)o(ogram)f(r)o(etains)g(a)h(pointer)g(to)g(the)g(pr)o +(o-)365 3610 y(cess)d(object,)g(it)f(can)h(use)f(scsh's)i +Fx(wait)c FB(system)k(call)e(to)h(synchr)o(onise)g(with)h(the)e(child)h +(and)365 3710 y(r)o(etrieve)h(its)h(exit)g(status)g(multiple)g(times)g +(\(this)h(is)f(not)g(possible)h(with)f(simple)h(Unix)e(in-)365 +3809 y(teger)f(pids)f(in)i(C\227the)e(pr)o(ogrammer)g(can)h(only)g +(wait)g(on)h(a)e(pid)g(once\).)490 3937 y(Thus,)h(pr)o(ocess)g(objects) +g(allow)g(scsh)h(pr)o(ogrammer)e(to)h(do)g(two)h(things)g(not)g +(allowed)365 4037 y(in)g(other)f(pr)o(ogramming)g(envir)o(onments:)490 +4233 y Ft(\017)41 b FB(Subpr)o(ocesses)30 b(that)g(ar)o(e)f(never)i +(waited)f(on)h(ar)o(e)e(still)j(r)o(emoved)d(fr)o(om)i(the)f(pr)o(o-) +573 4333 y(cess)g(table,)i(and)e(their)g(associated)g(exit)g(status)g +(data)f(is)i(eventually)f(automati-)573 4432 y(cally)20 +b(garbage)g(collected.)490 4602 y Ft(\017)41 b FB(Subpr)o(ocesses)20 +b(can)g(be)h(waited)f(on)h(multiple)h(times.)490 4799 +y(However)-6 b(,)26 b(note)g(that)g(once)g(a)f(child)h(has)g(exited,)g +(if)f(the)h(scsh)g(pr)o(ogrammer)f(dr)o(ops)365 4898 +y(all)e(pointers)g(to)f(the)h(child's)g(pr)o(oc)f(object,)h(the)f +(child's)h(exit)g(status)f(will)h(be)g(r)o(eaped)d(and)365 +5147 y FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(55)p eop %%Page: 56 62 -56 61 bop 805 614 a FA(Automatic)14 b(pr)o(ocess)g(r)o(eaping)f(is)h(a)f -(useful)h(pr)o(ogramming)g(convenience.)26 b(However)-6 b(,)681 -714 y(if)14 b(a)g(pr)o(ogram)g(is)h(car)o(eful)e(to)i(wait)f(for)h(all)f -(childr)o(en,)h(and)f(does)h(not)g(wish)h(automatic)e(r)o(eap-)681 -814 y(ing)21 b(to)g(happen,)g(the)f(pr)o(ogrammer)g(can)h(simply)g(turn)g(pr) -o(ocess)g(autor)o(eaping)f(of)o(f.)805 945 y(Pr)o(ograms)35 -b(that)h(do)f(not)h(wish)g(to)g(use)f(automatic)g(pr)o(ocess)g(r)o(eaping)f -(should)i(be)681 1044 y(awar)o(e)17 b(that)h(some)i(scsh)f(r)o(outines)g(cr)o -(eate)e(subpr)o(ocesses)h(but)h(do)f(not)i(r)o(eturn)e(the)h(child's)681 -1144 y(pid:)28 b Fw(run/port*)p FA(,)17 b(and)k(its)h(r)o(elated)d(pr)o -(ocedur)o(es)h(and)h(special)f(forms)i(\()p Fw(run/strings)p -FA(,)16 b Fz(et)681 1244 y(al.)p FA(\).)33 b(Automatic)22 b(pr)o(ocess)h(r)o -(eaping)e(will)j(clean)e(the)h(child)g(pr)o(ocesses)f(cr)o(eated)f(by)i -(these)681 1343 y(pr)o(ocedur)o(es)f(out)i(of)f(the)h(kernel's)g(pr)o(ocess)f -(table.)35 b(If)24 b(a)f(pr)o(ogram)g(doesn't)h(use)f(pr)o(ocess)681 -1443 y(r)o(eaping,)17 b(it)g(should)h(either)f(avoid)g(these)h(forms,)g(or)f -(use)g Fw(wait-any)d FA(to)k(wait)f(for)g(the)h(chil-)681 1542 -y(dr)o(en)i(to)h(exit.)681 1810 y Fy(3.4.2)81 b(Process)20 -b(waiting)681 2024 y Fw(\(wait)41 b Fz(pr)o(oc/pid)19 b([\257ags])p -Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(status)1167 b FA(pr)o(ocedur)o(e)888 -2151 y(This)21 b(pr)o(ocedur)o(e)e(waits)h(until)h(a)f(child)h(pr)o(ocess)f -(exits,)g(and)g(r)o(eturns)g(its)g(exit)h(code.)888 2251 y(The)15 -b Fz(pr)o(oc/pid)e FA(ar)o(gument)i(is)g(either)g(a)g(pr)o(ocess)g(object)g -(\(section)h(3.4.1\))d(or)i(an)g(integer)888 2350 y(pr)o(ocess)22 -b(id.)33 b Fw(Wait)21 b FA(r)o(eturns)h(the)g(child's)h(exit)g(status)f(code) -g(\(or)h(suspension)h(code,)888 2450 y(if)g(the)g Fw(wait/stopped-chi)o(ldr)o -(en)17 b FA(option)25 b(is)f(used,)h(see)e(below\).)37 b(Status)23 -b(values)888 2549 y(can)e(be)f(queried)h(with)g(the)g(pr)o(ocedur)o(es)e(in)i -(section)h(3.4.3.)888 2687 y(The)f Fz(\257ags)g FA(ar)o(gument)g(is)g(an)g -(integer)g(whose)h(bits)f(specify)g(additional)g(options.)29 -b(It)888 2786 y(is)21 b(composed)h(by)e(or)6 b('ing)22 b(together)f(the)g -(following)h(\257ags:)p 888 2935 2662 4 v 888 3035 4 100 v -941 3005 a(Flag)p 1907 3035 V 861 w(Meaning)p 3547 3035 V 888 -3038 2662 4 v 888 3055 V 888 3154 4 100 v 941 3124 a Fw(wait/poll)p -1907 3154 V 623 w FA(Return)f Fw(#f)f FA(immediately)h(if)f(child)h(still)h -(active.)p 3547 3154 V 888 3158 2662 4 v 888 3257 4 100 v 941 -3227 a Fw(wait/stopped-chil)o(dre)o(n)p 1907 3257 V 97 w FA(W)-8 -b(ait)21 b(for)f(suspend)h(as)g(well)g(as)f(exit.)p 3547 3257 -V 888 3260 2662 4 v 681 3434 a Fw(\(wait-any)40 b Fz([\257ags])p -Fw(\))86 b Fs(\000)-15 b(!)88 b Fz([pr)o(oc)19 b(status])1068 -b FA(pr)o(ocedur)o(e)888 3579 y(The)23 b(optional)h Fz(\257ags)f -FA(ar)o(gument)g(is)g(as)g(for)g Fw(wait)p FA(.)33 b(This)24 -b(pr)o(ocedur)o(e)d(waits)i(for)g(any)888 3679 y(child)e(pr)o(ocess)f(to)h -(exit)f(\(or)h(stop,)f(if)h(the)f Fw(wait/stopped-chil)o(dr)o(en)14 -b FA(\257ag)21 b(is)g(used\))888 3779 y(It)g(r)o(eturns)g(the)g(pr)o(ocess')f -(pr)o(ocess)g(object)i(and)e(status)h(code.)27 b(If)21 b(ther)o(e)f(ar)o(e)f -(no)j(chil-)888 3878 y(dr)o(en)j(left)h(for)g(which)h(to)f(wait,)h(the)f(two) -h(values)f Fw([#f)42 b(#t])25 b FA(ar)o(e)f(r)o(eturned.)42 -b(If)26 b(the)888 3978 y Fw(wait/poll)18 b FA(\257ag)k(is)f(used,)g(and)g -(none)i(of)e(the)g(childr)o(en)g(ar)o(e)f(immediately)i(eligble)888 -4077 y(for)f(waiting,)g(then)g(the)g(values)f Fw([#f)43 b(#f])19 -b FA(ar)o(e)h(r)o(eturned:)p 1688 4150 1057 4 v 1688 4250 4 -100 v 1741 4220 a([)p Fw(#f)g(#f)p FA(])p 2042 4250 V 102 w(Poll,)h(none)h(r) -o(eady)p 2742 4250 V 1688 4253 1057 4 v 1688 4353 4 100 v 1741 -4323 a([)p Fw(#f)e(#t)p FA(])p 2042 4353 V 102 w(No)h(childr)o(en)p -2742 4353 V 1688 4356 1057 4 v 888 4462 a Fw(Wait-any)71 b -FA(will)k(not)f(r)o(eturn)g(a)f(pr)o(ocess)h(that)f(has)h(been)g(pr)o -(eviously)888 4562 y(waited)49 b(by)h(any)g(other)g(pr)o(ocess-wait)f(pr)o -(ocedur)o(e)e(\()p Fw(wait)p FA(,)55 b Fw(wait-any)p FA(,)e(and)888 -4662 y Fw(wait-process-grou)o(p)p FA(\).)48 b(It)30 b(will)h(r)o(eturn)e(r)o -(eaped)f(pr)o(ocesses)h(that)h(haven't)g(yet)888 4761 y(been)21 -b(waited.)888 4898 y(The)g(use)g(of)g Fw(wait-any)c FA(is)k(depr)o(ecated.) -681 5147 y(56)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w -FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 w FD(November)d(1,)h(1995)h -(\261)f(15)13 b(:)f(58)p eop +56 61 bop 681 614 a FB(thr)o(own)17 b(away)-9 b(.)24 +b(This)17 b(is)h(the)f(intended)g(behaviour)-6 b(,)17 +b(and)f(it)h(means)h(that)e(integer)h(pids)g(ar)o(e)681 +714 y(not)24 b(enough)g(to)g(cause)f(a)g(pr)o(ocess's)g(exit)g(status)h +(to)f(be)h(r)o(etained)e(by)h(the)h(scsh)f(r)o(untime.)681 +814 y(\(This)e(is)g(because)f(it)h(is)g(clearly)f(impossible)i(to)f(GC) +g(data)e(r)o(efer)o(enced)f(by)j(integers.\))805 938 +y(As)32 b(a)f(convenience)i(for)f(interactive)f(use)h(and)f(debugging,) +k(all)d(pr)o(ocedur)o(es)e(that)681 1038 y(take)24 b(pr)o(ocess)g +(objects)h(will)g(also)g(accept)e(integer)h(Unix)h(pids)f(as)g(ar)o +(guments,)h(coer)o(cing)681 1137 y(them)k(to)h(the)f(corr)o(esponding)h +(pr)o(ocess)e(objects.)52 b(Since)28 b(integer)i(pr)o(ocess)e(ids)i(ar) +o(e)d(not)681 1237 y(r)o(eliable)c(ways)h(to)h(keep)f(a)g(child's)h +(exit)f(status)g(fr)o(om)g(being)h(r)o(eaped)d(and)i(garbage)f(col-)681 +1337 y(lected,)18 b(pr)o(ogrammers)g(ar)o(e)e(encouraged)i(to)h(use)f +(pr)o(ocess)g(objects)h(in)g(pr)o(oduction)g(code.)681 +1479 y Fx(\(autoreap-policy)37 b FA([policy])p Fx(\))85 +b Ft(\000)-15 b(!)88 b FA(old-policy)810 b FB(pr)o(ocedur)o(e)888 +1614 y(The)20 b(scsh)g(pr)o(ogrammer)f(can)h(choose)g(dif)o(fer)o(ent)e +(policies)i(for)g(automatic)f(pr)o(ocess)888 1714 y(r)o(eaping.)39 +b(The)25 b(policy)h(is)g(determined)e(by)i(applying)f(this)h(pr)o +(ocedur)o(e)e(to)h(one)h(of)888 1813 y(the)21 b(values)g +Fx('early)p FB(,)d Fx('late)p FB(,)g(or)j Fx(#f)f FB(\()p +FA(i.e.)o FB(,)h(no)g(autor)o(eap\).)888 1973 y Fz(early)41 +b FB(The)25 b(child)g(is)h(r)o(eaped)d(fr)o(om)i(the)g(Unix)g(kernel's) +g(pr)o(ocess)g(table)f(into)i(scsh)1071 2072 y(as)h(soon)i(as)f(it)g +(dies.)46 b(This)29 b(is)f(done)g(by)f(having)h(a)g(signal)g(handler)f +(for)h(the)1071 2172 y Fx(SIGCHLD)34 b FB(signal)j(r)o(eap)e(the)i(pr)o +(ocess.)147 b FA(If)37 b(a)f(scsh)h(pr)o(ogram)e(sets)i(its)g(own)1071 +2271 y(handler)29 b(for)h(the)f Fx(SIGCHLD)d FA(signal,)32 +b(the)d(handler)g(must)g(r)o(eap)g(dead)f(childr)o(en)h(by)1071 +2371 y(calling)h Fx(wait)p FA(,)g Fx(wait-any)p FA(,)f(or)h +Fx(reap-zombies)p FA(.)48 b FB(W)-8 b(e)30 b(depr)o(ecate)e(interr)o +(upt-)1071 2471 y(driven)17 b(code,)h(and)g(hope)g(to)g(pr)o(ovide)f +(alternative)f(tools)j(in)f(a)g(futur)o(e,)f(multi-)1071 +2570 y(thr)o(eaded)i(r)o(elease)g(of)i(scsh.)888 2688 +y Fz(late)40 b FB(The)21 b(child)h(is)f(not)h(autor)o(eaped)d(until)j +(it)f(dies)g FA(and)g FB(the)g(scsh)h(pr)o(ogram)f(dr)o(ops)1071 +2780 y(all)g(pointers)h(to)f(its)g(pr)o(ocess)g(object.)27 +b(That)21 b(is,)g(the)g(pr)o(ocess)g(table)f(is)i(cleaned)1071 +2871 y(out)f(during)g(garbage)f(collection.)1226 2989 +y FE(Oops:)50 b Fk(The)18 b Fh(late)g Fk(policy)f(is)g(not)h(supported) +e(under)h(the)h(curr)o(ent)f(r)o(elease)1226 3080 y(of)24 +b(scsh.)39 b(It)24 b(r)o(equir)o(es)d(mor)o(e)i(sophisticated)h(gc)f +(hooks)g(than)j(we)e(can)h(get)1226 3171 y(fr)o(om)18 +b(the)h(r)o(elease)e(of)h(Scheme)i(48)f(that)h(we)f(use.)888 +3298 y Fx(#f)41 b FB(If)20 b(autor)o(eaping)e(is)j(turned)e(of)o(f,)g +(pr)o(ocess)h(r)o(eaping)f(is)h(completely)g(under)g(con-)1071 +3397 y(tr)o(ol)30 b(of)f(the)h(pr)o(ogrammer)-6 b(,)31 +b(who)g(can)e(for)o(ce)g(outstanding)h(zombies)g(to)g(be)1071 +3497 y(r)o(eaped)h(by)i(manually)h(calling)f(the)h Fx(reap-zombies)28 +b FB(pr)o(ocedur)o(e)j(\(see)i(be-)1071 3597 y(low\).)888 +3756 y(Note)27 b(that)f(under)f(any)i(of)f(the)g(autor)o(eap)e +(policies,)k(a)e(particular)f(pr)o(ocess)g Fy(p)h FB(can)888 +3856 y(be)i(manually)g(r)o(eaped)e(into)j(scsh)g(by)f(simply)g(calling) +h Fx(\(wait)41 b Fy(p)p Fx(\))p FB(.)47 b FA(All)28 b +FB(zombies)888 3955 y(can)21 b(be)f(manually)h(r)o(eaped)e(with)i +Fx(reap-zombies)p FB(.)888 4085 y(The)40 b Fx(autoreap-policy)34 +b FB(pr)o(ocedur)o(e)k(r)o(eturns)h(the)h(policy's)g(pr)o(evious)g +(value.)888 4184 y(Calling)27 b Fx(autoreap-policy)19 +b FB(with)27 b(no)g(ar)o(guments)f(r)o(eturns)f(the)h(curr)o(ent)f +(policy)888 4284 y(without)d(no)g(change.)681 4565 y +Fx(\(reap-zombies\))81 b Ft(\000)-14 b(!)87 b FA(boolean)1321 +b FB(pr)o(ocedur)o(e)888 4699 y(This)25 b(pr)o(ocedur)o(e)e(r)o(eaps)g +(all)i(outstanding)g(exited)f(child)h(pr)o(ocesses)f(into)h(scsh.)38 +b(It)888 4799 y(r)o(eturns)26 b(tr)o(ue)g(if)g(ther)o(e)f(ar)o(e)g(no)i +(mor)o(e)f(child)g(pr)o(ocesses)g(to)g(wait)g(on,)i(and)e(false)f(if) +888 4898 y(ther)o(e)20 b(ar)o(e)g(outstanding)h(pr)o(ocesses)g(still)g +(r)o(unning)h(or)f(suspended.)681 5147 y(56)p 1952 5071 +323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 +V 1952 5176 323 4 v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 57 63 -57 62 bop 365 777 a Fw(\(wait-process-gro)o(up)37 b Fz(pr)o(oc/pid)18 -b([\257ags])p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz([pr)o(oc)20 -b(status])338 b FA(pr)o(ocedur)o(e)573 931 y(This)18 b(pr)o(ocedur)o(e)e -(waits)h(for)h(any)f(child)h(whose)g(pr)o(ocess)g(gr)o(oup)f(is)h -Fz(pr)o(oc/pid)d FA(\(either)573 1031 y(a)20 b(pr)o(ocess)g(object)i(or)e(a)h -(pid\).)27 b(The)20 b Fz(\257ags)h FA(ar)o(gument)f(is)h(as)g(for)f -Fw(wait)p FA(.)573 1177 y(Note)14 b(that)g(if)g(the)g(pr)o(ogrammer)f(wishes) -i(to)f(wait)g(for)g(exited)f(pr)o(ocesses)h(by)g(pr)o(ocess)573 -1277 y(gr)o(oup,)24 b(the)g(pr)o(ogram)f(should)i(take)e(car)o(e)f(not)j(to)f -(use)g(pr)o(ocess)f(r)o(eaping)g(\(section)573 1376 y(3.4.1\),)i(as)h(this)h -(loses)g(pr)o(ocess)e(gr)o(oup)h(information.)45 b(However)-6 -b(,)27 b(most)g(pr)o(ocess-)573 1476 y(gr)o(oup)19 b(waiting)g(is)h(for)e -(stopped)h(pr)o(ocesses)g(\(to)g(implement)h(job)f(contr)o(ol\),)g(so)h(this) -573 1576 y(is)h(rar)o(ely)e(an)i(issue,)g(as)f(stopped)h(pr)o(ocesses)f(ar)o -(e)g(not)h(subject)g(to)g(r)o(eaping.)365 2045 y Fy(3.4.3)81 -b(Analysing)19 b(process)h(status)f(codes)365 2254 y FA(When)26 -b(a)g(child)g(pr)o(ocess)f(dies)g(\(or)h(is)g(suspended\),)g(its)g(par)o(ent) -f(can)g(call)g(the)h Fw(wait)e FA(pr)o(o-)365 2353 y(cedur)o(e)d(to)h(r)o -(ecover)f(the)i(exit)e(\(or)h(suspension\))i(status)e(of)g(the)g(child.)32 -b(The)22 b(exit)g(status)g(is)365 2453 y(a)g(small)g(integer)f(that)h -(encodes)g(information)g(describing)g(how)h(the)e(child)h(terminated.)365 -2553 y(The)d(bit-level)e(format)h(of)h(the)f(exit)g(status)h(is)g(not)g -(de\256ned)e(by)k(P)t Fr(O)t(S)t(I)t(X)r FA(;)f(you)f(must)g(use)f(the)365 -2652 y(following)29 b(thr)o(ee)c(functions)j(to)f(decode)f(one.)46 -b(However)-6 b(,)28 b(if)e(a)g(child)h(terminates)g(nor)o(-)365 -2752 y(mally)c(with)h(exit)e(code)g(0,)j(P)t Fr(O)t(S)t(I)t(X)h -FA(does)d(r)o(equir)o(e)e Fw(wait)g FA(to)i(r)o(eturn)f(an)g(exit)h(status)g -(that)f(is)365 2852 y(exactly)k(zer)o(o.)44 b(So)27 b Fw(\(zero?)41 -b Fz(status)p Fw(\))26 b FA(is)h(a)f(corr)o(ect)g(way)h(to)g(test)f(for)h -(non-err)o(or)-6 b(,)27 b(normal)365 2951 y(termination,)22 -b Fz(e.g.)o FA(,)573 3175 y Fw(\(if)42 b(\(zero?)f(\(run)h(\(rcp)g -(scsh.tar.gz)d(lambda.csd.hku.hk)o(:\))o(\)\))747 3275 y(\(delete-file)g -("scsh.tar.gz"\)\))365 3562 y(\(status:exit-val)e Fz(status)p -Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(integer)21 b(or)g Fw(#f)760 -b FA(pr)o(ocedur)o(e)365 3661 y Fw(\(status:stop-sig)37 b Fz(status)p -Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(integer)21 b(or)g Fw(#f)760 -b FA(pr)o(ocedur)o(e)365 3761 y Fw(\(status:term-sig)37 b Fz(status)p -Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(integer)21 b(or)g Fw(#f)760 -b FA(pr)o(ocedur)o(e)573 3915 y(For)27 b(a)g(given)g(status)g(value)f(pr)o -(oduced)g(by)h(calling)g Fw(wait)p FA(,)g(exactly)f(one)i(of)e(these)573 -4015 y(r)o(outines)21 b(will)g(r)o(eturn)f(a)h(tr)o(ue)f(value.)573 -4161 y(If)31 b(the)h(child)g(pr)o(ocess)g(exited)f(normally)-9 -b(,)35 b Fw(status:exit-val)25 b FA(r)o(eturns)32 b(the)g(exit)573 -4261 y(code)26 b(for)g(the)g(child)g(pr)o(ocess)g(\()p Fz(i.e.)o -FA(,)i(the)e(value)f(the)i(child)f(passed)g(to)g Fw(exit)f -FA(or)h(r)o(e-)573 4360 y(turned)20 b(fr)o(om)h Fw(main)p FA(\).)k -(Otherwise,)c(this)h(function)f(r)o(eturns)f(false.)573 4506 -y(If)e(the)i(child)f(pr)o(ocess)f(was)h(suspended)g(by)g(a)g(signal,)g -Fw(status:stop-sig)13 b FA(r)o(eturns)573 4606 y(the)i(signal)g(that)g -(suspended)f(the)h(child.)26 b(Otherwise,)16 b(this)g(function)f(r)o(eturns)g -(false.)573 4752 y(If)k(the)g(child)h(pr)o(ocess)f(terminated)g(abnormally)-9 -b(,)19 b Fw(status:term-sig)13 b FA(r)o(eturns)19 b(the)573 -4852 y(signal)i(that)g(terminated)f(the)h(child.)28 b(Otherwise,)21 -b(this)g(function)h(r)o(eturns)e(false.)365 5147 y FD(November)e(1,)h(1995)h -(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 -v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FA(57)p -eop +57 62 bop 365 906 a Fz(Issues)20 b(with)g(process)g(reaping)365 +1110 y FB(Reaping)26 b(a)f(pr)o(ocess)h(does)f(not)i(r)o(eveal)d(its)i +(pr)o(ocess)f(gr)o(oup)h(at)f(the)h(time)g(of)g(death;)h(this)365 +1210 y(information)g(is)g(lost)f(when)h(the)f(pr)o(ocess)g(r)o(eaped.) +39 b(This)26 b(means)g(that)g(a)g(dead,)g(r)o(eaped)365 +1309 y(pr)o(ocess)h(is)h FA(not)f(eligible)h FB(as)f(a)g(r)o(eturn)g +(value)g(for)g(a)g(futur)o(e)f Fx(wait-process-grou)o(p)21 +b FB(call.)365 1409 y(This)f(is)f(not)h(likely)f(to)g(be)g(a)f(pr)o +(oblem)h(for)f(most)i(code,)f(as)f(pr)o(ograms)h(almost)g(never)g(wait) +365 1509 y(on)g(exited)d(pr)o(ocesses)i(by)f(pr)o(ocess)g(gr)o(oup.)25 +b(Pr)o(ocess)17 b(gr)o(oup)g(waiting)i(is)f(usually)f(applied)365 +1608 y(to)24 b FA(stopped)e FB(pr)o(ocesses,)i(which)g(ar)o(e)e(never)h +(r)o(eaped.)32 b(So)23 b(it)h(is)g(unlikely)g(that)f(this)i(will)f(be) +365 1708 y(a)d(pr)o(oblem)f(for)h(most)g(pr)o(ograms.)490 +1848 y(Automatic)30 b(pr)o(ocess)g(r)o(eaping)g(is)h(a)f(useful)g(pr)o +(ogramming)h(convenience.)55 b(How-)365 1948 y(ever)-6 +b(,)28 b(if)f(a)g(pr)o(ogram)f(is)i(car)o(eful)d(to)j(wait)f(for)g(all) +g(childr)o(en,)h(and)f(does)g(not)h(wish)g(auto-)365 +2047 y(matic)17 b(r)o(eaping)f(to)i(happen,)f(the)g(pr)o(ogrammer)g +(can)g(simply)h(turn)f(pr)o(ocess)f(autor)o(eaping)365 +2147 y(of)o(f.)490 2287 y(Pr)o(ograms)35 b(that)g(do)g(not)h(wish)h(to) +e(use)g(automatic)h(pr)o(ocess)e(r)o(eaping)h(should)h(be)365 +2387 y(awar)o(e)17 b(that)i(some)g(scsh)g(r)o(outines)g(cr)o(eate)e +(subpr)o(ocesses)i(but)f(do)h(not)g(r)o(eturn)f(the)h(child's)365 +2487 y(pid:)27 b Fx(run/port*)p FB(,)17 b(and)k(its)h(r)o(elated)e(pr)o +(ocedur)o(es)g(and)h(special)g(forms)g(\()p Fx(run/strings)p +FB(,)c FA(et)365 2586 y(al.)p FB(\).)32 b(Automatic)22 +b(pr)o(ocess)h(r)o(eaping)f(will)h(clean)g(the)g(child)g(pr)o(ocesses)g +(cr)o(eated)d(by)j(these)365 2686 y(pr)o(ocedur)o(es)f(out)i(of)g(the)g +(kernel's)g(pr)o(ocess)f(table.)34 b(If)24 b(a)f(pr)o(ogram)g(doesn't)h +(use)g(pr)o(ocess)365 2786 y(r)o(eaping,)32 b(it)f(should)h(either)e +(avoid)h(these)g(forms,)i(or)e(use)g Fx(wait-any)c FB(to)k(wait)g(for)f +(the)365 2885 y(childr)o(en)21 b(to)g(exit.)365 3177 +y Fz(3.4.2)81 b(Process)20 b(waiting)365 3401 y Fx(\(wait)42 +b FA(pr)o(oc/pid)18 b([\003ags])p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(status)1168 b FB(pr)o(ocedur)o(e)573 3530 +y(This)21 b(pr)o(ocedur)o(e)d(waits)j(until)g(a)f(child)g(pr)o(ocess)g +(exits,)g(and)g(r)o(eturns)g(its)h(exit)f(code.)573 3630 +y(The)28 b FA(pr)o(oc/pid)e FB(ar)o(gument)i(is)h(either)f(a)g(pr)o +(ocess)f(object)i(\(section)g(3.4.1\))d(or)i(an)g(in-)573 +3730 y(teger)23 b(pr)o(ocess)f(id.)33 b Fx(Wait)22 b +FB(r)o(eturns)h(the)g(child's)h(exit)f(status)g(code)g(\(or)g +(suspension)573 3829 y(code,)29 b(if)e(the)h Fx(wait/stopped-chil)o +(dre)o(n)22 b FB(option)29 b(is)f(used,)h(see)e(below\).)47 +b(Status)573 3929 y(values)20 b(can)h(be)f(queried)h(with)g(the)g(pr)o +(ocedur)o(es)e(in)i(section)h(3.4.3.)573 4072 y(The)f +FA(\003ags)g FB(ar)o(gument)g(is)g(an)g(integer)g(whose)h(bits)g +(specify)f(additional)g(options.)28 b(It)573 4172 y(is)21 +b(composed)g(by)g(or)6 b('ing)22 b(together)f(the)g(following)h +(\003ags:)p 573 4327 2662 4 v 573 4427 4 100 v 626 4397 +a(Flag)p 1591 4427 V 860 w(Meaning)p 3231 4427 V 573 +4430 2662 4 v 573 4447 V 573 4546 4 100 v 626 4516 a +Fx(wait/poll)p 1591 4546 V 622 w FB(Return)f Fx(#f)f +FB(immediately)h(if)g(child)g(still)g(active.)p 3231 +4546 V 573 4549 2662 4 v 573 4649 4 100 v 626 4619 a +Fx(wait/stopped-chi)o(ldr)o(en)p 1591 4649 V 96 w FB(W)-8 +b(ait)21 b(for)g(suspend)g(as)f(well)h(as)g(exit.)p 3231 +4649 V 573 4652 2662 4 v 365 4845 a Fx(\(wait-any)40 +b FA([\003ags])p Fx(\))86 b Ft(\000)-14 b(!)87 b FA([pr)o(oc)19 +b(status])1069 b FB(pr)o(ocedur)o(e)365 5147 y FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p 1636 5071 323 +4 v 1636 5173 4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 +5176 323 4 v 1216 w FB(57)p eop %%Page: 58 64 -58 63 bop 681 614 a Fu(3.5)99 b(Process)25 b(state)681 856 -y Fw(\(umask\))84 b Fs(\000)-14 b(!)87 b Fz(\256xnum)1633 b -FA(pr)o(ocedur)o(e)681 956 y Fw(\(set-umask)39 b Fz(perms)p -Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)1125 b FA(pr)o(ocedur)o(e)681 -1056 y Fw(\(with-umask*)38 b Fz(perms)21 b(thunk)p Fw(\))87 -b Fs(\000)-15 b(!)88 b Fz(values)21 b(of)f(thunk)636 b FA(pr)o(ocedur)o(e)681 -1155 y Fw(\(with-umask)39 b Fz(perms)21 b(.)f(body)p Fw(\))86 -b Fs(\000)-14 b(!)87 b Fz(values)21 b(of)g(body)852 b FA(syntax)888 -1281 y(The)49 b(pr)o(ocess')g(curr)o(ent)f(umask)i(is)f(r)o(etrieved)f(with)i -Fw(umask)p FA(,)j(and)c(set)g(with)888 1381 y Fw(\(set-umask)40 -b Fz(perms)p Fw(\))p FA(.)25 b(Calling)14 b Fw(with-umask*)c -FA(changes)k(the)g(umask)h(to)f Fz(perms)g FA(for)888 1480 -y(the)19 b(duration)f(of)g(the)g(call)g(to)h Fz(thunk)o FA(.)27 -b(If)18 b(the)g(pr)o(ogram)g(thr)o(ows)g(out)h(of)f Fz(thunk)g -FA(by)g(in-)888 1580 y(voking)k(a)e(continuation,)i(the)e(umask)h(is)g(r)o -(eset)f(to)h(its)g(external)e(value.)27 b(If)20 b(the)h(pr)o(o-)888 -1679 y(gram)h(thr)o(ows)f(back)g(into)i Fz(thunk)d FA(by)i(calling)g(a)f -(stor)o(ed)f(continuation,)j(the)f(umask)888 1779 y(is)f(r)o(estor)o(ed)e(to) -h(the)h Fz(perms)f FA(value.)27 b(The)20 b(special)g(form)g -Fw(with-umask)c FA(is)21 b(equivalent)888 1879 y(in)c(ef)o(fect)e(to)i(the)g -(pr)o(ocedur)o(e)e Fw(with-umask*)p FA(,)d(but)17 b(does)g(not)g(r)o(equir)o -(e)e(the)i(pr)o(ogram-)888 1978 y(mer)h(to)g(explicitly)g(wrap)f(a)h -Fw(\()p Fx(\025)38 b Fw(\(\))43 b Fx(:)14 b(:)g(:)g Fw(\))j -FA(ar)o(ound)g(the)h(body)g(of)g(the)g(code)f(to)h(be)g(ex-)888 -2078 y(ecuted.)681 2275 y Fw(\(chdir)41 b Fz([fname])p Fw(\))86 -b Fs(\000)-14 b(!)87 b Fz(unde\256ned)1244 b FA(pr)o(ocedur)o(e)681 -2375 y Fw(\(cwd\))85 b Fs(\000)-14 b(!)87 b Fz(string)1760 -b FA(pr)o(ocedur)o(e)681 2474 y Fw(\(with-cwd*)39 b Fz(fname)21 -b(thunk)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(value\(s\))21 -b(of)f(thunk)668 b FA(pr)o(ocedur)o(e)681 2574 y Fw(\(with-cwd)40 -b Fz(fname)20 b(.)h(body)p Fw(\))86 b Fs(\000)-14 b(!)87 b -Fz(value\(s\))20 b(of)h(body)884 b FA(syntax)888 2717 y(These)25 -b(forms)g(manipulate)f(the)h(curr)o(ent)f(working)i(dir)o(ectory)-9 -b(.)38 b(The)25 b(cwd)f(can)g(be)888 2817 y(changed)d(with)h -Fw(chdir)d FA(\(although)j(in)g(most)g(cases,)e Fw(with-cwd)e -FA(is)k(pr)o(eferrable\).)j(If)888 2916 y Fw(chdir)18 b FA(is)h(called)g -(with)h(no)f(ar)o(guments,)g(it)h(changes)f(the)h(cwd)f(to)g(the)h(user)6 -b('s)19 b(home)888 3016 y(dir)o(ectory)-9 b(.)25 b(The)15 b -Fw(with-cwd*)c FA(pr)o(ocedur)o(e)j(calls)h Fw(thunk)e FA(with)j(the)f(cwd)g -(temporarily)888 3116 y(set)h(to)g Fz(fname)p FA(;)i(when)e -Fz(thunk)f FA(r)o(eturns,)i(or)e(is)i(exited)e(in)h(a)g(non-local)g(fashion)g -(\()p Fz(e.g.)o FA(,)h(by)888 3215 y(raising)24 b(an)e(exception)h(or)h(by)f -(invoking)h(a)f(continuation\),)h(the)f(cwd)g(is)g(r)o(eturned)888 -3315 y(to)e(its)f(original)h(value.)27 b(The)20 b(special)f(form)i -Fw(with-cwd)c FA(is)j(simply)h(syntactic)f(sugar)888 3415 y(for)h -Fw(with-cwd*)p FA(.)681 3612 y Fw(\(pid\))85 b Fs(\000)-14 -b(!)87 b Fz(\256xnum)1720 b FA(pr)o(ocedur)o(e)681 3711 y Fw(\(parent-pid\)) -82 b Fs(\000)-14 b(!)87 b Fz(\256xnum)1415 b FA(pr)o(ocedur)o(e)681 -3811 y Fw(\(process-group\))81 b Fs(\000)-15 b(!)88 b Fz(\256xnum)1284 -b FA(pr)o(ocedur)o(e)681 3911 y Fw(\(set-process-gro)o(up)37 -b Fz([pr)o(oc])19 b(pgrp)p Fw(\))86 b Fs(\000)-15 b(!)87 b -Fz(unde\256ned)604 b FA(pr)o(ocedur)o(e)888 4054 y Fw(\(pid\))25 -b FA(and)i Fw(\(parent-pid\))22 b FA(r)o(etrieve)j(the)i(pr)o(ocess)g(id)g -(for)f(the)h(curr)o(ent)f(pr)o(ocess)888 4154 y(and)18 b(its)g(par)o(ent.)25 -b Fw(\(process-group\))12 b FA(r)o(eturns)17 b(the)h(pr)o(ocess)g(gr)o(oup)f -(of)h(the)g(curr)o(ent)888 4253 y(pr)o(ocess.)45 b(A)26 b(pr)o(ocess')h(pr)o -(ocess-gr)o(oup)e(can)i(be)f(set)h(with)g Fw(set-process-group)o -FA(;)888 4353 y(the)21 b(value)f Fz(pid)g FA(speci\256es)h(the)g(af)o(fected) -d(pr)o(ocess.)27 b(It)20 b(may)h(be)f(either)h(a)f(pr)o(ocess)g(ob-)888 -4452 y(ject)h(or)g(an)g(integer)f(pr)o(ocess)h(id,)f(and)g(defaults)g(to)i -(the)e(curr)o(ent)g(pr)o(ocess.)681 4650 y Fw(\(set-priority)38 -b Fz(which)20 b(who)g(priority)p Fw(\))86 b Fs(\000)-15 b(!)88 -b Fz(unde\256ned)559 b FA(pr)o(ocedur)o(e)681 4749 y Fw(\(priority)40 -b Fz(which)19 b(who)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(\256xnum)1100 -b FA(pr)o(ocedur)o(e)681 4849 y Fw(\(nice)41 b Fz([pid)20 b(delta])p -Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(unde\256ned)1202 b FA(pr)o(ocedur)o(e)681 -5147 y(58)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +58 63 bop 888 614 a FB(The)24 b(optional)g FA(\003ags)f +FB(ar)o(gument)g(is)g(as)g(for)g Fx(wait)p FB(.)31 b(This)24 +b(pr)o(ocedur)o(e)e(waits)h(for)g(any)888 714 y(child)e(pr)o(ocess)f +(to)h(exit)f(\(or)h(stop,)f(if)h(the)f Fx(wait/stopped-chil)o(dr)o(en) +14 b FB(\003ag)21 b(is)g(used\))888 814 y(It)g(r)o(eturns)g(the)g(pr)o +(ocess')g(pr)o(ocess)f(object)h(and)g(status)g(code.)26 +b(If)21 b(ther)o(e)f(ar)o(e)f(no)j(chil-)888 913 y(dr)o(en)k(left)f +(for)h(which)h(to)g(wait,)g(the)f(two)h(values)f Fx([#f)42 +b(#t])25 b FB(ar)o(e)g(r)o(eturned.)40 b(If)26 b(the)888 +1013 y Fx(wait/poll)18 b FB(\003ag)k(is)f(used,)g(and)g(none)i(of)e +(the)g(childr)o(en)g(ar)o(e)f(immediately)i(eligble)888 +1112 y(for)f(waiting,)g(then)g(the)g(values)f Fx([#f)43 +b(#f])19 b FB(ar)o(e)h(r)o(eturned:)p 1688 1181 1057 +4 v 1688 1281 4 100 v 1741 1251 a([)p Fx(#f)g(#f)p FB(])p +2042 1281 V 102 w(Poll,)h(none)h(r)o(eady)p 2742 1281 +V 1688 1284 1057 4 v 1688 1384 4 100 v 1741 1354 a([)p +Fx(#f)e(#t)p FB(])p 2042 1384 V 102 w(No)h(childr)o(en)p +2742 1384 V 1688 1387 1057 4 v 888 1490 a Fx(Wait-any)71 +b FB(will)k(not)f(r)o(eturn)g(a)f(pr)o(ocess)h(that)f(has)h(been)g(pr)o +(eviously)888 1589 y(waited)49 b(by)h(any)g(other)g(pr)o(ocess-wait)f +(pr)o(ocedur)o(e)e(\()p Fx(wait)p FB(,)55 b Fx(wait-any)p +FB(,)e(and)888 1689 y Fx(wait-process-grou)o(p)p FB(\).)47 +b(It)30 b(will)h(r)o(eturn)e(r)o(eaped)f(pr)o(ocesses)i(that)g(haven't) +g(yet)888 1789 y(been)21 b(waited.)888 1922 y(The)g(use)g(of)g +Fx(wait-any)c FB(is)k(depr)o(ecated.)681 2214 y Fx(\(wait-process-gr)o +(ou)o(p)38 b FA(pr)o(oc/pid)18 b([\003ags])p Fx(\))86 +b Ft(\000)-14 b(!)87 b FA([pr)o(oc)19 b(status])338 b +FB(pr)o(ocedur)o(e)888 2356 y(This)18 b(pr)o(ocedur)o(e)e(waits)i(for)f +(any)h(child)g(whose)g(pr)o(ocess)f(gr)o(oup)g(is)h FA(pr)o(oc/pid)e +FB(\(either)888 2455 y(a)21 b(pr)o(ocess)f(object)h(or)g(a)f(pid\).)25 +b(The)c FA(\003ags)f FB(ar)o(gument)h(is)g(as)f(for)h +Fx(wait)p FB(.)888 2589 y(Note)j(that)g(if)g(the)g(pr)o(ogrammer)f +(wishes)i(to)f(wait)g(for)g(exited)f(pr)o(ocesses)h(by)g(pr)o(o-)888 +2688 y(cess)36 b(gr)o(oup,)k(the)c(pr)o(ogram)f(should)i(take)f(car)o +(e)e(not)j(to)f(use)g(pr)o(ocess)g(r)o(eaping)888 2788 +y(\(section)29 b(3.4.1\),)e(as)g(this)i(loses)f(pr)o(ocess)g(gr)o(oup)f +(information.)48 b(However)-6 b(,)29 b(most)888 2888 +y(pr)o(ocess-gr)o(oup)h(waiting)g(is)h(for)f(stopped)g(pr)o(ocesses)g +(\(to)g(implement)h(job)g(con-)888 2987 y(tr)o(ol\),)j(so)d(this)h(is)g +(rar)o(ely)e(an)h(issue,)j(as)d(stopped)g(pr)o(ocesses)g(ar)o(e)f(not)i +(subject)g(to)888 3087 y(r)o(eaping.)681 3482 y Fz(3.4.3)81 +b(Analysing)19 b(process)h(status)f(codes)681 3666 y +FB(When)26 b(a)f(child)h(pr)o(ocess)f(dies)h(\(or)f(is)h(suspended\),)g +(its)h(par)o(ent)d(can)i(call)f(the)h Fx(wait)e FB(pr)o(o-)681 +3766 y(cedur)o(e)d(to)h(r)o(ecover)f(the)h(exit)h(\(or)f(suspension\))h +(status)f(of)g(the)h(child.)30 b(The)22 b(exit)g(status)h(is)681 +3866 y(a)e(small)h(integer)g(that)f(encodes)h(information)h(describing) +e(how)i(the)f(child)g(terminated.)681 3965 y(The)27 b(bit-level)h +(format)f(of)h(the)f(exit)h(status)g(is)g(not)g(de\002ned)f(by)j(P)t +Fs(O)t(S)t(I)t(X)r FB(;)i(you)d(must)f(use)681 4065 y(the)i(following)h +(thr)o(ee)e(functions)h(to)g(decode)f(one.)53 b(However)-6 +b(,)31 b(if)f(a)f(child)h(terminates)681 4164 y(normally)20 +b(with)g(exit)g(code)f(0,)i(P)t Fs(O)t(S)t(I)t(X)i FB(does)c(r)o(equir) +o(e)f Fx(wait)g FB(to)i(r)o(eturn)f(an)g(exit)h(status)f(that)681 +4264 y(is)i(exactly)g(zer)o(o.)k(So)c Fx(\(zero?)42 b +FA(status)o Fx(\))21 b FB(is)h(a)e(corr)o(ect)g(way)h(to)h(test)f(for)g +(non-err)o(or)-6 b(,)21 b(normal)681 4364 y(termination,)g +FA(e.g.)o FB(,)888 4556 y Fx(\(if)43 b(\(zero?)e(\(run)h(\(rcp)g +(scsh.tar.gz)d(lambda.csd.hku.)o(hk:)o(\)\))o(\))1063 +4656 y(\(delete-file)f("scsh.tar.gz"\)\))681 4898 y(\(status:exit-val)f +FA(status)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(integer)21 +b(or)g Fx(#f)760 b FB(pr)o(ocedur)o(e)681 5147 y(58)p +1952 5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226) +f(21)13 b(:)f(47)p eop %%Page: 59 65 -59 64 bop 573 614 a FA(These)21 b(pr)o(ocedur)o(es)d(set)j(and)f(access)h -(the)g(priority)g(of)f(pr)o(ocesses.)27 b(I)21 b(can't)f(r)o(emem-)573 -714 y(ber)13 b(how)i Fw(set-priority)9 b FA(and)14 b Fw(priority)c -FA(work,)16 b(so)e(no)h(documentation,)h(and)d(be-)573 814 -y(sides,)20 b(they)h(ar)o(en't)f(implemented)h(yet,)g(anyway)-9 -b(.)365 965 y Fw(\(user-login-name\))80 b Fs(\000)-14 b(!)87 -b Fz(string)1238 b FA(pr)o(ocedur)o(e)365 1064 y Fw(\(user-uid\))83 -b Fs(\000)-14 b(!)87 b Fz(\256xnum)1503 b FA(pr)o(ocedur)o(e)365 -1164 y Fw(\(user-effective-u)o(id)o(\))81 b Fs(\000)-14 b(!)87 -b Fz(\256xnum)1067 b FA(pr)o(ocedur)o(e)365 1263 y Fw(\(user-gid\))83 -b Fs(\000)-14 b(!)87 b Fz(\256xnum)1503 b FA(pr)o(ocedur)o(e)365 -1363 y Fw(\(user-effective-g)o(id)o(\))81 b Fs(\000)-14 b(!)87 -b Fz(\256xnum)1067 b FA(pr)o(ocedur)o(e)365 1463 y Fw(\(user-supplementa)o -(ry)o(-gi)o(ds)o(\))81 b Fs(\000)-14 b(!)87 b Fz(\256xnum)20 -b(list)723 b FA(pr)o(ocedur)o(e)365 1562 y Fw(\(set-uid)41 -b Fz(uid)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)1305 -b FA(pr)o(ocedur)o(e)365 1662 y Fw(\(set-gid)41 b Fz(gid)p -Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)1310 b FA(pr)o(ocedur)o(e)573 -1808 y(These)22 b(r)o(outines)g(get)g(and)f(set)h(the)g(ef)o(fective)e(and)i -(r)o(eal)f(user)g(and)h(gr)o(oup)g(ids.)31 b(The)573 1908 y -Fw(set-uid)e FA(and)i Fw(set-gid)f FA(r)o(outines)i(corr)o(espond)f(to)i(the) -h(P)t Fr(O)t(S)t(I)t(X)h Fw(setuid\(\))29 b FA(and)573 2007 -y Fw(setgid\(\))17 b FA(pr)o(ocedur)o(es.)365 2213 y Fw(\(process-times\))81 -b Fs(\000)-14 b(!)87 b Fz([\256xnum)20 b(\256xnum)g(\256xnum)g(\256xnum])440 -b FA(pr)o(ocedur)o(e)573 2359 y(Returns)21 b(four)g(values:)756 -2459 y(user)f(CPU)g(time)h(in)h(clock-ticks)756 2558 y(system)f(CPU)f(time)h -(in)h(clock-ticks)756 2658 y(user)e(CPU)g(time)h(of)g(all)g(descendant)f(pr)o -(ocesses)756 2758 y(system)h(CPU)f(time)h(of)g(all)g(descendant)f(pr)o -(ocesses)573 2857 y(Note)e(that)h(CPU)f(time)g(clock)h(r)o(esolution)g(is)g -(not)g(the)f(same)h(as)f(the)g(r)o(eal-time)f(clock)573 2957 -y(r)o(esolution)k(pr)o(ovided)f(by)h Fw(time+ticks)p FA(.)i(That's)e(Unix.) -365 3162 y Fw(\(cpu-ticks/sec\))81 b Fs(\000)-14 b(!)87 b Fz(integer)1293 -b FA(pr)o(ocedur)o(e)573 3309 y(Returns)27 b(the)f(r)o(esolution)h(of)g(the)f -(CPU)g(timer)h(in)f(clock)h(ticks)g(per)f(second.)44 b(This)573 -3408 y(can)20 b(be)h(used)f(to)h(convert)g(the)g(times)g(r)o(eported)f(by)h -Fw(process-times)15 b FA(to)21 b(seconds.)365 3724 y Fu(3.6)99 -b(User)25 b(and)f(group)h(database)g(access)365 3947 y FA(These)16 -b(pr)o(ocedur)o(es)f(ar)o(e)g(used)h(to)g(access)g(the)g(user)g(and)g(gr)o -(oup)g(databases)f(\()p Fz(e.g.)o FA(,)i(the)f(ones)365 4047 -y(traditionally)21 b(stor)o(ed)f(in)i Fw(/etc/passwd)16 b FA(and)k -Fw(/etc/group)p FA(.\))365 4201 y Fw(\(user-info)40 b Fz(uid/name)p -Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(r)o(ecord)1135 b FA(pr)o(ocedur)o(e)573 -4347 y(Return)19 b(a)e Fw(user-info)e FA(r)o(ecor)o(d)h(giving)j(the)g(r)o -(ecor)o(ded)d(information)j(for)f(a)g(particu-)573 4447 y(lar)i(user:)756 -4623 y Fw(\(define-record)37 b(user-info)843 4722 y(name)42 -b(uid)g(gid)g(home-dir)f(shell\))573 4898 y FA(The)21 b Fz(uid/name)f -FA(ar)o(gument)g(is)h(either)g(an)f(integer)h(uid)g(or)g(a)f(string)h(user)o -(-name.)365 5147 y FD(November)d(1,)h(1995)h(\261)f(15)14 b(:)e(58)p -1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 -V 1636 5176 323 4 v 1216 w FA(59)p eop +59 64 bop 365 614 a Fx(\(status:stop-sig)37 b FA(status)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(integer)21 b(or)g +Fx(#f)760 b FB(pr)o(ocedur)o(e)365 714 y Fx(\(status:term-sig)37 +b FA(status)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(integer)21 +b(or)g Fx(#f)760 b FB(pr)o(ocedur)o(e)573 850 y(For)27 +b(a)g(given)g(status)g(value)f(pr)o(oduced)g(by)h(calling)g +Fx(wait)p FB(,)g(exactly)f(one)i(of)e(these)573 950 y(r)o(outines)21 +b(will)g(r)o(eturn)f(a)h(tr)o(ue)f(value.)573 1081 y(If)31 +b(the)h(child)g(pr)o(ocess)g(exited)f(normally)-9 b(,)35 +b Fx(status:exit-val)25 b FB(r)o(eturns)32 b(the)g(exit)573 +1180 y(code)26 b(for)g(the)g(child)g(pr)o(ocess)g(\()p +FA(i.e.)o FB(,)i(the)e(value)f(the)i(child)f(passed)g(to)g +Fx(exit)f FB(or)h(r)o(e-)573 1280 y(turned)20 b(fr)o(om)h +Fx(main)p FB(\).)i(Otherwise,)e(this)h(function)f(r)o(eturns)g(false.) +573 1410 y(If)d(the)i(child)f(pr)o(ocess)f(was)h(suspended)g(by)g(a)g +(signal,)g Fx(status:stop-sig)13 b FB(r)o(eturns)573 +1510 y(the)35 b(signal)g(that)g(suspended)f(the)h(child.)68 +b(Otherwise,)38 b(this)e(function)f(r)o(eturns)573 1610 +y(false.)573 1740 y(If)19 b(the)g(child)h(pr)o(ocess)f(terminated)g +(abnormally)-9 b(,)19 b Fx(status:term-sig)13 b FB(r)o(eturns)19 +b(the)573 1840 y(signal)i(that)g(terminated)f(the)h(child.)26 +b(Otherwise,)21 b(this)g(function)h(r)o(eturns)e(false.)365 +2129 y Fv(3.5)99 b(Process)26 b(state)365 2364 y Fx(\(umask\))85 +b Ft(\000)-15 b(!)88 b FA(\002xnum)1633 b FB(pr)o(ocedur)o(e)365 +2463 y Fx(\(set-umask)40 b FA(perms)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(unde\002ned)1126 b FB(pr)o(ocedur)o(e)365 +2563 y Fx(\(with-umask*)39 b FA(perms)21 b(thunk)p Fx(\))86 +b Ft(\000)-14 b(!)87 b FA(value\(s\))20 b(of)h(thunk)581 +b FB(pr)o(ocedur)o(e)365 2662 y Fx(\(with-umask)39 b +FA(perms)21 b(.)g(body)p Fx(\))86 b Ft(\000)-15 b(!)88 +b FA(value\(s\))20 b(of)h(body)796 b FB(syntax)573 2785 +y(The)49 b(pr)o(ocess')g(curr)o(ent)f(umask)h(is)h(r)o(etrieved)d(with) +j Fx(umask)p FB(,)k(and)49 b(set)g(with)573 2884 y Fx(\(set-umask)39 +b FA(perms)p Fx(\))p FB(.)52 b(Calling)30 b Fx(with-umask*)25 +b FB(changes)30 b(the)g(umask)g(to)g FA(perms)573 2984 +y FB(for)25 b(the)g(duration)h(of)f(the)g(call)g(to)h +FA(thunk)o FB(.)39 b(If)25 b(the)h(pr)o(ogram)e(thr)o(ows)i(out)g(of)f +FA(thunk)573 3083 y FB(by)k(invoking)i(a)e(continuation,)k(the)d(umask) +g(is)g(r)o(eset)e(to)i(its)g(external)f(value.)51 b(If)573 +3183 y(the)22 b(pr)o(ogram)f(thr)o(ows)h(back)g(into)g +FA(thunk)f FB(by)h(calling)g(a)g(stor)o(ed)f(continuation,)i(the)573 +3283 y(umask)32 b(is)f(r)o(estor)o(ed)f(to)i(the)g FA(perms)f +FB(value.)57 b(The)31 b(special)g(form)h Fx(with-umask)27 +b FB(is)573 3382 y(equivalent)f(in)g(ef)o(fect)e(to)i(the)g(pr)o +(ocedur)o(e)e Fx(with-umask*)p FB(,)e(but)k(does)f(not)i(r)o(equir)o(e) +573 3482 y(the)21 b(pr)o(ogrammer)g(to)g(explicitly)h(wrap)f(a)g +Fx(\()p Fy(\025)38 b Fx(\(\))43 b(...\))20 b FB(ar)o(ound)g(the)i(body) +f(of)g(the)573 3582 y(code)f(to)h(be)g(executed.)365 +3766 y Fx(\(chdir)41 b FA([fname])p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(unde\002ned)1245 b FB(pr)o(ocedur)o(e)365 +3865 y Fx(\(cwd\))85 b Ft(\000)-14 b(!)87 b FA(string)1761 +b FB(pr)o(ocedur)o(e)365 3965 y Fx(\(with-cwd*)40 b FA(fname)20 +b(thunk)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(value\(s\))20 +b(of)h(thunk)668 b FB(pr)o(ocedur)o(e)365 4064 y Fx(\(with-cwd)40 +b FA(fname)21 b(.)f(body)p Fx(\))86 b Ft(\000)-14 b(!)87 +b FA(value\(s\))21 b(of)f(body)884 b FB(syntax)573 4201 +y(These)25 b(forms)g(manipulate)f(the)h(curr)o(ent)f(working)i(dir)o +(ectory)-9 b(.)37 b(The)25 b(cwd)f(can)h(be)573 4301 +y(changed)c(with)h Fx(chdir)d FB(\(although)j(in)g(most)g(cases,)f +Fx(with-cwd)d FB(is)k(pr)o(eferrable\).)i(If)573 4400 +y Fx(chdir)17 b FB(is)j(called)e(with)i(no)g(ar)o(guments,)f(it)g +(changes)h(the)f(cwd)g(to)h(the)f(user)6 b('s)20 b(home)573 +4500 y(dir)o(ectory)-9 b(.)31 b(The)23 b Fx(with-cwd*)c +FB(pr)o(ocedur)o(e)i(calls)i Fx(thunk)d FB(with)k(the)f(cwd)g(temporar) +o(-)573 4599 y(ily)30 b(set)f(to)h FA(fname)p FB(;)j(when)d +FA(thunk)e FB(r)o(eturns,)j(or)e(is)h(exited)f(in)g(a)g(non-local)h +(fashion)573 4699 y(\()p FA(e.g.)o FB(,)d(by)f(raising)h(an)f +(exception)g(or)h(by)f(invoking)i(a)d(continuation\),)k(the)d(cwd)g(is) +573 4799 y(r)o(eturned)d(to)i(its)g(original)g(value.)35 +b(The)25 b(special)f(form)g Fx(with-cwd)d FB(is)k(simply)g(syn-)573 +4898 y(tactic)20 b(sugar)h(for)f Fx(with-cwd*)p FB(.)365 +5147 y FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(59)p eop %%Page: 60 66 -60 65 bop 681 614 a Fw(\(->uid)41 b Fz(uid/name)p Fw(\))86 -b Fs(\000)-14 b(!)87 b Fz(\256xnum)1274 b FA(pr)o(ocedur)o(e)681 -714 y Fw(\(->username)39 b Fz(uid/name)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(string)1096 b FA(pr)o(ocedur)o(e)888 856 y(These)19 -b(two)h(pr)o(ocedur)o(es)d(coer)o(ce)h(integer)h(uid's)g(and)g(user)f(names)h -(to)h(a)e(particular)888 956 y(form.)681 1149 y Fw(\(group-info)39 -b Fz(gid/name)p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(r)o(ecord)1096 -b FA(pr)o(ocedur)o(e)888 1291 y(Return)20 b(a)e Fw(group-info)d -FA(r)o(ecor)o(d)i(giving)j(the)f(r)o(ecor)o(ded)d(information)k(for)f(a)f -(partic-)888 1391 y(ular)j(gr)o(oup:)1071 1559 y Fw(\(define-record)38 -b(group-info)1158 1658 y(name)k(gid)g(members\))888 1826 y -FA(The)21 b Fz(gid/name)e FA(ar)o(gument)i(is)g(either)f(an)h(integer)g(gid)g -(or)f(a)h(string)g(gr)o(oup-name.)681 2124 y Fu(3.7)99 b(Accessing)26 -b(command-line)e(arguments)681 2364 y Fw(command-line-arg)o(um)o(ent)o(s)1565 -b Fz(string)20 b FA(list)681 2464 y Fw(\(command-line\))81 -b Fs(\000)-14 b(!)87 b Fz(string)21 b(list)1241 b FA(pr)o(ocedur)o(e)888 -2589 y(The)45 b(list)g(of)f(strings)i Fw(command-line-arg)o(um)o(ent)o(s)38 -b FA(contains)46 b(the)e(ar)o(guments)888 2689 y(passed)16 -b(to)h(the)g(scsh)g(pr)o(ocess)f(on)h(the)g(command)g(line.)26 -b(Calling)17 b Fw(\(command-line\))888 2788 y FA(r)o(eturns)h(the)h(complete) -g Fw(argv)e FA(string)i(list,)h(including)f(the)g(pr)o(ogram.)26 -b(So)18 b(if)h(we)g(r)o(un)888 2888 y(a)i(scsh)g(pr)o(ogram)1071 -3028 y Fw(/usr/shivers/bin)o(/my)o(ls)37 b(-CF)42 b(src)888 -3169 y FA(then)22 b Fw(command-line-ar)o(gum)o(en)o(ts)14 b -FA(is)1071 3310 y Fw(\("-CF")41 b("src"\))888 3450 y FA(and)21 -b Fw(\(command-line\))15 b FA(r)o(eturns)1071 3591 y Fw(\("/usr/shivers/b)o -(in/)o(my)o(ls)o(")38 b("-CF")j("src"\))888 3732 y(command-line)32 -b FA(r)o(eturns)k(a)g(fr)o(esh)g(list)h(each)f(time)g(it)h(is)g(called.)74 -b(In)36 b(this)i(way)-9 b(,)888 3831 y(the)37 b(pr)o(ogrammer)f(can)g(get)h -(a)f(fr)o(esh)g(copy)g(of)h(the)g(original)g(ar)o(gument)f(list)h(if)888 -3931 y Fw(command-line-argu)o(me)o(nts)14 b FA(has)21 b(been)f(modi\256ed)h -(or)g(is)g(lexically)g(shadowed.)681 4124 y Fw(\(arg)42 b Fz(ar)o(glist)20 -b(n)h([default])p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(string)1128 -b FA(pr)o(ocedur)o(e)681 4224 y Fw(\(arg*)41 b Fz(ar)o(glist)20 -b(n)h([default-thunk])p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(string)858 -b FA(pr)o(ocedur)o(e)681 4324 y Fw(\(argv)41 b Fz(n)21 b([default])p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(string)1320 b FA(pr)o(ocedur)o(e)888 -4466 y(These)17 b(pr)o(ocedur)o(es)e(ar)o(e)g(useful)h(for)g(accessing)h(ar)o -(guments)f(fr)o(om)g(ar)o(gument)h(lists.)888 4565 y Fw(arg)d -FA(r)o(eturns)f(the)i Fx(n)1492 4535 y Ft(th)1573 4565 y FA(element)g(of)f -Fz(ar)o(glist)o FA(.)26 b(The)14 b(index)g(is)h(1-based.)24 -b(If)14 b Fz(n)g FA(is)h(too)g(lar)o(ge,)888 4665 y Fz(default)21 -b FA(is)g(r)o(eturned;)e(if)i(no)g Fz(default)p FA(,)f(then)h(an)g(err)o(or)f -(is)h(signaled.)888 4799 y Fw(arg*)j FA(is)h(similar)-6 b(,)27 -b(except)d(that)h(the)h Fz(default-thunk)e FA(is)h(called)g(to)g(generate)g -(the)g(de-)888 4898 y(fault)c(value.)681 5147 y(60)p 1952 5071 -323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 -5176 323 4 v 435 w FD(November)d(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +60 65 bop 681 614 a Fx(\(pid\))85 b Ft(\000)-14 b(!)87 +b FA(\002xnum)1720 b FB(pr)o(ocedur)o(e)681 714 y Fx(\(parent-pid\))82 +b Ft(\000)-14 b(!)87 b FA(\002xnum)1415 b FB(pr)o(ocedur)o(e)681 +814 y Fx(\(process-group\))81 b Ft(\000)-15 b(!)88 b +FA(\002xnum)1284 b FB(pr)o(ocedur)o(e)681 913 y Fx(\(set-process-gro)o +(up)37 b FA([pr)o(oc/pid])18 b(pgrp)p Fx(\))85 b Ft(\000)-14 +b(!)87 b FA(unde\002ned)473 b FB(pr)o(ocedur)o(e)888 +1063 y Fx(\(pid\))25 b FB(and)i Fx(\(parent-pid\))22 +b FB(r)o(etrieve)j(the)i(pr)o(ocess)g(id)g(for)f(the)h(curr)o(ent)f(pr) +o(ocess)888 1162 y(and)18 b(its)g(par)o(ent.)24 b Fx(\(process-group\)) +12 b FB(r)o(eturns)17 b(the)h(pr)o(ocess)g(gr)o(oup)g(of)g(the)g(curr)o +(ent)888 1262 y(pr)o(ocess.)44 b(A)26 b(pr)o(ocess')h(pr)o(ocess-gr)o +(oup)f(can)g(be)h(set)g(with)g Fx(set-process-group)o +FB(;)888 1361 y(the)19 b(value)f FA(pr)o(oc/pid)e FB(speci\002es)i(the) +h(af)o(fected)c(pr)o(ocess.)25 b(It)18 b(may)g(be)g(either)h(a)e(pr)o +(ocess)888 1461 y(object)k(or)g(an)g(integer)g(pr)o(ocess)f(id,)g(and)h +(defaults)f(to)h(the)g(curr)o(ent)f(pr)o(ocess.)681 1676 +y Fx(\(set-priority)38 b FA(which)20 b(who)g(priority)p +Fx(\))86 b Ft(\000)-15 b(!)88 b FA(unde\002ned)559 b +FB(pr)o(ocedur)o(e)681 1776 y Fx(\(priority)40 b FA(which)19 +b(who)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(\002xnum)1100 +b FB(pr)o(ocedur)o(e)681 1876 y Fx(\(nice)41 b FA([pr)o(oc/pid)18 +b(delta])p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(unde\002ned)1035 +b FB(pr)o(ocedur)o(e)888 2025 y(These)21 b(pr)o(ocedur)o(es)e(set)i +(and)g(access)f(the)h(priority)g(of)g(pr)o(ocesses.)k(I)c(can't)g(r)o +(emem-)888 2125 y(ber)28 b(how)h Fx(set-priority)23 b +FB(and)k Fx(priority)e FB(work,)30 b(so)e(no)h(documentation,)h(and)888 +2224 y(besides,)21 b(they)g(ar)o(en't)e(implemented)i(yet,)g(anyway)-9 +b(.)681 2382 y Fx(\(user-login-name)o(\))81 b Ft(\000)-14 +b(!)87 b FA(string)1237 b FB(pr)o(ocedur)o(e)681 2481 +y Fx(\(user-uid\))83 b Ft(\000)-14 b(!)87 b FA(\002xnum)1502 +b FB(pr)o(ocedur)o(e)681 2581 y Fx(\(user-effective-)o(ui)o(d\))81 +b Ft(\000)-15 b(!)88 b FA(\002xnum)1066 b FB(pr)o(ocedur)o(e)681 +2680 y Fx(\(user-gid\))83 b Ft(\000)-14 b(!)87 b FA(\002xnum)1502 +b FB(pr)o(ocedur)o(e)681 2780 y Fx(\(user-effective-)o(gi)o(d\))81 +b Ft(\000)-15 b(!)88 b FA(\002xnum)1066 b FB(pr)o(ocedur)o(e)681 +2880 y Fx(\(user-supplement)o(ar)o(y-g)o(id)o(s\))81 +b Ft(\000)-15 b(!)88 b FA(\002xnum)20 b(list)722 b FB(pr)o(ocedur)o(e) +681 2979 y Fx(\(set-uid)40 b FA(uid)p Fx(\))87 b Ft(\000)-15 +b(!)87 b FA(unde\002ned)1305 b FB(pr)o(ocedur)o(e)681 +3079 y Fx(\(set-gid)40 b FA(gid)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(unde\002ned)1309 b FB(pr)o(ocedur)o(e)888 +3228 y(These)22 b(r)o(outines)h(get)f(and)f(set)h(the)h(ef)o(fective)d +(and)h(r)o(eal)g(user)h(and)g(gr)o(oup)g(ids.)29 b(The)888 +3328 y Fx(set-uid)g FB(and)j Fx(set-gid)d FB(r)o(outines)j(corr)o +(espond)g(to)g(the)i(P)t Fs(O)t(S)t(I)t(X)i Fx(setuid\(\))28 +b FB(and)888 3428 y Fx(setgid\(\))18 b FB(pr)o(ocedur)o(es.)681 +3643 y Fx(\(process-times\))81 b Ft(\000)-15 b(!)88 b +FA([\002xnum)19 b(\002xnum)h(\002xnum)g(\002xnum])440 +b FB(pr)o(ocedur)o(e)888 3792 y(Returns)22 b(four)e(values:)1071 +3892 y(user)h(CPU)f(time)h(in)g(clock-ticks)1071 3991 +y(system)g(CPU)g(time)g(in)g(clock-ticks)1071 4091 y(user)g(CPU)f(time) +h(of)g(all)f(descendant)g(pr)o(ocesses)1071 4191 y(system)h(CPU)g(time) +g(of)g(all)f(descendant)g(pr)o(ocesses)888 4290 y(Note)f(that)f(CPU)g +(time)h(clock)g(r)o(esolution)g(is)f(not)h(the)g(same)f(as)g(the)h(r)o +(eal-time)e(clock)888 4390 y(r)o(esolution)22 b(pr)o(ovided)d(by)i +Fx(time+ticks)p FB(.)h(That's)e(Unix.)681 4605 y Fx(\(cpu-ticks/sec\)) +81 b Ft(\000)-15 b(!)88 b FA(integer)1292 b FB(pr)o(ocedur)o(e)888 +4755 y(Returns)27 b(the)g(r)o(esolution)g(of)g(the)f(CPU)g(timer)h(in)g +(clock)g(ticks)g(per)f(second.)42 b(This)888 4854 y(can)21 +b(be)f(used)h(to)g(convert)g(the)g(times)g(r)o(eported)e(by)i +Fx(process-times)15 b FB(to)22 b(seconds.)681 5147 y(60)p +1952 5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)d(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p eop %%Page: 61 67 -61 66 bop 573 614 a Fw(\(argv)41 b Fz(n)q Fw(\))25 b FA(is)i(simply)g -Fw(\(arg)42 b(\(command-line\))c(\(+)43 b Fz(n)g Fw(1\)\))p -FA(.)g(The)26 b(+1)g(of)o(fset)g(en-)573 714 y(sur)o(es)20 -b(that)h(the)g(two)g(forms)756 877 y Fw(\(arg)41 b(command-line-argu)o(men)o -(ts)c Fz(n)p Fw(\))756 977 y(\(argv)k Fz(n)p Fw(\))573 1141 -y FA(r)o(eturn)22 b(the)h(same)g(ar)o(gument)g(\(assuming)h(the)f(user)g(has) -g(not)h(r)o(ebound)e(or)h(modi-)573 1240 y(\256ed)d Fw(command-line-argu)o -(me)o(nts)o FA(\).)573 1372 y(Example:)756 1535 y Fw(\(if)42 -b(\(null?)f(command-line-arg)o(um)o(ent)o(s\))930 1635 y(\(&)i(\(xterm)e(-n)h -(,host)g(-title)f(,host)1366 1734 y(-name)g(,\(string-append)d("xterm_")i -(host\)\)\))930 1834 y(\(let*)h(\(\(progname)f(\(file-name-nondi)o(re)o(cto)o -(ry)d(\(argv)k(1\)\)\))1235 1934 y(\(title)g(\(string-append)d(host)k(":")g -(progname\)\)\))1017 2033 y(\(&)h(\(xterm)e(-n)217 b(,title)1453 -2133 y(-title)41 b(,title)1453 2233 y(-e)217 b(,@command-line-a)o(rgu)o(me)o -(nt)o(s\)\))o(\)\))573 2396 y FA(A)22 b(subtlety:)33 b(when)23 -b(the)h(scsh)f(interpr)o(eter)f(is)h(used)g(to)g(execute)f(a)h(scsh)h(pr)o -(ogram,)573 2496 y(the)d(pr)o(ogram)f(name)h(r)o(eported)e(in)j(the)f(head)f -(of)h(the)g Fw(\(command-line\))15 b FA(list)21 b(is)g(the)573 -2595 y(scsh)d(pr)o(ogram,)g Fz(not)f FA(the)h(interpr)o(eter)-6 -b(.)25 b(For)18 b(example,)g(if)f(we)h(have)g(a)f(shell)h(script)g(in)573 -2695 y(\256le)j Fw(fullecho)p FA(:)756 2858 y Fw(#!/usr/local/bi)o(n/)o(scs)o -(h)37 b(-s)756 2958 y(!#)756 3058 y(\(for-each)i(\()p Fx(\025)g -Fw(\(arg\))j(\(display)e(arg\))i(\(display)e(")j("\)\))1191 -3157 y(\(command-line\)\))573 3321 y FA(and)20 b(we)h(r)o(un)g(the)g(pr)o -(ogram)756 3459 y Fw(fullecho)40 b(hello)h(world)573 3598 y -FA(the)21 b(pr)o(ogram)f(will)h(print)g(out)756 3736 y Fw(fullecho)40 -b(hello)h(world)573 3875 y FA(not)756 4013 y Fw(/usr/local/bin/)o(sc)o(sh)c -(-s)43 b(fullecho)d(hello)i(world)573 4184 y FA(This)37 b(ar)o(gument)f(line) -h(pr)o(ocessing)f(ensur)o(es)g(that)h(if)f(a)g(scsh)h(pr)o(ogram)f(is)h(sub-) -573 4284 y(sequently)29 b(compiled)g(into)g(a)g(standalone)f(executable)f(or) -i(byte-compiled)f(to)h(a)573 4383 y(heap-image)c(executable)g(by)h(the)h -(Scheme)f(48)f(virtual)h(machine,)h(its)g(semantics)573 4483 -y(will)21 b(be)g(unchanged\320the)g(ar)o(glist)f(pr)o(ocessing)h(is)g -(invariant.)27 b(In)21 b(ef)o(fect,)e(the)756 4621 y Fw(/usr/local/bin/)o(sc) -o(sh)37 b(-s)573 4760 y FA(is)24 b(not)g(part)e(of)h(the)h(pr)o(ogram;)f -(it's)h(a)f(speci\256cation)h(for)f(the)g(machine)h(to)f(execute)573 -4860 y(the)e(pr)o(ogram)f(on,)h(so)g(it)g(is)g(not)g(pr)o(operly)f(part)g(of) -h(the)g(pr)o(ogram's)f(ar)o(gument)g(list.)365 5147 y FD(November)e(1,)h -(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 -4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 -w FA(61)p eop +61 66 bop 365 614 a Fv(3.6)99 b(User)25 b(and)f(group)h(database)g +(access)365 829 y FB(These)32 b(pr)o(ocedur)o(es)d(ar)o(e)h(used)i(to)g +(access)e(the)i(user)f(and)g(gr)o(oup)h(databases)e(\()p +FA(e.g.)n FB(,)k(the)365 928 y(ones)22 b(traditionally)f(stor)o(ed)f +(in)h Fx(/etc/passwd)16 b FB(and)k Fx(/etc/group)p FB(.\))365 +1078 y Fx(\(user-info)40 b FA(uid/name)p Fx(\))86 b Ft(\000)-15 +b(!)88 b FA(r)o(ecord)1135 b FB(pr)o(ocedur)o(e)573 1219 +y(Return)24 b(a)e Fx(user-info)e FB(r)o(ecor)o(d)h(giving)j(the)g(r)o +(ecor)o(ded)d(information)j(for)f(a)g(partic-)573 1319 +y(ular)d(user:)756 1485 y Fx(\(define-record)37 b(user-info)843 +1585 y(name)42 b(uid)g(gid)g(home-dir)f(shell\))573 1751 +y FB(The)21 b FA(uid/name)f FB(ar)o(gument)g(is)h(either)g(an)f +(integer)h(uid)g(or)g(a)f(string)h(user)o(-name.)365 +1942 y Fx(\(->uid)41 b FA(uid/name)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(\002xnum)1275 b FB(pr)o(ocedur)o(e)365 2042 +y Fx(\(->username)39 b FA(uid/name)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(string)1097 b FB(pr)o(ocedur)o(e)573 2183 +y(These)19 b(two)g(pr)o(ocedur)o(es)f(coer)o(ce)f(integer)i(uid's)h +(and)e(user)h(names)g(to)g(a)g(particular)573 2283 y(form.)365 +2474 y Fx(\(group-info)39 b FA(gid/name)p Fx(\))86 b +Ft(\000)-15 b(!)88 b FA(r)o(ecord)1096 b FB(pr)o(ocedur)o(e)573 +2615 y(Return)19 b(a)g Fx(group-info)14 b FB(r)o(ecor)o(d)j(giving)j +(the)f(r)o(ecor)o(ded)e(information)j(for)e(a)h(partic-)573 +2715 y(ular)h(gr)o(oup:)756 2881 y Fx(\(define-record)37 +b(group-info)843 2981 y(name)42 b(gid)g(members\))573 +3147 y FB(The)21 b FA(gid/name)e FB(ar)o(gument)h(is)h(either)g(an)f +(integer)h(gid)g(or)g(a)f(string)i(gr)o(oup-name.)365 +3442 y Fv(3.7)99 b(Accessing)26 b(command-line)e(arguments)365 +3681 y Fx(command-line-argu)o(me)o(nts)1564 b FA(string)21 +b FB(list)365 3781 y Fx(\(command-line\))82 b Ft(\000)-15 +b(!)88 b FA(string)20 b(list)1242 b FB(pr)o(ocedur)o(e)573 +3905 y(The)44 b(list)h(of)g(strings)g Fx(command-line-argu)o(men)o(ts) +38 b FB(contains)45 b(the)g(ar)o(guments)573 4005 y(passed)16 +b(to)h(the)g(scsh)g(pr)o(ocess)f(on)i(the)f(command)g(line.)24 +b(Calling)17 b Fx(\(command-line\))573 4104 y FB(r)o(eturns)h(the)h +(complete)g Fx(argv)e FB(string)j(list,)f(including)h(the)f(pr)o +(ogram.)24 b(So)19 b(if)f(we)h(r)o(un)573 4204 y(a)h(scsh)h(pr)o(ogram) +756 4343 y Fx(/usr/shivers/bi)o(n/)o(myl)o(s)37 b(-CF)43 +b(src)573 4482 y FB(then)21 b Fx(command-line-arg)o(ume)o(nt)o(s)15 +b FB(is)756 4621 y Fx(\("-CF")41 b("src"\))573 4759 y +FB(and)20 b Fx(\(command-line\))15 b FB(r)o(eturns)756 +4898 y Fx(\("/usr/shivers/)o(bi)o(n/m)o(yl)o(s")37 b("-CF")42 +b("src"\))365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(61)p +eop %%Page: 62 68 -62 67 bop 681 614 a Fu(3.8)99 b(System)25 b(parameters)681 -861 y Fw(\(system-name\))82 b Fs(\000)-15 b(!)88 b Fz(string)1411 -b FA(pr)o(ocedur)o(e)888 988 y(Returns)24 b(the)g(name)g(of)f(the)h(host)g -(on)g(which)h(we)e(ar)o(e)f(executing.)36 b(This)24 b(may)f(be)h(a)888 -1087 y(local)c(name,)g(such)g(as)f(\252solar)-6 b(,\272)19 -b(as)g(opposed)h(to)g(a)f(fully-quali\256ed)h(domain)g(name)888 -1187 y(such)i(as)e(\252solar)-6 b(.csie.ntu.edu.tw)e(.\272)681 -1503 y Fu(3.9)99 b(Signal)25 b(system)681 1727 y FA(Signal)20 -b(numbers)i(ar)o(e)d(bound)i(to)g(the)g(variables)f Fw(signal/hup)p -FA(,)c Fw(signal/int)p FA(,)g Fx(:)e(:)g(:)681 1882 y Fw(\(signal-process)37 -b Fz(pr)o(oc)20 b(sig)p Fw(\))87 b Fs(\000)-15 b(!)87 b Fz(unde\256ned)850 -b FA(pr)o(ocedur)o(e)681 1981 y Fw(\(signal-process-)o(gr)o(oup)37 -b Fz(pr)o(grp)19 b(sig)p Fw(\))87 b Fs(\000)-15 b(!)88 b Fz(unde\256ned)543 -b FA(pr)o(ocedur)o(e)888 2127 y(These)24 b(two)g(pr)o(ocedur)o(es)d(send)j -(signals)g(to)g(a)e(speci\256c)i(pr)o(ocess,)f(and)g(all)g(the)h(pr)o(o-)888 -2227 y(cesses)g(in)g(a)f(speci\256c)g(pr)o(ocess)g(gr)o(oup,)h(r)o -(espectively)-9 b(.)34 b(The)24 b Fz(pr)o(oc)e FA(and)h Fz(pr)o(grp)f -FA(ar)o(gu-)888 2327 y(ments)g(ar)o(e)d(either)i(pr)o(ocesses)f(or)h(integer) -g(pr)o(ocess)f(ids.)805 2510 y(I)15 b(haven't)f(done)h(signal)g(handlers)g -(yet.)25 b(Should)15 b(be)f(straightforwar)o(d:)23 b(a)14 b(mechanism)681 -2610 y(to)21 b(assign)g(pr)o(ocedur)o(es)e(to)i(signals.)681 -2765 y Fw(\(itimer)40 b Fz(???)p Fw(\))86 b Fs(\000)-15 b(!)88 -b Fz(unde\256ned)1334 b FA(pr)o(ocedur)o(e)681 2864 y Fw(\(pause-until-int)o -(er)o(rup)o(t\))80 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)849 -b FA(pr)o(ocedur)o(e)681 3019 y Fw(\(sleep)41 b Fz(secs)p Fw(\))87 -b Fs(\000)-14 b(!)87 b Fz(unde\256ned)1372 b FA(pr)o(ocedur)o(e)888 -3165 y(Sleeping)24 b(is)f(de\256ned,)h(but)f(we)h(don't)g(of)o(fer)e(a)h(way) -h(to)f(sleep)h(for)f(a)g(mor)o(e)g(pr)o(ecise)888 3265 y(interval)e(\()p -Fz(e.g.)o FA(,)f(a)h(micr)o(osecond)f(timer\),)h(as)f(this)i(is)f(not)g(in)i -(P)t Fr(O)t(S)t(I)t(X)r FA(.)681 3581 y Fu(3.10)99 b(T)-5 b(ime)681 -3805 y FA(This)16 b(time)g(package)e(does)i(not)g(curr)o(ently)f(work)h(with) -g(NeXTSTEP)-11 b(,)15 b(as)g(NeXTSTEP)g(does)681 3904 y(not)21 -b(pr)o(ovide)f(a)i(P)t Fr(O)t(S)t(I)t(X)r FA(-compliant)h(time)e(library)f -(that)h(will)g(even)g(link.)805 4036 y(Scsh's)32 b(time)g(system)g(is)f -(fairly)g(sophisticated,)j(particularly)d(with)h(r)o(espect)e(to)i(its)681 -4136 y(car)o(eful)c(tr)o(eatment)g(of)i(time)g(zones.)54 b(However)-6 -b(,)31 b(casual)e(users)h(shouldn't)h(be)e(intimi-)681 4236 -y(dated;)g(all)e(of)g(the)h(complexity)g(is)f(optional,)j(and)d(defaulting)g -(all)g(the)g(optional)h(ar)o(gu-)681 4335 y(ments)21 b(r)o(educes)f(the)h -(system)g(to)g(a)f(simple)i(interface.)681 4606 y Fy(3.10.1)80 -b(T)-9 b(erminology)681 4799 y FA(\252UTC\272)16 b(and)i(\252UCT\272)e(stand) -i(for)g(\252universal)f(coor)o(dinated)g(time,\272)h(which)h(is)f(the)h(of)o -(\256cial)681 4898 y(name)h(for)h(what)g(is)g(colloquially)h(r)o(eferr)o(ed)c -(to)j(as)g(\252Gr)o(eenwich)f(Mean)g(T)-5 b(ime.\272)681 5147 -y(62)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +62 67 bop 888 614 a Fx(command-line)32 b FB(r)o(eturns)k(a)g(fr)o(esh)g +(list)h(each)f(time)h(it)g(is)g(called.)72 b(In)37 b(this)h(way)-9 +b(,)888 714 y(the)37 b(pr)o(ogrammer)f(can)g(get)h(a)f(fr)o(esh)g(copy) +g(of)h(the)g(original)g(ar)o(gument)f(list)h(if)888 814 +y Fx(command-line-argu)o(me)o(nts)14 b FB(has)21 b(been)f(modi\002ed)h +(or)g(is)g(lexically)g(shadowed.)681 1003 y Fx(\(arg)42 +b FA(ar)o(glist)20 b(n)h([default])p Fx(\))85 b Ft(\000)-14 +b(!)87 b FA(string)1128 b FB(pr)o(ocedur)o(e)681 1102 +y Fx(\(arg*)41 b FA(ar)o(glist)20 b(n)h([default-thunk])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(string)858 b FB(pr)o(ocedur)o(e)681 +1202 y Fx(\(argv)41 b FA(n)21 b([default])p Fx(\))86 +b Ft(\000)-14 b(!)87 b FA(string)1320 b FB(pr)o(ocedur)o(e)888 +1342 y(These)17 b(pr)o(ocedur)o(es)e(ar)o(e)g(useful)h(for)g(accessing) +h(ar)o(guments)f(fr)o(om)g(ar)o(gument)h(lists.)888 1442 +y Fx(arg)28 b FB(r)o(eturns)g(the)h Fy(n)1535 1412 y +Fu(th)1630 1442 y FB(element)g(of)f FA(ar)o(glist)p FB(.)49 +b(The)28 b(index)h(is)g(1-based.)47 b(If)29 b FA(n)f +FB(is)h(too)888 1541 y(lar)o(ge,)20 b FA(default)g FB(is)h(r)o +(eturned;)f(if)g(no)i FA(default)o FB(,)f(then)g(an)f(err)o(or)g(is)h +(signaled.)888 1674 y Fx(arg*)j FB(is)h(similar)-6 b(,)27 +b(except)d(that)h(the)h FA(default-thunk)e FB(is)h(called)g(to)g +(generate)g(the)g(de-)888 1773 y(fault)c(value.)888 1905 +y Fx(\(argv)42 b FA(n)p Fx(\))26 b FB(is)h(simply)g Fx(\(arg)42 +b(\(command-line\))c(\(+)43 b FA(n)h Fx(1\)\))p FB(.)d(The)26 +b(+1)h(of)o(fset)e(en-)888 2005 y(sur)o(es)c(that)f(the)h(two)h(forms) +1071 2170 y Fx(\(arg)42 b(command-line-arg)o(um)o(ent)o(s)37 +b FA(n)q Fx(\))1071 2270 y(\(argv)42 b FA(n)p Fx(\))888 +2435 y FB(r)o(eturn)23 b(the)g(same)g(ar)o(gument)f(\(assuming)i(the)f +(user)g(has)g(not)h(r)o(ebound)f(or)g(modi-)888 2534 +y(\002ed)e Fx(command-line-arg)o(um)o(ent)o(s)p FB(\))o(.)888 +2666 y(Example:)1071 2831 y Fx(\(if)42 b(\(null?)f(command-line-argu)o +(men)o(ts)o(\))1245 2931 y(\(&)i(\(xterm)e(-n)i(,host)e(-title)h(,host) +1681 3031 y(-name)g(,\(string-append)37 b("xterm_")j(host\)\)\))1245 +3130 y(\(let*)i(\(\(progname)d(\(file-name-nondir)o(ec)o(tor)o(y)e +(\(argv)42 b(1\)\)\))1550 3230 y(\(title)g(\(string-append)37 +b(host)42 b(":")h(progname\)\)\))1333 3329 y(\(&)f(\(xterm)f(-n)217 +b(,title)1768 3429 y(-title)41 b(,title)1768 3529 y(-e)217 +b(,@command-line-ar)o(gum)o(en)o(ts\))o(\)\))o(\))888 +3694 y FB(A)23 b(subtlety:)31 b(when)24 b(the)f(scsh)h(interpr)o(eter)d +(is)j(used)f(to)g(execute)g(a)f(scsh)i(pr)o(ogram,)888 +3793 y(the)d(pr)o(ogram)g(name)f(r)o(eported)g(in)h(the)g(head)f(of)h +(the)g Fx(\(command-line\))15 b FB(list)22 b(is)f(the)888 +3893 y(scsh)26 b(pr)o(ogram,)f FA(not)f FB(the)h(interpr)o(eter)-6 +b(.)37 b(For)25 b(example,)g(if)g(we)g(have)f(a)h(shell)g(script)888 +3992 y(in)d(\002le)e Fx(fullecho)p FB(:)1071 4157 y Fx +(#!/usr/local/bin)o(/sc)o(sh)37 b(-s)1071 4257 y(!#)1071 +4357 y(\(for-each)j(\()p Fy(\025)f Fx(\(arg\))i(\(display)f(arg\))i +(\(display)f(")i("\)\))1507 4456 y(\(command-line\)\))888 +4621 y FB(and)21 b(we)f(r)o(un)i(the)f(pr)o(ogram)1071 +4760 y Fx(fullecho)40 b(hello)i(world)888 4898 y FB(the)21 +b(pr)o(ogram)f(will)i(print)f(out)681 5147 y(62)p 1952 +5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 +5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 63 69 -63 68 bop 492 614 a FA(P)t Fr(O)t(S)t(I)t(X)28 b FA(allows)d(a)g(single)g -(time)g(zone)g(to)g(specify)f Fz(two)g FA(dif)o(fer)o(ent)f(of)o(fsets)h(fr)o -(om)g(UTC:)365 714 y(one)15 b(standar)o(d)e(one,)j(and)e(one)h(for)g -(\252summer)f(time.\272)25 b(Summer)15 b(time)g(is)g(fr)o(equently)f(some)365 -814 y(sort)21 b(of)g(daylight)g(savings)g(time.)490 942 y(The)31 -b(scsh)i(time)e(package)g(consistently)i(uses)f(this)g(terminology:)51 -b(we)32 b(never)f(say)365 1042 y(\252gmt\272)21 b(or)f(\252dst;\272)g(we)h -(always)f(say)h(\252utc\272)f(and)g(\252summer)h(time.\272)365 -1302 y Fy(3.10.2)81 b(Basic)20 b(data)f(types)365 1490 y FA(W)-8 -b(e)21 b(have)f(two)i(types:)27 b Fz(time)21 b FA(and)f Fz(date)p -FA(.)490 1619 y(A)k Fz(time)g FA(speci\256es)g(an)g(instant)h(in)g(the)g -(history)g(of)f(the)h(universe.)38 b(It)24 b(is)h(location)g(and)365 -1718 y(time-zone)g(independent.)1245 1688 y Ft(3)1320 1718 -y FA(A)g(time)f(is)h(a)f(r)o(eal)f(value)h(giving)i(the)e(number)h(of)g -(elapsed)365 1818 y(seconds)d(since)g(the)f(Unix)g(\252epoch\272)g -(\(Midnight,)g(January)f(1,)h(1970)e(UTC\).)h(T)-5 b(ime)22 -b(values)365 1917 y(pr)o(ovide)16 b(arbitrary)f(time)i(r)o(esolution,)h -(limited)f(only)h(by)e(the)h(number)g(system)g(of)g(the)g(un-)365 -2017 y(derlying)k(Scheme)g(system.)490 2145 y(A)31 b Fz(date)h -FA(is)g(a)f(name)h(for)g(an)f(instant)i(in)f(time)h(that)e(is)i(speci\256ed)e -(r)o(elative)g(to)h(some)365 2245 y(location/time-zone)22 b(in)f(the)g -(world,)g Fz(e.g.)o FA(:)573 2345 y(Friday)f(October)h(31,)e(1994)g(3:47:21)f -(pm)j(EST)-6 b(.)365 2444 y(Dates)33 b(pr)o(ovide)g(one-second)h(r)o -(esolution,)j(and)c(ar)o(e)f(expr)o(essed)f(with)k(the)e(following)365 -2544 y(r)o(ecor)o(d)19 b(type:)573 2741 y Fw(\(define-record)38 -b(date)216 b(;)43 b(A)g(Posix)f(tm)h(struct)660 2841 y(seconds)302 -b(;)43 b(Seconds)e(after)h(the)g(minute)f([0-59])660 2940 y(minute)346 -b(;)43 b(Minutes)e(after)h(the)g(hour)g([0-59])660 3040 y(hour)434 -b(;)43 b(Hours)f(since)f(midnight)g([0-23])660 3140 y(month-day)214 -b(;)43 b(Day)g(of)g(the)f(month)f([1-31])660 3239 y(month)390 -b(;)43 b(Months)f(since)f(January)g([0-11])660 3339 y(year)434 -b(;)43 b(Years)f(since)f(1900)660 3439 y(tz-name)302 b(;)43 -b(Time-zone)d(name:)i(#f)h(or)f(a)h(string.)660 3538 y(tz-secs)302 -b(;)43 b(Time-zone)d(offset:)h(#f)i(or)f(an)h(integer.)660 -3638 y(summer?)302 b(;)43 b(Summer)f(\(Daylight)d(Savings\))i(time)h(in)g -(effect?)660 3737 y(week-day)258 b(;)43 b(Days)f(since)g(Sunday)f([0-6])660 -3837 y(year-day\))214 b(;)43 b(Days)f(since)g(Jan.)g(1)h([0-365])365 -4034 y FA(If)19 b(the)h Fw(tz-secs)c FA(\256eld)j(is)h(given,)g(it)f -(speci\256es)g(the)h(time-zone's)f(of)o(fset)g(fr)o(om)g(UTC)f(in)i(sec-)365 -4134 y(onds.)28 b(If)21 b(it)g(is)g(speci\256ed,)f(the)h Fw(tz-name)d -FA(and)i Fw(summer?)e FA(\256elds)i(ar)o(e)g(ignor)o(ed)g(when)i(using)365 -4234 y(the)f(date)f(str)o(uctur)o(e)g(to)h(determine)g(a)f(speci\256c)h -(instant)g(in)g(time.)490 4362 y(If)38 b(the)g Fw(tz-name)d -FA(\256eld)j(is)g(given,)43 b(it)38 b(is)h(a)e(time-zone)h(string)h(such)g -(as)e Fw("EST")f FA(or)365 4461 y Fw("HKT")25 b FA(understood)j(by)f(the)g -(OS.)g(Since)i(P)t Fr(O)t(S)t(I)t(X)h FA(time-zone)d(strings)h(can)f(specify) -g(dual)365 4561 y(standar)o(d/summer)34 b(time-zones)h(\(e.g.,)h -(\272EST5EDT\272)d(speci\256es)h(U.S.)f(Eastern)h(Stan-)365 -4661 y(dar)o(d/Eastern)20 b(Daylight)j(T)-5 b(ime\),)22 b(the)h(value)e(of)h -(the)g Fw(summer?)e FA(\256eld)h(is)i(used)f(to)g(r)o(esolve)p -365 4742 1146 4 v 450 4796 a Fo(3)485 4819 y Fr(Physics)e(pedants)d(please)j -(note:)25 b(The)18 b(scsh)i(authors)f(live)g(in)f(a)h(Newtonian)h(universe.) -28 b(W)-6 b(e)19 b(disclaim)h(r)o(e-)365 4898 y(sponsibility)e(for)f -(calculations)i(performed)d(in)g(non-ANSI)h(standar)o(d)f(light-cones.)365 -5147 y FD(November)i(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 -5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V -1636 5176 323 4 v 1216 w FA(63)p eop +63 68 bop 756 614 a Fx(fullecho)40 b(hello)h(world)573 +767 y FB(not)756 919 y Fx(/usr/local/bin/)o(sc)o(sh)c(-s)43 +b(fullecho)d(hello)i(world)573 1110 y FB(This)37 b(ar)o(gument)f(line)h +(pr)o(ocessing)f(ensur)o(es)g(that)h(if)f(a)g(scsh)h(pr)o(ogram)f(is)h +(sub-)573 1210 y(sequently)29 b(compiled)g(into)g(a)g(standalone)f +(executable)f(or)i(byte-compiled)f(to)h(a)573 1309 y(heap-image)c +(executable)g(by)h(the)h(Scheme)f(48)f(virtual)h(machine,)h(its)g +(semantics)573 1409 y(will)21 b(be)g(unchanged\227the)g(ar)o(glist)f +(pr)o(ocessing)h(is)g(invariant.)k(In)c(ef)o(fect,)e(the)756 +1561 y Fx(/usr/local/bin/)o(sc)o(sh)37 b(-s)573 1713 +y FB(is)24 b(not)g(part)e(of)h(the)h(pr)o(ogram;)f(it's)h(a)f +(speci\002cation)h(for)f(the)g(machine)h(to)f(execute)573 +1813 y(the)e(pr)o(ogram)f(on,)h(so)g(it)g(is)g(not)g(pr)o(operly)f +(part)g(of)h(the)g(pr)o(ogram's)f(ar)o(gument)g(list.)365 +2132 y Fv(3.8)99 b(System)25 b(parameters)365 2380 y +Fx(\(system-name\))82 b Ft(\000)-14 b(!)87 b FA(string)1412 +b FB(pr)o(ocedur)o(e)573 2507 y(Returns)24 b(the)g(name)f(of)h(the)g +(host)g(on)h(which)f(we)g(ar)o(e)e(executing.)34 b(This)24 +b(may)g(be)f(a)573 2607 y(local)d(name,)f(such)h(as)g(\223solar)-6 +b(,\224)18 b(as)i(opposed)g(to)g(a)f(fully-quali\002ed)h(domain)g(name) +573 2706 y(such)h(as)g(\223solar)-6 b(.csie.ntu.edu.tw)e(.\224)365 +3026 y Fv(3.9)99 b(Signal)26 b(system)365 3251 y FB(Signal)g(numbers)h +(ar)o(e)e(bound)i(to)f(the)h(variables)e Fx(signal/hup)p +FB(,)e Fx(signal/int)p FB(,)h(.)12 b(.)g(.)g(.)42 b(See)365 +3351 y(tables)21 b(3.9)e(and)i(3.3)e(for)i(the)f(full)h(list.)365 +3506 y Fx(\(signal-process)38 b FA(pr)o(oc)19 b(sig)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(unde\002ned)850 b +FB(pr)o(ocedur)o(e)365 3606 y Fx(\(signal-process-g)o(ro)o(up)37 +b FA(pr)o(grp)20 b(sig)p Fx(\))86 b Ft(\000)-14 b(!)87 +b FA(unde\002ned)544 b FB(pr)o(ocedur)o(e)573 3753 y(These)23 +b(two)h(pr)o(ocedur)o(es)e(send)h(signals)h(to)g(a)f(speci\002c)g(pr)o +(ocess,)h(and)f(all)g(the)g(pr)o(o-)573 3852 y(cesses)g(in)i(a)e +(speci\002c)g(pr)o(ocess)h(gr)o(oup,)f(r)o(espectively)-9 +b(.)33 b(The)24 b FA(pr)o(oc)e FB(and)i FA(pr)o(grp)e +FB(ar)o(gu-)573 3952 y(ments)f(ar)o(e)f(either)g(pr)o(ocesses)h(or)f +(integer)h(pr)o(ocess)f(ids.)365 4160 y Fx(\(itimer)41 +b FA(???)p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(unde\002ned)1335 +b FB(pr)o(ocedur)o(e)365 4260 y Fx(\(pause-until-inte)o(rr)o(upt)o(\)) +81 b Ft(\000)-14 b(!)87 b FA(unde\002ned)849 b FB(pr)o(ocedur)o(e)365 +4415 y Fx(\(sleep)41 b FA(secs)p Fx(\))88 b Ft(\000)-14 +b(!)87 b FA(unde\002ned)1372 b FB(pr)o(ocedur)o(e)365 +4515 y Fx(\(sleep-until)39 b FA(time)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(unde\002ned)1094 b FB(pr)o(ocedur)o(e)573 +4662 y(The)29 b Fx(sleep)f FB(pr)o(ocedur)o(e)g(causes)h(the)h(pr)o +(ocess)f(to)h(sleep)f(for)h FA(secs)g FB(seconds.)53 +b(The)573 4761 y Fx(sleep-until)26 b FB(pr)o(ocedur)o(e)j(causes)i(the) +g(pr)o(ocess)g(to)g(sleep)g(until)h FA(time)f FB(\(see)f(sec-)573 +4861 y(tion)21 b(3.10\).)365 5147 y FE(Mar)o(ch)e(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v +540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w +FB(63)p eop %%Page: 64 70 -64 69 bop 681 614 a FA(the)27 b(amiguous)g(boundary)f(cases.)45 -b(For)27 b(example,)g(on)g(the)g(morning)h(of)f(the)f(Fall)h(day-)681 -714 y(light)22 b(savings)g(change-over)-6 b(,)21 b(1:00am\2612:00am)c -(happens)22 b(twice.)30 b(Hence)21 b(the)h(date)f(1:30)681 -814 y(am)27 b(on)h(this)g(morning)h(can)e(specify)g(two)h(dif)o(fer)o(ent)d -(seconds;)31 b(the)c Fw(summer?)d FA(\257ag)k(says)681 913 -y(which)21 b(one.)805 1038 y(A)h(date)f(with)i Fw(tz-name)i -Fl(=)j Fw(tz-secs)c Fl(=)k Fw(#f)21 b FA(is)i(a)e(date)h(that)g(is)g -(speci\256ed)g(in)h(terms)f(of)681 1137 y(the)f(system's)g(curr)o(ent)f(time) -h(zone.)805 1262 y(Ther)o(e)f(is)h(r)o(edundancy)e(in)i(the)g -Fw(date)e FA(data)g(str)o(uctur)o(e.)27 b(For)21 b(example,)f(the)g -Fw(year-day)681 1362 y FA(\256eld)f(is)h(r)o(edundant)e(with)i(the)g -Fw(month-day)15 b FA(and)k Fw(month)e FA(\256elds.)27 b(Either)20 -b(of)f(these)g(implies)681 1461 y(the)d(values)f(of)h(the)g -Fw(week-day)c FA(\256eld.)26 b(The)15 b Fw(summer?)e FA(and)i -Fw(tz-name)e FA(\256elds)j(ar)o(e)e(r)o(edundant)681 1561 y(with)28 -b(the)f Fw(tz-secs)d FA(\256eld)j(in)h(terms)f(of)h(specifying)f(an)g -(instant)h(in)g(time.)46 b(This)28 b(r)o(edun-)681 1660 y(dancy)23 -b(is)h(pr)o(ovided)f(because)g(consumers)h(of)g(dates)f(may)h(want)g(it)g(br) -o(oken)f(out)i(in)f(dif-)681 1760 y(fer)o(ent)c(ways.)29 b(The)21 -b(scsh)h(pr)o(ocedur)o(es)d(that)j(pr)o(oduce)e(date)g(r)o(ecor)o(ds)g -(\256ll)i(them)f(out)h(com-)681 1860 y(pletely)-9 b(.)27 b(However)-6 -b(,)21 b(when)g(date)f(r)o(ecor)o(ds)g(pr)o(oduced)f(by)i(the)g(pr)o -(ogrammer)f(ar)o(e)g(passed)681 1959 y(to)29 b(scsh)g(pr)o(ocedur)o(es,)f -(the)h(r)o(edundancy)f(is)h(r)o(esolved)e(by)i(ignoring)h(some)f(of)g(the)g -(sec-)681 2059 y(ondary)20 b(\256elds.)28 b(This)21 b(is)g(described)f(for)g -(each)h(pr)o(ocedur)o(e)d(below)-8 b(.)681 2196 y Fw(\(make-date)39 -b Fz(s)14 b(min)g(h)f(mday)g(mon)g(y)h([tzn)f(tzs)g(summ?)h(wday)e(yday])p -Fw(\))41 b Fs(\000)-14 b(!)44 b Fz(date)86 b FA(pr)o(ocedur)o(e)888 -2325 y(When)25 b(making)g(a)f Fw(date)f FA(r)o(ecor)o(d,)h(the)g(last)h -(\256ve)f(elements)h(of)g(the)f(r)o(ecor)o(d)f(ar)o(e)g(op-)888 -2424 y(tional,)d(and)f(default)g(to)g Fw(#f)p FA(,)g Fw(#f)p -FA(,)f Fw(#f)p FA(,)h(0,)g(and)g(0)g(r)o(espectively)-9 b(.)25 -b(This)20 b(is)g(useful)f(when)888 2524 y(cr)o(eating)h(a)g -Fw(date)g FA(r)o(ecor)o(d)f(to)i(pass)f(as)h(an)f(ar)o(gument)h(to)g -Fw(time)p FA(.)681 2779 y Fy(3.10.3)80 b(T)-5 b(ime)21 b(zones)681 -2962 y FA(Several)13 b(time)j(pr)o(ocedur)o(es)d(take)h(time)i(zones)f(as)f -(ar)o(guments.)26 b(When)15 b(optional,)i(the)e(time)681 3062 -y(zone)20 b(defaults)g(to)i(local)e(time)h(zone.)28 b(Otherwise)21 -b(the)g(time)g(zone)g(can)f(be)g(one)i(of:)938 3181 y Fw(#f)274 -b FA(Local)20 b(time)938 3280 y(Integer)100 b(Seconds)18 b(of)h(of)o(fset)g -(fr)o(om)f(UTC.)g(For)i(example,)e(New)1300 3380 y(Y)-8 b(ork)25 -b(City)f(is)h(-18000)c(\(-5)i(hours\),)j(San)d(Francisco)i(is)1300 -3480 y(-28800)18 b(\(-8)h(hours\).)938 3579 y(String)140 b(A)18 -b(P)t Fr(O)t(S)t(I)t(X)h FA(time)e(zone)f(string)i(understood)e(by)h(the)f -(OS)1300 3679 y(\()p Fz(i.e.)o FA(.,)28 b(the)f(sort)g(of)f(time)h(zone)g -(assigned)f(to)h(the)g Fw($TZ)1300 3778 y FA(envir)o(onment)21 -b(variable\).)681 3916 y(An)e(integer)g(time)h(zone)f(gives)h(the)f(number)h -(of)f(seconds)h(you)g(must)g(add)e(to)i(UTC)e(to)i(get)681 -4016 y(time)h(in)g(that)g(zone.)27 b(It)21 b(is)g Fz(not)f -FA(\252seconds)h(west\272)g(of)f(UTC\320that)g(\257ips)i(the)f(sign.)805 -4140 y(T)-8 b(o)22 b(get)e(UTC)g(time,)h(use)g(a)f(time)h(zone)g(of)g(either) -f(0)h(or)g Fw("UCT0")p FA(.)681 4385 y Fy(3.10.4)80 b(Procedures)681 -4581 y Fw(\(time+ticks\))i Fs(\000)-14 b(!)87 b Fz([secs)21 -b(ticks])1297 b FA(pr)o(ocedur)o(e)681 4680 y Fw(\(ticks/sec\))82 -b Fs(\000)-14 b(!)87 b Fz(r)o(eal)1579 b FA(pr)o(ocedur)o(e)888 -4799 y(The)27 b(curr)o(ent)g(time,)h(with)g(sub-second)f(r)o(esolution.)47 -b(Sub-second)27 b(r)o(esolution)h(is)888 4898 y(not)21 b(pr)o(ovided)e(by)k -(P)t Fr(O)t(S)t(I)t(X)r FA(,)e(but)g(is)f(available)f(on)i(many)g(systems.)28 -b(The)20 b(time)h(is)f(r)o(e-)681 5147 y(64)p 1952 5071 323 -4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 -323 4 v 435 w FD(November)e(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +64 69 bop 910 535 2407 4 v 960 604 a FB(Interr)o(upt)854 +b(Unix)21 b(signal)246 b(OS)21 b(V)-8 b(ariant)p 910 +638 V 910 654 V 960 724 a Fx(interrupt/alrm)1576 694 +y Fn(a)2149 724 y Fx(signal/alrm)184 b FB(P)t Fs(O)t(S)t(I)t(X)960 +824 y Fx(interrupt/int)1532 794 y Fn(b)2149 824 y Fx(signal/int)228 +b FB(P)t Fs(O)t(S)t(I)t(X)960 924 y Fx(interrupt/memor)o(y-s)o(ho)o +(rta)o(ge)93 b FB(N/A)960 1024 y Fx(interrupt/chld)573 +b(signal/chld)184 b FB(P)t Fs(O)t(S)t(I)t(X)960 1123 +y Fx(interrupt/cont)573 b(signal/cont)184 b FB(P)t Fs(O)t(S)t(I)t(X)960 +1223 y Fx(interrupt/hup)617 b(signal/hup)228 b FB(P)t +Fs(O)t(S)t(I)t(X)960 1322 y Fx(interrupt/quit)573 b(signal/quit)184 +b FB(P)t Fs(O)t(S)t(I)t(X)960 1422 y Fx(interrupt/term)573 +b(signal/term)184 b FB(P)t Fs(O)t(S)t(I)t(X)960 1522 +y Fx(interrupt/tstp)573 b(signal/tstp)184 b FB(P)t Fs(O)t(S)t(I)t(X)960 +1621 y Fx(interrupt/usr1)573 b(signal/usr1)184 b FB(P)t +Fs(O)t(S)t(I)t(X)960 1721 y Fx(interrupt/usr2)573 b(signal/usr2)184 +b FB(P)t Fs(O)t(S)t(I)t(X)960 1920 y Fx(interrupt/info)573 +b(signal/info)182 b FB(BSD)21 b(only)960 2020 y Fx(interrupt/io)661 +b(signal/io)270 b FB(BSD)21 b(+)g(SVR4)960 2119 y Fx(interrupt/poll)573 +b(signal/poll)182 b FB(SVR4)20 b(only)960 2219 y Fx(interrupt/prof)573 +b(signal/prof)182 b FB(BSD)21 b(+)g(SVR4)960 2319 y Fx(interrupt/pwr) +617 b(signal/pwr)226 b FB(SVR4)20 b(only)960 2418 y Fx(interrupt/urg) +617 b(signal/urg)226 b FB(BSD)21 b(+)g(SVR4)960 2518 +y Fx(interrupt/vtalr)o(m)486 b(signal/vtalrm)94 b FB(BSD)21 +b(+)g(SVR4)960 2618 y Fx(interrupt/winch)529 b(signal/winch)138 +b FB(BSD)21 b(+)g(SVR4)960 2717 y Fx(interrupt/xcpu)573 +b(signal/xcpu)182 b FB(BSD)21 b(+)g(SVR4)960 2817 y Fx(interrupt/xfsz) +573 b(signal/xfsz)182 b FB(BSD)21 b(+)g(SVR4)681 3082 +y(T)-8 b(able)17 b(3.2:)23 b(Scheme)18 b(48)f(virtual-machine)h(interr) +o(upts)g(and)g(r)o(elated)e(Unix)i(signals.)25 b(Only)681 +3181 y(the)20 b(P)t Fs(O)t(S)t(I)t(X)i FB(signals)d(ar)o(e)e +(guaranteed)g(to)h(be)g(de\002ned;)h(however)-6 b(,)18 +b(your)h(implementation)681 3281 y(and)h(OS)h(may)f(de\002ne)h(other)g +(signals)g(and)g(interr)o(upts)g(not)g(listed)g(her)o(e.)p +681 3357 1146 4 v 763 3411 a Ff(a)800 3434 y Fs(Also)c(bound)f(to)h +(Scheme)f(48)h(interr)o(upt)f Fj(interrupt/alarm)p Fs(.)769 +3492 y Ff(b)800 3516 y Fs(Also)h(bound)f(to)h(Scheme)f(48)h(interr)o +(upt)f Fj(interrupt/keyboard)p Fs(.)681 3818 y Fz(Interrupt)j(handlers) +681 4044 y FB(Scsh)27 b(interr)o(upt)g(handlers)g(ar)o(e)e(complicated) +i(by)g(the)g(fact)f(that)h(scsh)g(is)h(implemented)681 +4144 y(on)c(top)g(of)f(the)h(Scheme)f(48)f(virtual)i(machine,)g(which)g +(has)g(its)f(own)i(interr)o(upt)f(system,)681 4243 y(independent)i(of)f +(the)i(Unix)e(signal)i(system.)42 b(This)26 b(means)g(that)g(Unix)g +(signals)g(ar)o(e)f(de-)681 4343 y(liver)o(ed)h(in)j(two)f(stages:)39 +b(\002rst,)30 b(Unix)e(delivers)f(the)h(signal)g(to)g(the)g(Scheme)g +(48)e(virtual)681 4442 y(machine,)21 b(then)g(the)g(Scheme)f(48)g +(virtual)g(machine)h(delivers)g(the)g(signal)g(to)g(the)g(execut-)681 +4542 y(ing)c(Scheme)e(pr)o(ogram)h(as)g(a)g(Scheme)g(48)f(interr)o +(upt.)24 b(This)17 b(ensur)o(es)f(that)g(signal)h(delivery)681 +4642 y(happens)g(between)h(two)h(vm)f(instr)o(uctions,)i(keeping)e +(individual)f(instr)o(uctions)j(atomic.)805 4799 y(The)28 +b(Scheme)g(48)e(machine)j(has)e(its)i(own)f(set)g(of)g(interr)o(upts,)i +(which)f(includes)f(the)681 4898 y(asynchr)o(onous)23 +b(Unix)g(signals)g(\(table)e(3.9\).)61 b(Note)22 b(that)h(scsh)g(does)g +FA(not)f FB(support)h(signal)681 5147 y(64)p 1952 5071 +323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 +V 1952 5176 323 4 v 538 w FE(Mar)o(ch)c(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 65 71 -65 70 bop 573 614 a FA(turned)26 b(as)g(elapsed)f(seconds)i(since)f(the)g -(Unix)g(epoch,)i(plus)e(a)g(number)h(of)f(sub-)573 714 y(second)17 -b(\252ticks.\272)26 b(The)17 b(length)h(of)f(a)g(tick)h(may)f(vary)g(fr)o(om) -f(implementation)j(to)e(im-)573 814 y(plementation;)k(it)g(can)f(be)h -(determined)f(fr)o(om)g Fw(\(ticks/sec\))p FA(.)573 955 y(The)d(system)i -(clock)f(is)g(not)g(r)o(equir)o(ed)e(to)i(r)o(eport)f(time)h(at)f(the)h(full) -g(r)o(esolution)g(given)573 1055 y(by)29 b Fw(\(ticks/sec\))p -FA(.)48 b(For)29 b(example,)i(on)e(BSD,)g(time)g(is)h(r)o(eported)e(at)g -Fl(1)p Fx(\026)p FA(s)h(r)o(esolu-)573 1154 y(tion,)18 b(so)f -Fw(\(ticks/sec\))12 b FA(is)17 b(1,000,000.)22 b(That)16 b(doesn't)h(mean)g -(the)f(system)i(clock)f(has)573 1254 y(micr)o(o-second)j(r)o(esolution.)573 -1395 y(If)c(the)h(OS)f(does)h(not)g(support)g(sub-second)g(r)o(esolution,)h -(the)e Fz(ticks)h FA(value)f(is)h(always)573 1495 y(0,)j(and)g -Fw(\(ticks/sec\))c FA(r)o(eturns)21 b(1.)756 1690 y FD(Remark:)58 -b Fj(I)20 b(chose)f(to)h(r)o(epr)o(esent)e(system)h(clock)g(r)o(esolution)f -(as)i(ticks/sec)f(in-)756 1782 y(stead)25 b(of)g(sec/tick)h(to)g(incr)o(ease) -e(the)j(odds)d(that)j(the)g(value)e(could)g(be)h(r)o(epr)o(e-)756 -1873 y(sented)13 b(as)g(an)h(exact)g(integer)-6 b(,)13 b(incr)o(easing)g(ef)o -(\256ciency)f(and)i(making)f(it)h(easier)e(for)756 1964 y(Scheme)22 -b(implementations)h(that)h(don't)f(have)g(sophisticated)f(numeric)g(sup-)756 -2056 y(port)c(to)h(deal)f(with)h(the)h(quantity)-8 b(.)756 -2168 y(Y)h(ou)18 b(can)i(convert)f(seconds)f(and)h(ticks)f(to)h(seconds)f -(with)h(the)h(expr)o(ession)911 2312 y Fi(\(+)39 b Fg(secs)h -Fi(\(/)g Fg(ticks)f Fi(\(ticks/sec\)\)\))756 2457 y Fj(Given)23 -b(that,)i(why)e(not)h(have)g(the)f(\256ne-grain)g(time)g(pr)o(ocedur)o(e)e -(just)i(r)o(eturn)g(a)756 2548 y(non-integer)f(r)o(eal)f(for)h(time?)36 -b(Following)22 b(Common)g(Lisp,)g(I)h(chose)f(to)h(allow)756 -2639 y(the)h(system)f(clock)g(to)h(r)o(eport)e(sub-second)h(time)h(in)g(its)f -(own)i(units)f(to)g(lower)756 2730 y(the)c(over)o(head)g(of)g(determining)f -(the)i(time.)30 b(This)20 b(would)g(be)g(important)h(for)f(a)756 -2822 y(system)14 b(that)j(wanted)f(to)g(pr)o(ecisely)c(time)k(the)g(duration) -f(of)g(some)g(event.)24 b(T)l(ime)756 2913 y(stamps)16 b(could)g(be)h -(collected)e(with)j(little)e(over)o(head,)g(deferring)e(the)k(over)o(head)756 -3004 y(of)g(pr)o(ecisely)e(calculating)k(with)f(them)g(until)g(after)g -(collection.)756 3117 y(This)d(is)g(all)h(a)g(bit)h(academic)f(for)f(the)h -(Scheme)g(48)h(implementation,)f(wher)o(e)g(we)756 3208 y(determine)c(time)h -(with)h(a)g(heavyweight)f(system)g(call,)h(but)f(it's)g(nice)h(to)f(plan)h -(for)756 3299 y(the)k(futur)o(e.)365 3599 y Fw(\(date\))85 -b Fs(\000)-14 b(!)87 b Fz(date-r)o(ecord)1545 b FA(pr)o(ocedur)o(e)365 -3699 y Fw(\(date)42 b Fz([time)20 b(tz])p Fw(\))86 b Fs(\000)-15 -b(!)88 b Fz(date-r)o(ecord)1213 b FA(pr)o(ocedur)o(e)573 3848 -y(Simple)20 b Fw(\(date\))f FA(r)o(eturns)h(the)h(curr)o(ent)f(date,)f(in)j -(the)f(local)f(time)h(zone.)573 3990 y(W)-5 b(ith)23 b(the)f(optional)h(ar)o -(guments,)f Fw(date)e FA(converts)j(the)f(time)g(to)h(the)f(date)f(as)h -(spec-)573 4089 y(i\256ed)g(by)h(the)f(time)h(zone)g Fz(tz)o -FA(.)33 b Fz(T)-5 b(ime)22 b FA(defaults)g(to)h(the)f(curr)o(ent)g(time;)i -Fz(tz)e FA(defaults)f(to)573 4189 y(local)g(time,)f(and)h(is)g(as)f -(described)g(in)h(the)g(time-zone)g(section.)573 4330 y(If)j(the)h -Fz(tz)g FA(ar)o(gument)f(is)i(an)e(integer)-6 b(,)26 b(the)f(date's)f -Fw(tz-name)e FA(\256eld)j(is)g(a)i(P)t Fr(O)t(S)t(I)t(X)h FA(time)573 -4430 y(zone)16 b(of)h(the)f(form)h(\252)p Fw(UTC+)p Fq(hh)11 -b Fw(:)p Fq(mm)j Fw(:)p Fq(ss)f FA(\272;)k(the)g(trailing)f -Fw(:)p Fq(mm)e Fw(:)p Fq(ss)29 b FA(portion)18 b(is)f(deleted)573 -4530 y(if)j(it)h(is)h(zer)o(oes.)365 4746 y Fw(\(time\))85 -b Fs(\000)-14 b(!)87 b Fz(integer)1685 b FA(pr)o(ocedur)o(e)365 -4846 y Fw(\(time)42 b Fz([date])p Fw(\))85 b Fs(\000)-14 b(!)87 -b Fz(integer)1448 b FA(pr)o(ocedur)o(e)365 5147 y FD(November)18 -b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 -5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v -1216 w FA(65)p eop +65 70 bop 943 1542 1709 4 v 993 1612 a FB(Unix)21 b(signal)159 +b(T)-7 b(ype)399 b(OS)20 b(V)-8 b(ariant)p 943 1645 V +943 1662 V 993 1731 a Fx(signal/stop)95 b FB(Uncatchable)125 +b(P)t Fs(O)t(S)t(I)t(X)993 1831 y Fx(signal/kill)95 b +FB(Uncatchable)125 b(P)t Fs(O)t(S)t(I)t(X)993 2030 y +Fx(signal/abrt)95 b FB(Synchr)o(onous)103 b(P)t Fs(O)t(S)t(I)t(X)993 +2130 y Fx(signal/fpe)139 b FB(Synchr)o(onous)103 b(P)t +Fs(O)t(S)t(I)t(X)993 2230 y Fx(signal/ill)139 b FB(Synchr)o(onous)103 +b(P)t Fs(O)t(S)t(I)t(X)993 2329 y Fx(signal/pipe)95 b +FB(Synchr)o(onous)103 b(P)t Fs(O)t(S)t(I)t(X)993 2429 +y Fx(signal/segv)95 b FB(Synchr)o(onous)103 b(P)t Fs(O)t(S)t(I)t(X)993 +2528 y Fx(signal/ttin)95 b FB(Synchr)o(onous)103 b(P)t +Fs(O)t(S)t(I)t(X)993 2628 y Fx(signal/ttou)95 b FB(Synchr)o(onous)103 +b(P)t Fs(O)t(S)t(I)t(X)993 2827 y Fx(signal/bus)139 b +FB(Synchr)o(onous)101 b(BSD)20 b(+)h(SVR4)993 2927 y +Fx(signal/emt)139 b FB(Synchr)o(onous)101 b(BSD)20 b(+)h(SVR4)993 +3027 y Fx(signal/iot)139 b FB(Synchr)o(onous)101 b(BSD)20 +b(+)h(SVR4)993 3126 y Fx(signal/sys)139 b FB(Synchr)o(onous)101 +b(BSD)20 b(+)h(SVR4)993 3226 y Fx(signal/trap)95 b FB(Synchr)o(onous) +101 b(BSD)20 b(+)h(SVR4)365 3491 y(T)-8 b(able)19 b(3.3:)k(Uncatchable) +17 b(and)h(synchr)o(onous)i(Unix)f(signals.)25 b(While)20 +b(these)e(signals)i(may)365 3590 y(be)30 b(sent)g(with)h +Fx(signal-process)24 b FB(or)31 b Fx(signal-process-)o(gro)o(up)o +FB(,)26 b(ther)o(e)k(ar)o(e)e(no)j(corr)o(e-)365 3690 +y(sponding)21 b(scsh)f(interr)o(upt)g(handlers.)25 b(Only)20 +b(the)i(P)t Fs(O)t(S)t(I)t(X)h FB(signals)d(ar)o(e)f(guaranteed)f(to)i +(be)365 3789 y(de\002ned;)28 b(however)-6 b(,)26 b(your)g +(implementation)g(and)g(OS)f(may)g(de\002ne)h(other)g(signals)g(not)365 +3889 y(listed)21 b(her)o(e.)365 5147 y FE(Mar)o(ch)e(10,)g(1997)h(\226) +f(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 +v 540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 +w FB(65)p eop %%Page: 66 72 -66 71 bop 888 614 a FA(Simple)21 b Fw(\(time\))d FA(r)o(eturns)i(the)h(curr)o -(ent)f(time.)888 744 y(W)-5 b(ith)20 b(the)f(optional)h(date)e(ar)o(gument,)h -Fw(time)e FA(converts)i(a)g(date)f(to)h(a)f(time.)28 b Fz(Date)18 -b FA(de-)888 843 y(faults)j(to)g(the)g(curr)o(ent)f(date.)888 -973 y(Note)31 b(that)f(the)g(input)h Fz(date)f FA(r)o(ecor)o(d)e(is)j(over)o -(constrained.)55 b Fw(time)29 b FA(ignor)o(es)h Fz(date)p FA('s)888 -1073 y Fw(week-day)j FA(and)j Fw(year-day)d FA(\256elds.)75 -b(If)36 b(the)g(date's)g Fw(tz-secs)e FA(\256eld)i(is)h(set,)j(the)888 -1172 y Fw(tz-name)18 b FA(and)j Fw(summer?)c FA(\256elds)k(ar)o(e)f(ignor)o -(ed.)888 1302 y(If)26 b(the)h Fw(tz-secs)c FA(\256eld)j(is)h -Fw(#f)p FA(,)g(then)f(the)h(time-zone)f(is)h(taken)f(fr)o(om)f(the)i -Fw(tz-name)888 1401 y FA(\256eld.)37 b(A)23 b(false)h Fw(tz-name)d -FA(means)j(the)g(system's)h(curr)o(ent)e(time)h(zone.)37 b(When)24 -b(cal-)888 1501 y(culating)f(with)h(time-zones,)f(the)g(date's)g -Fw(summer?)c FA(\256eld)k(is)g(used)g(to)g(r)o(esolve)g(am-)888 -1601 y(biguities:)1121 1702 y Fw(#f)160 b FA(Resolve)22 b(an)e(ambiguous)i -(time)f(in)g(favor)f(of)h(non-summer)h(time.)1121 1802 y(tr)o(ue)99 -b(Resolve)22 b(an)e(ambiguous)i(time)f(in)g(favor)f(of)h(summer)g(time.)888 -1900 y(This)g(is)f(useful)g(in)g(boundary)g(cases)f(during)h(the)g -(change-over)-6 b(.)26 b(For)21 b(example,)e(in)888 2000 y(the)h(Fall,)f -(when)h(US)e(daylight)i(savings)f(time)h(changes)f(over)g(at)g(2:00)f(am,)h -(1:30)e(am)888 2100 y(happens)k(twice\320it)g(names)g(two)g(instants)h(in)f -(time,)g(an)g(hour)g(apart.)888 2229 y(Outside)32 b(of)f(these)g(boundary)g -(cases,)i(the)e Fw(summer?)d FA(\257ag)k(is)f(ignor)o(ed.)58 -b(For)32 b(ex-)888 2329 y(ample,)21 b(if)g(the)h(standar)o(d/summer)e -(change-overs)h(happen)g(in)h(the)g(Fall)f(and)g(the)888 2428 -y(Spring,)f(then)g(the)f(value)g(of)h Fw(summer?)c FA(is)k(ignor)o(ed)f(for)h -(a)f(January)f(or)i(July)f(date.)26 b(A)888 2528 y(January)19 -b(date)f(would)i(be)f(r)o(esolved)g(with)h(standar)o(d)e(time,)h(and)g(a)g -(July)h(date)e(with)888 2628 y(summer)k(time,)e(r)o(egar)o(dless)f(of)i(the)g -Fw(summer?)d FA(value.)888 2757 y(The)k Fw(summer?)d FA(\257ag)j(is)h(also)f -(ignor)o(ed)f(if)h(the)g(time)g(zone)g(doesn't)h(have)e(a)h(summer)888 -2857 y(time\320for)f(example,)f(simple)h(UTC.)681 3037 y Fw(\(date->string)38 -b Fz(date)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(string)1186 -b FA(pr)o(ocedur)o(e)681 3137 y Fw(\(format-date)38 b Fz(fmt)20 -b(date)p Fw(\))87 b Fs(\000)-15 b(!)87 b Fz(string)1094 b FA(pr)o(ocedur)o(e) -888 3272 y Fw(Date->string)16 b FA(formats)21 b(the)g(date)e(as)i(a)f -(24-character)e(string)k(of)e(the)h(form:)1071 3371 y(Sun)g(Sep)f(16)f -(01:03:52)f(1973)888 3501 y Fw(Format-date)13 b FA(formats)18 -b(the)g(date)e(accor)o(ding)h(to)h(the)g(format)f(string)i -Fz(fmt)o FA(.)26 b(The)18 b(for)o(-)888 3600 y(mat)e(string)g(is)g(copied)f -(verbatim,)g(except)g(that)g(tilde)h(characters)e(indicate)h(conver)o(-)888 -3700 y(sion)21 b(speci\256ers)f(that)g(ar)o(e)f(r)o(eplaced)f(by)i(\256elds)g -(fr)o(om)g(the)g(date)f(r)o(ecor)o(d.)26 b(Figur)o(e)19 b(3.1)888 -3799 y(gives)i(the)g(full)g(set)g(of)f(conversion)i(speci\256ers)f(supported) -f(by)h Fw(format-date)p FA(.)681 3980 y Fw(\(fill-in-date!)38 -b Fz(date)p Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(date)1206 b -FA(pr)o(ocedur)o(e)888 4115 y(This)27 b(pr)o(ocedur)o(e)d(\256lls)j(in)f -(missing,)j(r)o(edundant)c(slots)i(in)f(a)g(date)f(r)o(ecor)o(d.)42 -b(In)26 b(de-)888 4214 y(cr)o(easing)20 b(or)o(der)g(of)h(priority:)988 -4374 y Fs(\017)41 b Fy(year)-5 b(,)20 b(month,)g(month-day)f -Fs(\))i Fy(year)o(-day)1071 4473 y FA(If)g(the)h Fw(year)p -FA(,)d Fw(month)p FA(,)h(and)h Fw(month-day)c FA(\256elds)22 -b(ar)o(e)e(all)h(de\256ned)g(\(ar)o(e)f(all)h(inte-)1071 4573 -y(gers\),)f(the)h Fw(year-day)c FA(\256eld)k(is)g(set)g(to)g(the)g(corr)o -(esponding)g(value.)988 4699 y Fs(\017)41 b Fy(year)-5 b(,)20 -b(year)o(-day)f Fs(\))i Fy(month,)f(month-day)1071 4799 y FA(If)41 -b(the)h Fw(month)e FA(and)i Fw(month-day)c FA(\256elds)k(ar)o(en't)f(set,)46 -b(but)c(the)g Fw(year)e FA(and)1071 4898 y Fw(year-day)17 b -FA(\256elds)k(ar)o(e)f(set,)g(then)h Fw(month)e FA(and)h Fw(month-day)d -FA(ar)o(e)j(calculated.)681 5147 y(66)p 1952 5071 323 4 v 1952 -5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 -v 435 w FD(November)e(1,)h(1995)h(\261)f(15)13 b(:)f(58)p eop +66 71 bop 681 614 a FB(handlers)20 b(for)h(\223synchr)o(onous\224)h +(Unix)e(signals,)i(such)f(as)g Fx(signal/ill)c FB(or)k +Fx(signal/pipe)681 714 y FB(\(see)g(table)f(3.3\).)26 +b(Synchr)o(onous)c(occurr)o(ences)f(of)g(these)g(signals)h(ar)o(e)e +(better)h(handled)g(by)681 814 y(raising)k(a)g(Scheme)g(exception.)39 +b(W)-8 b(e)25 b(r)o(ecommend)g(you)h(avoid)e(using)j(signal)e(handlers) +681 913 y(unless)19 b(you)h(absolutely)f(have)f(to;)h(we)g(intend)g(to) +g(pr)o(ovide)f(a)g(better)-6 b(,)19 b(higher)o(-level)f(inter)o(-)681 +1013 y(face)h(to)i(Unix)g(signals)h(after)d(scsh)i(has)g(been)g(ported) +f(to)h(a)g(multi-thr)o(eaded)e(platform.)681 1167 y Fx +(\(signal->interru)o(pt)37 b FA(integer)p Fx(\))87 b +Ft(\000)-14 b(!)87 b FA(integer)839 b FB(pr)o(ocedur)o(e)888 +1314 y(The)27 b(pr)o(ogrammer)f(maps)h(fr)o(om)f(Unix)g(signals)i(to)f +(Scheme)f(48)g(interr)o(upts)h(with)888 1413 y(the)22 +b Fx(signal->interrupt)15 b FB(pr)o(ocedur)o(e.)27 b(If)21 +b(the)h(signal)g(does)g(not)h(have)e(a)h(de\002ned)888 +1513 y(Scheme)f(48)e(interr)o(upt,)i(an)g(errr)o(or)e(is)i(signaled.) +681 1819 y Fx(\(interrupt-set)38 b FA(integer)1570 1831 +y Fu(1)1628 1819 y FA(.)12 b(.)g(.)g(integer)1962 1831 +y Fn(n)2008 1819 y Fx(\))87 b Ft(\000)-15 b(!)88 b FA(integer)575 +b FB(pr)o(ocedur)o(e)888 1966 y(This)25 b(pr)o(ocedur)o(e)d(builds)i +(interr)o(upt)g(sets)g(fr)o(om)f(its)h(interr)o(upt)g(ar)o(guments.)35 +b(A)23 b(set)888 2065 y(is)h(r)o(epr)o(esented)d(as)h(an)h(integer)g +(using)h(a)f(two's-complement)h(r)o(epr)o(esentation)e(of)888 +2165 y(the)f(bit)g(set.)681 2471 y Fx(\(enabled-interru)o(pt)o(s\))81 +b Ft(\000)-15 b(!)88 b FA(interrupt-set)880 b FB(pr)o(ocedur)o(e)681 +2571 y Fx(\(set-enabled-int)o(er)o(rup)o(ts)37 b FA(interrupt-set)p +Fx(\))87 b Ft(\000)-15 b(!)88 b FA(interrupt-set)233 +b FB(pr)o(ocedur)o(e)888 2717 y(Get)21 b(and)f(set)g(the)g(value)g(of)g +(the)h(enabled-interr)o(upt)e(set.)26 b(Only)21 b(interr)o(upts)g(in)f +(this)888 2816 y(set)f(have)f(their)g(handlers)g(called)g(when)h +(deliver)o(ed.)k(When)18 b(a)g(disabled)g(interr)o(upt)888 +2916 y(is)h(deliver)o(ed)e(to)i(the)g(Scheme)f(48)g(machine,)h(it)g(is) +g(held)g(pending)g(until)g(it)g(becomes)888 3016 y(enabled,)h(at)g +(which)i(time)f(its)g(handler)g(is)g(invoked.)888 3154 +y(Interr)o(upt)33 b(sets)g(ar)o(e)f(r)o(epr)o(esented)f(as)h(integer)h +(bit)g(sets)g(\(constr)o(ucted)g(with)h(the)888 3253 +y Fx(interrupt-set)23 b FB(function\).)49 b(The)29 b +Fx(set-enabled-int)o(err)o(up)o(ts)22 b FB(pr)o(ocedur)o(e)k(r)o(e-)888 +3353 y(turns)c(the)e(pr)o(evious)h(value)f(of)h(the)g(enabled-interr)o +(upt)e(set.)681 3560 y Fx(\(with-enabled-in)o(te)o(rru)o(pt)o(s)37 +b FA(interrupt-set)17 b(.)g(body)p Fx(\))53 b Ft(\000)-15 +b(!)54 b FA(value\(s\))17 b(of)f(body)87 b FB(syntax)681 +3659 y Fx(\(with-enabled-in)o(te)o(rru)o(pt)o(s*)37 b +FA(interrupt-set)16 b(thunk)p Fx(\))43 b Ft(\000)-15 +b(!)44 b FA(value\(s\))15 b(of)h(thunk)87 b FB(pr)o(ocedur)o(e)888 +3805 y(Run)30 b(code)e(with)i(a)e(given)h(set)f(of)h(interr)o(upts)g +(enabled.)48 b(Note)29 b(that)g(\223enabling\224)888 +3905 y(an)21 b(interr)o(upt)h(means)f(enabling)h(delivery)e(fr)o(om)h +(the)g(Scheme)g(48)f(vm)i(to)f(the)g(scsh)888 4005 y(pr)o(ogram.)62 +b(Using)34 b(the)f(Scheme)g(48)f(interr)o(upt)i(system)g(is)f(fairly)g +(lightweight,)888 4104 y(and)25 b(does)g(not)h(involve)f(actually)g +(making)g(a)g(system)h(call.)38 b(Note)25 b(that)g(enabling)888 +4204 y(an)d(interr)o(upt)h(means)f(that)g(the)g(assigned)g(interr)o +(upt)h(handler)f(is)g(allowed)g(to)h(r)o(un)888 4304 +y(when)f(the)f(interr)o(upt)g(is)g(deliver)o(ed.)j(Interr)o(upts)d(not) +h(enabled)e(ar)o(e)f(held)i(pending)888 4403 y(when)h(deliver)o(ed.)888 +4541 y(Interr)o(upt)33 b(sets)g(ar)o(e)f(r)o(epr)o(esented)f(as)h +(integer)h(bit)g(sets)g(\(constr)o(ucted)g(with)h(the)888 +4641 y Fx(interrupt-set)16 b FB(function\).)681 4847 +y Fx(\(set-interrupt-h)o(an)o(dle)o(r)37 b FA(interrupt)21 +b(handler)p Fx(\))87 b Ft(\000)-15 b(!)88 b FA(old-handler)167 +b FB(pr)o(ocedur)o(e)681 5147 y(66)p 1952 5071 323 4 +v 1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 +5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 67 73 -67 72 bop 365 1129 2865 4 v 365 4301 4 3173 v 443 1274 a Fw(~~)99 -b FA(Converted)20 b(to)i(the)e Fw(~)h FA(character)-6 b(.)443 -1399 y Fw(~a)99 b FA(abbr)o(eviated)18 b(weekday)j(name)443 -1523 y Fw(~A)99 b FA(full)21 b(weekday)f(name)443 1648 y Fw(~b)99 -b FA(abbr)o(eviated)18 b(month)23 b(name)443 1772 y Fw(~B)99 -b FA(full)21 b(month)h(name)443 1897 y Fw(~c)99 b FA(time)21 -b(and)g(date)e(using)j(the)f(time)g(and)f(date)g(r)o(epr)o(esentation)g(for)g -(the)h(locale)630 1996 y(\()p Fw(~X)43 b(~x)p FA(\))443 2121 -y Fw(~d)99 b FA(day)20 b(of)h(the)g(month)h(as)e(a)h(decimal)f(number)h -(\(01-31\))443 2245 y Fw(~H)99 b FA(hour)21 b(based)f(on)i(a)e(24-hour)g -(clock)h(as)f(a)h(decimal)f(number)h(\(00-23\))443 2370 y Fw(~I)99 -b FA(hour)21 b(based)f(on)i(a)e(12-hour)g(clock)h(as)f(a)h(decimal)f(number)h -(\(01-12\))443 2495 y Fw(~j)99 b FA(day)20 b(of)h(the)g(year)f(as)g(a)h -(decimal)f(number)h(\(001-366\))443 2619 y Fw(~m)99 b FA(month)22 -b(as)f(a)f(decimal)g(number)h(\(01-12\))443 2744 y Fw(~M)99 -b FA(minute)22 b(as)e(a)g(decimal)h(number)f(\(00-59\))443 -2868 y Fw(~p)99 b FA(AM/PM)20 b(designation)h(associated)g(with)g(a)f -(12-hour)g(clock)443 2993 y Fw(~S)99 b FA(second)21 b(as)g(a)f(decimal)g -(number)h(\(00-61\))443 3117 y Fw(~U)99 b FA(week)21 b(number)g(of)f(the)h -(year;)f(Sunday)g(is)h(\256rst)g(day)g(of)f(week)h(\(00-53\))443 -3242 y Fw(~w)99 b FA(weekday)20 b(as)h(a)f(decimal)g(number)h(\(0-6\),)e -(wher)o(e)h(Sunday)g(is)h(0)443 3366 y Fw(~W)99 b FA(week)21 -b(number)g(of)f(the)h(year;)f(Monday)g(is)i(\256rst)f(day)f(of)g(week)h -(\(00-53\))443 3491 y Fw(~x)99 b FA(date)20 b(using)i(the)f(date)e(r)o(epr)o -(esentation)h(for)g(the)h(locale)443 3615 y Fw(~X)99 b FA(time)21 -b(using)h(the)f(time)g(r)o(epr)o(esentation)e(for)i(the)g(locale)443 -3740 y Fw(~y)99 b FA(year)20 b(without)i(century)f(\(00-99\))443 -3864 y Fw(~Y)99 b FA(year)20 b(with)i(century)e(\()p Fz(e.g.)o -FA(1990\))443 3989 y Fw(~Z)99 b FA(time)21 b(zone)g(name)g(or)f(abbr)o -(eviation,)g(or)h(no)g(characters)e(if)i(no)g(time)g(zone)g(is)630 -4089 y(determinable)958 4278 y(Figur)o(e)g(3.1:)26 b Fw(format-date)16 -b FA(conversion)22 b(speci\256ers)p 3226 4301 V 365 4304 2865 -4 v 365 5147 a FD(November)c(1,)h(1995)h(\261)f(15)14 b(:)e(58)p -1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 -V 1636 5176 323 4 v 1216 w FA(67)p eop +67 72 bop 573 614 a FB(Assigns)28 b(a)g(handler)f(for)g(a)g(given)h +(interr)o(upt,)i(and)d(r)o(eturns)g(the)h(interr)o(upt's)g(old)573 +714 y(handler)-6 b(.)25 b(The)20 b FA(handler)g FB(ar)o(gument)g(is)h +Fx(#f)e FB(\(ignor)o(e\),)h Fx(#t)g FB(\(default\),)e(or)j(a)f(pr)o +(ocedur)o(e)573 814 y(taking)28 b(an)g(integer)f(ar)o(gument;)k(the)d +(r)o(eturn)f(value)g(follows)i(the)f(same)f(conven-)573 +913 y(tions.)h(Note)22 b(that)f(the)h FA(interrupt)g +FB(ar)o(gument)e(is)i(an)g(interr)o(upt)f(value,)g(not)h(a)f(signal)573 +1013 y(value.)35 b(An)25 b(interr)o(upt)f(is)h(deliver)o(ed)d(to)j(the) +f(Scheme)g(48)g(machine)g(by)g(\(1\))f(block-)573 1112 +y(ing)30 b(all)f(interr)o(upts,)j(and)d(\(2\))f(applying)i(the)f +(handler)g(pr)o(ocedur)o(e)f(to)i(the)f(set)h(of)573 +1212 y(interr)o(upts)f(that)f(wer)o(e)f(enabled)h(prior)g(to)h(the)f +(interr)o(upt)h(delivery)-9 b(.)47 b(If)28 b(the)g(pr)o(o-)573 +1312 y(cedur)o(e)23 b(r)o(eturns)h(normally)i(\()p FA(i.e.)o +FB(,)g(it)f(doesn't)g(thr)o(ow)g(to)h(a)e(continuation\),)j(the)e(set) +573 1411 y(of)h(enabled)g(interr)o(upts)h(will)h(be)e(r)o(eturned)f(to) +i(its)g(pr)o(evious)g(value.)42 b(\(T)-8 b(o)27 b(r)o(estor)o(e)573 +1511 y(the)19 b(enabled-interr)o(upt)f(set)h(befor)o(e)e(thr)o(owing)j +(out)g(of)e(an)h(interr)o(upt)g(handler)-6 b(,)19 b(see)573 +1611 y Fx(set-enabled-inte)o(rr)o(upt)o(s)p FB(\))573 +1740 y Ft(f)p FB(Note)29 b(If)f(you)i(set)f(a)g(handler)f(for)h(the)g +Fx(interrupt/chld)24 b FB(interr)o(upt,)31 b(you)f(may)573 +1840 y(br)o(eak)f(scsh's)j(autor)o(eaping)e(pr)o(ocess)g(machinery)-9 +b(.)55 b(See)30 b(the)h(discussion)h(of)e(au-)573 1940 +y(tor)o(eaping)20 b(in)h(section)h(3.4.1.)p Ft(g)365 +2221 y Fx(\(interrupt-handle)o(r)37 b FA(interrupt)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(handler)747 b FB(pr)o(ocedur)o(e)573 +2356 y(Return)28 b(the)g(handler)f(for)h(a)f(given)h(interr)o(upt.)46 +b(Note)28 b(that)g(the)g(ar)o(gument)f(is)h(an)573 2455 +y(interr)o(upt)i(value,)i(not)f(a)f(signal)g(value.)53 +b(A)30 b(handler)g(is)g(either)g Fx(#f)g FB(\(ignor)o(e\),)h +Fx(#t)573 2555 y FB(\(default\),)19 b(or)h(a)h(pr)o(ocedur)o(e)d +(taking)k(an)e(integer)h(ar)o(gument.)365 2967 y Fv(3.10)99 +b(T)-5 b(ime)365 3181 y FB(Scsh's)18 b(time)f(system)h(is)f(fairly)g +(sophisticated,)h(particularly)e(with)i(r)o(espect)e(to)i(its)f(car)o +(eful)365 3281 y(tr)o(eatment)h(of)g(time)g(zones.)25 +b(However)-6 b(,)18 b(casual)g(users)g(shouldn't)i(be)e(intimidated;)h +(all)f(of)365 3381 y(the)25 b(complexity)g(is)g(optional,)h(and)e +(defaulting)g(all)h(the)f(optional)i(ar)o(guments)e(r)o(educes)365 +3480 y(the)d(system)h(to)f(a)f(simple)h(interface.)573 +3637 y FE(Remark:)66 b Fk(This)22 b(time)g(package)g(does)g(not)h(curr) +o(ently)e(work)h(with)h(NeXTSTEP)-10 b(,)22 b(as)573 +3728 y(NeXTSTEP)17 b(does)f(not)i(pr)o(ovide)e(a)k(P)t +Fg(O)t(S)t(I)t(X)r Fk(-compliant)d(time)g(library)g(that)i(will)e(even) +573 3820 y(link.)365 4068 y Fz(3.10.1)81 b(T)-9 b(erminology)365 +4251 y FB(\223UTC\224)17 b(and)g(\223UCT\224)g(stand)g(for)h +(\223universal)g(coor)o(dinated)f(time,\224)h(which)h(is)f(the)g(of)o +(\002cial)365 4350 y(name)j(for)f(what)h(is)g(colloquially)i(r)o(eferr) +o(ed)18 b(to)j(as)f(\223Gr)o(eenwich)h(Mean)e(T)-5 b(ime.\224)492 +4475 y(P)t Fs(O)t(S)t(I)t(X)28 b FB(allows)d(a)g(single)g(time)g(zone)g +(to)g(specify)f FA(two)g FB(dif)o(fer)o(ent)f(of)o(fsets)h(fr)o(om)g +(UTC:)365 4575 y(one)33 b(standar)o(d)d(one,)35 b(and)c(one)h(for)g +(\223summer)g(time.\224)59 b(Summer)31 b(time)i(is)f(fr)o(equently)365 +4674 y(some)22 b(sort)f(of)g(daylight)g(savings)g(time.)490 +4799 y(The)32 b(scsh)g(time)g(package)f(consistently)i(uses)f(this)h +(terminology:)49 b(we)31 b(never)h(say)365 4898 y(\223gmt\224)21 +b(or)f(\223dst;\224)g(we)h(always)f(say)h(\223utc\224)f(and)g +(\223summer)h(time.\224)365 5147 y FE(Mar)o(ch)e(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v +540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w +FB(67)p eop %%Page: 68 74 -68 73 bop 988 614 a Fs(\017)41 b Fy(year)-5 b(,)20 b(month,)g(month-day)-8 -b(,)19 b(year)o(-day)g Fs(\))i Fy(week-day)1071 714 y FA(If)27 -b(either)h(of)f(the)h(above)f(r)o(ules)h(is)g(able)f(to)h(determine)f(what)h -(day)f(it)g(is,)j(the)1071 814 y Fw(week-day)17 b FA(\256eld)k(is)g(then)g -(set.)988 933 y Fs(\017)41 b Fy(tz-secs)19 b Fs(\))h Fy(tz-name)1071 -1033 y FA(If)j Fw(tz-secs)e FA(is)j(de\256ned,)f(but)h Fw(tz-name)d -FA(is)j(not,)h(it)e(is)h(assigned)g(a)f(time-zone)1071 1132 -y(name)i(of)g(the)g(form)g(\252)p Fw(UTC+)p Fq(hh)12 b Fw(:)p -Fq(mm)h Fw(:)p Fq(ss)g FA(\272;)27 b(the)e(trailing)g Fw(:)p -Fq(mm)13 b Fw(:)p Fq(ss)39 b FA(portion)26 b(is)1071 1232 y(deleted)20 -b(if)g(it)h(is)g(zer)o(oes.)988 1351 y Fs(\017)41 b Fy(tz-name,)18 -b(date,)h(summer?)26 b Fs(\))21 b Fy(tz-secs,)d(summer?)1071 -1451 y FA(If)g(the)g(date)g(information)h(is)f(pr)o(ovided)f(up)i(to)f -(second)h(r)o(esolution,)g Fw(tz-name)1071 1551 y FA(is)k(also)f(pr)o -(ovided,)f(and)h Fw(tz-secs)e FA(is)i(not)h(set,)g(then)g Fw(tz-secs)c -FA(and)j Fw(summer?)1071 1650 y FA(ar)o(e)14 b(set)h(to)g(their)g(corr)o(ect) -f(values.)25 b(Summer)o(-time)15 b(ambiguities)g(ar)o(e)f(r)o(esolved)1071 -1750 y(using)23 b(the)f(original)g(value)f(of)h Fw(summer?)p -FA(.)27 b(If)21 b(the)h(time)g(zone)g(doesn't)g(have)g(a)1071 -1849 y(summer)f(time)g(variant,)f(then)h Fw(summer?)d FA(is)j(set)g(to)g -Fw(#f)p FA(.)988 1969 y Fs(\017)41 b Fy(local)20 b(time,)f(date,)g(summer?)26 -b Fs(\))21 b Fy(tz-name,)d(tz-secs,)g(summer?)1071 2068 y FA(If)24 -b(the)h(date)f(information)h(is)g(pr)o(ovided)e(up)i(to)g(second)g(r)o -(esolution,)h(but)e(no)1071 2168 y(time)16 b(zone)g(information)h(is)f(pr)o -(ovided)f(\(both)h Fw(tz-name)d FA(and)i Fw(tz-secs)e FA(ar)o(en't)1071 -2268 y(set\),)24 b(then)g(we)g(pr)o(oceed)f(as)g(in)h(the)g(above)g(case,)f -(except)g(the)h(system's)h(cur)o(-)1071 2367 y(r)o(ent)20 b(time)h(zone)g(is) -g(used.)888 2520 y(These)16 b(r)o(ules)g(allow)h(one)f(particular)f -(ambiguity)h(to)g(escape:)24 b(if)16 b(both)g Fw(tz-name)d -FA(and)888 2620 y Fw(tz-secs)j FA(ar)o(e)h(set,)i(they)g(ar)o(e)f(not)h(br)o -(ought)g(into)g(agr)o(eement.)26 b(It)19 b(isn't)g(clear)f(how)i(to)888 -2719 y(do)h(this,)g(nor)h(is)f(it)g(clear)f(which)h(one)g(should)h(take)e(pr) -o(ecedence.)1071 2873 y FD(Oops:)54 b Fi(fill-in-date!)22 b -Fj(isn't)d(implemented)e(yet.)681 3207 y Fu(3.1)l(1)99 b(Environment)25 -b(variables)681 3433 y Fw(\(setenv)40 b Fz(var)21 b(val)p Fw(\))86 -b Fs(\000)-14 b(!)87 b Fz(unde\256ned)1226 b FA(pr)o(ocedur)o(e)681 -3532 y Fw(\(getenv)40 b Fz(var)p Fw(\))87 b Fs(\000)-14 b(!)87 -b Fz(string)1475 b FA(pr)o(ocedur)o(e)888 3650 y(These)22 b(functions)g(get)g -(and)f(set)g(the)h(pr)o(ocess)f(envir)o(onment,)h(stor)o(ed)f(in)h(the)g -(exter)o(-)888 3750 y(nal)g(C)g(variable)f Fw(char)41 b(**environ)p -FA(.)28 b(An)21 b(envir)o(onment)i(variable)d Fz(var)i FA(is)g(a)g(string.) -888 3849 y(If)j(an)g(envir)o(onment)h(variable)e(is)h(set)g(to)h(a)f(string)h -Fz(val)o FA(,)g(then)g(the)f(pr)o(ocess')g(global)888 3949 -y(envir)o(onment)i(str)o(uctur)o(e)e(is)h(alter)o(ed)f(with)h(an)g(entry)g -(of)g(the)g(form)g Fw(")p Fz(var)o Fw(=)p Fz(val)o Fw(")p FA(.)42 -b(If)888 4049 y Fz(val)21 b FA(is)g Fw(#f)p FA(,)e(then)j(any)e(entry)h(for)g -Fz(var)f FA(is)h(deleted.)681 4220 y Fw(\(env->alist\))82 b -Fs(\000)-14 b(!)87 b Fz(string)p Fs(!)p Fz(string)21 b(alist)1005 -b FA(pr)o(ocedur)o(e)888 4347 y(The)21 b Fw(env->alist)c FA(pr)o(ocedur)o(e)i -(converts)i(the)h(entir)o(e)e(envir)o(onment)h(into)h(an)f(alist,)888 -4447 y Fz(e.g.)p FA(,)1071 4599 y Fw(\(\("TERM")40 b(.)j("vt100"\))1115 -4699 y(\("SHELL")d(.)j("/bin/csh"\))1115 4799 y(\("EDITOR")c(.)44 -b("emacs"\))1115 4898 y Fx(:)14 b(:)g(:)f Fw(\))681 5147 y -FA(68)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +68 73 bop 681 614 a Fz(3.10.2)80 b(Basic)20 b(data)g(types)681 +810 y FB(W)-8 b(e)21 b(have)f(two)h(types:)26 b FA(time)20 +b FB(and)h FA(date)p FB(.)805 945 y(A)j FA(time)g FB(speci\002es)h(an)f +(instant)h(in)g(the)g(history)g(of)g(the)f(universe.)37 +b(It)24 b(is)h(location)g(and)681 1044 y(time-zone)f(independent.)1560 +1014 y Fu(3)1635 1044 y FB(A)g(time)h(is)g(a)f(r)o(eal)f(value)h +(giving)i(the)f(number)f(of)h(elapsed)681 1144 y(seconds)c(since)h(the) +f(Unix)h(\223epoch\224)e(\(Midnight,)h(January)g(1,)f(1970)g(UTC\).)g +(T)-5 b(ime)21 b(values)681 1244 y(pr)o(ovide)28 b(arbitrary)g(time)i +(r)o(esolution,)i(limited)e(only)h(by)e(the)h(number)f(system)h(of)g +(the)681 1343 y(underlying)21 b(Scheme)g(system.)805 +1478 y(A)32 b FA(date)f FB(is)h(a)g(name)f(for)h(an)g(instant)g(in)h +(time)f(that)g(is)g(speci\002ed)g(r)o(elative)e(to)i(some)681 +1577 y(location/time-zone)21 b(in)h(the)f(world,)f FA(e.g.)p +FB(:)888 1677 y(Friday)h(October)f(31,)g(1994)f(3:47:21)e(pm)k(EST)-6 +b(.)681 1777 y(Dates)33 b(pr)o(ovide)f(one-second)i(r)o(esolution,)j +(and)c(ar)o(e)f(expr)o(essed)g(with)i(the)g(following)681 +1876 y(r)o(ecor)o(d)19 b(type:)888 2084 y Fx(\(define-record)38 +b(date)216 b(;)44 b(A)f(Posix)e(tm)i(struct)976 2183 +y(seconds)302 b(;)43 b(Seconds)e(after)g(the)h(minute)g([0-59])976 +2283 y(minute)346 b(;)43 b(Minutes)e(after)g(the)h(hour)g([0-59])976 +2383 y(hour)434 b(;)43 b(Hours)e(since)h(midnight)e([0-23])976 +2482 y(month-day)214 b(;)43 b(Day)f(of)h(the)f(month)g([1-31])976 +2582 y(month)390 b(;)43 b(Months)e(since)h(January)e([0-11])976 +2682 y(year)434 b(;)43 b(Years)e(since)h(1900)976 2781 +y(tz-name)302 b(;)43 b(Time-zone)d(name:)h(#f)i(or)g(a)g(string.)976 +2881 y(tz-secs)302 b(;)43 b(Time-zone)d(offset:)g(#f)j(or)g(an)g +(integer.)976 2980 y(summer?)302 b(;)43 b(Summer)e(\(Daylight)f +(Savings\))g(time)i(in)h(effect?)976 3080 y(week-day)258 +b(;)43 b(Days)f(since)f(Sunday)g([0-6])976 3180 y(year-day\))214 +b(;)43 b(Days)f(since)f(Jan.)h(1)h([0-365])681 3387 y +FB(If)31 b(the)g Fx(tz-secs)e FB(\002eld)i(is)h(given,)i(it)d +(speci\002es)h(the)f(time-zone's)g(of)o(fset)g(fr)o(om)g(UTC)g(in)681 +3487 y(seconds.)50 b(If)28 b(it)h(is)g(speci\002ed,)i(the)d +Fx(tz-name)e FB(and)j Fx(summer?)d FB(\002elds)i(ar)o(e)g(ignor)o(ed)g +(when)681 3587 y(using)21 b(the)g(date)f(str)o(uctur)o(e)g(to)i +(determine)e(a)g(speci\002c)h(instant)g(in)h(time.)805 +3721 y(If)38 b(the)g Fx(tz-name)d FB(\002eld)j(is)h(given,)j(it)d(is)f +(a)g(time-zone)g(string)h(such)f(as)g Fx("EST")e FB(or)681 +3821 y Fx("HKT")25 b FB(understood)i(by)g(the)h(OS.)e(Since)j(P)t +Fs(O)t(S)t(I)t(X)i FB(time-zone)c(strings)h(can)f(specify)g(dual)681 +3920 y(standar)o(d/summer)33 b(time-zones)i(\(e.g.,)i(\224EST5EDT\224) +32 b(speci\002es)j(U.S.)e(Eastern)h(Stan-)681 4020 y(dar)o(d/Eastern)20 +b(Daylight)j(T)-5 b(ime\),)22 b(the)g(value)g(of)g(the)g +Fx(summer?)d FB(\002eld)j(is)g(used)g(to)h(r)o(esolve)681 +4120 y(the)k(amiguous)g(boundary)g(cases.)43 b(For)27 +b(example,)g(on)h(the)e(morning)j(of)d(the)h(Fall)g(day-)681 +4219 y(light)22 b(savings)h(change-over)-6 b(,)21 b(1:00am\2262:00am)c +(happens)22 b(twice.)28 b(Hence)22 b(the)g(date)f(1:30)681 +4319 y(am)27 b(on)h(this)g(morning)h(can)e(specify)g(two)h(dif)o(fer)o +(ent)d(seconds;)31 b(the)c Fx(summer?)d FB(\003ag)k(says)681 +4418 y(which)21 b(one.)805 4553 y(A)i(date)e(with)j Fx(tz-name)f +Fm(=)j Fx(tz-secs)e Fm(=)i Fx(#f)c FB(is)h(a)f(date)f(that)i(is)g +(speci\002ed)f(in)h(terms)g(of)681 4652 y(the)e(system's)g(curr)o(ent)f +(time)h(zone.)p 681 4742 1146 4 v 766 4796 a Fp(3)800 +4819 y Fs(Physics)26 b(pedants)f(please)g(note:)37 b(The)24 +b(scsh)i(authors)f(live)g(in)g(a)h(Newtonian)f(universe.)46 +b(W)-6 b(e)25 b(disclaim)681 4898 y(r)o(esponsibility)17 +b(for)g(calculations)i(performed)d(in)h(non-ANSI)f(standar)o(d)g +(light-cones.)681 5147 y FB(68)p 1952 5071 323 4 v 1952 +5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 5176 +323 4 v 538 w FE(Mar)o(ch)j(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 69 75 -69 74 bop 365 614 a Fw(\(alist->env)39 b Fz(alist)p Fw(\))87 -b Fs(\000)-14 b(!)87 b Fz(unde\256ned)1142 b FA(pr)o(ocedur)o(e)573 -761 y Fz(Alist)20 b FA(must)h(be)f(an)g(alist)g(whose)h(keys)f(ar)o(e)f(all)h -(strings,)h(and)e(whose)i(values)f(ar)o(e)f(all)573 860 y(either)d(strings)g -(or)g(string)h(lists.)26 b(String)16 b(lists)h(ar)o(e)d(converted)h(to)i -(colon)f(lists)h(\(see)e(be-)573 960 y(low\).)26 b(The)15 b(alist)h(is)f -(installed)h(as)f(the)g(curr)o(ent)g(Unix)g(envir)o(onment)h(\()p -Fz(i.e.)p FA(,)g(converted)573 1059 y(to)i(a)g(null-terminated)g(C)g(vector)f -(of)i Fw(")p Fz(var)o Fw(=)p Fz(val)o Fw(")e FA(strings)i(which)g(is)g -(assigned)f(to)g(the)573 1159 y(global)j Fw(char)42 b(**environ)p -FA(\).)490 1343 y(The)21 b(following)h(thr)o(ee)e(functions)i(help)f(the)g -(pr)o(ogrammer)f(manipulate)h(alist)g(tables)365 1442 y(in)f(some)h -(generally)e(useful)g(ways.)27 b(They)20 b(ar)o(e)e(all)i(de\256ned)f(using)h -Fw(equal?)d FA(for)j(key)f(com-)365 1542 y(parison.)365 1696 -y Fw(\(alist-delete)39 b Fz(key)20 b(alist)p Fw(\))87 b Fs(\000)-15 -b(!)88 b Fz(alist)1110 b FA(pr)o(ocedur)o(e)573 1842 y(Delete)20 -b(any)h(entry)g(labelled)f(by)h(value)f Fz(key)p FA(.)365 2148 -y Fw(\(alist-update)39 b Fz(key)20 b(val)g(alist)p Fw(\))87 -b Fs(\000)-14 b(!)87 b Fz(alist)988 b FA(pr)o(ocedur)o(e)573 -2294 y(Delete)20 b Fz(key)h FA(fr)o(om)f Fz(alist)p FA(,)h(then)g(cons)g(on)h -(a)e Fw(\()p Fz(key)43 b Fw(.)g Fz(val)o Fw(\))21 b FA(entry)-9 -b(.)365 2600 y Fw(\(alist-compress)38 b Fz(alist)p Fw(\))86 -b Fs(\000)-14 b(!)87 b Fz(alist)1155 b FA(pr)o(ocedur)o(e)573 -2746 y(Compr)o(esses)20 b Fz(alist)h FA(by)g(r)o(emoving)g(shadowed)g -(entries.)27 b(Example:)756 2922 y Fw(;;;)42 b(Shadowed)e(\(1)j(.)g(c\))g -(entry)e(removed.)756 3022 y(\(alist-compress)c('\()43 b(\(1)f(.)i(a\))e(\(2) -h(.)g(b\))g(\(1)g(.)g(c\))g(\(3)f(.)i(d\))e(\)\))930 3121 y -Fl(=)-14 b Fs(\))87 b Fw(\(\(1)42 b(.)h(a\))g(\(2)g(.)g(b\))g(\(3)f(.)i -(d\)\))365 3423 y(\(with-env*)c Fz(env-alist-delta)19 b(thunk)p -Fw(\))87 b Fs(\000)-15 b(!)88 b Fz(value\(s\))20 b(of)g(thunk)392 -b FA(pr)o(ocedur)o(e)365 3522 y Fw(\(with-total-env*)37 b Fz(env-alist)21 -b(thunk)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(value\(s\))20 -b(of)h(thunk)319 b FA(pr)o(ocedur)o(e)573 3668 y(These)34 b(pr)o(ocedur)o(es) -e(call)i Fz(thunk)g FA(in)h(the)f(context)g(of)h(an)f(alter)o(ed)e(envir)o -(onment.)573 3768 y(They)20 b(r)o(eturn)e(whatever)h(values)h -Fz(thunk)f FA(r)o(eturns.)26 b(Non-local)20 b(r)o(eturns)f(r)o(estor)o(e)f -(the)573 3868 y(envir)o(onment)g(to)g(its)g(outer)g(value;)g(thr)o(owing)g -(back)f(into)i(the)f(thunk)g(by)g(invoking)573 3967 y(a)i(stor)o(ed)g -(continuation)j(r)o(estor)o(es)c(the)i(envir)o(onment)g(back)g(to)g(its)g -(inner)g(value.)573 4105 y(The)16 b Fz(env-alist-delta)f FA(ar)o(gument)h -(speci\256es)h(a)f Fz(modi\256cation)f FA(to)i(the)f(curr)o(ent)g(envir)o -(on-)573 4205 y(ment\320)p Fz(thunk)p FA('s)k(envir)o(onment)h(is)g(the)f -(original)h(envir)o(onment)g(overridden)f(with)573 4304 y(the)h(bindings)g -(speci\256ed)g(by)g(the)g(alist)f(delta.)573 4442 y(The)h Fz(env-alist)g -FA(ar)o(gument)f(speci\256es)h(a)g(complete)g(envir)o(onment)h(that)f(is)g -(installed)573 4542 y(for)f Fz(thunk)p FA(.)365 4748 y Fw(\(with-env)40 -b Fz(env-alist-delta)20 b(.)g(body)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(value\(s\))20 b(of)h(body)607 b FA(syntax)365 4847 -y Fw(\(with-total-env)38 b Fz(env-alist)20 b(.)h(body)p Fw(\))86 -b Fs(\000)-15 b(!)88 b Fz(value\(s\))20 b(of)g(body)535 b FA(syntax)365 -5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p -1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 -V 1636 5176 323 4 v 1216 w FA(69)p eop +69 74 bop 490 614 a FB(Ther)o(e)20 b(is)h(r)o(edundancy)e(in)j(the)e +Fx(date)g FB(data)f(str)o(uctur)o(e.)25 b(For)c(example,)f(the)h +Fx(year-day)365 714 y FB(\002eld)f(is)g(r)o(edundant)e(with)i(the)g +Fx(month-day)c FB(and)j Fx(month)e FB(\002elds.)25 b(Either)20 +b(of)f(these)h(implies)365 814 y(the)27 b(values)g(of)f(the)h +Fx(week-day)d FB(\002eld.)43 b(The)27 b Fx(summer?)d +FB(and)j Fx(tz-name)c FB(\002elds)k(ar)o(e)f(r)o(edun-)365 +913 y(dant)33 b(with)g(the)g Fx(tz-secs)d FB(\002eld)i(in)h(terms)g(of) +g(specifying)g(an)f(instant)h(in)h(time.)61 b(This)365 +1013 y(r)o(edundancy)26 b(is)g(pr)o(ovided)g(because)f(consumers)j(of)e +(dates)g(may)g(want)h(it)g(br)o(oken)f(out)365 1112 y(in)d(dif)o(fer)o +(ent)d(ways.)29 b(The)22 b(scsh)h(pr)o(ocedur)o(es)d(that)i(pr)o(oduce) +f(date)g(r)o(ecor)o(ds)g(\002ll)i(them)f(out)365 1212 +y(completely)-9 b(.)58 b(However)-6 b(,)34 b(when)e(date)f(r)o(ecor)o +(ds)f(pr)o(oduced)g(by)i(the)f(pr)o(ogrammer)g(ar)o(e)365 +1312 y(passed)19 b(to)h(scsh)g(pr)o(ocedur)o(es,)d(the)j(r)o(edundancy) +e(is)h(r)o(esolved)g(by)g(ignoring)i(some)f(of)f(the)365 +1411 y(secondary)i(\002elds.)k(This)d(is)f(described)e(for)i(each)f(pr) +o(ocedur)o(e)f(below)-8 b(.)365 1563 y Fx(\(make-date)40 +b FA(s)16 b(min)f(h)h(mday)e(mon)h(y)h([tzn)f(tzs)g(summ?)g(wday)g +(yday])p Fx(\))41 b Ft(\000)-14 b(!)43 b FA(date)87 b +FB(pr)o(ocedur)o(e)573 1707 y(When)25 b(making)g(a)f +Fx(date)f FB(r)o(ecor)o(d,)g(the)i(last)f(\002ve)h(elements)g(of)f(the) +h(r)o(ecor)o(d)e(ar)o(e)g(op-)573 1807 y(tional,)d(and)f(default)f(to)i +Fx(#f)p FB(,)f Fx(#f)p FB(,)g Fx(#f)p FB(,)f(0,)i(and)f(0)g(r)o +(espectively)-9 b(.)24 b(This)c(is)f(useful)h(when)573 +1906 y(cr)o(eating)g(a)g Fx(date)f FB(r)o(ecor)o(d)g(to)i(pass)g(as)f +(an)h(ar)o(gument)f(to)h Fx(time)p FB(.)365 2185 y Fz(3.10.3)81 +b(T)-5 b(ime)20 b(zones)365 2373 y FB(Several)30 b(time)i(pr)o(ocedur)o +(es)d(take)i(time)g(zones)h(as)f(ar)o(guments.)56 b(When)32 +b(optional,)i(the)365 2473 y(time)21 b(zone)g(defaults)f(to)h(local)g +(time)g(zone.)k(Otherwise)d(the)f(time)g(zone)f(can)h(be)f(one)h(of:) +623 2597 y Fx(#f)273 b FB(Local)20 b(time)623 2697 y(Integer)99 +b(Seconds)19 b(of)g(of)o(fset)f(fr)o(om)h(UTC.)f(For)h(example,)g(New) +984 2797 y(Y)-8 b(ork)25 b(City)g(is)f(-18000)e(\(-5)h(hours\),)i(San)f +(Francisco)g(is)984 2896 y(-28800)18 b(\(-8)i(hours\).)623 +2996 y(String)139 b(A)18 b(P)t Fs(O)t(S)t(I)t(X)i FB(time)d(zone)f +(string)h(understood)g(by)f(the)h(OS)984 3096 y(\()p +FA(i.e.)p FB(.,)27 b(the)g(sort)g(of)g(time)g(zone)f(assigned)h(to)g +(the)g Fx($TZ)984 3195 y FB(envir)o(onment)21 b(variable\).)365 +3339 y(An)f(integer)f(time)h(zone)f(gives)g(the)h(number)f(of)h +(seconds)f(you)h(must)g(add)e(to)i(UTC)f(to)h(get)365 +3438 y(time)h(in)h(that)e(zone.)26 b(It)21 b(is)g FA(not)f +FB(\223seconds)h(west\224)f(of)h(UTC\227that)f(\003ips)i(the)e(sign.) +490 3567 y(T)-8 b(o)21 b(get)g(UTC)f(time,)h(use)g(a)f(time)h(zone)g +(of)f(either)h(0)f(or)h Fx("UCT0")p FB(.)365 3828 y Fz(3.10.4)81 +b(Procedures)365 4039 y Fx(\(time+ticks\))i Ft(\000)-15 +b(!)87 b FA([secs)22 b(ticks])1297 b FB(pr)o(ocedur)o(e)365 +4139 y Fx(\(ticks/sec\))83 b Ft(\000)-14 b(!)87 b FA(r)o(eal)1579 +b FB(pr)o(ocedur)o(e)573 4265 y(The)27 b(curr)o(ent)g(time,)h(with)h +(sub-second)e(r)o(esolution.)46 b(Sub-second)26 b(r)o(esolution)i(is) +573 4364 y(not)h(pr)o(ovided)f(by)j(P)t Fs(O)t(S)t(I)t(X)r +FB(,)h(but)d(is)g(available)f(on)h(many)g(systems.)51 +b(The)29 b(time)g(is)573 4464 y(r)o(eturned)19 b(as)h(elapsed)g +(seconds)g(since)h(the)g(Unix)f(epoch,)g(plus)h(a)f(number)g(of)h(sub-) +573 4564 y(second)29 b(\223ticks.\224)50 b(The)29 b(length)h(of)f(a)g +(tick)g(may)g(vary)f(fr)o(om)h(implementation)h(to)573 +4663 y(implementation;)21 b(it)g(can)g(be)f(determined)g(fr)o(om)h +Fx(\(ticks/sec\))p FB(.)573 4799 y(The)c(system)i(clock)f(is)g(not)g(r) +o(equir)o(ed)e(to)i(r)o(eport)f(time)h(at)f(the)h(full)g(r)o(esolution) +g(given)573 4898 y(by)g Fx(\(ticks/sec\))p FB(.)i(For)f(example,)f(on)h +(BSD,)e(time)i(is)f(r)o(eported)f(at)h Fm(1)p Fy(\026)p +FB(s)g(r)o(esolution,)365 5147 y FE(Mar)o(ch)h(10,)g(1997)h(\226)f(21) +13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 +w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(69)p +eop %%Page: 70 76 -70 75 bop 888 614 a FA(These)34 b(special)f(forms)h(pr)o(ovide)f(syntactic)h -(sugar)f(for)h Fw(with-env*)c FA(and)j Fw(with-)888 714 y(total-env*)p -FA(.)23 b(The)c(env)g(alists)g(ar)o(e)f(not)i(evaluated)d(positions,)k(but)e -(ar)o(e)f(implicitly)888 814 y(backquoted.)34 b(In)23 b(this)h(way)-9 -b(,)23 b(they)g(tend)g(to)h(r)o(esemble)e(binding)h(lists)h(for)f -Fw(let)e FA(and)888 913 y Fw(let*)e FA(forms.)805 1071 y(Example:)24 -b(These)15 b(four)g(pieces)g(of)g(code)g(all)f(r)o(un)i(the)f(mailer)g(with)h -(special)e Fw($TERM)f FA(and)681 1162 y Fw($EDITOR)18 b FA(values.)888 -1311 y Fi(\(with-env)42 b(\(\("TERM")f(.)e("xterm"\))i(\("EDITOR")g(.)f -(,my-editor\)\))967 1403 y(\(run)g(\(mail)g(shivers@lcs.mit.edu\)\)\))888 -1585 y(\(with-env*)i(`\(\("TERM")f(.)f("xterm"\))h(\("EDITOR")g(.)e -(,my-editor\)\))967 1677 y(\()n Fe(\025)c Fi(\(\))40 b(\(run)g(\(mail)h -(shivers@csd.hku.hk\)\)\)\))888 1859 y(\(run)f(\(begin)h(\(setenv)g("TERM")f -("xterm"\))238 b(;)39 b(Env)h(mutation)h(happens)1359 1951 -y(\(setenv)g("EDITOR")g(my-editor\))g(;)f(in)g(the)f(subshell.)1359 -2042 y(\(exec-epf)i(\(mail)g(shivers@research.att.com\)\)\)\))888 -2225 y(;;)f(In)g(this)g(example,)h(we)f(compute)g(an)g(alternate)h -(environment)h(ENV2)888 2316 y(;;)e(as)g(an)f(alist,)i(and)f(install)h(it)e -(with)i(an)e(explicit)i(call)f(to)g(the)888 2407 y(;;)g(EXEC-PATH/ENV)i -(procedure.)888 2499 y(\(let*)f(\(\(env)f(\(env->alist\)\))435 -b(;)39 b(Get)h(the)g(current)h(environment,)1163 2590 y(\(env1)f -(\(alist-update)i(env)80 b("TERM")40 b("xterm"\)\))238 b(;)39 -b(and)h(compute)1163 2681 y(\(env2)g(\(alist-update)i(env1)f("EDITOR")g -(my-editor\)\)\))h(;)d(the)h(new)g(env.)967 2772 y(\(run)g(\(begin)h -(\(exec-path/env)h("mail")f(env2)f("shivers@cs.cmu.edu"\)\)\)\))681 -3181 y Fy(3.1)m(1.1)80 b(Path)20 b(lists)f(and)h(colon)g(lists)681 -3355 y FA(Envir)o(onment)i(variables)e(such)i(as)f Fw($)o(PATH)f -FA(encode)h(a)g(list)g(of)h(strings)g(by)f(separating)g(the)681 -3447 y(list)e(elements)g(with)g(colon)h(delimiters.)27 b(Once)19 -b(parsed)e(into)j(actual)e(lists,)h(these)g(or)o(der)o(ed)681 -3538 y(lists)g(can)g(be)g(manipulated)f(with)i(the)f(following)h(two)g -(functions.)28 b(T)-8 b(o)19 b(convert)g(between)681 3629 y(the)25 -b(colon-separated)f(string)i(encoding)g(and)e(the)i(list-of-strings)g(r)o -(epr)o(esentation,)e(see)681 3721 y(the)d Fw(field-reader)15 -b FA(and)21 b Fw(join-strings)16 b FA(functions)21 b(in)h(section)f(7.1.)888 -3870 y FD(Remark:)74 b Fj(An)24 b(earlier)e(r)o(elease)g(of)h(scsh)g(pr)o -(ovided)f(the)i Fi(split-colon-list)j Fj(and)888 3961 y Fi -(string-list->colon-list)18 b Fj(functions.)23 b(These)13 b(have)g(been)g(r)o -(emoved)e(fr)o(om)h(scsh,)888 4053 y(and)26 b(ar)o(e)e(r)o(eplaced)f(by)i -(the)g(mor)o(e)f(general)g(parsers)f(and)i(unparsers)f(of)h(the)g(\256eld-) -888 4144 y(r)o(eader)17 b(module.)681 4326 y Fw(\(add-before)39 -b Fz(elt)21 b(befor)o(e)g(list)p Fw(\))87 b Fs(\000)-14 b(!)87 -b Fz(list)1084 b FA(pr)o(ocedur)o(e)681 4426 y Fw(\(add-after)39 -b Fz(elt)21 b(after)g(list)p Fw(\))87 b Fs(\000)-14 b(!)87 -b Fz(list)1169 b FA(pr)o(ocedur)o(e)888 4566 y(These)20 b(functions)h(ar)o(e) -e(for)h(modifying)h(sear)o(ch-path)e(lists,)h(wher)o(e)g(element)g(or)o(der) -888 4666 y(is)h(signi\256cant.)888 4799 y Fw(add-before)d FA(adds)i -Fz(elt)i FA(to)g(the)f(list)h(immediately)g(befor)o(e)e(the)i(\256rst)g -(occurr)o(ence)e(of)888 4898 y Fz(befor)o(e)g FA(in)g(the)f(list.)28 -b(If)19 b Fz(befor)o(e)h FA(is)f(not)h(in)g(the)g(list,)f Fz(elt)h -FA(is)f(added)f(to)i(the)f(end)g(of)g(the)h(list.)681 5147 -y(70)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)e(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +70 75 bop 888 614 a FB(so)34 b Fx(\(ticks/sec\))28 b +FB(is)33 b(1,000,000.)58 b(That)33 b(doesn't)g(mean)g(the)g(system)h +(clock)f(has)888 714 y(micr)o(o-second)21 b(r)o(esolution.)888 +849 y(If)c(the)f(OS)h(does)f(not)i(support)f(sub-second)f(r)o +(esolution,)i(the)f FA(ticks)f FB(value)g(is)h(always)888 +949 y(0,)j(and)h Fx(\(ticks/sec\))16 b FB(r)o(eturns)k(1.)1071 +1129 y FE(Remark:)93 b Fk(I)29 b(chose)g(to)g(r)o(epr)o(esent)e(system) +i(clock)f(r)o(esolution)g(as)h(ticks/sec)1071 1221 y(instead)20 +b(of)g(sec/tick)g(to)g(incr)o(ease)g(the)h(odds)e(that)j(the)e(value)h +(could)e(be)i(r)o(epr)o(e-)1071 1312 y(sented)j(as)g(an)h(exact)f +(integer)-6 b(,)25 b(incr)o(easing)e(ef)o(\002ciency)h(and)h(making)e +(it)i(easier)1071 1403 y(for)k(Scheme)h(implementations)g(that)i(don't) +d(have)i(sophisticated)f(numeric)1071 1494 y(support)18 +b(to)h(deal)f(with)i(the)f(quantity)-8 b(.)1071 1604 +y(Y)h(ou)18 b(can)i(convert)f(seconds)f(and)h(ticks)g(to)f(seconds)g +(with)i(the)f(expr)o(ession)1226 1735 y Fh(\(+)40 b Fi(secs)g +Fh(\(/)f Fi(ticks)h Fh(\(ticks/sec\)\)\))1071 1866 y +Fk(Given)23 b(that,)i(why)f(not)f(have)h(the)g(\002ne-grain)f(time)g +(pr)o(ocedur)o(e)d(just)k(r)o(eturn)e(a)1071 1958 y(non-integer)g(r)o +(eal)g(for)g(time?)35 b(Following)21 b(Common)i(Lisp,)f(I)h(chose)g(to) +f(allow)1071 2049 y(the)i(system)f(clock)g(to)h(r)o(eport)f(sub-second) +g(time)g(in)h(its)g(own)g(units)g(to)g(lower)1071 2140 +y(the)d(over)o(head)f(of)g(determining)f(the)j(time.)28 +b(This)20 b(would)g(be)g(important)h(for)f(a)1071 2232 +y(system)15 b(that)i(wanted)f(to)g(pr)o(ecisely)d(time)i(the)h +(duration)g(of)f(some)g(event.)22 b(T)l(ime)1071 2323 +y(stamps)16 b(could)g(be)h(collected)f(with)h(little)g(over)o(head,)e +(deferring)g(the)i(over)o(head)1071 2414 y(of)h(pr)o(ecisely)f +(calculating)i(with)h(them)f(until)g(after)g(collection.)1071 +2524 y(This)e(is)f(all)h(a)g(bit)g(academic)g(for)f(the)i(Scheme)f(48)g +(implementation,)h(wher)o(e)e(we)1071 2615 y(determine)23 +b(time)h(with)h(a)g(heavyweight)f(system)g(call,)h(but)g(it's)e(nice)i +(to)f(plan)1071 2706 y(for)18 b(the)h(futur)o(e.)681 +2976 y Fx(\(date\))84 b Ft(\000)-14 b(!)87 b FA(date-r)o(ecord)1545 +b FB(pr)o(ocedur)o(e)681 3075 y Fx(\(date)41 b FA([time)20 +b(tz])p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(date-r)o(ecord)1213 +b FB(pr)o(ocedur)o(e)888 3219 y(Simple)21 b Fx(\(date\))d +FB(r)o(eturns)i(the)h(curr)o(ent)f(date,)g(in)h(the)g(local)g(time)g +(zone.)888 3354 y(W)-5 b(ith)23 b(the)g(optional)g(ar)o(guments,)e +Fx(date)g FB(converts)h(the)h(time)f(to)g(the)h(date)e(as)h(spec-)888 +3454 y(i\002ed)h(by)f(the)h(time)g(zone)g FA(tz)o FB(.)31 +b FA(T)-5 b(ime)23 b FB(defaults)f(to)h(the)f(curr)o(ent)g(time;)i +FA(tz)e FB(defaults)g(to)888 3553 y(local)f(time,)g(and)f(is)h(as)g +(described)e(in)j(the)f(time-zone)f(section.)888 3688 +y(If)25 b(the)g FA(tz)f FB(ar)o(gument)h(is)g(an)g(integer)-6 +b(,)25 b(the)h(date's)e Fx(tz-name)e FB(\002eld)j(is)g(a)h(P)t +Fs(O)t(S)t(I)t(X)j FB(time)888 3788 y(zone)17 b(of)f(the)h(form)f(\223) +p Fx(UTC+)p Fr(hh)c Fx(:)p Fr(mm)h Fx(:)p Fr(ss)g FB(\224;)k(the)g +(trailing)g Fx(:)p Fr(mm)c Fx(:)p Fr(ss)30 b FB(portion)17 +b(is)g(deleted)888 3888 y(if)k(it)g(is)g(zer)o(oes.)681 +4086 y Fx(\(time\))84 b Ft(\000)-14 b(!)87 b FA(integer)1685 +b FB(pr)o(ocedur)o(e)681 4185 y Fx(\(time)41 b FA([date])p +Fx(\))86 b Ft(\000)-15 b(!)88 b FA(integer)1447 b FB(pr)o(ocedur)o(e) +888 4329 y(Simple)21 b Fx(\(time\))d FB(r)o(eturns)i(the)h(curr)o(ent)f +(time.)888 4464 y(W)-5 b(ith)30 b(the)g(optional)g(date)e(ar)o(gument,) +i Fx(time)e FB(converts)h(a)g(date)f(to)h(a)g(time.)51 +b FA(Date)888 4564 y FB(defaults)20 b(to)h(the)g(curr)o(ent)f(date.)888 +4699 y(Note)31 b(that)f(the)h(input)g FA(date)f FB(r)o(ecor)o(d)e(is)j +(over)o(constrained.)54 b Fx(time)29 b FB(ignor)o(es)h +FA(date)p FB('s)888 4799 y Fx(week-day)k FB(and)i Fx(year-day)d +FB(\002elds.)73 b(If)36 b(the)h(date's)f Fx(tz-secs)d +FB(\002eld)k(is)g(set,)j(the)888 4898 y Fx(tz-name)18 +b FB(and)j Fx(summer?)c FB(\002elds)k(ar)o(e)f(ignor)o(ed.)681 +5147 y(70)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)f(10,)g +(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 71 77 -71 76 bop 573 614 a Fw(add-after)17 b FA(is)22 b(similar:)28 -b Fz(elt)21 b FA(is)h(added)d(after)h(the)i(last)f(occurr)o(ence)f(of)h -Fz(after)p FA(.)29 b(If)20 b Fz(after)573 714 y FA(is)h(not)g(found,)g -Fz(elt)g FA(is)g(added)e(to)i(the)g(beginning)h(of)f(the)g(list.)573 -848 y(Neither)16 b(function)g(destr)o(uctively)g(alters)f(the)h(original)h -(path-list.)25 b(The)16 b(r)o(esult)g(may)573 947 y(shar)o(e)k(str)o(uctur)o -(e)h(with)g(the)h(original)f(list.)29 b(Both)22 b(functions)g(use)f -Fw(equal?)e FA(for)h(com-)573 1047 y(paring)g(elements.)365 -1318 y Fy(3.1)m(1.2)81 b Fw($)o(USER)p Fy(,)19 b Fw($HOME)p -Fy(,)g(and)g Fw($PATH)365 1502 y FA(Like)26 b(sh)g(and)f(unlike)i(csh,)g -(scsh)f(has)g Fz(no)g FA(interactive)f(dependencies)g(on)h(envir)o(onment)365 -1602 y(variables.)e(It)14 b(does,)h(however)-6 b(,)15 b(initialise)g(certain) -e(internal)h(values)g(at)f(startup)h(time)g(fr)o(om)365 1702 -y(the)19 b(initial)g(pr)o(ocess)g(envir)o(onment,)g(in)g(particular)f -Fw($HOME)f FA(and)h Fw($PATH)p FA(.)e(Scsh)j(never)f(uses)365 -1801 y Fw($USER)d FA(at)i(all.)26 b(It)17 b(computes)h Fw(\(user-login-name)o -(\))11 b FA(fr)o(om)17 b(the)g(system)h(call)f Fw(\(user-uid\))p -FA(.)365 1951 y Fw(home-directory)2046 b Fz(string)365 2051 -y Fw(exec-path-list)1914 b Fz(string)21 b FA(list)573 2193 -y(Scsh)28 b(accesses)g Fw($HOME)e FA(at)i(start-up)g(time,)i(and)e(stor)o(es) -h(the)f(value)g(in)h(the)f(global)573 2293 y(variable)19 b -Fw(home-directory)p FA(.)i(It)f(uses)g(this)h(value)f(for)f -Fw(~)h FA(lookups)h(and)f(for)g(r)o(eturn-)573 2392 y(ing)h(to)g(home)h(on)f -Fw(\(chdir\))p FA(.)573 2526 y(Scsh)g(accesses)g Fw($PATH)f -FA(at)h(start-up)g(time,)h(colon-splits)h(the)f(path)f(list,)h(and)g(stor)o -(es)573 2626 y(the)32 b(value)g(in)h(the)g(global)f(variable)f -Fw(exec-path-list)p FA(.)57 b(This)33 b(list)g(is)g(used)f(for)573 -2725 y Fw(exec-path)17 b FA(and)j Fw(exec-path/env)c FA(sear)o(ches.)365 -3023 y Fu(3.12)99 b(T)-11 b(erminal)25 b(device)g(control)365 -3238 y FA(Scsh)g(pr)o(ovides)g(a)f(complete)i(set)f(of)g(r)o(outines)g(for)g -(manipulating)h(terminal)f(devices\320)365 3338 y(putting)g(them)g(in)g -(\252raw\272)d(mode,)j(changing)g(and)f(querying)h(their)f(special)g -(characters,)365 3437 y(modifying)17 b(their)e(i/o)i(speeds,)f(and)f(so)h -(forth.)25 b(The)16 b(scsh)g(interface)e(is)i(designed)g(both)g(for)365 -3537 y(generality)i(and)g(portability)h(acr)o(oss)f(dif)o(fer)o(ent)e(Unix)i -(platforms,)h(so)g(you)f(don't)h(have)f(to)365 3637 y(r)o(ewrite)k(your)h(pr) -o(ogram)f(each)f(time)i(you)g(move)g(to)g(a)f(new)h(system.)33 -b(W)-8 b(e've)23 b(also)f(made)365 3736 y(an)28 b(ef)o(fort)e(to)i(use)g(r)o -(easonable,)g(Scheme-like)f(names)h(for)g(the)g(multitudinous)h(named)365 -3836 y(constants)c(involved,)f(so)g(when)g(you)g(ar)o(e)f(r)o(eading)f(code,) -i(you'll)g(have)f(less)h(likelihood)365 3936 y(of)k(getting)g(lost)g(in)g(a)f -(bewildering)g(maze)g(of)g(obfuscatory)h(constants)g(named)f -Fw(ICRNL)p FA(,)365 4035 y Fw(INPCK)p FA(,)19 b Fw(IUCLC)p -FA(,)f(and)i Fw(ONOCR)p FA(.)490 4161 y(This)25 b(section)g(can)f(only)h(lay) -f(out)h(the)g(basic)f(functionality)h(of)f(the)h(terminal)f(device)365 -4261 y(interface.)38 b(For)25 b(further)f(details,)h(see)f(the)h -(termios\(3\))f(man)g(page)g(on)i(your)e(system,)i(or)365 4360 -y(consult)c(one)f(of)g(the)g(standar)o(d)e(Unix)i(texts.)365 -4614 y Fy(3.12.1)81 b(Portability)18 b(across)j(OS)f(variants)365 -4799 y FA(T)-8 b(erminal-contr)o(ol)28 b(softwar)o(e)f(is)i(inescapably)e -(complex,)j(ugly)-9 b(,)29 b(and)f(low-level.)49 b(Unix)365 -4898 y(variants)26 b(each)f(pr)o(ovide)g(their)h(own)h(way)f(of)g(contr)o -(olling)h(terminal)f(devices,)h(making)365 5147 y FD(November)18 -b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 -5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v -1216 w FA(71)p eop +71 76 bop 573 614 a FB(If)26 b(the)g Fx(tz-secs)e FB(\002eld)i(is)g +Fx(#f)p FB(,)h(then)g(the)f(time-zone)g(is)h(taken)f(fr)o(om)g(the)g +Fx(tz-name)573 714 y FB(\002eld.)35 b(A)24 b(false)g +Fx(tz-name)d FB(means)j(the)g(system's)h(curr)o(ent)f(time)g(zone.)36 +b(When)24 b(cal-)573 814 y(culating)f(with)h(time-zones,)f(the)g +(date's)f Fx(summer?)e FB(\002eld)j(is)g(used)g(to)g(r)o(esolve)f(am-) +573 913 y(biguities:)805 1015 y Fx(#f)161 b FB(Resolve)21 +b(an)g(ambiguous)g(time)g(in)h(favor)e(of)g(non-summer)i(time.)805 +1114 y(tr)o(ue)100 b(Resolve)21 b(an)g(ambiguous)g(time)g(in)h(favor)e +(of)g(summer)h(time.)573 1213 y(This)f(is)h(useful)f(in)g(boundary)g +(cases)g(during)g(the)g(change-over)-6 b(.)25 b(For)20 +b(example,)f(in)573 1313 y(the)g(Fall,)g(when)h(US)f(daylight)g +(savings)h(time)f(changes)h(over)f(at)g(2:00)e(am,)i(1:30)f(am)573 +1412 y(happens)j(twice\227it)g(names)f(two)i(instants)f(in)h(time,)e +(an)h(hour)g(apart.)573 1539 y(Outside)31 b(of)h(these)f(boundary)g +(cases,)i(the)f Fx(summer?)c FB(\003ag)j(is)h(ignor)o(ed.)57 +b(For)31 b(ex-)573 1638 y(ample,)21 b(if)g(the)g(standar)o(d/summer)g +(change-overs)g(happen)g(in)h(the)f(Fall)h(and)e(the)573 +1738 y(Spring,)f(then)h(the)g(value)f(of)h Fx(summer?)d +FB(is)j(ignor)o(ed)f(for)h(a)f(January)f(or)i(July)g(date.)k(A)573 +1838 y(January)18 b(date)h(would)h(be)f(r)o(esolved)f(with)i(standar)o +(d)e(time,)i(and)f(a)g(July)g(date)g(with)573 1937 y(summer)i(time,)g +(r)o(egar)o(dless)e(of)h(the)h Fx(summer?)d FB(value.)573 +2064 y(The)k Fx(summer?)d FB(\003ag)j(is)g(also)g(ignor)o(ed)g(if)g +(the)g(time)g(zone)g(doesn't)g(have)g(a)f(summer)573 +2163 y(time\227for)g(example,)e(simple)j(UTC.)365 2335 +y Fx(\(date->string)39 b FA(date)p Fx(\))86 b Ft(\000)-15 +b(!)88 b FA(string)1186 b FB(pr)o(ocedur)o(e)365 2435 +y Fx(\(format-date)39 b FA(fmt)20 b(date)p Fx(\))86 b +Ft(\000)-14 b(!)87 b FA(string)1094 b FB(pr)o(ocedur)o(e)573 +2563 y Fx(Date->string)16 b FB(formats)k(the)h(date)f(as)g(a)h +(24-character)d(string)j(of)g(the)g(form:)756 2663 y(Sun)f(Sep)g(16)g +(01:03:52)d(1973)573 2789 y Fx(Format-date)26 b FB(formats)31 +b(the)g(date)f(accor)o(ding)g(to)i(the)f(format)f(string)i +FA(fmt)o FB(.)57 b(The)573 2889 y(format)16 b(string)i(is)f(copied)f +(verbatim,)h(except)f(that)g(tilde)h(characters)e(indicate)h(con-)573 +2989 y(version)21 b(speci\002ers)g(that)f(ar)o(e)f(r)o(eplaced)g(by)i +(\002elds)f(fr)o(om)h(the)f(date)g(r)o(ecor)o(d.)k(Figur)o(e)573 +3088 y(3.1)19 b(gives)i(the)g(full)g(set)g(of)g(conversion)g +(speci\002ers)g(supported)f(by)h Fx(format-date)p FB(.)365 +3260 y Fx(\(fill-in-date!)38 b FA(date)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(date)1207 b FB(pr)o(ocedur)o(e)573 3388 y(This)27 +b(pr)o(ocedur)o(e)d(\002lls)j(in)f(missing,)j(r)o(edundant)c(slots)i +(in)g(a)f(date)f(r)o(ecor)o(d.)40 b(In)26 b(de-)573 3488 +y(cr)o(easing)20 b(or)o(der)g(of)g(priority:)672 3641 +y Ft(\017)42 b Fz(year)-5 b(,)20 b(month,)f(month-day)g +Ft(\))i Fz(year)o(-day)756 3741 y FB(If)g(the)g Fx(year)p +FB(,)f Fx(month)p FB(,)f(and)i Fx(month-day)d FB(\002elds)j(ar)o(e)f +(all)i(de\002ned)f(\(ar)o(e)e(all)j(inte-)756 3841 y(gers\),)e(the)g +Fx(year-day)e FB(\002eld)j(is)g(set)f(to)i(the)f(corr)o(esponding)f +(value.)672 3961 y Ft(\017)42 b Fz(year)-5 b(,)20 b(year)o(-day)f +Ft(\))h Fz(month,)g(month-day)756 4060 y FB(If)41 b(the)h +Fx(month)e FB(and)h Fx(month-day)d FB(\002elds)k(ar)o(en't)f(set,)47 +b(but)42 b(the)g Fx(year)e FB(and)756 4160 y Fx(year-day)17 +b FB(\002elds)k(ar)o(e)e(set,)i(then)g Fx(month)e FB(and)h +Fx(month-day)d FB(ar)o(e)i(calculated.)672 4280 y Ft(\017)42 +b Fz(year)-5 b(,)20 b(month,)f(month-day)-8 b(,)19 b(year)o(-day)g +Ft(\))i Fz(week-day)756 4380 y FB(If)27 b(either)g(of)h(the)f(above)g +(r)o(ules)h(is)g(able)f(to)h(determine)f(what)h(day)f(it)h(is,)h(the) +756 4479 y Fx(week-day)17 b FB(\002eld)k(is)g(then)g(set.)672 +4599 y Ft(\017)42 b Fz(tz-secs)18 b Ft(\))j Fz(tz-name)756 +4699 y FB(If)i Fx(tz-secs)d FB(is)k(de\002ned,)g(but)g +Fx(tz-name)c FB(is)k(not,)h(it)f(is)g(assigned)g(a)f(time-zone)756 +4799 y(name)h(of)i(the)f(form)g(\223)p Fx(UTC+)p Fr(hh)11 +b Fx(:)p Fr(mm)j Fx(:)p Fr(ss)f FB(\224;)26 b(the)f(trailing)h +Fx(:)p Fr(mm)13 b Fx(:)p Fr(ss)38 b FB(portion)26 b(is)756 +4898 y(deleted)19 b(if)i(it)g(is)g(zer)o(oes.)365 5147 +y FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(71)p eop %%Page: 72 78 -72 77 bop 681 614 a FA(it)19 b(dif)o(\256cult)g(to)h(pr)o(ovide)f(interfaces) -f(that)i(ar)o(e)e(portable)h(acr)o(oss)g(dif)o(fer)o(ent)e(Unix)i(systems.) -681 714 y(Scsh's)27 b(terminal)g(support)g(is)h(based)e(primarily)h(upon)g -(the)i(P)t Fr(O)t(S)t(I)t(X)i FA(termios)c(interface.)681 814 -y(Pr)o(ograms)i(that)g(can)h(be)f(written)h(using)g(only)g(the)i(P)t -Fr(O)t(S)t(I)t(X)h FA(interface)28 b(ar)o(e)g(likely)i(to)g(be)681 -913 y(widely)21 b(portable.)805 1060 y(The)f(bulk)g(of)g(the)g(documentation) -h(that)e(follows)i(consists)g(of)f(several)f(pages)g(worth)681 -1160 y(of)25 b(tables)h(de\256ning)g(dif)o(fer)o(ent)d(named)j(constants)g -(that)g(enable)f(and)g(disable)g(dif)o(fer)o(ent)681 1259 y(featur)o(es)20 -b(of)h(the)h(terminal)g(driver)-6 b(.)29 b(Some)22 b(of)f(these)h(\257ags)g -(ar)o(e)g(P)t Fr(O)t(S)t(I)t(X)r FA(;)i(others)e(ar)o(e)e(taken)681 -1359 y(fr)o(om)d(the)h(two)g(common)h(branches)e(of)h(Unix)f(development,)h -(SVR4)f(and)h(4.3+)e(Berkeley)-9 b(.)681 1459 y(Scsh)21 b(guarantees)e(that)i -(the)g(non-)r(P)t Fr(O)t(S)t(I)t(X)k FA(constants)d(will)f(be)f(bound)i -(identi\256ers.)805 1687 y Fs(\017)41 b FA(If)22 b(your)h(OS)f(supports)h(a)f -(particular)f(non-)r(P)t Fr(O)t(S)t(I)t(X)26 b FA(\257ag,)d(its)f(named)g -(constant)h(will)888 1786 y(be)e(bound)g(to)g(the)g(\257ag's)g(value.)805 -1982 y Fs(\017)41 b FA(If)26 b(your)h(OS)f(doesn't)g(support)h(the)f(\257ag,) -h(its)g(named)f(constant)g(will)h(be)f(pr)o(esent,)888 2082 -y(but)21 b(bound)g(to)g Fw(#f)p FA(.)681 2310 y(This)15 b(means)h(that)f(if)f -(you)i(want)f(to)h(use)f(SVR4)f(or)i(Berkeley)e(featur)o(es)f(in)j(a)e(pr)o -(ogram,)i(your)681 2409 y(pr)o(ogram)21 b(can)h(portably)g(test)h(the)f -(values)g(of)g(the)h(\257ags)g(befor)o(e)e(using)i(them\320the)g(\257ags)681 -2509 y(can)28 b(r)o(eliably)g(be)h(r)o(efer)o(enced)d(without)k(pr)o(oducing) -f(OS-dependent)f(\252unbound)h(vari-)681 2608 y(able\272)19 -b(err)o(ors.)805 2755 y(Finally)-9 b(,)19 b(note)f(that)g(although)j(P)t -Fr(O)t(S)t(I)t(X)r FA(,)f(SVR4,)d(and)h(Berkeley)f(cover)h(the)g(lion's)h -(shar)o(e)681 2855 y(of)i(the)f(terminal-driver)g(functionality)-9 -b(,)21 b(each)f(operating)h(system)h(inevitably)f(has)f(non-)681 -2954 y(standar)o(d)33 b(extensions.)73 b(While)35 b(a)g(particular)f(scsh)i -(implementation)h(may)e(pr)o(ovide)681 3054 y(these)21 b(extensions,)g(they)g -(ar)o(e)f(not)h(portable,)f(and)g(so)i(ar)o(e)d(not)i(documented)g(her)o(e.) -681 3362 y Fy(3.12.2)80 b(The)21 b(tty-info)e(record)i(type)681 -3574 y FA(The)35 b(primary)g(data-str)o(uctur)o(e)e(that)i(describes)g(a)g -(terminal's)h(mode)f(is)h(a)e Fw(tty-info)681 3674 y FA(r)o(ecor)o(d,)19 -b(de\256ned)h(as)g(follows:)888 3902 y Fw(\(define-record)38 -b(tty-info)976 4002 y(control-chars)81 b(;)43 b(String:)e(Magic)h(input)f -(chars)976 4101 y(input-flags)169 b(;)43 b(Int:)f(Input)g(processing)976 -4201 y(output-flags)125 b(;)43 b(Int:)f(Output)g(processing)976 -4300 y(control-flags)81 b(;)43 b(Int:)f(Serial-line)d(control)976 -4400 y(local-flags)169 b(;)43 b(Int:)f(Line-editting)d(UI)976 -4500 y(input-speed)169 b(;)43 b(Int:)f(Code)g(for)h(input)e(speed)976 -4599 y(output-speed)125 b(;)43 b(Int:)f(Code)g(for)h(output)e(speed)976 -4699 y(min)521 b(;)43 b(Int:)f(Raw-mode)f(input)g(policy)976 -4799 y(time\))433 b(;)43 b(Int:)f(Raw-mode)f(input)g(policy)681 -5147 y FA(72)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +72 77 bop 681 1129 2865 4 v 681 4301 4 3173 v 759 1274 +a Fx(~~)99 b FB(Converted)20 b(to)h(the)g Fx(~)f FB(character)-6 +b(.)759 1399 y Fx(~a)99 b FB(abbr)o(eviated)18 b(weekday)i(name)759 +1523 y Fx(~A)99 b FB(full)20 b(weekday)g(name)759 1648 +y Fx(~b)99 b FB(abbr)o(eviated)18 b(month)k(name)759 +1772 y Fx(~B)99 b FB(full)20 b(month)i(name)759 1897 +y Fx(~c)99 b FB(time)21 b(and)f(date)g(using)h(the)g(time)g(and)g(date) +f(r)o(epr)o(esentation)f(for)i(the)g(locale)946 1996 +y(\()p Fx(~X)42 b(~x)p FB(\))759 2121 y Fx(~d)99 b FB(day)20 +b(of)h(the)f(month)j(as)d(a)g(decimal)g(number)h(\(01-31\))759 +2245 y Fx(~H)99 b FB(hour)21 b(based)f(on)h(a)f(24-hour)g(clock)h(as)g +(a)f(decimal)g(number)h(\(00-23\))759 2370 y Fx(~I)99 +b FB(hour)21 b(based)f(on)h(a)f(12-hour)g(clock)h(as)g(a)f(decimal)g +(number)h(\(01-12\))759 2495 y Fx(~j)99 b FB(day)20 b(of)h(the)f(year)g +(as)h(a)f(decimal)g(number)h(\(001-366\))759 2619 y Fx(~m)99 +b FB(month)22 b(as)e(a)g(decimal)h(number)g(\(01-12\))759 +2744 y Fx(~M)99 b FB(minute)21 b(as)g(a)f(decimal)g(number)h(\(00-59\)) +759 2868 y Fx(~p)99 b FB(AM/PM)19 b(designation)j(associated)e(with)i +(a)e(12-hour)g(clock)759 2993 y Fx(~S)99 b FB(second)21 +b(as)f(a)g(decimal)h(number)f(\(00-61\))759 3117 y Fx(~U)99 +b FB(week)20 b(number)h(of)g(the)g(year;)f(Sunday)g(is)h(\002rst)g(day) +f(of)h(week)f(\(00-53\))759 3242 y Fx(~w)99 b FB(weekday)20 +b(as)g(a)g(decimal)h(number)g(\(0-6\),)d(wher)o(e)i(Sunday)g(is)h(0)759 +3366 y Fx(~W)99 b FB(week)20 b(number)h(of)g(the)g(year;)f(Monday)g(is) +h(\002rst)g(day)f(of)h(week)g(\(00-53\))759 3491 y Fx(~x)99 +b FB(date)19 b(using)j(the)f(date)f(r)o(epr)o(esentation)f(for)i(the)g +(locale)759 3615 y Fx(~X)99 b FB(time)21 b(using)g(the)g(time)g(r)o +(epr)o(esentation)f(for)g(the)h(locale)759 3740 y Fx(~y)99 +b FB(year)20 b(without)i(century)e(\(00-99\))759 3864 +y Fx(~Y)99 b FB(year)20 b(with)h(century)g(\()p FA(e.g.)o +FB(1990\))759 3989 y Fx(~Z)99 b FB(time)21 b(zone)f(name)h(or)g(abbr)o +(eviation,)e(or)i(no)h(characters)d(if)i(no)g(time)g(zone)g(is)946 +4089 y(determinable)1275 4278 y(Figur)o(e)f(3.1:)k Fx(format-date)17 +b FB(conversion)k(speci\002ers)p 3542 4301 V 681 4304 +2865 4 v 681 5147 a(72)p 1952 5071 323 4 v 1952 5173 +4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 +v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 73 79 -73 78 bop 365 614 a Fy(The)21 b(control-characters)d(string)365 -822 y FA(The)h Fw(control-chars)14 b FA(\256eld)k(is)i(a)e(character)f -(string;)j(its)f(characters)f(may)h(be)f(indexed)g(by)365 921 -y(integer)j(values)f(taken)h(fr)o(om)f(table)h(3.1.)490 1064 -y(As)27 b(discussed)h(above,)g(only)h(the)h(P)t Fr(O)t(S)t(I)t(X)h -FA(entries)d(in)g(table)f(3.1)g(ar)o(e)f(guaranteed)g(to)365 -1164 y(be)e(legal,)h(integer)f(indices.)38 b(A)24 b(pr)o(ogram)g(can)g(r)o -(eliably)f(test)h(the)h(OS)f(to)g(see)g(if)h(the)f(non-)367 -1263 y(P)t Fr(O)t(S)t(I)t(X)e FA(characters)17 b(ar)o(e)g(supported)i(by)f -(checking)h(the)g(index)f(constants.)28 b(If)18 b(the)h(contr)o(ol-)365 -1363 y(character)g(function)j(is)f(supported)f(by)h(the)f(terminal)h(driver) --6 b(,)20 b(then)h(the)f(corr)o(esponding)365 1463 y(index)d(will)h(be)f -(bound)g(to)h(an)f(integer;)h(if)f(it)g(is)h(not)g(supported,)f(the)h(index)f -(will)g(be)g(bound)365 1562 y(to)k Fw(#f)p FA(.)490 1705 y(T)-8 -b(o)21 b(disable)e(a)h(given)g(contr)o(ol-character)f(function,)i(set)f(its)h -(corr)o(esponding)f(entry)g(in)365 1805 y(the)15 b Fw(tty-info:control)o(-ch) -o(ar)o(s)9 b FA(string)15 b(to)g(the)g(special)f(character)f -Fw(disable-tty-char)365 1905 y FA(\(and)21 b(then)h(use)f(the)h -Fw(\(set-tty-info)38 b Fz(fd/port)k(info)p Fw(\))21 b FA(pr)o(ocedur)o(e)e -(to)j(update)e(the)i(termi-)365 2004 y(nal's)f(state\).)365 -2303 y Fy(The)g(\257ag)f(\256elds)365 2510 y FA(The)49 b Fw(tty-info)c -FA(r)o(ecor)o(d's)i Fw(input-flags)p FA(,)j Fw(output-flags)p -FA(,)g Fw(control-flags)p FA(,)g(and)365 2610 y Fw(local-flags)22 -b FA(\256elds)27 b(ar)o(e)e(all)h(bit)h(sets)g(r)o(epr)o(esented)d(as)j -(two's-complement)h(integers.)365 2709 y(Their)15 b(values)f(ar)o(e)f -(composed)h(by)h(or)6 b('ing)15 b(together)g(values)f(taken)g(fr)o(om)g(the)g -(named)g(con-)365 2809 y(stants)21 b(listed)g(in)g(tables)g(3.2)e(thr)o(ough) -j(3.6.)490 2952 y(As)17 b(discussed)h(above,)f(only)i(the)h(P)t -Fr(O)t(S)t(I)t(X)h FA(entries)d(listed)g(in)g(these)g(tables)f(ar)o(e)g -(guaran-)365 3052 y(teed)23 b(to)h(be)g(legal,)g(integer)f(\257ag)h(values.) -36 b(A)23 b(pr)o(ogram)g(can)h(r)o(eliably)f(test)g(the)h(OS)g(to)g(see)365 -3151 y(if)h(the)g(non-)r(P)t Fr(O)t(S)t(I)t(X)k FA(\257ags)c(ar)o(e)e -(supported)i(by)g(checking)g(the)g(named)g(constants.)40 b(If)24 -b(the)365 3251 y(featur)o(e)17 b(is)j(supported)f(by)g(the)g(terminal)g -(driver)-6 b(,)18 b(then)i(the)f(corr)o(esponding)g(\257ag)g(will)h(be)365 -3350 y(bound)h(to)h(an)e(integer;)h(if)f(it)h(is)g(not)h(supported,)e(the)h -(\257ag)g(will)g(be)g(bound)g(to)g Fw(#f)p FA(.)365 3649 y -Fy(The)g(speed)e(\256elds)365 3856 y FA(The)f Fw(input-speed)13 -b FA(and)k Fw(output-speed)c FA(\256elds)k(determine)h(the)g(I/O)g(rate)e(of) -i(the)g(termi-)365 3956 y(nal's)26 b(line.)43 b(The)25 b(value)g(of)h(these)g -(\256elds)f(is)h(an)g(integer)g(giving)g(the)g(speed)f(in)h(bits-per)o(-)365 -4055 y(second.)i(The)21 b(following)h(speeds)e(ar)o(e)g(supported)g(by)j(P)t -Fr(O)t(S)t(I)t(X)r FA(:)1417 4279 y(0)100 b(134)139 b(600)h(4800)1376 -4379 y(50)99 b(150)f(1200)139 b(9600)1376 4478 y(75)99 b(200)f(1800)f(19200) -1339 4578 y(1)-5 b(10)99 b(300)f(2400)f(38400)365 4799 y(Y)-8 -b(our)27 b(OS)g(may)f(accept)f(others;)k(it)e(may)f(also)g(allow)h(the)f -(special)g(symbols)i Fw('exta)c FA(and)365 4898 y Fw('extb)p -FA(.)365 5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p -1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 -V 1636 5176 323 4 v 1216 w FA(73)p eop +73 78 bop 672 614 a Ft(\017)42 b Fz(tz-name,)17 b(date,)i(summer?)25 +b Ft(\))c Fz(tz-secs,)d(summer?)756 714 y FB(If)f(the)i(date)e +(information)i(is)g(pr)o(ovided)e(up)h(to)h(second)f(r)o(esolution,)h +Fx(tz-name)756 814 y FB(is)j(also)h(pr)o(ovided,)e(and)h +Fx(tz-secs)d FB(is)k(not)g(set,)f(then)h Fx(tz-secs)d +FB(and)h Fx(summer?)756 913 y FB(ar)o(e)34 b(set)i(to)h(their)f(corr)o +(ect)f(values.)71 b(Summer)o(-time)36 b(ambiguities)g(ar)o(e)f(r)o(e-) +756 1013 y(solved)21 b(using)i(the)f(original)g(value)f(of)h +Fx(summer?)p FB(.)j(If)d(the)f(time)h(zone)g(doesn't)756 +1112 y(have)e(a)g(summer)h(time)g(variant,)f(then)h Fx(summer?)d +FB(is)j(set)g(to)g Fx(#f)p FB(.)672 1256 y Ft(\017)42 +b Fz(local)19 b(time,)g(date,)g(summer?)25 b Ft(\))20 +b Fz(tz-name,)e(tz-secs,)h(summer?)756 1356 y FB(If)24 +b(the)g(date)g(information)i(is)f(pr)o(ovided)e(up)i(to)g(second)f(r)o +(esolution,)i(but)f(no)756 1455 y(time)16 b(zone)f(information)i(is)f +(pr)o(ovided)f(\(both)h Fx(tz-name)d FB(and)j Fx(tz-secs)d +FB(ar)o(en't)756 1555 y(set\),)24 b(then)g(we)g(pr)o(oceed)e(as)i(in)g +(the)g(above)f(case,)h(except)f(the)h(system's)h(cur)o(-)756 +1654 y(r)o(ent)20 b(time)h(zone)f(is)i(used.)573 1842 +y(These)31 b(r)o(ules)g(allow)g(one)h(particular)d(ambiguity)j(to)f +(escape:)45 b(if)31 b(both)g Fx(tz-name)573 1941 y FB(and)c +Fx(tz-secs)d FB(ar)o(e)i(set,)i(they)g(ar)o(e)e(not)i(br)o(ought)f +(into)h(agr)o(eement.)44 b(It)27 b(isn't)h(clear)573 +2041 y(how)21 b(to)h(do)e(this,)i(nor)f(is)g(it)g(clear)f(which)h(one)h +(should)f(take)f(pr)o(ecedence.)756 2242 y FE(Oops:)50 +b Fh(fill-in-date!)22 b Fk(isn't)d(implemented)f(yet.)365 +2670 y Fv(3.1)l(1)100 b(Environment)24 b(variables)365 +2924 y Fx(\(setenv)41 b FA(var)20 b(val)p Fx(\))87 b +Ft(\000)-15 b(!)88 b FA(unde\002ned)1226 b FB(pr)o(ocedur)o(e)365 +3024 y Fx(\(getenv)41 b FA(var)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(string)1476 b FB(pr)o(ocedur)o(e)573 3154 +y(These)21 b(functions)i(get)e(and)g(set)h(the)g(pr)o(ocess)f(envir)o +(onment,)h(stor)o(ed)f(in)h(the)f(exter)o(-)573 3253 +y(nal)h(C)g(variable)f Fx(char)41 b(**environ)p FB(.)26 +b(An)c(envir)o(onment)h(variable)d FA(var)i FB(is)h(a)e(string.)573 +3353 y(If)k(an)g(envir)o(onment)g(variable)f(is)i(set)f(to)h(a)e +(string)i FA(val)p FB(,)g(then)f(the)h(pr)o(ocess')e(global)573 +3452 y(envir)o(onment)i(str)o(uctur)o(e)g(is)g(alter)o(ed)f(with)h(an)g +(entry)g(of)g(the)h(form)f Fx(")p FA(var)o Fx(=)p FA(val)o +Fx(")p FB(.)41 b(If)573 3552 y FA(val)20 b FB(is)h Fx(#f)p +FB(,)f(then)h(any)g(entry)g(for)f FA(var)h FB(is)g(deleted.)365 +3775 y Fx(\(env->alist\))83 b Ft(\000)-15 b(!)87 b FA(string)p +Ft(!)p FA(string)21 b(alist)1006 b FB(pr)o(ocedur)o(e)573 +3927 y(The)21 b Fx(env->alist)c FB(pr)o(ocedur)o(e)i(converts)i(the)g +(entir)o(e)f(envir)o(onment)i(into)g(an)f(alist,)573 +4026 y FA(e.g.)o FB(,)756 4213 y Fx(\(\("TERM")40 b(.)j("vt100"\))799 +4313 y(\("SHELL")d(.)k("/bin/csh"\))799 4413 y(\("EDITOR")c(.)j +("emacs"\))799 4512 y(...\))365 4845 y(\(alist->env)c +FA(alist)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(unde\002ned)1142 +b FB(pr)o(ocedur)o(e)365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v +540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w +FB(73)p eop %%Page: 74 80 -74 79 bop 681 614 a Fy(The)20 b(min)g(and)g(time)f(\256elds)681 -807 y FA(The)30 b(integer)g Fw(min)f FA(and)h Fw(time)f FA(\256elds)h -(determine)g(input)h(blocking)g(behaviour)f(during)681 907 -y(non-canonical)18 b(\(raw\))f(input;)i(otherwise,)g(they)g(ar)o(e)d(ignor)o -(ed.)26 b(See)17 b(the)i(termios\(3\))e(man)681 1006 y(page)j(for)g(further)h -(details.)805 1138 y(Be)29 b(warned)g(that)i(P)t Fr(O)t(S)t(I)t(X)i -FA(allows)d(the)f(base)g(system)h(call's)f(r)o(epr)o(esentation)g(of)g(the) -681 1238 y Fw(tty-info)13 b FA(r)o(ecor)o(d)i(to)i(shar)o(e)f(storage)g(for)h -(the)g Fw(min)e FA(\256eld)i(and)f(the)h Fw(ttychar/eof)12 -b FA(element)681 1337 y(of)21 b(the)g(contr)o(ol-characters)f(string,)i(and)f -(for)g(the)h Fw(time)d FA(\256eld)i(and)g(the)h Fw(ttychar/eol)16 -b FA(el-)681 1437 y(ement)21 b(of)f(the)h(contr)o(ol-characters)f(string.)28 -b(Many)20 b(implementations)i(in)g(fact)d(do)i(this.)805 1569 -y(T)-8 b(o)20 b(stay)e(out)i(of)e(tr)o(ouble,)h(set)g(the)g -Fw(min)e FA(and)h Fw(time)g FA(\256elds)g(only)i(if)f(you)g(ar)o(e)e(putting) -j(the)681 1669 y(terminal)25 b(into)h(raw)e(mode;)j(set)e(the)g(eof)g(and)f -(eol)i(contr)o(ol-characters)d(only)j(if)f(you)g(ar)o(e)681 -1768 y(putting)c(the)g(terminal)g(into)h(canonical)e(mode.)28 -b(It's)21 b(ugly)-9 b(,)21 b(but)g(it's)g(Unix.)681 2038 y -Fy(3.12.3)80 b(Using)20 b(tty-info)g(records)681 2253 y Fw(\(make-tty-info)38 -b Fz(if)14 b(of)f(cf)h(lf)g(ispeed)g(ospeed)g(min)f(time)p -Fw(\))43 b Fs(\000)-14 b(!)43 b Fz(tty-info-r)o(ecord)85 b -FA(pr)o(ocedur)o(e)681 2353 y Fw(\(copy-tty-info)38 b Fz(tty-info-r)o(ecord)p -Fw(\))84 b Fs(\000)-14 b(!)87 b Fz(tty-info-r)o(ecord)504 b -FA(pr)o(ocedur)o(e)888 2480 y(These)25 b(pr)o(ocedur)o(es)d(make)i(it)g -(possible)h(to)g(cr)o(eate)d(new)j Fw(tty-info)c FA(r)o(ecor)o(ds.)36 -b(The)888 2579 y(typical)29 b(method)h(for)f(cr)o(eating)f(a)h(new)g(r)o -(ecor)o(d)e(is)j(to)f(copy)h(one)f(r)o(etrieved)e(by)j(a)888 -2679 y(call)d(to)h(the)g Fw(tty-info)c FA(pr)o(ocedur)o(e,)j(then)h(modify)f -(the)h(copy)g(as)f(desir)o(ed.)46 b(Note)888 2779 y(that)16 -b(the)g Fw(make-tty-info)10 b FA(pr)o(ocedur)o(e)k(does)i(not)g(take)g(a)f -(parameter)f(to)i(de\256ne)g(the)888 2878 y(new)28 b(r)o(ecor)o(d's)e(contr)o -(ol)h(characters.)2074 2848 y Ft(4)2157 2878 y FA(Instead,)h(it)g(simply)g(r) -o(eturns)f(a)f Fw(tty-info)888 2978 y FA(r)o(ecor)o(d)16 b(whose)i(contr)o -(ol-character)e(string)i(has)g(all)f(elements)h(initialised)f(to)j(A)t -Fr(S)t(C)t(I)t(I)888 3078 y FA(nul.)79 b(Y)-8 b(ou)38 b(may)g(then)g(install) -g(the)f(special)g(characters)g(by)g(assigning)i(to)f(the)888 -3177 y(string.)45 b(Similarly)-9 b(,)27 b(the)f(contr)o(ol-character)f -(string)i(in)f(the)h(r)o(ecor)o(d)d(pr)o(oduced)h(by)888 3277 -y Fw(copy-tty-info)17 b FA(does)k(not)i(shar)o(e)e(str)o(uctur)o(e)g(with)h -(the)g(string)h(in)f(the)g(r)o(ecor)o(d)e(be-)888 3376 y(ing)i(copied,)e(so)h -(you)h(may)e(mutate)h(it)g(fr)o(eely)-9 b(.)681 3582 y Fw(\(tty-info)40 -b Fz(fd/port)p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(tty-info-r)o(ecord)983 -b FA(pr)o(ocedur)o(e)888 3728 y(The)33 b Fz(fd/port)e FA(parameter)g(is)i(an) -f(integer)g(\256le)h(descriptor)f(or)h(Scheme)f(I/O)h(port)888 -3828 y(opened)24 b(on)h(a)e(terminal)i(device.)36 b(This)25 -b(pr)o(ocedur)o(e)d(r)o(eturns)h(a)h Fw(tty-info)d FA(r)o(ecor)o(d)888 -3927 y(describing)g(the)g(terminal's)g(curr)o(ent)f(mode.)681 -4133 y Fw(\(set-tty-info/no)o(w)37 b Fz(fd/port)20 b(info)p -Fw(\))87 b Fs(\000)-15 b(!)87 b Fz(no-value)685 b FA(pr)o(ocedur)o(e)681 -4233 y Fw(\(set-tty-info/dr)o(ai)o(n)38 b Fz(fd/port)19 b(info)p -Fw(\))87 b Fs(\000)-15 b(!)88 b Fz(no-value)597 b FA(pr)o(ocedur)o(e)681 -4332 y Fw(\(set-tty-info/fl)o(us)o(h)38 b Fz(fd/port)19 b(info)p -Fw(\))87 b Fs(\000)-15 b(!)88 b Fz(no-value)597 b FA(pr)o(ocedur)o(e)888 -4478 y(The)33 b Fz(fd/port)e FA(parameter)g(is)i(an)f(integer)g(\256le)h -(descriptor)f(or)h(Scheme)f(I/O)h(port)888 4578 y(opened)14 -b(on)h(a)f(terminal)g(device.)24 b(The)15 b(pr)o(ocedur)o(e)d(chosen)j -(determines)f(when)g(and)888 4678 y(how)22 b(the)f(terminal's)g(mode)g(is)g -(alter)o(ed:)p 681 4742 1146 4 v 766 4796 a Fo(4)800 4819 y -Fr(Why?)j(Because)18 b(the)e(length)g(of)h(the)f(string)h(varies)h(fr)o(om)f -(Unix)g(to)g(Unix.)23 b(For)17 b(example,)g(the)f(wor)o(d-erase)681 -4898 y(contr)o(ol)h(character)h(\(typically)f(contr)o(ol-w\))h(is)f(pr)o -(ovided)f(by)g(most)h(Unixes,)f(but)g(not)g(part)h(of)g(the)g(P)t -Fn(O)t(S)t(I)t(X)f Fr(spec.)681 5147 y FA(74)p 1952 5071 323 -4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 -323 4 v 435 w FD(November)i(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +74 79 bop 888 614 a FA(Alist)29 b FB(must)g(be)f(an)g(alist)h(whose)g +(keys)g(ar)o(e)e(all)h(strings,)j(and)d(whose)h(values)f(ar)o(e)888 +714 y(all)i(either)g(strings)h(or)f(string)g(lists.)54 +b(String)30 b(lists)g(ar)o(e)f(converted)g(to)h(colon)h(lists)888 +814 y(\(see)c(below\).)46 b(The)27 b(alist)h(is)g(installed)f(as)g(the) +h(curr)o(ent)e(Unix)i(envir)o(onment)g(\()p FA(i.e.)o +FB(,)888 913 y(converted)23 b(to)g(a)g(null-terminated)g(C)g(vector)f +(of)h Fx(")p FA(var)p Fx(=)p FA(val)o Fx(")f FB(strings)i(which)g(is)g +(as-)888 1013 y(signed)d(to)h(the)e(global)h Fx(char)42 +b(**environ)p FB(\).)805 1175 y(The)21 b(following)i(thr)o(ee)d +(functions)i(help)f(the)g(pr)o(ogrammer)f(manipulate)g(alist)h(tables) +681 1275 y(in)f(some)g(generally)g(useful)f(ways.)26 +b(They)20 b(ar)o(e)e(all)h(de\002ned)h(using)g Fx(equal?)e +FB(for)h(key)h(com-)681 1375 y(parison.)681 1517 y Fx(\(alist-delete)38 +b FA(key)20 b(alist)p Fx(\))87 b Ft(\000)-14 b(!)87 b +FA(alist)1110 b FB(pr)o(ocedur)o(e)888 1651 y(Delete)21 +b(any)g(entry)f(labelled)g(by)h(value)f FA(key)p FB(.)681 +1931 y Fx(\(alist-update)38 b FA(key)20 b(val)h(alist)p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(alist)988 b FB(pr)o(ocedur)o(e)888 +2066 y(Delete)21 b FA(key)f FB(fr)o(om)h FA(alist)p FB(,)f(then)h(cons) +h(on)f(a)f Fx(\()p FA(key)43 b Fx(.)g FA(val)p Fx(\))20 +b FB(entry)-9 b(.)681 2346 y Fx(\(alist-compress)37 b +FA(alist)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(alist)1154 +b FB(pr)o(ocedur)o(e)888 2480 y(Compr)o(esses)21 b FA(alist)g +FB(by)f(r)o(emoving)h(shadowed)g(entries.)26 b(Example:)1071 +2639 y Fx(;;;)42 b(Shadowed)f(\(1)h(.)i(c\))e(entry)g(removed.)1071 +2739 y(\(alist-compress)37 b('\()43 b(\(1)g(.)g(a\))g(\(2)g(.)g(b\))g +(\(1)f(.)h(c\))g(\(3)g(.)g(d\))g(\)\))1245 2838 y Fm(=)-14 +b Ft(\))87 b Fx(\(\(1)43 b(.)g(a\))g(\(2)f(.)h(b\))g(\(3)g(.)g(d\)\)) +681 3095 y(\(with-env*)c FA(env-alist-delta)20 b(thunk)p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(value\(s\))20 b(of)h(thunk)391 +b FB(pr)o(ocedur)o(e)681 3194 y Fx(\(with-total-env*)37 +b FA(env-alist)20 b(thunk)p Fx(\))87 b Ft(\000)-15 b(!)88 +b FA(value\(s\))20 b(of)g(thunk)319 b FB(pr)o(ocedur)o(e)888 +3329 y(These)35 b(pr)o(ocedur)o(es)d(call)i FA(thunk)f +FB(in)i(the)f(context)h(of)f(an)g(alter)o(ed)f(envir)o(onment.)888 +3428 y(They)20 b(r)o(eturn)f(whatever)h(values)f FA(thunk)g +FB(r)o(eturns.)25 b(Non-local)20 b(r)o(eturns)f(r)o(estor)o(e)g(the)888 +3528 y(envir)o(onment)g(to)f(its)g(outer)f(value;)h(thr)o(owing)h(back) +e(into)h(the)g(thunk)h(by)f(invoking)888 3628 y(a)j(stor)o(ed)f +(continuation)i(r)o(estor)o(es)e(the)h(envir)o(onment)g(back)f(to)h +(its)g(inner)h(value.)888 3757 y(The)17 b FA(env-alist-delta)e +FB(ar)o(gument)h(speci\002es)g(a)g FA(modi\002cation)f +FB(to)i(the)g(curr)o(ent)e(envir)o(on-)888 3857 y(ment\227)p +FA(thunk)p FB('s)21 b(envir)o(onment)g(is)f(the)h(original)g(envir)o +(onment)g(overridden)e(with)888 3956 y(the)i(bindings)h(speci\002ed)e +(by)h(the)g(alist)g(delta.)888 4085 y(The)g FA(env-alist)g +FB(ar)o(gument)g(speci\002es)g(a)g(complete)g(envir)o(onment)g(that)h +(is)f(installed)888 4185 y(for)g FA(thunk)o FB(.)681 +4366 y Fx(\(with-env)40 b FA(env-alist-delta)19 b(.)i(body)p +Fx(\))86 b Ft(\000)-15 b(!)88 b FA(value\(s\))20 b(of)g(body)608 +b FB(syntax)681 4465 y Fx(\(with-total-env)37 b FA(env-alist)20 +b(.)h(body)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(value\(s\))20 +b(of)h(body)535 b FB(syntax)888 4599 y(These)34 b(special)f(forms)h(pr) +o(ovide)f(syntactic)h(sugar)f(for)h Fx(with-env*)c FB(and)j +Fx(with-)888 4699 y(total-env*)p FB(.)21 b(The)e(env)h(alists)f(ar)o(e) +f(not)i(evaluated)e(positions,)j(but)e(ar)o(e)f(implicitly)888 +4799 y(backquoted.)33 b(In)23 b(this)h(way)-9 b(,)23 +b(they)g(tend)g(to)h(r)o(esemble)e(binding)i(lists)g(for)f +Fx(let)e FB(and)888 4898 y Fx(let*)e FB(forms.)681 5147 +y(74)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)g(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p eop %%Page: 75 81 -75 80 bop 689 535 2425 4 v 689 634 4 100 v 742 604 a FA(Pr)o(ocedur)o(e)507 -b(Meaning)p 3110 634 V 689 638 2425 4 v 689 654 V 689 754 4 -100 v 742 724 a Fw(set-tty-info/now)180 b FA(Make)20 b(change)g(immediately) --9 b(.)p 3110 754 V 689 853 V 742 824 a Fw(set-tty-info/dra)o(in)93 -b FA(Drain)21 b(output,)g(then)g(change.)p 3110 853 V 689 953 -V 742 923 a Fw(set-tty-info/flu)o(sh)93 b FA(Drain)21 b(output,)g(\257ush)h -(input,)f(then)g(change.)p 3110 953 V 689 956 2425 4 v 365 -1261 a Fy(3.12.4)81 b(Other)20 b(terminal-device)d(procedures)365 -1492 y Fw(\(send-tty-break)38 b Fz(fd/port)19 b([duration])p -Fw(\))86 b Fs(\000)-15 b(!)87 b Fz(no-value)556 b FA(pr)o(ocedur)o(e)573 -1624 y(Send)33 b(a)h(br)o(eak)f(signal)i(on)f(the)h(terminal)f(associated)f -(with)i(\256le)g(descriptor)e(or)573 1724 y(Scheme)24 b(I/O)h(port)g -Fz(fd/port)n FA(.)39 b(A)24 b(br)o(eak)g(signal)h(is)g(a)f(sequence)h(of)f -(continuous)j(ze-)573 1824 y(r)o(os)20 b(on)i(the)f(terminal's)g -(transmission)h(line.)573 1972 y(The)g Fz(duration)g FA(ar)o(gument)g -(determines)g(the)g(length)h(of)f(the)h(br)o(eak)e(signal.)32 -b(A)22 b(zer)o(o)573 2072 y(value)i(\(the)g(default\))f(causes)h(a)f(br)o -(eak)g(of)i(between)f(0.25)e(and)i(0.5)f(seconds)i(to)g(be)573 -2171 y(sent;)20 b(other)g(values)g(determine)f(a)h(period)f(in)h(a)g(manner)g -(that)f(will)i(depend)e(upon)573 2271 y(local)i(community)h(standar)o(ds.)365 -2509 y Fw(\(drain-tty)40 b Fz(fd/port)p Fw(\))85 b Fs(\000)-14 -b(!)87 b Fz(no-value)1140 b FA(pr)o(ocedur)o(e)573 2666 y(This)14 -b(pr)o(ocedur)o(e)e(waits)i(until)h(all)f(the)g(output)h(written)f(to)g(the)g -(terminal)g(device)g(has)573 2765 y(been)23 b(transmitted)g(to)h(the)g -(device.)34 b(If)23 b Fz(fd/port)f FA(is)i(an)f(output)h(port)f(with)h(buf)o -(fer)o(ed)573 2865 y(I/O)e(enabled,)g(then)g(the)g(port's)g(buf)o(fer)o(ed)e -(characters)g(ar)o(e)h(\257ushed)h(befor)o(e)f(wait-)573 2965 -y(ing)g(for)g(the)g(device)f(to)h(drain.)365 3203 y Fw(\(flush-tty/input)37 -b Fz(fd/port)p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(no-value)879 -b FA(pr)o(ocedur)o(e)365 3302 y Fw(\(flush-tty/output)37 b -Fz(fd/port)p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(no-value)835 -b FA(pr)o(ocedur)o(e)365 3402 y Fw(\(flush-tty/both)38 b Fz(fd/port)p -Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(no-value)922 b FA(pr)o(ocedur)o(e)573 -3559 y(These)33 b(pr)o(ocedur)o(es)e(discar)o(d)g(the)i(unr)o(ead)f(input)i -(chars)e(or)h(unwritten)h(output)573 3659 y(chars)20 b(in)i(the)e(tty's)i -(kernel)e(buf)o(fers.)365 3897 y Fw(\(start-tty-output)37 b -Fz(fd/port)p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(no-value)835 -b FA(pr)o(ocedur)o(e)365 3996 y Fw(\(stop-tty-output)37 b Fz(fd/port)p -Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(no-value)879 b FA(pr)o(ocedur)o(e)365 -4096 y Fw(\(start-tty-input)37 b Fz(fd/port)p Fw(\))85 b Fs(\000)-14 -b(!)87 b Fz(no-value)879 b FA(pr)o(ocedur)o(e)365 4195 y Fw(\(stop-tty-input) -38 b Fz(fd/port)p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(no-value)922 -b FA(pr)o(ocedur)o(e)573 4352 y(These)28 b(pr)o(ocedur)o(es)f(can)h(be)g -(used)h(to)f(contr)o(ol)h(a)f(terminal's)h(input)g(and)f(output)573 -4452 y(\257ow)-8 b(.)28 b(The)21 b Fw(stop-tty-output)14 b -FA(and)19 b Fw(start-tty-output)14 b FA(pr)o(ocedur)o(es)k(suspend)573 -4552 y(and)32 b(r)o(esume)f(output)i(fr)o(om)e(a)h(terminal)g(device.)61 -b(The)32 b Fw(stop-tty-input)26 b FA(and)573 4651 y Fw(start-tty-input)9 -b FA(pr)o(ocedur)o(es)14 b(transmit)i(the)g(special)g(ST)o(OP)f(and)g(ST)-6 -b(AR)m(T)15 b(char)o(-)573 4751 y(acters)i(to)h(the)g(terminal)g(with)g(the)g -(intention)i(of)d(stopping)i(and)e(starting)h(terminal)573 -4850 y(input)j(\257ow)-8 b(.)365 5147 y FD(November)18 b(1,)h(1995)h(\261)f -(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w -FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FA(75)p eop +75 80 bop 490 614 a FB(Example:)39 b(These)28 b(four)f(pieces)h(of)f +(code)h(all)g(r)o(un)g(the)g(mailer)g(with)g(special)g +Fx($TERM)365 706 y FB(and)21 b Fx($EDITOR)c FB(values.)573 +841 y Fh(\(with-env)41 b(\(\("TERM")g(.)f("xterm"\))h(\("EDITOR")g(.)e +(,my-editor\)\))651 933 y(\(run)h(\(mail)h(shivers@lcs.mit.edu\)\)\)) +573 1115 y(\(with-env*)g(`\(\("TERM")h(.)d("xterm"\))i(\("EDITOR")g(.)f +(,my-editor\)\))651 1207 y(\()n Fe(\025)c Fh(\(\))k(\(run)g(\(mail)g +(shivers@csd.hku.hk\)\)\)\))573 1389 y(\(run)g(\(begin)h(\(setenv)f +("TERM")h("xterm"\))237 b(;)40 b(Env)g(mutation)h(happens)1044 +1481 y(\(setenv)f("EDITOR")h(my-editor\))h(;)d(in)h(the)g(subshell.) +1044 1572 y(\(exec-epf)h(\(mail)f(shivers@research.att.com\)\)\)\))573 +1755 y(;;)g(In)f(this)h(example,)h(we)f(compute)h(an)f(alternate)h +(environment)h(ENV2)573 1846 y(;;)e(as)f(an)h(alist,)g(and)g(install)h +(it)f(with)g(an)g(explicit)h(call)f(to)g(the)573 1937 +y(;;)g(EXEC-PATH/ENV)i(procedure.)573 2029 y(\(let*)e(\(\(env)h +(\(env->alist\)\))434 b(;)39 b(Get)h(the)g(current)h(environment,)847 +2120 y(\(env1)g(\(alist-update)h(env)79 b("TERM")41 b("xterm"\)\))237 +b(;)40 b(and)f(compute)847 2211 y(\(env2)i(\(alist-update)h(env1)e +("EDITOR")h(my-editor\)\)\))h(;)e(the)f(new)h(env.)651 +2302 y(\(run)g(\(begin)h(\(exec-path/env)h("mail")f(env2)f +("shivers@cs.cmu.edu"\)\)\)\))365 2691 y Fz(3.1)m(1.1)81 +b(Path)19 b(lists)h(and)f(colon)i(lists)365 2866 y FB(Envir)o(onment)h +(variables)e(such)i(as)f Fx($PATH)e FB(encode)i(a)g(list)h(of)f +(strings)h(by)g(separating)e(the)365 2957 y(list)g(elements)f(with)h +(colon)f(delimiters.)25 b(Once)19 b(parsed)f(into)i(actual)e(lists,)i +(these)f(or)o(der)o(ed)365 3048 y(lists)h(can)f(be)g(manipulated)f +(with)i(the)g(following)g(two)g(functions.)26 b(T)-8 +b(o)20 b(convert)f(between)365 3140 y(the)26 b(colon-separated)e +(string)h(encoding)h(and)f(the)g(list-of-strings)h(r)o(epr)o +(esentation,)f(see)365 3231 y(the)c Fx(field-reader)16 +b FB(and)k Fx(join-strings)c FB(functions)22 b(in)f(section)g(7.1.)573 +3367 y FE(Remark:)71 b Fk(An)24 b(earlier)f(r)o(elease)f(of)h(scsh)h +(pr)o(ovided)e(the)i Fh(split-colon-list)k Fk(and)573 +3458 y Fh(string-list->colon-list)41 b Fk(functions.)77 +b(These)36 b(have)h(been)f(r)o(emoved)f(fr)o(om)573 3549 +y(scsh,)27 b(and)g(ar)o(e)e(r)o(eplaced)f(by)i(the)h(mor)o(e)d(general) +h(parsers)g(and)h(unparsers)f(of)g(the)573 3640 y(\002eld-r)o(eader)16 +b(module.)365 3795 y Fx(\(add-before)39 b FA(elt)21 b(befor)o(e)h(list) +p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(list)1085 b FB(pr)o(ocedur)o(e)365 +3895 y Fx(\(add-after)40 b FA(elt)21 b(after)f(list)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(list)1170 b FB(pr)o(ocedur)o(e)573 +4022 y(These)20 b(functions)h(ar)o(e)e(for)h(modifying)h(sear)o +(ch-path)d(lists,)j(wher)o(e)e(element)i(or)o(der)573 +4122 y(is)g(signi\002cant.)573 4248 y Fx(add-before)c +FB(adds)k FA(elt)g FB(to)h(the)g(list)g(immediately)g(befor)o(e)e(the)h +(\002rst)h(occurr)o(ence)f(of)573 4348 y FA(befor)o(e)f +FB(in)g(the)f(list.)26 b(If)19 b FA(befor)o(e)h FB(is)g(not)g(in)g(the) +f(list,)h FA(elt)f FB(is)h(added)e(to)i(the)f(end)g(of)h(the)f(list.) +573 4474 y Fx(add-after)f FB(is)j(similar:)27 b FA(elt)22 +b FB(is)f(added)f(after)g(the)i(last)f(occurr)o(ence)g(of)g +FA(after)p FB(.)27 b(If)21 b FA(after)573 4573 y FB(is)g(not)g(found,)g +FA(elt)g FB(is)g(added)e(to)i(the)g(beginning)h(of)f(the)g(list.)573 +4699 y(Neither)16 b(function)h(destr)o(uctively)f(alters)f(the)h +(original)h(path-list.)24 b(The)16 b(r)o(esult)g(may)573 +4799 y(shar)o(e)k(str)o(uctur)o(e)h(with)h(the)f(original)h(list.)28 +b(Both)21 b(functions)h(use)g Fx(equal?)c FB(for)j(com-)573 +4898 y(paring)f(elements.)365 5147 y FE(Mar)o(ch)f(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v +540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w +FB(75)p eop %%Page: 76 82 -76 81 bop 681 614 a Fy(3.12.5)80 b(Control)21 b(terminals,)d(sessions,)h(and) -h(terminal)e(process)i(groups)681 819 y Fw(\(open-control-tt)o(y)37 -b Fz(tty-name)19 b([\257ags])p Fw(\))86 b Fs(\000)-14 b(!)87 -b Fz(port)678 b FA(pr)o(ocedur)o(e)888 942 y(This)19 b(pr)o(ocedur)o(e)d -(opens)i(terminal)g(device)f Fz(tty-name)f FA(as)i(the)g(pr)o(ocess')f(contr) -o(ol)h(ter)o(-)888 1042 y(minal)k(\(see)e(the)i Fw(termios)c -FA(man)j(page)f(for)h(mor)o(e)g(information)h(on)g(contr)o(ol)f(termi-)888 -1141 y(nals\).)31 b(The)21 b Fz(tty-name)g FA(ar)o(gument)g(is)h(a)f -(\256le-name)h(such)g(as)g Fw(/dev/ttya)p FA(.)k(The)c Fz(\257ags)888 -1241 y FA(ar)o(gument)29 b(is)h(a)f(value)f(suitable)i(as)f(the)g(second)h -(ar)o(gument)f(to)g(the)h Fw(open-file)888 1341 y FA(call;)g(it)d(defaults)f -(to)i Fw(open/read+write)o FA(,)23 b(causing)k(the)g(terminal)g(to)h(be)e -(opened)888 1440 y(for)21 b(both)g(input)g(and)g(output.)888 -1572 y(The)g(port)h(r)o(eturned)e(is)h(an)g(input)h(port)f(if)g(the)g -Fz(\257ags)g FA(permit)g(it,)g(otherwise)h(an)f(out-)888 1671 -y(put)i(port.)35 b(R4RS/Scheme)23 b(48/scsh)g(do)g(not)h(have)f(input/output) -h(ports,)g(so)g(it's)888 1771 y(one)i(or)g(the)f(other)-6 b(.)41 -b(However)-6 b(,)26 b(you)g(can)f(get)g(both)h(r)o(ead)e(and)h(write)g(ports) -h(open)888 1870 y(on)d(a)f(terminal)g(by)g(opening)h(it)f(r)o(ead/write,)f -(taking)i(the)f(r)o(esult)g(input)g(port,)g(and)888 1970 y(duping)f(it)g(to)h -(an)e(output)h(port)g(with)h Fw(dup->outport)p FA(.)888 2101 -y(This)d(pr)o(ocedur)o(e)c(guarantees)i(to)i(make)e(the)h(opened)g(terminal)g -(the)f(pr)o(ocess')h(con-)888 2201 y(tr)o(ol)j(terminal)g(only)h(if)f(the)g -(pr)o(ocess)f(does)h(not)h(have)e(an)h(assigned)g(contr)o(ol)g(termi-)888 -2301 y(nal)15 b(at)f(the)g(time)h(of)f(the)h(call.)25 b(If)14 -b(the)h(scsh)g(pr)o(ocess)f(alr)o(eady)e(has)j(a)e(contr)o(ol)i(terminal,)888 -2400 y(the)21 b(r)o(esults)g(ar)o(e)e(unde\256ned.)888 2532 -y(T)-8 b(o)19 b(arrange)f(for)g(the)h(pr)o(ocess)f(to)h(have)f(no)h(contr)o -(ol)g(terminal)g(prior)f(to)h(calling)g(this)888 2631 y(pr)o(ocedur)o(e,)g -(use)i(the)g Fw(become-session-)o(lea)o(de)o(r)15 b FA(pr)o(ocedur)o(e.)1071 -2801 y FD(Oops:)66 b Fj(The)22 b(contr)o(ol)f(terminal)h(code)f(was)h(added)f -(just)h(befor)o(e)f(r)o(elease)f(time)1071 2892 y(for)d(scsh)i(r)o(elease)d -(0.4.)25 b(Contr)o(ol)18 b(terminals)f(ar)o(e)h(one)g(of)g(the)h -(less-standar)o(dised)1071 2984 y(elements)d(of)g(Unix.)24 -b(W)-7 b(e)16 b(can't)i(guarantee)e(that)j(the)e(terminal)f(is)g -(de\256nitely)g(at-)1071 3075 y(tached)j(as)g(a)g(contr)o(ol)f(terminal;)h -(we)f(wer)o(e)g(only)g(able)h(to)g(test)g(this)f(out)h(on)g(HP-)1071 -3166 y(UX.)e(If)g(you)f(intend)i(to)f(use)g(this)g(featur)o(e)g(on)g(your)f -(OS,)h(you)f(should)h(test)g(it)g(out)1071 3258 y(\256rst.)26 -b(If)19 b(your)f(OS)h(r)o(equir)o(es)d(the)k(use)f(of)f(the)i -Fi(TIOCSCTTY)h(ioctl)p Fj(,)f(uncomment)1071 3349 y(the)e(appr)o(opriate)f -(few)h(lines)f(of)h(code)f(in)h(the)g(\256le)g Fi(tty1.c)h -Fj(and)f(send)g(us)f(email.)681 3599 y Fw(\(become-session-)o(le)o(ade)o(r\)) -80 b Fs(\000)-14 b(!)87 b Fz(integer)944 b FA(pr)o(ocedur)o(e)888 -3737 y(This)20 b(is)g(the)g(C)f Fw(setsid\(\))e FA(call.)28 -b(P)t Fr(O)t(S)t(I)t(X)23 b FA(job-contr)o(ol)d(has)g(a)f(thr)o(ee-level)f -(hierar)o(chy:)888 3836 y(session/pr)o(ocess-gr)o(oup/pr)o(ocess.)33 -b(Every)22 b(session)h(has)g(an)f(associated)g(contr)o(ol)888 -3936 y(terminal.)27 b(This)19 b(pr)o(ocedur)o(e)d(places)h(the)i(curr)o(ent)e -(pr)o(ocess)h(into)h(a)e(brand)h(new)g(ses-)888 4036 y(sion,)31 -b(and)d(disassociates)g(the)g(pr)o(ocess)g(fr)o(om)g(any)g(pr)o(evious)g -(contr)o(ol)g(terminal.)888 4135 y(Y)-8 b(ou)22 b(may)e(subsequently)i(use)e -Fw(open-control-tty)14 b FA(to)20 b(open)h(a)f(new)h(contr)o(ol)f(ter)o(-)888 -4235 y(minal.)888 4366 y(It)35 b(is)f(an)g(err)o(or)f(to)i(call)f(this)h(pr)o -(ocedur)o(e)d(if)i(the)g(curr)o(ent)g(pr)o(ocess)g(is)g(alr)o(eady)f(a)888 -4466 y(pr)o(ocess-gr)o(oup)26 b(leader)-6 b(.)42 b(One)27 b(way)f(to)h -(guarantee)e(this)i(is)f(not)h(the)g(case)e(is)i(only)888 4565 -y(to)21 b(call)g(this)g(pr)o(ocedur)o(e)e(after)h(forking.)681 -4752 y Fw(\(tty-process-gro)o(up)37 b Fz(fd/port)p Fw(\))85 -b Fs(\000)-14 b(!)87 b Fz(integer)847 b FA(pr)o(ocedur)o(e)681 -4852 y Fw(\(set-tty-process)o(-g)o(rou)o(p)37 b Fz(fd/port)19 -b(pgrp)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)400 -b FA(pr)o(ocedur)o(e)681 5147 y(76)p 1952 5071 323 4 v 1952 -5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 -v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +76 81 bop 681 614 a Fz(3.1)m(1.2)80 b Fx($USER)p Fz(,)19 +b Fx($HOME)p Fz(,)f(and)i Fx($PATH)681 797 y FB(Like)25 +b(sh)i(and)e(unlike)h(csh,)h(scsh)g(has)e FA(no)h FB(interactive)f +(dependencies)g(on)h(envir)o(onment)681 897 y(variables.)56 +b(It)31 b(does,)j(however)-6 b(,)34 b(initialise)e(certain)f(internal)g +(values)g(at)g(startup)g(time)681 997 y(fr)o(om)39 b(the)g(initial)h +(pr)o(ocess)e(envir)o(onment,)45 b(in)39 b(particular)f +Fx($HOME)f FB(and)i Fx($PATH)p FB(.)e(Scsh)681 1096 y(never)23 +b(uses)h Fx($USER)d FB(at)i(all.)34 b(It)24 b(computes)g +Fx(\(user-login-nam)o(e\))17 b FB(fr)o(om)23 b(the)h(system)g(call)681 +1196 y Fx(\(user-uid\))p FB(.)681 1344 y Fx(home-directory)2045 +b FA(string)681 1444 y Fx(exec-path-list)1914 b FA(string)20 +b FB(list)888 1584 y(Scsh)29 b(accesses)e Fx($HOME)g +FB(at)h(start-up)f(time,)k(and)d(stor)o(es)g(the)h(value)e(in)i(the)g +(global)888 1683 y(variable)19 b Fx(home-directory)p +FB(.)h(It)g(uses)h(this)g(value)e(for)h Fx(~)g FB(lookups)h(and)f(for)g +(r)o(eturn-)888 1783 y(ing)i(to)f(home)g(on)h Fx(\(chdir\))p +FB(.)888 1915 y(Scsh)g(accesses)f Fx($PATH)f FB(at)h(start-up)g(time,)h +(colon-splits)h(the)e(path)h(list,)g(and)f(stor)o(es)888 +2015 y(the)33 b(value)f(in)h(the)g(global)f(variable)g +Fx(exec-path-list)p FB(.)55 b(This)33 b(list)g(is)g(used)f(for)888 +2115 y Fx(exec-path)17 b FB(and)k Fx(exec-path/env)15 +b FB(sear)o(ches.)681 2408 y Fv(3.12)99 b(T)-11 b(erminal)24 +b(device)h(control)681 2622 y FB(Scsh)g(pr)o(ovides)f(a)h(complete)g +(set)g(of)g(r)o(outines)h(for)f(manipulating)g(terminal)h(devices\227) +681 2721 y(putting)f(them)f(in)h(\223raw\224)e(mode,)i(changing)g(and)e +(querying)j(their)e(special)g(characters,)681 2821 y(modifying)i(their) +f(i/o)i(speeds,)e(and)g(so)h(forth.)39 b(The)26 b(scsh)f(interface)g +(is)g(designed)g(both)681 2921 y(for)34 b(generality)g(and)g +(portability)g(acr)o(oss)g(dif)o(fer)o(ent)e(Unix)i(platforms,)j(so)e +(you)g(don't)681 3020 y(have)29 b(to)h(r)o(ewrite)e(your)i(pr)o(ogram)f +(each)g(time)g(you)h(move)g(to)g(a)f(new)h(system.)52 +b(W)-8 b(e've)681 3120 y(also)30 b(made)f(an)h(ef)o(fort)f(to)h(use)g +(r)o(easonable,)h(Scheme-like)f(names)g(for)f(the)i(multitudi-)681 +3219 y(nous)g(named)e(constants)i(involved,)i(so)d(when)h(you)f(ar)o(e) +f(r)o(eading)g(code,)j(you'll)f(have)681 3319 y(less)26 +b(likelihood)i(of)e(getting)h(lost)f(in)h(a)f(bewildering)g(maze)f(of)h +(obfuscatory)g(constants)681 3419 y(named)20 b Fx(ICRNL)p +FB(,)f Fx(INPCK)p FB(,)f Fx(IUCLC)p FB(,)g(and)j Fx(ONOCR)p +FB(.)805 3543 y(This)k(section)g(can)f(only)i(lay)e(out)h(the)f(basic)g +(functionality)i(of)e(the)g(terminal)h(device)681 3643 +y(interface.)36 b(For)25 b(further)f(details,)h(see)g(the)f +(termios\(3\))h(man)f(page)g(on)i(your)f(system,)h(or)681 +3742 y(consult)c(one)f(of)f(the)h(standar)o(d)e(Unix)i(texts.)681 +3993 y Fz(3.12.1)80 b(Portability)19 b(across)h(OS)h(variants)681 +4176 y FB(T)-8 b(erminal-contr)o(ol)28 b(softwar)o(e)f(is)i +(inescapably)e(complex,)j(ugly)-9 b(,)30 b(and)e(low-level.)47 +b(Unix)681 4276 y(variants)25 b(each)h(pr)o(ovide)f(their)h(own)h(way)f +(of)g(contr)o(olling)h(terminal)f(devices,)g(making)681 +4375 y(it)19 b(dif)o(\002cult)g(to)h(pr)o(ovide)f(interfaces)f(that)i +(ar)o(e)e(portable)h(acr)o(oss)g(dif)o(fer)o(ent)e(Unix)i(systems.)681 +4475 y(Scsh's)27 b(terminal)g(support)g(is)h(based)e(primarily)h(upon)g +(the)i(P)t Fs(O)t(S)t(I)t(X)i FB(termios)c(interface.)681 +4575 y(Pr)o(ograms)i(that)g(can)h(be)f(written)h(using)g(only)g(the)i +(P)t Fs(O)t(S)t(I)t(X)h FB(interface)28 b(ar)o(e)g(likely)i(to)g(be)681 +4674 y(widely)21 b(portable.)805 4799 y(The)f(bulk)g(of)g(the)g +(documentation)h(that)e(follows)i(consists)g(of)f(several)f(pages)g +(worth)681 4898 y(of)25 b(tables)h(de\002ning)g(dif)o(fer)o(ent)d +(named)j(constants)g(that)g(enable)f(and)g(disable)g(dif)o(fer)o(ent) +681 5147 y(76)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 77 83 -77 82 bop 573 614 a FA(This)22 b(pair)g(of)f(pr)o(ocedur)o(es)g(gets)h(and)f -(sets)h(the)g(pr)o(ocess)g(gr)o(oup)f(of)h(a)g(given)g(termi-)573 -714 y(nal.)365 974 y Fy(3.12.6)81 b(Pseudo-terminals)365 1157 -y FA(Scsh)21 b(implements)h(an)e(interface)g(to)h(Berkeley-style)f -(pseudo-terminals.)365 1299 y Fw(\(fork-pty-session)37 b Fz(thunk)p -Fw(\))66 b Fs(\000)-15 b(!)67 b Fz([pr)o(ocess)17 b(pty-in)f(pty-out)f -(tty-name])86 b FA(pr)o(ocedur)o(e)573 1432 y(This)54 b(pr)o(ocedur)o(e)d -(gives)j(a)e(convenient)i(high-level)g(interface)e(to)i(pseudo-)573 -1532 y(terminals.)60 b(It)32 b(\256rst)g(allocates)f(a)g(pty/tty)h(pair)f(of) -h(devices,)h(and)e(then)h(forks)g(a)573 1632 y(child)21 b(to)g(execute)f(pr)o -(ocedur)o(e)f Fz(thunk)o FA(.)27 b(In)21 b(the)g(child)g(pr)o(ocess)672 -1790 y Fs(\017)42 b FA(Stdio)20 b(and)g(the)h(curr)o(ent)f(I/O)i(ports)f(ar)o -(e)e(bound)i(to)g(the)g(terminal)g(device.)672 1915 y Fs(\017)42 -b FA(The)28 b(child)h(is)g(placed)f(in)h(its)g(own,)j(new)d(session)h(\(see)e -Fw(become-session-)756 2015 y(leader)p FA(\).)672 2140 y Fs(\017)42 -b FA(The)20 b(terminal)g(device)g(becomes)h(the)f(new)h(session's)h(contr)o -(olling)f(terminal)756 2239 y(\(see)f Fw(open-control-tt)o(y)p -FA(\).)672 2365 y Fs(\017)42 b FA(The)20 b Fw(\(error-output-por)o(t\))14 -b FA(is)21 b(unbuf)o(fer)o(ed.)573 2523 y(The)16 b Fw(fork-pty-sessio)o(n)10 -b FA(pr)o(ocedur)o(e)j(r)o(eturns)j(four)f(values:)25 b(the)16 -b(child's)g(pr)o(ocess)573 2623 y(object,)21 b(two)g(ports)g(open)g(on)g(the) -g(contr)o(olling)g(pty)g(device,)f(and)g(the)g(name)h(of)f(the)573 -2722 y(child's)h(corr)o(esponding)g(terminal)g(device.)365 -2902 y Fw(\(open-pty\))83 b Fs(\000)-14 b(!)87 b Fz(pty-inport)19 -b(tty-name)1073 b FA(pr)o(ocedur)o(e)573 3035 y(This)27 b(pr)o(ocedur)o(e)d -(\256nds)j(a)f(fr)o(ee)f(pty/tty)i(pair)-6 b(,)26 b(and)g(opens)h(the)g(pty)f -(device)g(with)573 3135 y(r)o(ead/write)18 b(access.)27 b(It)19 -b(r)o(eturns)h(a)f(port)h(on)g(the)g(pty)-9 b(,)20 b(and)f(the)h(name)f(of)h -(the)g(corr)o(e-)573 3234 y(sponding)i(terminal)f(device.)573 -3363 y(The)h(port)h(r)o(eturned)e(is)i(an)f(input)h(port\320Scheme)f(doesn't) -h(allow)f(input/output)573 3463 y(ports.)52 b(However)-6 b(,)31 -b(you)f(can)e(easily)h(use)g Fw(\(dup->outport)38 b Fz(pty-inport)n -Fw(\))29 b FA(to)g(pr)o(o-)573 3562 y(duce)19 b(a)h(matching)g(output)g -(port.)28 b(Y)-8 b(ou)21 b(may)e(wish)i(to)f(turn)h(of)o(f)e(I/O)h(buf)o -(fering)f(for)573 3662 y(this)i(output)h(port.)365 3842 y Fw -(\(pty-name->tty-na)o(me)37 b Fz(pty-name)p Fw(\))85 b Fs(\000)-14 -b(!)87 b Fz(tty-name)642 b FA(pr)o(ocedur)o(e)365 3941 y Fw -(\(tty-name->pty-na)o(me)37 b Fz(tty-name)p Fw(\))85 b Fs(\000)-14 -b(!)87 b Fz(pty-name)642 b FA(pr)o(ocedur)o(e)573 4075 y(These)16 -b(two)i(pr)o(ocedur)o(es)c(map)j(between)f(corr)o(esponding)h(terminal)g(and) -f(pty)g(con-)573 4174 y(tr)o(oller)k(names.)28 b(For)21 b(example,)756 -4333 y Fw(\(pty-name->tty-)o(na)o(me)37 b("/dev/ptyq3"\))h -Fl(=)-14 b Fs(\))87 b Fw("/dev/ttyq3")756 4432 y(\(tty-name->pty-)o(na)o(me) -37 b("/dev/ttyrc"\))h Fl(=)-14 b Fs(\))87 b Fw("/dev/ptyrc")756 -4624 y FD(Remark:)60 b Fj(This)21 b(is)e(rather)i(Berkeley-speci\256c.)26 -b(SVR4)21 b(ptys)f(ar)o(e)g(rar)o(e)f(enough)756 4716 y(that)i(I've)f(no)g(r) -o(eal)f(idea)h(if)f(it)h(generalises)f(acr)o(oss)f(the)j(Unix)f(gap.)28 -b(Experts)19 b(ar)o(e)756 4807 y(invited)i(to)h(advise.)34 -b(Users)20 b(feel)h(fr)o(ee)g(to)h(not)g(worry\320the)f(pr)o(edominance)g(of) -756 4898 y(curr)o(ent)d(popular)g(Unix)g(systems)g(use)g(Berkeley)e(ptys.)365 -5147 y FD(November)i(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 -5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V -1636 5176 323 4 v 1216 w FA(77)p eop +77 82 bop 365 614 a FB(featur)o(es)20 b(of)i(the)g(terminal)g(driver)-6 +b(.)28 b(Some)21 b(of)h(these)g(\003ags)g(ar)o(e)h(P)t +Fs(O)t(S)t(I)t(X)r FB(;)g(others)f(ar)o(e)f(taken)365 +714 y(fr)o(om)c(the)h(two)g(common)h(branches)f(of)f(Unix)h +(development,)g(SVR4)f(and)g(4.3+)g(Berkeley)-9 b(.)365 +814 y(Scsh)21 b(guarantees)f(that)h(the)g(non-)r(P)t +Fs(O)t(S)t(I)t(X)j FB(constants)e(will)f(be)g(bound)g(identi\002ers.) +490 988 y Ft(\017)41 b FB(If)22 b(your)g(OS)h(supports)f(a)g +(particular)f(non-)r(P)t Fs(O)t(S)t(I)t(X)27 b FB(\003ag,)22 +b(its)h(named)f(constant)h(will)573 1087 y(be)d(bound)h(to)h(the)e +(\003ag's)i(value.)490 1245 y Ft(\017)41 b FB(If)26 b(your)g(OS)g +(doesn't)h(support)f(the)g(\003ag,)i(its)e(named)g(constant)h(will)g +(be)e(pr)o(esent,)573 1344 y(but)c(bound)g(to)g Fx(#f)p +FB(.)365 1518 y(This)30 b(means)e(that)h(if)f(you)i(want)e(to)i(use)e +(SVR4)g(or)h(Berkeley)f(featur)o(es)f(in)i(a)g(pr)o(ogram,)365 +1618 y(your)23 b(pr)o(ogram)e(can)h(portably)g(test)h(the)f(values)g +(of)g(the)g(\003ags)h(befor)o(e)e(using)i(them\227the)365 +1718 y(\003ags)30 b(can)e(r)o(eliably)g(be)h(r)o(efer)o(enced)d +(without)k(pr)o(oducing)f(OS-dependent)e(\223unbound)365 +1817 y(variable\224)19 b(err)o(ors.)490 1942 y(Finally)-9 +b(,)18 b(note)h(that)f(although)j(P)t Fs(O)t(S)t(I)t(X)r +FB(,)e(SVR4,)f(and)f(Berkeley)h(cover)f(the)h(lion's)h(shar)o(e)365 +2041 y(of)i(the)g(terminal-driver)f(functionality)-9 +b(,)21 b(each)f(operating)h(system)g(inevitably)g(has)g(non-)365 +2141 y(standar)o(d)34 b(extensions.)71 b(While)36 b(a)f(particular)f +(scsh)i(implementation)h(may)e(pr)o(ovide)365 2241 y(these)21 +b(extensions,)h(they)f(ar)o(e)e(not)j(portable,)d(and)i(so)g(ar)o(e)e +(not)j(documented)f(her)o(e.)365 2488 y Fz(3.12.2)81 +b(Miscellaneous)17 b(procedures)365 2687 y Fx(\(tty?)42 +b FA(fd/port)p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(boolean)1399 +b FB(pr)o(ocedur)o(e)573 2807 y(Return)21 b(tr)o(ue)g(if)f(the)h(ar)o +(gument)g(is)g(a)f(tty)-9 b(.)365 2986 y Fx(\(tty-file-name)38 +b FA(fd/port)p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(string)1054 +b FB(pr)o(ocedur)o(e)573 3118 y(The)24 b(ar)o(gument)f +FA(fd/port)f FB(must)j(be)e(a)h(\002le)g(descriptor)f(or)h(port)g(open) +g(on)h(a)e(tty)-9 b(.)35 b(Re-)573 3218 y(turn)21 b(the)g(\002le-name)f +(of)h(the)g(tty)-9 b(.)365 3477 y Fz(3.12.3)81 b(The)20 +b(tty-info)g(record)h(type)365 3660 y FB(The)36 b(primary)e(data-str)o +(uctur)o(e)g(that)h(describes)g(a)f(terminal's)i(mode)f(is)h(a)f +Fx(tty-info)365 3760 y FB(r)o(ecor)o(d,)19 b(de\002ned)h(as)h(follows:) +573 3934 y Fx(\(define-record)38 b(tty-info)660 4033 +y(control-chars)82 b(;)43 b(String:)e(Magic)g(input)h(chars)660 +4133 y(input-flags)170 b(;)43 b(Int:)f(Input)f(processing)660 +4233 y(output-flags)126 b(;)43 b(Int:)f(Output)f(processing)660 +4332 y(control-flags)82 b(;)43 b(Int:)f(Serial-line)d(control)660 +4432 y(local-flags)170 b(;)43 b(Int:)f(Line-editting)c(UI)660 +4532 y(input-speed)170 b(;)43 b(Int:)f(Code)g(for)g(input)g(speed)660 +4631 y(output-speed)126 b(;)43 b(Int:)f(Code)g(for)g(output)f(speed)660 +4731 y(min)522 b(;)43 b(Int:)f(Raw-mode)e(input)i(policy)660 +4830 y(time\))434 b(;)43 b(Int:)f(Raw-mode)e(input)i(policy)365 +5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(77)p eop %%Page: 78 84 -78 83 bop 681 614 a Fw(\(make-pty-genera)o(to)o(r\))81 b Fs(\000)-15 -b(!)88 b Fz(pr)o(ocedur)o(e)982 b FA(pr)o(ocedur)o(e)888 756 -y(This)17 b(pr)o(ocedur)o(e)e(r)o(eturns)h(a)g(generator)g(of)g(candidate)f -(pty)i(names.)26 b(Each)16 b(time)h(the)888 855 y(r)o(eturned)k(pr)o(ocedur)o -(e)e(is)j(called,)f(it)h(pr)o(oduces)f(a)g(new)h(candidate.)28 -b(Softwar)o(e)20 b(that)888 955 y(wishes)h(to)f(sear)o(ch)e(thr)o(ough)j(the) -e(set)h(of)g(available)e(ptys)i(can)f(use)h(a)f(pty)h(generator)888 -1054 y(to)28 b(iterate)f(over)g(them.)48 b(After)27 b(pr)o(oducing)g(all)g -(the)h(possible)g(ptys,)i(a)d(generator)888 1154 y(r)o(eturns)21 -b Fw(#f)f FA(every)g(time)h(it)g(is)g(called.)26 b(Example:)1071 -1320 y Fw(\(define)41 b(pg)h(\(make-pty-generat)o(or\))o(\))1071 -1420 y(\(pg\))g Fl(=)-14 b Fs(\))87 b Fw("/dev/ptyp0")1071 -1519 y(\(pg\))42 b Fl(=)-14 b Fs(\))87 b Fw("/dev/ptyp1")1420 -1606 y(.)1420 1639 y(.)1420 1673 y(.)1071 1772 y(\(pg\))42 -b Fl(=)-14 b Fs(\))87 b Fw("/dev/ptyqe")1071 1872 y(\(pg\))42 -b Fl(=)-14 b Fs(\))87 b Fw("/dev/ptyqf")169 b Fq(\(Last)42 -b(one\))1071 1972 y Fw(\(pg\))g Fl(=)-14 b Fs(\))87 b Fw(#f)1071 -2071 y(\(pg\))42 b Fl(=)-14 b Fs(\))87 b Fw(#f)1420 2158 y(.)1420 -2191 y(.)1420 2225 y(.)681 5147 y FA(78)p 1952 5071 323 4 v -1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 -4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +78 83 bop 681 614 a Fz(The)20 b(control-characters)e(string)681 +822 y FB(The)h Fx(control-chars)13 b FB(\002eld)19 b(is)g(a)f +(character)g(string;)i(its)f(characters)e(may)i(be)g(indexed)f(by)681 +921 y(integer)j(values)f(taken)h(fr)o(om)f(table)g(3.4.)805 +1064 y(As)28 b(discussed)f(above,)i(only)g(the)g(P)t +Fs(O)t(S)t(I)t(X)j FB(entries)27 b(in)h(table)g(3.4)e(ar)o(e)g +(guaranteed)h(to)681 1164 y(be)d(legal,)h(integer)f(indices.)37 +b(A)23 b(pr)o(ogram)h(can)g(r)o(eliably)g(test)g(the)h(OS)f(to)h(see)f +(if)g(the)g(non-)683 1263 y(P)t Fs(O)t(S)t(I)t(X)e FB(characters)17 +b(ar)o(e)h(supported)g(by)h(checking)g(the)g(index)f(constants.)26 +b(If)18 b(the)h(contr)o(ol-)681 1363 y(character)g(function)i(is)g +(supported)g(by)f(the)h(terminal)g(driver)-6 b(,)19 b(then)i(the)g +(corr)o(esponding)681 1463 y(index)c(will)h(be)e(bound)i(to)g(an)e +(integer;)j(if)e(it)g(is)g(not)h(supported,)g(the)f(index)g(will)h(be)f +(bound)681 1562 y(to)k Fx(#f)p FB(.)805 1705 y(T)-8 b(o)58 +b(disable)f(a)g(given)h(contr)o(ol-character)e(function,)67 +b(set)57 b(its)h(corr)o(esponding)681 1805 y(entry)67 +b(in)g(the)g Fx(tty-info:contro)o(l-)o(cha)o(rs)60 b +FB(string)67 b(to)h(the)e(special)h(character)681 1905 +y Fx(disable-tty-char)21 b FB(\(and)27 b(then)h(use)g(the)f +Fx(\(set-tty-info)39 b FA(fd/port)j(info)p Fx(\))27 b +FB(pr)o(ocedur)o(e)681 2004 y(to)21 b(update)f(the)h(terminal's)g +(state\).)681 2303 y Fz(The)f(\003ag)g(\002elds)681 2510 +y FB(The)48 b Fx(tty-info)d FB(r)o(ecor)o(d's)i Fx(input-flags)p +FB(,)k Fx(output-flags)p FB(,)f Fx(control-flags)p FB(,)f(and)681 +2610 y Fx(local-flags)22 b FB(\002elds)k(ar)o(e)g(all)g(bit)h(sets)f(r) +o(epr)o(esented)f(as)h(two's-complement)i(integers.)681 +2709 y(Their)i(values)f(ar)o(e)g(composed)i(by)f(or)6 +b('ing)31 b(together)f(values)g(taken)g(fr)o(om)f(the)h(named)681 +2809 y(constants)21 b(listed)g(in)g(tables)g(3.5)e(thr)o(ough)j(3.9.) +805 2952 y(As)j(discussed)h(above,)f(only)h(the)i(P)t +Fs(O)t(S)t(I)t(X)h FB(entries)c(listed)g(in)h(these)g(tables)e(ar)o(e)g +(guar)o(-)681 3052 y(anteed)17 b(to)i(be)e(legal,)i(integer)f(\003ag)g +(values.)24 b(A)18 b(pr)o(ogram)f(can)h(r)o(eliably)f(test)i(the)f(OS)g +(to)g(see)681 3151 y(if)25 b(the)g(non-)r(P)t Fs(O)t(S)t(I)t(X)k +FB(\003ags)c(ar)o(e)e(supported)i(by)g(checking)h(the)f(named)f +(constants.)39 b(If)25 b(the)681 3251 y(featur)o(e)17 +b(is)i(supported)g(by)g(the)g(terminal)g(driver)-6 b(,)19 +b(then)g(the)g(corr)o(esponding)g(\003ag)h(will)f(be)681 +3350 y(bound)i(to)g(an)g(integer;)f(if)h(it)g(is)g(not)g(supported,)g +(the)f(\003ag)h(will)h(be)e(bound)h(to)g Fx(#f)p FB(.)681 +3649 y Fz(The)f(speed)f(\002elds)681 3856 y FB(The)26 +b Fx(input-speed)c FB(and)27 b Fx(output-speed)21 b FB(\002elds)27 +b(determine)f(the)h(I/O)g(rate)f(of)g(the)h(ter)o(-)681 +3956 y(minal's)20 b(line.)25 b(The)20 b(value)f(of)g(these)h(\002elds)f +(is)h(an)f(integer)h(giving)g(the)g(speed)f(in)g(bits-per)o(-)681 +4055 y(second.)25 b(The)c(following)h(speeds)f(ar)o(e)e(supported)i(by) +h(P)t Fs(O)t(S)t(I)t(X)r FB(:)1733 4279 y(0)99 b(134)140 +b(600)f(4800)1691 4379 y(50)99 b(150)f(1200)139 b(9600)1691 +4478 y(75)99 b(200)f(1800)g(19200)1654 4578 y(1)-5 b(10)99 +b(300)f(2400)g(38400)681 4799 y(Y)-8 b(our)27 b(OS)f(may)g(accept)g +(others;)j(it)d(may)g(also)h(allow)g(the)f(special)g(symbols)h +Fx('exta)d FB(and)681 4898 y Fx('extb)p FB(.)681 5147 +y(78)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226) +f(21)13 b(:)f(47)p eop %%Page: 79 85 -79 84 bop 768 1501 2060 4 v 768 1601 4 100 v 821 1571 a FA(Scsh)938 -b(C)346 b(T)-7 b(ypical)20 b(char)p 2824 1601 V 768 1604 2060 -4 v 768 1621 V 768 1720 4 100 v 823 1691 a(P)t Fr(O)t(S)t(I)t(X)p -2824 1720 V 768 1820 V 821 1790 a Fw(ttychar/delete-c)o(ha)o(r)268 -b(ERASE)185 b FA(del)p 2824 1820 V 768 1920 V 821 1890 a Fw(ttychar/delete-l) -o(in)o(e)268 b(KILL)229 b(^U)p 2824 1920 V 768 2019 V 821 1989 -a(ttychar/eof)618 b(EOF)273 b(^D)p 2824 2019 V 768 2119 V 821 -2089 a(ttychar/eol)618 b(EOL)p 2824 2119 V 768 2219 V 821 2189 -a(ttychar/interrup)o(t)355 b(INTR)229 b(^C)p 2824 2219 V 768 -2318 V 821 2288 a(ttychar/quit)574 b(QUIT)229 b(^\\)p 2824 -2318 V 768 2418 V 821 2388 a(ttychar/suspend)442 b(SUSP)229 -b(^Z)p 2824 2418 V 768 2517 V 821 2488 a(ttychar/start)530 -b(START)185 b(^Q)p 2824 2517 V 768 2617 V 821 2587 a(ttychar/stop)574 -b(STOP)229 b(^S)p 2824 2617 V 768 2620 2060 4 v 768 2637 V -768 2737 4 100 v 821 2707 a FA(SVR4)20 b(and)g(4.3+BSD)p 2824 -2737 V 768 2836 V 821 2806 a Fw(ttychar/delayed-)o(su)o(spe)o(nd)93 -b(DSUSP)185 b(^Y)p 2824 2836 V 768 2936 V 821 2906 a(ttychar/delete-w)o(or)o -(d)268 b(WERASE)141 b(^W)p 2824 2936 V 768 3035 V 821 3006 -a(ttychar/discard)442 b(DISCARD)97 b(^O)p 2824 3035 V 768 3135 -V 821 3105 a(ttychar/eol2)574 b(EOL2)p 2824 3135 V 768 3235 -V 821 3205 a(ttychar/literal-)o(ne)o(xt)224 b(LNEXT)185 b(^V)p -2824 3235 V 768 3334 V 821 3304 a(ttychar/reprint)442 b(REPRINT)97 -b(^R)p 2824 3334 V 768 3338 2060 4 v 768 3354 V 768 3454 4 -100 v 821 3424 a FA(4.3+BSD)p 2824 3454 V 768 3554 V 821 3524 -a Fw(ttychar/status)486 b(STATUS)141 b(^T)p 2824 3554 V 768 -3557 2060 4 v 365 3792 a FA(T)-8 b(able)23 b(3.1:)31 b(Indices)23 -b(into)h(the)f Fw(tty-info)d FA(r)o(ecor)o(d's)i Fz(contr)o(ol-chars)g -FA(string,)i(and)f(the)g(char)o(-)365 3892 y(acter)g(traditionally)g(found)h -(at)f(each)g(index.)36 b(Only)24 b(the)g(indices)f(for)h(the)h(P)t -Fr(O)t(S)t(I)t(X)i FA(entries)365 3991 y(ar)o(e)20 b(guaranteed)f(to)i(be)g -(non-)p Fw(#f)p FA(.)365 5147 y FD(November)d(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1216 w FA(79)p eop +79 84 bop 365 614 a Fz(The)21 b(min)f(and)f(time)h(\002elds)365 +807 y FB(The)31 b(integer)f Fx(min)f FB(and)h Fx(time)e +FB(\002elds)i(determine)g(input)h(blocking)g(behaviour)f(during)365 +907 y(non-canonical)19 b(\(raw\))e(input;)i(otherwise,)h(they)e(ar)o(e) +f(ignor)o(ed.)24 b(See)17 b(the)i(termios\(3\))e(man)365 +1006 y(page)j(for)h(further)f(details.)490 1138 y(Be)29 +b(warned)f(that)k(P)t Fs(O)t(S)t(I)t(X)g FB(allows)e(the)g(base)f +(system)h(call's)f(r)o(epr)o(esentation)f(of)h(the)365 +1238 y Fx(tty-info)14 b FB(r)o(ecor)o(d)h(to)i(shar)o(e)e(storage)i +(for)f(the)h Fx(min)f FB(\002eld)g(and)g(the)h Fx(ttychar/eof)12 +b FB(element)365 1337 y(of)32 b(the)f(contr)o(ol-characters)f(string,)k +(and)d(for)g(the)h Fx(time)e FB(\002eld)h(and)g(the)g +Fx(ttychar/eol)365 1437 y FB(element)20 b(of)f(the)g(contr)o +(ol-characters)f(string.)26 b(Many)18 b(implementations)j(in)f(fact)e +(do)h(this.)490 1569 y(T)-8 b(o)19 b(stay)g(out)g(of)g(tr)o(ouble,)f +(set)h(the)g Fx(min)f FB(and)g Fx(time)f FB(\002elds)i(only)h(if)e(you) +i(ar)o(e)d(putting)i(the)365 1669 y(terminal)25 b(into)h(raw)f(mode;)i +(set)e(the)g(eof)f(and)h(eol)g(contr)o(ol-characters)f(only)i(if)e(you) +i(ar)o(e)365 1768 y(putting)c(the)f(terminal)g(into)g(canonical)g +(mode.)26 b(It's)21 b(ugly)-9 b(,)20 b(but)h(it's)h(Unix.)365 +2038 y Fz(3.12.4)81 b(Using)20 b(tty-info)f(records)365 +2253 y Fx(\(make-tty-info)38 b FA(if)16 b(of)g(cf)f(lf)h(ispeed)g +(ospeed)g(min)f(time)p Fx(\))43 b Ft(\000)-14 b(!)43 +b FA(tty-info-r)o(ecord)85 b FB(pr)o(ocedur)o(e)365 2353 +y Fx(\(copy-tty-info)38 b FA(tty-info-r)o(ecord)p Fx(\))85 +b Ft(\000)-15 b(!)88 b FA(tty-info-r)o(ecord)504 b FB(pr)o(ocedur)o(e) +573 2480 y(These)24 b(pr)o(ocedur)o(es)f(make)h(it)h(possible)g(to)f +(cr)o(eate)f(new)i Fx(tty-info)c FB(r)o(ecor)o(ds.)35 +b(The)573 2579 y(typical)18 b(method)g(for)g(cr)o(eating)f(a)g(new)i(r) +o(ecor)o(d)d(is)i(to)h(copy)f(one)g(r)o(etrieved)e(by)i(a)g(call)573 +2679 y(to)27 b(the)f Fx(tty-info)d FB(pr)o(ocedur)o(e,)i(then)i(modify) +g(the)f(copy)h(as)f(desir)o(ed.)40 b(Note)27 b(that)573 +2779 y(the)32 b Fx(make-tty-info)26 b FB(pr)o(ocedur)o(e)k(does)i(not)g +(take)f(a)h(parameter)e(to)i(de\002ne)f(the)573 2878 +y(new)d(r)o(ecor)o(d's)e(contr)o(ol)h(characters.)1759 +2848 y Fu(4)1841 2878 y FB(Instead,)h(it)g(simply)g(r)o(eturns)f(a)g +Fx(tty-info)573 2978 y FB(r)o(ecor)o(d)16 b(whose)i(contr)o +(ol-character)e(string)i(has)f(all)g(elements)h(initialised)g(to)i(A)t +Fs(S)t(C)t(I)t(I)573 3078 y FB(nul.)77 b(Y)-8 b(ou)38 +b(may)g(then)g(install)g(the)g(special)f(characters)g(by)h(assigning)g +(to)g(the)573 3177 y(string.)43 b(Similarly)-9 b(,)27 +b(the)g(contr)o(ol-character)d(string)k(in)e(the)h(r)o(ecor)o(d)d(pr)o +(oduced)h(by)573 3277 y Fx(copy-tty-info)16 b FB(does)22 +b(not)g(shar)o(e)f(str)o(uctur)o(e)g(with)i(the)f(string)g(in)g(the)g +(r)o(ecor)o(d)e(be-)573 3376 y(ing)h(copied,)f(so)i(you)f(may)g(mutate) +f(it)h(fr)o(eely)-9 b(.)365 3582 y Fx(\(tty-info)40 b +FA(fd/port)p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(tty-info-r)o(ecord)984 +b FB(pr)o(ocedur)o(e)573 3728 y(The)32 b FA(fd/port)f +FB(parameter)g(is)i(an)f(integer)h(\002le)g(descriptor)f(or)g(Scheme)g +(I/O)h(port)573 3828 y(opened)24 b(on)h(a)e(terminal)i(device.)35 +b(This)25 b(pr)o(ocedur)o(e)d(r)o(eturns)i(a)f Fx(tty-info)e +FB(r)o(ecor)o(d)573 3927 y(describing)g(the)g(terminal's)g(curr)o(ent)f +(mode.)365 4133 y Fx(\(set-tty-info/now)37 b FA(fd/port)19 +b(info)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(no-value)685 +b FB(pr)o(ocedur)o(e)365 4233 y Fx(\(set-tty-info/dra)o(in)37 +b FA(fd/port)19 b(info)p Fx(\))87 b Ft(\000)-14 b(!)87 +b FA(no-value)598 b FB(pr)o(ocedur)o(e)365 4332 y Fx +(\(set-tty-info/flu)o(sh)37 b FA(fd/port)19 b(info)p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(no-value)598 b FB(pr)o(ocedur)o(e) +573 4478 y(The)32 b FA(fd/port)f FB(parameter)g(is)i(an)f(integer)h +(\002le)g(descriptor)f(or)g(Scheme)g(I/O)h(port)573 4578 +y(opened)d(on)g(a)g(terminal)g(device.)52 b(The)30 b(pr)o(ocedur)o(e)e +(chosen)j(determines)f(when)573 4678 y(and)20 b(how)i(the)f(terminal's) +g(mode)g(is)g(alter)o(ed:)p 365 4742 1146 4 v 450 4796 +a Fp(4)485 4819 y Fs(Why?)i(Because)17 b(the)f(length)h(of)g(the)g +(string)g(varies)g(fr)o(om)h(Unix)f(to)g(Unix.)22 b(For)c(example,)f +(the)f(wor)o(d-erase)365 4898 y(contr)o(ol)i(character)f(\(typically)h +(contr)o(ol-w\))g(is)f(pr)o(ovided)f(by)g(most)g(Unixes,)g(but)g(not)h +(part)f(of)h(the)h(P)t Fo(O)t(S)t(I)t(X)d Fs(spec.)365 +5147 y FE(Mar)o(ch)k(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(79)p eop %%Page: 80 86 -80 85 bop 698 1676 2830 4 v 698 1767 4 92 v 751 1740 a Fj(Scsh)1091 -b(C)321 b(Meaning)p 3524 1767 V 698 1770 2830 4 v 698 1787 -V 698 1878 4 92 v 753 1851 a(P)t Ff(O)t(S)t(I)t(X)p 3524 1878 -V 698 1970 V 751 1942 a Fi(ttyin/check-parity)536 b(INPCK)179 -b Fj(Check)18 b(parity)-8 b(.)p 3524 1970 V 698 2061 V 751 -2034 a Fi(ttyin/ignore-bad-parity-char)q(s)106 b(IGNPAR)140 -b Fj(Ignor)o(e)17 b(chars)i(with)h(parity)e(err)o(ors.)p 3524 -2061 V 698 2152 V 751 2125 a Fi(ttyin/mark-parity-errors)302 -b(PARMRK)140 b Fj(Insert)18 b(chars)h(to)g(mark)f(parity)g(err)o(ors.)p -3524 2152 V 698 2244 V 751 2216 a Fi(ttyin/ignore-break)536 -b(IGNBRK)140 b Fj(Ignor)o(e)17 b(br)o(eaks.)p 3524 2244 V 698 -2335 V 751 2308 a Fi(ttyin/interrupt-on-break)302 b(BRKINT)140 -b Fj(Signal)19 b(on)g(br)o(eaks.)p 3524 2335 V 698 2426 V 751 -2399 a Fi(ttyin/7bits)809 b(ISTRIP)140 b Fj(Strip)18 b(char)h(to)g(seven)g -(bits.)p 3524 2426 V 698 2518 V 751 2490 a Fi(ttyin/cr->nl)770 -b(ICRNL)179 b Fj(Map)18 b(carriage-r)o(eturn)f(to)i(newline.)p -3524 2518 V 698 2609 V 751 2582 a Fi(ttyin/ignore-cr)653 b(IGNCR)179 -b Fj(Ignor)o(e)17 b(carriage-r)o(eturns.)p 3524 2609 V 698 -2700 V 751 2673 a Fi(ttyin/nl->cr)770 b(INLCR)179 b Fj(Map)18 -b(newline)h(to)g(carriage-r)o(eturn.)p 3524 2700 V 698 2792 -V 751 2764 a Fi(ttyin/input-flow-ctl)458 b(IXOFF)179 b Fj(Enable)19 -b(input)g(\257ow)g(contr)o(ol.)p 3524 2792 V 698 2883 V 751 -2856 a Fi(ttyin/output-flow-ctl)419 b(IXON)218 b Fj(Enable)19 -b(output)g(\257ow)g(contr)o(ol.)p 3524 2883 V 698 2886 2830 -4 v 698 2903 V 698 2994 4 92 v 751 2967 a(SVR4)g(and)h(4.3+BSD)p -3524 2994 V 698 3085 V 751 3058 a Fi(ttyin/xon-any)731 b(IXANY)179 -b Fj(Any)19 b(char)g(r)o(estarts)e(after)i(stop.)p 3524 3085 -V 698 3177 V 751 3149 a Fi(ttyin/beep-on-overflow)380 b(IMAXBEL)101 -b Fj(Ring)18 b(bell)g(when)i(queue)e(full.)p 3524 3177 V 698 -3180 2830 4 v 698 3197 V 698 3288 4 92 v 751 3261 a(SVR4)p -3524 3288 V 698 3379 V 751 3352 a Fi(ttyin/lowercase)653 b(IUCLC)179 -b Fj(Map)18 b(upper)g(case)h(to)g(lower)f(case.)p 3524 3379 -V 698 3383 2830 4 v 681 3618 a FA(T)-8 b(able)31 b(3.2:)47 -b(Input-\257ags.)59 b(These)31 b(ar)o(e)f(the)h(named)g(\257ags)g(for)g(the)h -Fw(tty-info)27 b FA(r)o(ecor)o(d's)681 3717 y Fz(input-\257ags)i -FA(\256eld.)55 b(These)30 b(\257ags)h(generally)f(contr)o(ol)g(the)h(pr)o -(ocessing)f(of)g(input)h(chars.)681 3817 y(Only)21 b(the)i(P)t -Fr(O)t(S)t(I)t(X)i FA(entries)20 b(ar)o(e)g(guaranteed)f(to)i(be)g(non-)p -Fw(#f)p FA(.)681 5147 y(80)p 1952 5071 323 4 v 1952 5173 4 -102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 w -FD(November)d(1,)h(1995)h(\261)f(15)13 b(:)f(58)p eop +80 85 bop 1004 535 2425 4 v 1004 634 4 100 v 1057 604 +a FB(Pr)o(ocedur)o(e)508 b(Meaning)p 3426 634 V 1004 +638 2425 4 v 1004 654 V 1004 754 4 100 v 1057 724 a Fx +(set-tty-info/now)181 b FB(Make)19 b(change)i(immediately)-9 +b(.)p 3426 754 V 1004 853 V 1057 824 a Fx(set-tty-info/drai)o(n)94 +b FB(Drain)20 b(output,)h(then)h(change.)p 3426 853 V +1004 953 V 1057 923 a Fx(set-tty-info/flus)o(h)94 b FB(Drain)20 +b(output,)h(\003ush)h(input,)f(then)g(change.)p 3426 +953 V 1004 956 2425 4 v 681 1261 a Fz(3.12.5)80 b(Other)20 +b(terminal-device)d(procedures)681 1492 y Fx(\(send-tty-break)37 +b FA(fd/port)19 b([duration])p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(no-value)555 b FB(pr)o(ocedur)o(e)888 1624 +y(Send)34 b(a)g(br)o(eak)e(signal)j(on)g(the)f(terminal)g(associated)g +(with)h(\002le)f(descriptor)g(or)888 1724 y(Scheme)18 +b(I/O)h(port)f FA(fd/port)o FB(.)24 b(A)18 b(br)o(eak)f(signal)i(is)g +(a)e(sequence)i(of)f(continuous)i(zer)o(os)888 1823 y(on)i(the)f +(terminal's)g(transmission)h(line.)888 1972 y(The)h FA(duration)f +FB(ar)o(gument)f(determines)i(the)f(length)h(of)g(the)f(br)o(eak)f +(signal.)31 b(A)22 b(zer)o(o)888 2071 y(value)i(\(the)g(default\))f +(causes)h(a)g(br)o(eak)f(of)h(between)g(0.25)f(and)h(0.5)f(seconds)i +(to)f(be)888 2171 y(sent;)d(other)f(values)f(determine)h(a)f(period)h +(in)g(a)f(manner)h(that)g(will)g(depend)f(upon)888 2271 +y(local)i(community)h(standar)o(ds.)681 2509 y Fx(\(drain-tty)39 +b FA(fd/port)p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(no-value)1140 +b FB(pr)o(ocedur)o(e)888 2666 y(This)27 b(pr)o(ocedur)o(e)e(waits)i +(until)g(all)g(the)f(output)h(written)g(to)g(the)g(terminal)g(device) +888 2765 y(has)37 b(been)g(transmitted)g(to)g(the)g(device.)73 +b(If)36 b FA(fd/port)f FB(is)i(an)g(output)g(port)g(with)888 +2865 y(buf)o(fer)o(ed)19 b(I/O)j(enabled,)f(then)g(the)h(port's)g(buf)o +(fer)o(ed)d(characters)h(ar)o(e)g(\003ushed)i(be-)888 +2965 y(for)o(e)e(waiting)h(for)g(the)g(device)f(to)h(drain.)681 +3203 y Fx(\(flush-tty/input)37 b FA(fd/port)p Fx(\))85 +b Ft(\000)-14 b(!)87 b FA(no-value)878 b FB(pr)o(ocedur)o(e)681 +3302 y Fx(\(flush-tty/outpu)o(t)37 b FA(fd/port)p Fx(\))86 +b Ft(\000)-15 b(!)87 b FA(no-value)835 b FB(pr)o(ocedur)o(e)681 +3402 y Fx(\(flush-tty/both)37 b FA(fd/port)p Fx(\))85 +b Ft(\000)-14 b(!)87 b FA(no-value)922 b FB(pr)o(ocedur)o(e)888 +3559 y(These)33 b(pr)o(ocedur)o(es)e(discar)o(d)h(the)h(unr)o(ead)f +(input)h(chars)g(or)g(unwritten)h(output)888 3658 y(chars)21 +b(in)g(the)g(tty's)g(kernel)g(buf)o(fers.)681 3897 y +Fx(\(start-tty-outpu)o(t)37 b FA(fd/port)p Fx(\))86 b +Ft(\000)-15 b(!)87 b FA(no-value)835 b FB(pr)o(ocedur)o(e)681 +3996 y Fx(\(stop-tty-output)37 b FA(fd/port)p Fx(\))85 +b Ft(\000)-14 b(!)87 b FA(no-value)878 b FB(pr)o(ocedur)o(e)681 +4096 y Fx(\(start-tty-input)37 b FA(fd/port)p Fx(\))85 +b Ft(\000)-14 b(!)87 b FA(no-value)878 b FB(pr)o(ocedur)o(e)681 +4195 y Fx(\(stop-tty-input)37 b FA(fd/port)p Fx(\))85 +b Ft(\000)-14 b(!)87 b FA(no-value)922 b FB(pr)o(ocedur)o(e)888 +4352 y(These)38 b(pr)o(ocedur)o(es)e(can)h(be)g(used)g(to)h(contr)o(ol) +g(a)f(terminal's)h(input)g(and)f(out-)888 4452 y(put)22 +b(\003ow)-8 b(.)31 b(The)23 b Fx(stop-tty-output)15 b +FB(and)22 b Fx(start-tty-output)16 b FB(pr)o(ocedur)o(es)k(sus-)888 +4552 y(pend)28 b(and)f(r)o(esume)h(output)g(fr)o(om)g(a)f(terminal)h +(device.)46 b(The)28 b Fx(stop-tty-input)888 4651 y FB(and)21 +b Fx(start-tty-input)15 b FB(pr)o(ocedur)o(es)20 b(transmit)i(the)f +(special)g(ST)o(OP)g(and)g(ST)-6 b(AR)m(T)888 4751 y(characters)19 +b(to)i(the)f(terminal)g(with)h(the)f(intention)i(of)e(stopping)h(and)f +(starting)g(ter)o(-)888 4850 y(minal)i(input)f(\003ow)-8 +b(.)681 5147 y(80)p 1952 5071 323 4 v 1952 5173 4 102 +v 1215 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 +w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 81 87 -81 86 bop 495 1741 2605 4 v 495 1840 4 100 v 548 1810 a FA(Scsh)982 -b(C)339 b(Meaning)p 3096 1840 V 495 1843 2605 4 v 495 1860 -V 495 1960 4 100 v 550 1930 a(P)t Fr(O)t(S)t(I)t(X)p 3096 1960 -V 495 2059 V 548 2029 a Fw(ttyout/enable)574 b(OPOST)178 b -FA(Enable)20 b(output)i(pr)o(ocessing.)p 3096 2059 V 495 2063 -2605 4 v 495 2079 V 495 2179 4 100 v 548 2149 a(SVR4)e(and)h(4.3+BSD)p -3096 2179 V 495 2279 V 548 2249 a Fw(ttyout/nl->crnl)486 b(ONLCR)178 -b FA(Map)20 b(nl)h(to)g(cr)o(-nl.)p 3096 2279 V 495 2282 2605 -4 v 495 2298 V 495 2398 4 100 v 548 2368 a(4.3+BSD)p 3096 2398 -V 495 2498 V 548 2468 a Fw(ttyout/discard-eo)o(t)355 b(ONOEOT)134 -b FA(Discar)o(d)20 b(EOT)h(chars.)p 3096 2498 V 495 2597 V -548 2567 a Fw(ttyout/expand-tab)o(s)355 b(OXTABS)1958 2537 -y Ft(5)2092 2567 y FA(Expand)20 b(tabs.)p 3096 2597 V 495 2601 -2605 4 v 495 2617 V 495 2717 4 100 v 548 2687 a(SVR4)p 3096 -2717 V 495 2817 V 548 2787 a Fw(ttyout/cr->nl)574 b(OCRNL)178 -b FA(Map)20 b(cr)g(to)i(nl.)p 3096 2817 V 495 2916 V 548 2886 -a Fw(ttyout/nl-does-cr)398 b(ONLRET)134 b FA(Nl)21 b(performs)g(cr)f(as)h -(well.)p 3096 2916 V 495 3016 V 548 2986 a Fw(ttyout/no-col0-cr)398 -b(ONOCR)178 b FA(No)21 b(cr)g(output)g(in)g(column)h(0.)p 3096 -3016 V 495 3115 V 548 3085 a Fw(ttyout/delay-w/fi)o(ll)o(-ch)o(ar)93 -b(OFILL)178 b FA(Send)20 b(\256ll)i(char)e(to)h(delay)-9 b(.)p -3096 3115 V 495 3215 V 548 3185 a Fw(ttyout/fill-w/del)398 -b(OFDEL)178 b FA(Fill)22 b(char)e(is)j(A)t Fr(S)t(C)t(I)t(I)h -FA(DEL.)p 3096 3215 V 495 3315 V 548 3285 a Fw(ttyout/uppercase)442 -b(OLCUC)178 b FA(Map)20 b(lower)h(to)g(upper)f(case.)p 3096 -3315 V 495 3318 2605 4 v 365 3553 a(T)-8 b(able)26 b(3.3:)38 -b(Output-\257ags.)45 b(These)26 b(ar)o(e)f(the)i(named)f(\257ags)h(for)f(the) -h Fw(tty-info)c FA(r)o(ecor)o(d's)365 3652 y Fz(output-\257ags)e -FA(\256eld.)33 b(These)22 b(\257ags)h(generally)f(contr)o(ol)h(the)g(pr)o -(ocessing)g(of)f(output)h(chars.)365 3752 y(Only)f(the)h(P)t -Fr(O)t(S)t(I)t(X)h FA(entries)d(ar)o(e)e(guaranteed)h(to)h(be)f(non-)p -Fw(#f)p FA(.)365 5147 y FD(November)e(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1216 w FA(81)p eop +81 86 bop 365 614 a Fz(3.12.6)81 b(Control)20 b(terminals,)e(sessions,) +h(and)h(terminal)f(process)h(groups)365 813 y Fx(\(open-control-tty)37 +b FA(tty-name)19 b([\003ags])p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(port)678 b FB(pr)o(ocedur)o(e)573 933 y(This)18 +b(pr)o(ocedur)o(e)e(opens)i(terminal)g(device)f FA(tty-name)g +FB(as)g(the)h(pr)o(ocess')g(contr)o(ol)g(ter)o(-)573 +1032 y(minal)j(\(see)g(the)g Fx(termios)d FB(man)k(page)e(for)h(mor)o +(e)g(information)h(on)f(contr)o(ol)h(termi-)573 1132 +y(nals\).)29 b(The)22 b FA(tty-name)e FB(ar)o(gument)i(is)g(a)g +(\002le-name)g(such)g(as)g Fx(/dev/ttya)p FB(.)k(The)c +FA(\003ags)573 1232 y FB(ar)o(gument)29 b(is)g(a)g(value)g(suitable)g +(as)g(the)h(second)f(ar)o(gument)g(to)h(the)f Fx(open-file)573 +1331 y FB(call;)g(it)f(defaults)e(to)h Fx(open/read+write)p +FB(,)22 b(causing)27 b(the)h(terminal)f(to)g(be)g(opened)573 +1431 y(for)20 b(both)i(input)f(and)f(output.)573 1559 +y(The)h(port)g(r)o(eturned)f(is)i(an)e(input)i(port)f(if)g(the)g +FA(\003ags)g FB(permit)h(it,)f(otherwise)h(an)e(out-)573 +1659 y(put)j(port.)33 b(R4RS/Scheme)23 b(48/scsh)h(do)f(not)h(have)f +(input/output)h(ports,)g(so)g(it's)573 1758 y(one)i(or)f(the)h(other)-6 +b(.)40 b(However)-6 b(,)26 b(you)g(can)f(get)g(both)h(r)o(ead)e(and)h +(write)h(ports)f(open)573 1858 y(on)e(a)e(terminal)h(by)h(opening)g(it) +f(r)o(ead/write,)f(taking)h(the)g(r)o(esult)g(input)h(port,)f(and)573 +1958 y(duping)f(it)g(to)g(an)g(output)g(port)g(with)g +Fx(dup->outport)p FB(.)573 2086 y(This)d(pr)o(ocedur)o(e)e(guarantees)h +(to)h(make)g(the)g(opened)f(terminal)h(the)g(pr)o(ocess')f(con-)573 +2185 y(tr)o(ol)29 b(terminal)g(only)h(if)f(the)h(pr)o(ocess)e(does)h +(not)h(have)f(an)g(assigned)g(contr)o(ol)h(ter)o(-)573 +2285 y(minal)h(at)g(the)g(time)h(of)f(the)g(call.)57 +b(If)30 b(the)i(scsh)f(pr)o(ocess)g(alr)o(eady)e(has)j(a)e(contr)o(ol) +573 2385 y(terminal,)20 b(the)h(r)o(esults)g(ar)o(e)e(unde\002ned.)573 +2513 y(T)-8 b(o)19 b(arrange)e(for)i(the)f(pr)o(ocess)h(to)g(have)f(no) +h(contr)o(ol)g(terminal)f(prior)h(to)g(calling)g(this)573 +2613 y(pr)o(ocedur)o(e,)f(use)j(the)g Fx(become-session-l)o(ead)o(er)14 +b FB(pr)o(ocedur)o(e.)365 2790 y Fx(\(become-session-l)o(ea)o(der)o(\)) +81 b Ft(\000)-14 b(!)87 b FA(integer)944 b FB(pr)o(ocedur)o(e)573 +2921 y(This)20 b(is)g(the)g(C)g Fx(setsid\(\))c FB(call.)27 +b(P)t Fs(O)t(S)t(I)t(X)c FB(job-contr)o(ol)d(has)g(a)f(thr)o(ee-level)g +(hierar)o(chy:)573 3021 y(session/pr)o(ocess-gr)o(oup/pr)o(ocess.)31 +b(Every)22 b(session)i(has)f(an)f(associated)g(contr)o(ol)573 +3121 y(terminal.)59 b(This)32 b(pr)o(ocedur)o(e)e(places)h(the)h(curr)o +(ent)g(pr)o(ocess)f(into)i(a)e(brand)g(new)573 3220 y(session,)f(and)e +(disassociates)g(the)g(pr)o(ocess)f(fr)o(om)g(any)h(pr)o(evious)g +(contr)o(ol)g(termi-)573 3320 y(nal.)d(Y)-8 b(ou)20 b(may)e +(subsequently)i(use)f Fx(open-control-tty)12 b FB(to)20 +b(open)f(a)f(new)h(contr)o(ol)573 3420 y(terminal.)573 +3548 y(It)34 b(is)h(an)f(err)o(or)f(to)i(call)e(this)i(pr)o(ocedur)o(e) +e(if)h(the)g(curr)o(ent)f(pr)o(ocess)h(is)h(alr)o(eady)d(a)573 +3647 y(pr)o(ocess-gr)o(oup)18 b(leader)-6 b(.)24 b(One)c(way)g(to)g +(guarantee)e(this)j(is)f(not)g(the)g(case)f(is)h(only)g(to)573 +3747 y(call)g(this)i(pr)o(ocedur)o(e)d(after)g(forking.)365 +3924 y Fx(\(tty-process-grou)o(p)37 b FA(fd/port)p Fx(\))86 +b Ft(\000)-15 b(!)88 b FA(integer)847 b FB(pr)o(ocedur)o(e)365 +4024 y Fx(\(set-tty-process-)o(gr)o(oup)37 b FA(fd/port)19 +b(pgrp)p Fx(\))86 b Ft(\000)-15 b(!)88 b FA(unde\002ned)400 +b FB(pr)o(ocedur)o(e)573 4156 y(This)22 b(pair)g(of)f(pr)o(ocedur)o(es) +g(gets)h(and)f(sets)h(the)g(pr)o(ocess)g(gr)o(oup)f(of)h(a)g(given)g +(termi-)573 4255 y(nal.)365 4432 y Fx(\(control-tty-file)o(-n)o(ame)o +(\))81 b Ft(\000)-14 b(!)87 b FA(string)976 b FB(pr)o(ocedur)o(e)573 +4564 y(Return)20 b(the)g(\002le-name)g(of)g(the)g(pr)o(ocess')f(contr)o +(ol)h(tty)-9 b(.)26 b(On)20 b(every)f(version)i(of)f(Unix)573 +4664 y(of)j(which)h(we)f(ar)o(e)f(awar)o(e,)f(this)j(is)g(just)f(the)h +(string)f Fx("/dev/tty")p FB(.)29 b(However)-6 b(,)23 +b(this)573 4763 y(pr)o(ocedur)o(e)15 b(uses)j(the)f(of)o(\002cial)g +(Posix)h(interface,)f(so)h(it)f(is)h(mor)o(e)f(portable)g(than)g(sim-) +573 4863 y(ply)k(using)g(a)g(constant)g(string.)365 5147 +y FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(81)p eop %%Page: 82 88 -82 87 bop 1581 1286 1696 4 v 1578 1382 4 100 v 1631 1352 a -FA(V)-8 b(alue)676 b(Comment)p 3274 1382 V 1581 1385 1696 4 -v 927 1452 a(Backspace)19 b(delay)p 1578 1482 4 100 v 102 w -Fw(ttyout/bs-delay)224 b FA(Bit-\256eld)21 b(mask)p 3274 1482 -V 1578 1581 V 1631 1551 a Fw(ttyout/bs-delay0)p 3274 1581 V -1578 1681 V 1631 1651 a(ttyout/bs-delay1)p 3274 1681 V 1581 -1684 1696 4 v 731 1750 a FA(Carriage-r)o(eturn)d(delay)p 1578 -1780 4 100 v 102 w Fw(ttyout/cr-delay)224 b FA(Bit-\256eld)21 -b(mask)p 3274 1780 V 1578 1880 V 1631 1850 a Fw(ttyout/cr-delay0)p -3274 1880 V 1578 1980 V 1631 1950 a(ttyout/cr-delay1)p 3274 -1980 V 1578 2079 V 1631 2049 a(ttyout/cr-delay2)p 3274 2079 -V 1578 2179 V 1631 2149 a(ttyout/cr-delay3)p 3274 2179 V 1581 -2182 1696 4 v 922 2249 a FA(Form-feed)f(delay)p 1578 2279 4 -100 v 102 w Fw(ttyout/ff-delay)224 b FA(Bit-\256eld)21 b(mask)p -3274 2279 V 1578 2378 V 1631 2348 a Fw(ttyout/ff-delay0)p 3274 -2378 V 1578 2478 V 1631 2448 a(ttyout/ff-delay1)p 3274 2478 -V 1581 2481 1696 4 v 764 2548 a FA(Horizontal-tab)f(delay)p -1578 2577 4 100 v 102 w Fw(ttyout/tab-delay)180 b FA(Bit-\256eld)21 -b(mask)p 3274 2577 V 1578 2677 V 1631 2647 a Fw(ttyout/tab-delay0)p -3274 2677 V 1578 2777 V 1631 2747 a(ttyout/tab-delay1)p 3274 -2777 V 1578 2876 V 1631 2846 a(ttyout/tab-delay2)p 3274 2876 -V 1578 2976 V 1631 2946 a(ttyout/tab-delayx)136 b FA(Expand)20 -b(tabs)p 3274 2976 V 1581 2979 1696 4 v 991 3046 a(Newline)h(delay)p -1578 3076 4 100 v 102 w Fw(ttyout/nl-delay)224 b FA(Bit-\256eld)21 -b(mask)p 3274 3076 V 1578 3175 V 1631 3145 a Fw(ttyout/nl-delay0)p -3274 3175 V 1578 3275 V 1631 3245 a(ttyout/nl-delay1)p 3274 -3275 V 1581 3278 1696 4 v 893 3345 a FA(V)-9 b(ertical)20 b(tab)g(delay)p -1578 3374 4 100 v 102 w Fw(ttyout/vtab-delay)136 b FA(Bit-\256eld)21 -b(mask)p 3274 3374 V 1578 3474 V 1631 3444 a Fw(ttyout/vtab-delay)o(0)p -3274 3474 V 1578 3574 V 1631 3544 a(ttyout/vtab-delay)o(1)p -3274 3574 V 1581 3577 1696 4 v 1415 3643 a FA(All)p 1578 3673 -4 100 v 103 w Fw(ttyout/all-delay)180 b FA(T)-8 b(otal)21 b(bit-\256eld)g -(mask)p 3274 3673 V 1581 3677 1696 4 v 681 3825 a(T)-8 b(able)17 -b(3.4:)25 b(Delay)18 b(constants.)27 b(These)18 b(ar)o(e)e(the)i(named)g -(\257ags)g(for)g(the)g Fw(tty-info)c FA(r)o(ecor)o(d's)681 -3925 y Fz(output-\257ags)h FA(\256eld.)26 b(These)16 b(\257ags)h(contr)o(ol)g -(the)f(output)h(delays)f(associated)g(with)h(printing)681 4024 -y(special)j(characters.)27 b(They)21 b(ar)o(e)e(non-)r(P)t -Fr(O)t(S)t(I)t(X)r FA(,)k(and)e(have)f(non-)p Fw(#f)h FA(values)f(only)i(on)g -(SVR4)681 4124 y(systems.)681 5147 y(82)p 1952 5071 323 4 v -1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 -4 v 435 w FD(November)c(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +82 87 bop 681 614 a Fz(3.12.7)80 b(Pseudo-terminals)681 +797 y FB(Scsh)21 b(implements)g(an)g(interface)e(to)j(Berkeley-style)e +(pseudo-terminals.)681 946 y Fx(\(fork-pty-sessio)o(n)37 +b FA(thunk)p Fx(\))65 b Ft(\000)-14 b(!)65 b FA([pr)o(ocess)18 +b(pty-in)f(pty-out)f(tty-name])85 b FB(pr)o(ocedur)o(e)888 +1086 y(This)54 b(pr)o(ocedur)o(e)d(gives)j(a)f(convenient)h(high-level) +g(interface)e(to)h(pseudo-)888 1186 y(terminals.)59 b(It)32 +b(\002rst)g(allocates)f(a)g(pty/tty)i(pair)e(of)h(devices,)h(and)e +(then)i(forks)f(a)888 1285 y(child)21 b(to)g(execute)f(pr)o(ocedur)o(e) +f FA(thunk)o FB(.)26 b(In)21 b(the)g(child)g(pr)o(ocess)988 +1451 y Ft(\017)41 b FB(Stdio)21 b(and)f(the)h(curr)o(ent)f(I/O)h(ports) +g(ar)o(e)e(bound)j(to)f(the)g(terminal)f(device.)988 +1582 y Ft(\017)41 b FB(The)29 b(child)g(is)g(placed)e(in)j(its)f(own,)i +(new)e(session)h(\(see)e Fx(become-session-)1071 1682 +y(leader)p FB(\).)988 1814 y Ft(\017)41 b FB(The)20 b(terminal)h +(device)f(becomes)g(the)h(new)f(session's)i(contr)o(olling)g(terminal) +1071 1914 y(\(see)e Fx(open-control-tty)o FB(\).)988 +2046 y Ft(\017)41 b FB(The)21 b Fx(\(error-output-po)o(rt)o(\))15 +b FB(is)21 b(unbuf)o(fer)o(ed.)888 2211 y(The)16 b Fx(fork-pty-session) +10 b FB(pr)o(ocedur)o(e)k(r)o(eturns)h(four)h(values:)23 +b(the)16 b(child's)g(pr)o(ocess)888 2310 y(object,)21 +b(two)g(ports)g(open)g(on)g(the)g(contr)o(olling)h(pty)e(device,)g(and) +g(the)h(name)f(of)h(the)888 2410 y(child's)h(corr)o(esponding)f +(terminal)f(device.)681 2600 y Fx(\(open-pty\))83 b Ft(\000)-14 +b(!)87 b FA(pty-inport)18 b(tty-name)1073 b FB(pr)o(ocedur)o(e)888 +2740 y(This)27 b(pr)o(ocedur)o(e)e(\002nds)h(a)g(fr)o(ee)f(pty/tty)i +(pair)-6 b(,)27 b(and)f(opens)h(the)f(pty)h(device)e(with)888 +2840 y(r)o(ead/write)19 b(access.)24 b(It)c(r)o(eturns)g(a)f(port)h(on) +h(the)f(pty)-9 b(,)19 b(and)h(the)g(name)f(of)h(the)g(corr)o(e-)888 +2939 y(sponding)i(terminal)f(device.)888 3072 y(The)i(port)f(r)o +(eturned)f(is)i(an)f(input)h(port\227Scheme)f(doesn't)h(allow)g +(input/output)888 3171 y(ports.)51 b(However)-6 b(,)31 +b(you)f(can)f(easily)g(use)g Fx(\(dup->outport)39 b FA(pty-inport)m +Fx(\))29 b FB(to)h(pr)o(o-)888 3271 y(duce)20 b(a)f(matching)i(output)g +(port.)k(Y)-8 b(ou)21 b(may)f(wish)h(to)f(turn)h(of)o(f)e(I/O)h(buf)o +(fering)f(for)888 3370 y(this)j(output)f(port.)681 3560 +y Fx(\(pty-name->tty-n)o(am)o(e)38 b FA(pty-name)p Fx(\))84 +b Ft(\000)-14 b(!)87 b FA(tty-name)642 b FB(pr)o(ocedur)o(e)681 +3660 y Fx(\(tty-name->pty-n)o(am)o(e)38 b FA(tty-name)p +Fx(\))85 b Ft(\000)-15 b(!)88 b FA(pty-name)641 b FB(pr)o(ocedur)o(e) +888 3800 y(These)17 b(two)g(pr)o(ocedur)o(es)e(map)h(between)h(corr)o +(esponding)f(terminal)h(and)f(pty)h(con-)888 3900 y(tr)o(oller)k +(names.)k(For)c(example,)1071 4065 y Fx(\(pty-name->tty-n)o(ame)37 +b("/dev/ptyq3"\))h Fm(=)-14 b Ft(\))87 b Fx("/dev/ttyq3")1071 +4164 y(\(tty-name->pty-n)o(ame)37 b("/dev/ttyrc"\))h +Fm(=)-14 b Ft(\))87 b Fx("/dev/ptyrc")1071 4370 y FE(Remark:)59 +b Fk(This)20 b(is)h(rather)f(Berkeley-speci\002c.)26 +b(SVR4)21 b(ptys)g(ar)o(e)f(rar)o(e)f(enough)1071 4462 +y(that)j(I've)e(no)g(r)o(eal)f(idea)h(if)g(it)g(generalises)e(acr)o +(oss)h(the)i(Unix)f(gap.)27 b(Experts)18 b(ar)o(e)1071 +4553 y(invited)k(to)g(advise.)32 b(Users)21 b(feel)g(fr)o(ee)g(to)h +(not)g(worry\227the)f(pr)o(edominance)h(of)1071 4644 +y(curr)o(ent)c(popular)g(Unix)h(systems)e(use)h(Berkeley)e(ptys.)681 +4850 y Fx(\(make-pty-genera)o(to)o(r\))81 b Ft(\000)-15 +b(!)88 b FA(pr)o(ocedur)o(e)982 b FB(pr)o(ocedur)o(e)681 +5147 y(82)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 83 89 -83 88 bop 409 1611 2777 4 v 409 1711 4 100 v 462 1681 a FA(Scsh)982 -b(C)476 b(Meaning)p 3183 1711 V 409 1714 2777 4 v 409 1731 -V 409 1830 4 100 v 464 1800 a(P)t Fr(O)t(S)t(I)t(X)p 3183 1830 -V 409 1930 V 462 1900 a Fw(ttyc/char-size)530 b(CSIZE)315 b -FA(Character)19 b(size)i(mask)p 3183 1930 V 409 2029 V 462 -2000 a Fw(ttyc/char-size5)486 b(CS5)403 b FA(5)21 b(bits)p -3183 2029 V 409 2129 V 462 2099 a Fw(ttyc/char-size6)486 b(CS6)403 -b FA(6)21 b(bits)p 3183 2129 V 409 2229 V 462 2199 a Fw(ttyc/char-size7)486 -b(CS7)403 b FA(7)21 b(bits)p 3183 2229 V 409 2328 V 462 2298 -a Fw(ttyc/char-size8)486 b(CS8)403 b FA(8)21 b(bits)p 3183 -2328 V 409 2428 V 462 2398 a Fw(ttyc/enable-pari)o(ty)355 b(PARENB)271 -b FA(Generate)20 b(and)h(detect)f(parity)-9 b(.)p 3183 2428 -V 409 2528 V 462 2498 a Fw(ttyc/odd-parity)486 b(PARODD)271 -b FA(Odd)21 b(parity)-9 b(.)p 3183 2528 V 409 2627 V 462 2597 -a Fw(ttyc/enable-read)442 b(CREAD)315 b FA(Enable)20 b(r)o(eception)h(of)f -(chars.)p 3183 2627 V 409 2727 V 462 2697 a Fw(ttyc/hup-on-clos)o(e)399 -b(HUPCL)315 b FA(Hang)21 b(up)g(on)g(last)g(close.)p 3183 2727 -V 409 2826 V 462 2797 a Fw(ttyc/no-modem-sy)o(nc)355 b(LOCAL)315 -b FA(Ignor)o(e)21 b(modem)g(lines.)p 3183 2826 V 409 2926 V -462 2896 a Fw(ttyc/2-stop-bits)442 b(CSTOPB)271 b FA(Send)20 -b(two)i(stop)f(bits.)p 3183 2926 V 409 2929 2777 4 v 409 2946 -V 409 3046 4 100 v 462 3016 a(4.3+BSD)p 3183 3046 V 409 3145 -V 462 3115 a Fw(ttyc/ignore-flag)o(s)399 b(CIGNORE)227 b FA(Ignor)o(e)21 -b(contr)o(ol)g(\257ags.)p 3183 3145 V 409 3245 V 462 3215 a -Fw(ttyc/CTS-output-)o(flo)o(w-)o(ctl)93 b(CCTS_OFLOW)i FA(CTS)20 -b(\257ow)i(contr)o(ol)f(of)g(output)p 3183 3245 V 409 3345 -V 462 3315 a Fw(ttyc/RTS-input-f)o(low)o(-c)o(tl)137 b(CRTS_IFLOW)95 -b FA(R)m(TS)21 b(\257ow)h(contr)o(ol)f(of)g(input)p 3183 3345 -V 409 3444 V 462 3414 a Fw(ttyc/carrier-flo)o(w-c)o(tl)224 -b(MDMBUF)p 3183 3444 V 409 3447 2777 4 v 365 3682 a FA(T)-8 -b(able)26 b(3.5:)36 b(Contr)o(ol-\257ags.)42 b(These)26 b(ar)o(e)e(the)i -(named)f(\257ags)h(for)g(the)g Fw(tty-info)c FA(r)o(ecor)o(d's)365 -3782 y Fz(contr)o(ol-\257ags)f FA(\256eld.)32 b(These)22 b(\257ags)g -(generally)g(contr)o(ol)h(the)f(details)g(of)g(the)g(terminal's)h(se-)365 -3882 y(rial)e(line.)27 b(Only)22 b(the)h(P)t Fr(O)t(S)t(I)t(X)h -FA(entries)d(ar)o(e)e(guaranteed)h(to)h(be)f(non-)p Fw(#f)p -FA(.)365 5147 y FD(November)e(1,)h(1995)h(\261)f(15)14 b(:)e(58)p -1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 -V 1636 5176 323 4 v 1216 w FA(83)p eop +83 88 bop 573 614 a FB(This)17 b(pr)o(ocedur)o(e)e(r)o(eturns)h(a)g +(generator)g(of)h(candidate)e(pty)i(names.)24 b(Each)16 +b(time)h(the)573 714 y(r)o(eturned)j(pr)o(ocedur)o(e)g(is)i(called,)f +(it)h(pr)o(oduces)f(a)g(new)h(candidate.)27 b(Softwar)o(e)21 +b(that)573 814 y(wishes)f(to)g(sear)o(ch)f(thr)o(ough)h(the)g(set)g(of) +f(available)f(ptys)i(can)g(use)f(a)g(pty)h(generator)573 +913 y(to)28 b(iterate)f(over)g(them.)47 b(After)26 b(pr)o(oducing)i +(all)f(the)h(possible)g(ptys,)i(a)d(generator)573 1013 +y(r)o(eturns)20 b Fx(#f)g FB(every)g(time)h(it)g(is)g(called.)k +(Example:)756 1179 y Fx(\(define)40 b(pg)j(\(make-pty-genera)o(to)o +(r\)\))756 1279 y(\(pg\))e Fm(=)-14 b Ft(\))87 b Fx("/dev/ptyp0")756 +1378 y(\(pg\))41 b Fm(=)-14 b Ft(\))87 b Fx("/dev/ptyp1")1104 +1465 y(.)1104 1498 y(.)1104 1532 y(.)756 1631 y(\(pg\))41 +b Fm(=)-14 b Ft(\))87 b Fx("/dev/ptyqe")756 1731 y(\(pg\))41 +b Fm(=)-14 b Ft(\))87 b Fx("/dev/ptyqf")170 b Fr(\(Last)41 +b(one\))756 1830 y Fx(\(pg\))g Fm(=)-14 b Ft(\))87 b +Fx(#f)756 1930 y(\(pg\))41 b Fm(=)-14 b Ft(\))87 b Fx(#f)1104 +2017 y(.)1104 2050 y(.)1104 2083 y(.)365 5147 y FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p 1636 5071 323 +4 v 1636 5173 4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 +5176 323 4 v 1216 w FB(83)p eop %%Page: 84 90 -84 89 bop 725 1483 2776 4 v 725 1574 4 92 v 778 1547 a Fj(Scsh)973 -b(C)439 b(Meaning)p 3497 1574 V 725 1578 2776 4 v 725 1594 -V 725 1686 4 92 v 780 1658 a(P)t Ff(O)t(S)t(I)t(X)p 3497 1686 -V 725 1777 V 778 1750 a Fi(ttyl/canonical)574 b(ICANON)258 -b Fj(Canonical)19 b(input)h(pr)o(ocessing.)p 3497 1777 V 725 -1868 V 778 1841 a Fi(ttyl/echo)769 b(ECHO)336 b Fj(Enable)19 -b(echoing.)p 3497 1868 V 725 1960 V 778 1932 a Fi(ttyl/echo-delete-line)301 -b(ECHOK)c Fj(Echo)18 b(newline)h(after)g(line)f(kill.)p 3497 -1960 V 725 2051 V 778 2024 a Fi(ttyl/echo-nl)652 b(ECHONL)258 -b Fj(Echo)18 b(newline)h(even)g(if)g(echo)g(is)f(of)o(f.)p -3497 2051 V 725 2142 V 778 2115 a Fi(ttyl/visual-delete)418 -b(ECHOE)297 b Fj(V)l(isually)17 b(erase)h(chars.)p 3497 2142 -V 725 2234 V 778 2206 a Fi(ttyl/enable-signals)379 b(ISIG)336 -b Fj(Enable)19 b Fi(^)p Fj(C,)f Fi(^)p Fj(Z)h(signalling.)p -3497 2234 V 725 2325 V 778 2298 a Fi(ttyl/extended)613 b(IEXTEN)258 -b Fj(Enable)19 b(extensions.)p 3497 2325 V 725 2416 V 778 2389 -a Fi(ttyl/no-flush-on-interrupt)106 b(NOFLSH)258 b Fj(Don't)19 -b(\257ush)g(after)f(interr)o(upt.)p 3497 2416 V 725 2508 V -778 2480 a Fi(ttyl/ttou-signal)496 b(ITOSTOP)219 b(SIGTTOU)20 -b Fj(on)f(backgr)o(ound)f(output.)p 3497 2508 V 725 2511 2776 -4 v 725 2528 V 725 2619 4 92 v 778 2592 a(SVR4)h(and)g(4.3+BSD)p -3497 2619 V 725 2710 V 778 2683 a Fi(ttyl/echo-ctl)613 b(ECHOCTL)219 -b Fj(Echo)18 b(contr)o(ol)h(chars)g(as)f(\252)p Fi(^X)p Fj(\272.)p -3497 2710 V 725 2802 V 778 2774 a Fi(ttyl/flush-output)457 -b(FLUSHO)258 b Fj(Output)19 b(is)f(being)g(\257ushed.)p 3497 -2802 V 725 2893 V 778 2865 a Fi(ttyl/hardcopy-delete)340 b(ECHOPRT)219 -b Fj(V)l(isual)18 b(erase)g(for)f(har)o(dcopy)-8 b(.)p 3497 -2893 V 725 2984 V 778 2957 a Fi(ttyl/reprint-unread-chars)145 -b(PENDIN)258 b Fj(Retype)18 b(pending)g(input.)p 3497 2984 -V 725 3076 V 778 3048 a Fi(ttyl/visual-delete-line)223 b(ECHOKE)258 -b Fj(V)l(isually)17 b(erase)h(a)h(line-kill.)p 3497 3076 V -725 3079 2776 4 v 725 3095 V 725 3187 4 92 v 778 3159 a(4.3+BSD)p -3497 3187 V 725 3278 V 778 3251 a Fi(ttyl/alt-delete-word)340 -b(ALTWERASE)141 b Fj(Alternate)19 b(wor)o(d)e(erase)h(algorithm)p -3497 3278 V 725 3369 V 778 3342 a Fi(ttyl/no-kernel-status)301 -b(NOKERNINFO)102 b Fj(No)18 b(kernel)g(status)h(on)g Fi(^T)p -Fj(.)p 3497 3369 V 725 3373 2776 4 v 725 3389 V 725 3481 4 -92 v 778 3453 a(SVR4)p 3497 3481 V 725 3572 V 778 3545 a Fi(ttyl/case-map)613 -b(XCASE)297 b Fj(Canonical)19 b(case)g(pr)o(esentation)p 3497 -3572 V 725 3575 2776 4 v 681 3810 a FA(T)-8 b(able)31 b(3.6:)48 -b(Local-\257ags.)59 b(These)31 b(ar)o(e)g(the)g(named)g(\257ags)h(for)g(the)f -Fw(tty-info)d FA(r)o(ecor)o(d's)681 3910 y Fz(local-\257ags)16 -b FA(\256eld.)26 b(These)17 b(\257ags)h(generally)f(contr)o(ol)g(the)g -(details)g(of)g(the)h(line-editting)f(user)681 4009 y(interface.)26 -b(Only)c(the)h(P)t Fr(O)t(S)t(I)t(X)h FA(entries)d(ar)o(e)e(guaranteed)g(to)j -(be)e(non-)p Fw(#f)p FA(.)681 5147 y(84)p 1952 5071 323 4 v -1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 -4 v 435 w FD(November)e(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +84 89 bop 1083 1460 2060 4 v 1083 1559 4 100 v 1136 1529 +a FB(Scsh)938 b(C)346 b(T)-7 b(ypical)20 b(char)p 3139 +1559 V 1083 1563 2060 4 v 1083 1579 V 1083 1679 4 100 +v 1138 1649 a(P)t Fs(O)t(S)t(I)t(X)p 3139 1679 V 1083 +1779 V 1136 1749 a Fx(ttychar/delete-ch)o(ar)267 b(ERASE)185 +b FB(del)p 3139 1779 V 1083 1878 V 1136 1848 a Fx(ttychar/delete-li)o +(ne)267 b(KILL)229 b(^U)p 3139 1878 V 1083 1978 V 1136 +1948 a(ttychar/eof)618 b(EOF)273 b(^D)p 3139 1978 V 1083 +2077 V 1136 2048 a(ttychar/eol)618 b(EOL)p 3139 2077 +V 1083 2177 V 1136 2147 a(ttychar/interrupt)354 b(INTR)229 +b(^C)p 3139 2177 V 1083 2277 V 1136 2247 a(ttychar/quit)574 +b(QUIT)229 b(^\\)p 3139 2277 V 1083 2376 V 1136 2346 +a(ttychar/suspend)442 b(SUSP)229 b(^Z)p 3139 2376 V 1083 +2476 V 1136 2446 a(ttychar/start)530 b(START)185 b(^Q)p +3139 2476 V 1083 2576 V 1136 2546 a(ttychar/stop)574 +b(STOP)229 b(^S)p 3139 2576 V 1083 2579 2060 4 v 1083 +2595 V 1083 2695 4 100 v 1136 2665 a FB(SVR4)21 b(and)f(4.3+BSD)p +3139 2695 V 1083 2795 V 1136 2765 a Fx(ttychar/delayed-s)o(us)o(pen)o +(d)93 b(DSUSP)185 b(^Y)p 3139 2795 V 1083 2894 V 1136 +2864 a(ttychar/delete-wo)o(rd)267 b(WERASE)141 b(^W)p +3139 2894 V 1083 2994 V 1136 2964 a(ttychar/discard)442 +b(DISCARD)97 b(^O)p 3139 2994 V 1083 3094 V 1136 3064 +a(ttychar/eol2)574 b(EOL2)p 3139 3094 V 1083 3193 V 1136 +3163 a(ttychar/literal-n)o(ex)o(t)224 b(LNEXT)185 b(^V)p +3139 3193 V 1083 3293 V 1136 3263 a(ttychar/reprint)442 +b(REPRINT)97 b(^R)p 3139 3293 V 1083 3296 2060 4 v 1083 +3313 V 1083 3412 4 100 v 1136 3383 a FB(4.3+BSD)p 3139 +3412 V 1083 3512 V 1136 3482 a Fx(ttychar/status)486 +b(STATUS)141 b(^T)p 3139 3512 V 1083 3515 2060 4 v 681 +3751 a FB(T)-8 b(able)23 b(3.4:)29 b(Indices)23 b(into)i(the)e +Fx(tty-info)d FB(r)o(ecor)o(d's)i FA(contr)o(ol-chars)g +FB(string,)i(and)f(the)g(char)o(-)681 3850 y(acter)f(traditionally)i +(found)g(at)f(each)g(index.)34 b(Only)25 b(the)f(indices)g(for)f(the)j +(P)t Fs(O)t(S)t(I)t(X)h FB(entries)681 3950 y(ar)o(e)19 +b(guaranteed)h(to)h(be)f(non-)p Fx(#f)p FB(.)681 5147 +y(84)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)f(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p eop %%Page: 85 91 -85 90 bop 365 1275 a Fv(Chapter)45 b(4)365 1727 y FB(Networking)365 -2220 y FA(The)25 b(Scheme)f(Shell)g(pr)o(ovides)g(a)g(BSD-style)g(sockets)h -(interface.)37 b(Ther)o(e)23 b(is)i(not)g(an)f(of)o(\256-)365 -2319 y(cial)d(standar)o(d)e(for)h(a)g(network)i(interface)d(for)i(scsh)g(to)g -(adopt)f(\(this)h(is)g(the)g(subject)g(of)f(the)365 2419 y(forthcoming)27 -b(Posix.8)d(standar)o(d\).)38 b(However)-6 b(,)26 b(Berkeley)e(sockets)i(ar)o -(e)d(a)i Fz(de)g(facto)f FA(stan-)365 2519 y(dar)o(d,)19 b(being)i(found)g -(on)g(most)h(Unix)f(workstations)h(and)e(PC)h(operating)g(systems.)490 -2656 y(It)29 b(is)h(fairly)f(straightforwar)o(d)g(to)h(add)e(higher)o(-level) -h(network)i(pr)o(otocols)f(such)g(as)365 2755 y(smtp,)22 b(telnet,)f(or)g -(http)h(on)f(top)h(of)f(the)g(the)h(basic)e(socket-level)h(support)h(scsh)g -(pr)o(ovides.)365 2855 y(The)29 b(Scheme)f(Under)o(gr)o(ound)f(has)i(also)g -(r)o(eleased)e(a)h(network)h(library)f(with)i(many)f(of)365 -2955 y(these)22 b(pr)o(otocols)g(as)g(a)f(companion)h(to)g(the)g(curr)o(ent)f -(r)o(elease)f(of)i(scsh.)30 b(See)21 b(this)h(code)g(for)365 -3054 y(examples)e(showing)j(the)e(use)g(of)f(the)h(sockets)h(interface.)365 -3364 y Fu(4.1)99 b(High-level)26 b(interface)365 3595 y FA(For)18 -b(convenience,)h(and)e(to)h(avoid)g(some)g(of)g(the)g(messy)h(details)e(of)h -(the)g(socket)g(interface,)365 3694 y(we)f(pr)o(ovide)f(a)g(high)i(level)e -(socket)h(interface.)25 b(These)17 b(r)o(outines)g(attempt)f(to)h(make)g(it)g -(easy)365 3794 y(to)23 b(write)f(simple)h(clients)g(and)f(servers)g(without)h -(having)g(to)f(think)i(of)e(many)h(of)f(the)g(de-)365 3894 -y(tails)f(of)g(initiating)i(socket)e(connections.)30 b(W)-8 -b(e)21 b(welcome)h(suggested)f(impr)o(ovements)g(to)365 3993 -y(this)i(interface,)e(including)i(better)f(names,)g(which)h(right)g(now)g(ar) -o(e)d(solely)j(descriptions)365 4093 y(of)14 b(the)h(pr)o(ocedur)o(e's)d -(action.)25 b(This)15 b(might)g(be)f(\256ne)g(for)g(people)g(who)h(alr)o -(eady)d(understand)365 4192 y(sockets,)21 b(but)g(does)g(not)g(help)g(the)g -(new)g(networking)h(pr)o(ogrammer)-6 b(.)365 4350 y Fw(\(socket-connect)38 -b Fz(pr)o(otocol-family)18 b(socket-type)h(.)h(ar)o(gs)p Fw(\))87 -b Fs(\000)-15 b(!)87 b Fz(socket)139 b FA(pr)o(ocedur)o(e)573 -4500 y Fw(socket-connect)92 b FA(is)98 b(intended)g(for)g(cr)o(eating)f -(client)i(applications.)573 4599 y Fz(pr)o(otocol-family)49 -b FA(is)k(speci\256ed)f(as)g(either)g(the)g Fw(protocol-family/i)o(nte)o(rn)o -(et)573 4699 y FA(or)84 b Fw(protocol-family/u)o(nix)o FA(.)213 -b Fz(socket-type)83 b FA(is)h(speci\256ed)g(as)h(either)573 -4799 y Fw(socket-type/stre)o(am)44 b FA(or)51 b Fw(socket-type/dat)o(agr)o -(am)o FA(.)111 b(See)50 b Fw(socket)e FA(for)i(a)573 4898 y(mor)o(e)20 -b(complete)h(description)g(of)g(these)g(terms.)365 5147 y FD(November)d(1,)h -(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 -4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 -w FA(85)p eop +85 90 bop 383 558 2830 4 v 383 650 4 92 v 436 622 a Fk(Scsh)1090 +b(C)321 b(Meaning)p 3209 650 V 383 653 2830 4 v 383 670 +V 383 761 4 92 v 438 733 a(P)t Fg(O)t(S)t(I)t(X)p 3209 +761 V 383 852 V 436 825 a Fh(ttyin/check-parity)535 b(INPCK)179 +b Fk(Check)19 b(parity)-8 b(.)p 3209 852 V 383 944 V +436 916 a Fh(ttyin/ignore-bad-parity-chars)106 b(IGNPAR)140 +b Fk(Ignor)o(e)18 b(chars)h(with)g(parity)g(err)o(ors.)p +3209 944 V 383 1035 V 436 1007 a Fh(ttyin/mark-parity-errors)301 +b(PARMRK)140 b Fk(Insert)19 b(chars)g(to)g(mark)f(parity)g(err)o(ors.)p +3209 1035 V 383 1126 V 436 1099 a Fh(ttyin/ignore-break)535 +b(IGNBRK)140 b Fk(Ignor)o(e)18 b(br)o(eaks.)p 3209 1126 +V 383 1217 V 436 1190 a Fh(ttyin/interrupt-on-break)301 +b(BRKINT)140 b Fk(Signal)19 b(on)g(br)o(eaks.)p 3209 +1217 V 383 1309 V 436 1281 a Fh(ttyin/7bits)808 b(ISTRIP)140 +b Fk(Strip)19 b(char)g(to)g(seven)f(bits.)p 3209 1309 +V 383 1400 V 436 1373 a Fh(ttyin/cr->nl)769 b(ICRNL)179 +b Fk(Map)19 b(carriage-r)o(eturn)e(to)i(newline.)p 3209 +1400 V 383 1491 V 436 1464 a Fh(ttyin/ignore-cr)652 b(IGNCR)179 +b Fk(Ignor)o(e)18 b(carriage-r)o(eturns.)p 3209 1491 +V 383 1583 V 436 1555 a Fh(ttyin/nl->cr)769 b(INLCR)179 +b Fk(Map)19 b(newline)g(to)g(carriage-r)o(eturn.)p 3209 +1583 V 383 1674 V 436 1647 a Fh(ttyin/input-flow-ctl)457 +b(IXOFF)179 b Fk(Enable)19 b(input)h(\003ow)f(contr)o(ol.)p +3209 1674 V 383 1765 V 436 1738 a Fh(ttyin/output-flow-ctl)418 +b(IXON)218 b Fk(Enable)19 b(output)h(\003ow)f(contr)o(ol.)p +3209 1765 V 383 1769 2830 4 v 383 1785 V 383 1877 4 92 +v 436 1849 a(SVR4)g(and)g(4.3+BSD)p 3209 1877 V 383 1968 +V 436 1941 a Fh(ttyin/xon-any)730 b(IXANY)179 b Fk(Any)19 +b(char)g(r)o(estarts)f(after)h(stop.)p 3209 1968 V 383 +2059 V 436 2032 a Fh(ttyin/beep-on-overflow)379 b(IMAXBEL)101 +b Fk(Ring)19 b(bell)f(when)i(queue)e(full.)p 3209 2059 +V 383 2063 2830 4 v 383 2079 V 383 2171 4 92 v 436 2143 +a(SVR4)p 3209 2171 V 383 2262 V 436 2235 a Fh(ttyin/lowercase)652 +b(IUCLC)179 b Fk(Map)19 b(upper)f(case)g(to)h(lower)f(case.)p +3209 2262 V 383 2265 2830 4 v 365 2500 a FB(T)-8 b(able)31 +b(3.5:)46 b(Input-\003ags.)58 b(These)31 b(ar)o(e)f(the)i(named)f +(\003ags)h(for)f(the)h Fx(tty-info)c FB(r)o(ecor)o(d's)365 +2600 y FA(input-\003ags)i FB(\002eld.)54 b(These)30 b(\003ags)g +(generally)h(contr)o(ol)f(the)h(pr)o(ocessing)f(of)g(input)h(chars.)365 +2699 y(Only)22 b(the)h(P)t Fs(O)t(S)t(I)t(X)h FB(entries)d(ar)o(e)e +(guaranteed)h(to)h(be)f(non-)p Fx(#f)p FB(.)p 495 2840 +2605 4 v 495 2939 4 100 v 548 2909 a(Scsh)982 b(C)339 +b(Meaning)p 3096 2939 V 495 2943 2605 4 v 495 2959 V +495 3059 4 100 v 550 3029 a(P)t Fs(O)t(S)t(I)t(X)p 3096 +3059 V 495 3159 V 548 3129 a Fx(ttyout/enable)574 b(OPOST)178 +b FB(Enable)20 b(output)i(pr)o(ocessing.)p 3096 3159 +V 495 3162 2605 4 v 495 3178 V 495 3278 4 100 v 548 3248 +a(SVR4)e(and)h(4.3+BSD)p 3096 3278 V 495 3378 V 548 3348 +a Fx(ttyout/nl->crnl)486 b(ONLCR)178 b FB(Map)20 b(nl)h(to)g(cr)o(-nl.) +p 3096 3378 V 495 3381 2605 4 v 495 3398 V 495 3497 4 +100 v 548 3467 a(4.3+BSD)p 3096 3497 V 495 3597 V 548 +3567 a Fx(ttyout/discard-eo)o(t)355 b(ONOEOT)134 b FB(Discar)o(d)20 +b(EOT)h(chars.)p 3096 3597 V 495 3697 V 548 3667 a Fx +(ttyout/expand-tab)o(s)355 b(OXTABS)1958 3637 y Fu(5)2092 +3667 y FB(Expand)20 b(tabs.)p 3096 3697 V 495 3700 2605 +4 v 495 3716 V 495 3816 4 100 v 548 3786 a(SVR4)p 3096 +3816 V 495 3916 V 548 3886 a Fx(ttyout/cr->nl)574 b(OCRNL)178 +b FB(Map)20 b(cr)g(to)i(nl.)p 3096 3916 V 495 4015 V +548 3985 a Fx(ttyout/nl-does-cr)398 b(ONLRET)134 b FB(Nl)21 +b(performs)g(cr)f(as)h(well.)p 3096 4015 V 495 4115 V +548 4085 a Fx(ttyout/no-col0-cr)398 b(ONOCR)178 b FB(No)21 +b(cr)g(output)g(in)g(column)h(0.)p 3096 4115 V 495 4215 +V 548 4185 a Fx(ttyout/delay-w/fi)o(ll)o(-ch)o(ar)93 +b(OFILL)178 b FB(Send)20 b(\002ll)i(char)e(to)h(delay)-9 +b(.)p 3096 4215 V 495 4314 V 548 4284 a Fx(ttyout/fill-w/del)398 +b(OFDEL)178 b FB(Fill)22 b(char)e(is)j(A)t Fs(S)t(C)t(I)t(I)h +FB(DEL.)p 3096 4314 V 495 4414 V 548 4384 a Fx(ttyout/uppercase)442 +b(OLCUC)178 b FB(Map)20 b(lower)h(to)g(upper)f(case.)p +3096 4414 V 495 4417 2605 4 v 365 4652 a(T)-8 b(able)27 +b(3.6:)36 b(Output-\003ags.)44 b(These)26 b(ar)o(e)g(the)h(named)f +(\003ags)h(for)g(the)g Fx(tty-info)c FB(r)o(ecor)o(d's)365 +4752 y FA(output-\003ags)f FB(\002eld.)31 b(These)22 +b(\003ags)h(generally)g(contr)o(ol)g(the)f(pr)o(ocessing)h(of)g(output) +g(chars.)365 4851 y(Only)f(the)h(P)t Fs(O)t(S)t(I)t(X)h +FB(entries)d(ar)o(e)e(guaranteed)h(to)h(be)f(non-)p Fx(#f)p +FB(.)365 5147 y FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(85)p +eop %%Page: 86 92 -86 91 bop 888 614 a FA(The)20 b(variable)e Fz(ar)o(gs)g FA(list)i(is)g(meant) -f(to)g(specify)g(pr)o(otocol)h(family)f(speci\256c)g(informa-)888 -714 y(tion.)27 b(For)15 b(Internet)f(sockets,)j(this)e(consists)h(of)f(two)g -(ar)o(guments:)24 b(a)14 b(host)i(name)e(and)888 814 y(a)21 -b(port)f(number)-6 b(.)28 b(For)21 b(Unix)g(sockets,)g(this)g(consists)h(of)f -(a)f(pathname.)888 957 y Fw(socket-connect)10 b FA(r)o(eturns)15 -b(a)g Fw(socket)d FA(which)17 b(can)e(be)g(used)g(for)g(input)h(and)f(output) -888 1057 y(fr)o(om)21 b(a)f(r)o(emote)g(server)-6 b(.)27 b(See)20 -b Fw(socket)e FA(for)i(a)h(description)g(of)f(the)h Fz(socket)g(r)o(ecord)p -FA(.)681 1280 y Fw(\(bind-listen-acc)o(ep)o(t-l)o(oo)o(p)37 -b Fz(pr)o(otocol-family)12 b(pr)o(oc)g(ar)o(g)p Fw(\))43 b -Fs(\000)-15 b(!)44 b Fz(does-not-r)o(eturn)87 b FA(pr)o(ocedur)o(e)888 -1431 y Fw(bind-listen-accep)o(t-)o(loo)o(p)22 b FA(is)29 b(intended)f(for)f -(cr)o(eating)h(server)f(applications.)888 1531 y Fz(pr)o(otocol-family)k -FA(is)j(speci\256ed)g(as)f(either)g(the)h Fw(protocol-family/i)o(nt)o(ern)o -(et)27 b FA(or)888 1631 y Fw(protocol-family/u)o(ni)o(x)p FA(.)e -Fz(pr)o(oc)c FA(is)h(a)f(pr)o(ocedur)o(e)f(of)i(two)h(ar)o(guments:)29 -b(a)22 b Fw(socket)888 1730 y FA(and)c(a)f(socket-addr)o(ess.)25 -b Fz(ar)o(g)17 b FA(speci\256es)h(a)f(port)h(number)g(for)f(Internet)h -(sockets)h(or)f(a)888 1830 y(pathname)23 b(for)g(Unix)g(sockets.)35 -b(See)22 b Fw(socket)f FA(for)i(a)g(mor)o(e)f(complete)i(description)888 -1930 y(of)d(these)g(terms.)888 2073 y Fz(pr)o(oc)g FA(is)h(called)f(with)h(a) -f(socket)h(and)f(a)g(socket)h(addr)o(ess)e(each)h(time)h(ther)o(e)f(is)h(a)f -(con-)888 2173 y(nection)16 b(fr)o(om)f(a)f(client)i(application.)25 -b(The)15 b(socket)h(allows)f(communications)i(with)888 2272 -y(the)k(client.)28 b(The)21 b(socket)g(addr)o(ess)e(speci\256es)i(the)g(addr) -o(ess)e(of)i(the)g(r)o(emote)f(client.)888 2416 y(This)j(pr)o(ocedur)o(e)e -(does)h(not)h(r)o(eturn,)f(but)g(loops)i(inde\256nitely)f(accepting)f -(connec-)888 2515 y(tions)g(fr)o(om)f(client)g(pr)o(ograms.)681 -2856 y Fu(4.2)99 b(Sockets)681 3110 y Fw(\(create-socket)38 -b Fz(pr)o(otocol-family)18 b(type)h([pr)o(otocol])p Fw(\))85 -b Fs(\000)-15 b(!)88 b Fz(socket)269 b FA(pr)o(ocedur)o(e)681 -3210 y Fw(\(create-socket-p)o(ai)o(r)38 b Fz(type)p Fw(\))85 -b Fs(\000)-14 b(!)87 b Fz([socket)2275 3222 y Ft(1)2333 3210 -y Fz(socket)2533 3222 y Ft(2)2570 3210 y Fz(])572 b FA(pr)o(ocedur)o(e)681 -3310 y Fw(\(close-socket)38 b Fz(socket)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(unde\256ned)998 b FA(pr)o(ocedur)o(e)888 3440 y(A)21 -b(socket)g(is)g(one)g(end)f(of)h(a)f(network)h(connection.)29 -b(Thr)o(ee)20 b(speci\256c)g(pr)o(operties)g(of)888 3539 y(sockets)j(ar)o(e)e -(speci\256ed)g(at)h(cr)o(eation)f(time:)30 b(the)23 b(pr)o(otocol-family)-9 -b(,)21 b(type,)h(and)g(pr)o(o-)888 3639 y(tocol.)888 3782 y(The)16 -b Fz(pr)o(otocol-family)d FA(speci\256es)j(the)g(pr)o(otocol)g(family)f(to)i -(be)e(used)g(with)i(the)f(socket.)888 3882 y(This)g(also)f(determines)f(the)h -(addr)o(ess)e(family)i(of)g(socket)g(addr)o(esses,)f(which)i(ar)o(e)d(de-)888 -3982 y(scribed)26 b(in)g(mor)o(e)g(detail)f(below)-8 b(.)44 -b(Scsh)26 b(curr)o(ently)g(supports)g(the)g(Unix)g(internal)888 -4081 y(pr)o(otocols)c(and)e(the)h(Internet)g(pr)o(otocols)g(using)g(the)g -(following)i(constants:)1071 4269 y Fw(protocol-family/)o(uns)o(pe)o(ci)o -(fie)o(d)1071 4368 y(protocol-family/)o(uni)o(x)1071 4468 y(protocol-family/) -o(int)o(er)o(ne)o(t)888 4699 y FA(The)g Fz(type)f FA(speci\256es)h(the)f -(style)i(of)e(communication.)35 b(Examples)22 b(that)h(your)g(oper)o(-)888 -4799 y(ating)18 b(system)h(pr)o(obably)e(pr)o(ovides)g(ar)o(e)f(str)o(eam)h -(and)g(datagram)g(sockets.)27 b(Others)888 4898 y(maybe)21 -b(available)e(depending)i(on)g(your)g(system.)28 b(T)-7 b(ypical)20 -b(values)h(ar)o(e:)681 5147 y(86)p 1952 5071 323 4 v 1952 5173 -4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 -w FD(November)d(1,)h(1995)h(\261)f(15)13 b(:)f(58)p eop +86 91 bop 1581 1286 1696 4 v 1578 1382 4 100 v 1631 1352 +a FB(V)-8 b(alue)676 b(Comment)p 3274 1382 V 1581 1385 +1696 4 v 927 1452 a(Backspace)19 b(delay)p 1578 1482 +4 100 v 102 w Fx(ttyout/bs-delay)224 b FB(Bit-\002eld)21 +b(mask)p 3274 1482 V 1578 1581 V 1631 1551 a Fx(ttyout/bs-delay0)p +3274 1581 V 1578 1681 V 1631 1651 a(ttyout/bs-delay1)p +3274 1681 V 1581 1684 1696 4 v 731 1750 a FB(Carriage-r)o(eturn)d +(delay)p 1578 1780 4 100 v 102 w Fx(ttyout/cr-delay)224 +b FB(Bit-\002eld)21 b(mask)p 3274 1780 V 1578 1880 V +1631 1850 a Fx(ttyout/cr-delay0)p 3274 1880 V 1578 1980 +V 1631 1950 a(ttyout/cr-delay1)p 3274 1980 V 1578 2079 +V 1631 2049 a(ttyout/cr-delay2)p 3274 2079 V 1578 2179 +V 1631 2149 a(ttyout/cr-delay3)p 3274 2179 V 1581 2182 +1696 4 v 922 2249 a FB(Form-feed)f(delay)p 1578 2279 +4 100 v 102 w Fx(ttyout/ff-delay)224 b FB(Bit-\002eld)21 +b(mask)p 3274 2279 V 1578 2378 V 1631 2348 a Fx(ttyout/ff-delay0)p +3274 2378 V 1578 2478 V 1631 2448 a(ttyout/ff-delay1)p +3274 2478 V 1581 2481 1696 4 v 764 2548 a FB(Horizontal-tab)f(delay)p +1578 2577 4 100 v 102 w Fx(ttyout/tab-delay)180 b FB(Bit-\002eld)21 +b(mask)p 3274 2577 V 1578 2677 V 1631 2647 a Fx(ttyout/tab-delay0)p +3274 2677 V 1578 2777 V 1631 2747 a(ttyout/tab-delay1)p +3274 2777 V 1578 2876 V 1631 2846 a(ttyout/tab-delay2)p +3274 2876 V 1578 2976 V 1631 2946 a(ttyout/tab-delayx)136 +b FB(Expand)20 b(tabs)p 3274 2976 V 1581 2979 1696 4 +v 991 3046 a(Newline)h(delay)p 1578 3076 4 100 v 102 +w Fx(ttyout/nl-delay)224 b FB(Bit-\002eld)21 b(mask)p +3274 3076 V 1578 3175 V 1631 3145 a Fx(ttyout/nl-delay0)p +3274 3175 V 1578 3275 V 1631 3245 a(ttyout/nl-delay1)p +3274 3275 V 1581 3278 1696 4 v 893 3345 a FB(V)-9 b(ertical)20 +b(tab)g(delay)p 1578 3374 4 100 v 102 w Fx(ttyout/vtab-delay)136 +b FB(Bit-\002eld)21 b(mask)p 3274 3374 V 1578 3474 V +1631 3444 a Fx(ttyout/vtab-delay)o(0)p 3274 3474 V 1578 +3574 V 1631 3544 a(ttyout/vtab-delay)o(1)p 3274 3574 +V 1581 3577 1696 4 v 1415 3643 a FB(All)p 1578 3673 4 +100 v 103 w Fx(ttyout/all-delay)180 b FB(T)-8 b(otal)21 +b(bit-\002eld)g(mask)p 3274 3673 V 1581 3677 1696 4 v +681 3825 a(T)-8 b(able)18 b(3.7:)23 b(Delay)18 b(constants.)25 +b(These)18 b(ar)o(e)f(the)i(named)f(\003ags)g(for)g(the)h +Fx(tty-info)14 b FB(r)o(ecor)o(d's)681 3925 y FA(output-\003ags)h +FB(\002eld.)24 b(These)17 b(\003ags)g(contr)o(ol)g(the)f(output)i +(delays)e(associated)g(with)h(printing)681 4024 y(special)j +(characters.)25 b(They)d(ar)o(e)d(non-)r(P)t Fs(O)t(S)t(I)t(X)r +FB(,)k(and)e(have)f(non-)p Fx(#f)h FB(values)g(only)h(on)g(SVR4)681 +4124 y(systems.)681 5147 y(86)p 1952 5071 323 4 v 1952 +5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 5176 +323 4 v 538 w FE(Mar)o(ch)d(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 87 93 -87 92 bop 756 614 a Fw(socket-type/str)o(ea)o(m)756 714 y(socket-type/dat)o -(ag)o(ram)756 814 y(socket-type/raw)573 1007 y FA(The)19 b -Fz(pr)o(otocol)e FA(speci\256es)i(a)g(particular)f(pr)o(otocol)h(to)g(use)h -(within)g(a)e(pr)o(otocol)i(family)573 1107 y(and)15 b(type.)26 -b(Usually)15 b(only)i(one)f(choice)g(exists,)g(but)g(it's)g(pr)o(obably)f -(safest)g(to)h(set)g(this)573 1207 y(explicitly)-9 b(.)35 b(See)22 -b(the)h(pr)o(otocol)h(database)d(r)o(outines)j(for)f(information)h(on)g -(looking)573 1306 y(up)d(pr)o(otocol)g(constants.)573 1437 -y(New)48 b(sockets)h(ar)o(e)e(typically)h(cr)o(eated)e(with)k -Fw(create-socket)p FA(.)104 b(However)-6 b(,)573 1537 y Fw(create-socket-pa)o -(ir)14 b FA(can)19 b(also)i(be)f(used)g(to)g(cr)o(eate)f(a)g(pair)h(of)g -(connected)g(sock-)573 1637 y(ets)14 b(in)h(the)f Fw(protocol-family/)o(un)o -(ix)8 b FA(pr)o(otocol-family)-9 b(.)24 b(The)15 b(value)e(of)h(a)g(r)o -(eturned)573 1736 y(socket)21 b(is)g(a)f Fz(socket)h(r)o(ecord)p -FA(,)f(de\256ned)g(to)h(have)g(the)g(following)h(str)o(uctur)o(e:)756 -1899 y Fw(\(define-record)37 b(socket)843 1998 y(family)1392 -b(;)43 b(protocol)d(family)843 2098 y(inport)1392 b(;)43 b(input-port)843 -2198 y(outport\))1304 b(;)43 b(output-port)573 2391 y FA(The)26 -b Fw(family)e FA(speci\256es)i(the)h(pr)o(otocol)f(family)h(of)f(the)g -(socket.)45 b(The)26 b Fw(inport)e FA(and)573 2491 y Fw(outport)h -FA(\256elds)j(ar)o(e)f(ports)i(that)f(can)g(be)g(used)f(for)h(input)h(and)f -(output,)i(r)o(espec-)573 2591 y(tively)-9 b(.)50 b(For)28 -b(a)g(str)o(eam)f(socket,)j(they)f(ar)o(e)d(only)k(usable)d(after)g(a)h -(connection)i(has)573 2690 y(been)18 b(established)g(via)g -Fw(connect-socket)12 b FA(or)18 b Fw(accept-connection)o FA(.)j(For)d(a)g -(data-)573 2790 y(gram)j(socket,)g Fz(outport)f FA(can)h(be)g(immediately)g -(using)h Fw(send-message)p FA(,)16 b(and)21 b Fz(inport)573 -2890 y FA(can)f(be)h(used)f(after)g Fw(bind)f FA(has)i(cr)o(eated)d(a)j -(local)f(addr)o(ess.)573 3021 y Fw(close-socket)9 b FA(pr)o(ovides)14 -b(a)g(convenient)h(way)g(to)f(close)h(a)f(socket's)h(port.)26 -b(It)14 b(is)h(pr)o(e-)573 3120 y(ferr)o(ed)h(to)i(explicitly)g(closing)h -(the)g(inport)f(and)g(outport)g(because)f(using)i Fw(close)d -FA(on)573 3220 y(sockets)21 b(is)g(not)h(curr)o(ently)e(portable)g(acr)o(oss) -g(operating)h(systems.)365 3510 y Fu(4.3)99 b(Socket)26 b(addresses)365 -3724 y FA(The)i(format)g(of)g(a)g(socket-addr)o(ess)e(depends)i(on)g(the)h -(addr)o(ess)d(family)i(of)g(the)g(socket.)365 3824 y(Addr)o -(ess-family-speci\256c)21 b(r)o(outines)j(ar)o(e)e(pr)o(ovided)g(to)i -(convert)f(pr)o(otocol-speci\256c)h(ad-)365 3924 y(dr)o(esses)i(to)i(socket)f -(addr)o(esses.)44 b(The)27 b(value)f(r)o(eturned)g(by)h(these)g(r)o(outines)g -(is)g(a)f Fz(socket-)365 4023 y(addr)o(ess)21 b(r)o(ecord)p -FA(,)f(de\256ned)g(to)h(have)f(the)h(following)i(visible)e(str)o(uctur)o(e:) -573 4207 y Fw(\(define-record)38 b(socket-address)660 4307 -y(family\))1348 b(;)43 b(address)e(family)490 4515 y FA(The)21 -b Fw(family)d FA(is)j(one)g(of)g(the)g(following)h(constants:)573 -4699 y Fw(address-family/u)o(ns)o(pec)o(if)o(ied)573 4799 y(address-family/u) -o(ni)o(x)573 4898 y(address-family/i)o(nt)o(ern)o(et)365 5147 -y FD(November)c(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 -323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 -5176 323 4 v 1216 w FA(87)p eop +87 92 bop 409 1570 2777 4 v 409 1669 4 100 v 462 1639 +a FB(Scsh)982 b(C)476 b(Meaning)p 3183 1669 V 409 1672 +2777 4 v 409 1689 V 409 1789 4 100 v 464 1759 a(P)t Fs(O)t(S)t(I)t(X)p +3183 1789 V 409 1888 V 462 1858 a Fx(ttyc/char-size)530 +b(CSIZE)315 b FB(Character)19 b(size)i(mask)p 3183 1888 +V 409 1988 V 462 1958 a Fx(ttyc/char-size5)486 b(CS5)403 +b FB(5)21 b(bits)p 3183 1988 V 409 2088 V 462 2058 a +Fx(ttyc/char-size6)486 b(CS6)403 b FB(6)21 b(bits)p 3183 +2088 V 409 2187 V 462 2157 a Fx(ttyc/char-size7)486 b(CS7)403 +b FB(7)21 b(bits)p 3183 2187 V 409 2287 V 462 2257 a +Fx(ttyc/char-size8)486 b(CS8)403 b FB(8)21 b(bits)p 3183 +2287 V 409 2386 V 462 2357 a Fx(ttyc/enable-pari)o(ty)355 +b(PARENB)271 b FB(Generate)20 b(and)h(detect)f(parity)-9 +b(.)p 3183 2386 V 409 2486 V 462 2456 a Fx(ttyc/odd-parity)486 +b(PARODD)271 b FB(Odd)21 b(parity)-9 b(.)p 3183 2486 +V 409 2586 V 462 2556 a Fx(ttyc/enable-read)442 b(CREAD)315 +b FB(Enable)20 b(r)o(eception)h(of)f(chars.)p 3183 2586 +V 409 2685 V 462 2655 a Fx(ttyc/hup-on-clos)o(e)399 b(HUPCL)315 +b FB(Hang)21 b(up)g(on)g(last)g(close.)p 3183 2685 V +409 2785 V 462 2755 a Fx(ttyc/no-modem-sy)o(nc)355 b(LOCAL)315 +b FB(Ignor)o(e)21 b(modem)g(lines.)p 3183 2785 V 409 +2885 V 462 2855 a Fx(ttyc/2-stop-bits)442 b(CSTOPB)271 +b FB(Send)20 b(two)i(stop)f(bits.)p 3183 2885 V 409 2888 +2777 4 v 409 2905 V 409 3004 4 100 v 462 2974 a(4.3+BSD)p +3183 3004 V 409 3104 V 462 3074 a Fx(ttyc/ignore-flag)o(s)399 +b(CIGNORE)227 b FB(Ignor)o(e)21 b(contr)o(ol)g(\003ags.)p +3183 3104 V 409 3203 V 462 3173 a Fx(ttyc/CTS-output-)o(flo)o(w-)o(ctl) +93 b(CCTS_OFLOW)i FB(CTS)20 b(\003ow)i(contr)o(ol)f(of)g(output)p +3183 3203 V 409 3303 V 462 3273 a Fx(ttyc/RTS-input-f)o(low)o(-c)o(tl) +137 b(CRTS_IFLOW)95 b FB(R)m(TS)21 b(\003ow)h(contr)o(ol)f(of)g(input)p +3183 3303 V 409 3403 V 462 3373 a Fx(ttyc/carrier-flo)o(w-c)o(tl)224 +b(MDMBUF)p 3183 3403 V 409 3406 2777 4 v 365 3641 a FB(T)-8 +b(able)26 b(3.8:)35 b(Contr)o(ol-\003ags.)41 b(These)26 +b(ar)o(e)e(the)j(named)e(\003ags)h(for)g(the)g Fx(tty-info)d +FB(r)o(ecor)o(d's)365 3740 y FA(contr)o(ol-\003ags)32 +b FB(\002eld.)61 b(These)33 b(\003ags)g(generally)f(contr)o(ol)h(the)g +(details)g(of)f(the)h(terminal's)365 3840 y(serial)21 +b(line.)26 b(Only)21 b(the)i(P)t Fs(O)t(S)t(I)t(X)h FB(entries)d(ar)o +(e)e(guaranteed)h(to)h(be)g(non-)p Fx(#f)p FB(.)365 5147 +y FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(87)p eop %%Page: 88 94 -88 93 bop 681 614 a Fw(\(unix-address->s)o(oc)o(ket)o(-a)o(dd)o(res)o(s)37 -b Fz(pathname)p Fw(\))56 b Fs(\000)-14 b(!)57 b Fz(socket-addr)o(ess)86 -b FA(pr)o(ocedur)o(e)888 752 y Fw(unix-address->soc)o(ke)o(t-a)o(dd)o(res)o -(s)33 b FA(r)o(eturns)38 b(a)g Fz(socket-addr)o(ess)g FA(based)g(on)i(the)888 -851 y(string)e Fz(pathname)n FA(.)76 b(Ther)o(e)36 b(is)h(a)f(system)i -(dependent)e(limit)i(on)f(the)g(length)h(of)888 951 y Fz(pathname)o -FA(.)681 1136 y Fw(\(internet-addres)o(s-)o(>so)o(ck)o(et)o(-ad)o(dr)o(ess)f -Fz(host-addr)o(ess)12 b(service-port)p Fw(\))43 b Fs(\000)-14 -b(!)43 b Fz(socket-addr)o(ess)86 b FA(pr)o(ocedur)o(e)888 1273 -y Fw(internet-address-)o(>s)o(ock)o(et)o(-ad)o(dr)o(ess)7 b -FA(r)o(eturns)14 b(a)f Fz(socket-addr)o(ess)g FA(based)g(on)i(an)888 -1373 y(integer)k Fz(host-addr)o(ess)f FA(and)g(an)h(integer)g -Fz(service-port)o FA(.)27 b(Besides)19 b(being)g(a)f(32-bit)g(host)888 -1472 y(addr)o(ess,)28 b(an)g(Internet)g(host)h(addr)o(ess)d(can)i(also)g(be)g -(one)g(of)g(the)g(following)i(con-)888 1572 y(stants:)1071 -1734 y Fw(internet-address)o(/an)o(y)1071 1833 y(internet-address)o(/lo)o(op) -o(ba)o(ck)1071 1933 y(internet-address)o(/br)o(oa)o(dc)o(ast)888 -2126 y FA(The)g(use)f(of)h Fw(internet-addres)o(s/a)o(ny)23 -b FA(is)30 b(described)e(below)i(in)g Fw(bind-socket)p FA(.)888 -2226 y Fw(internet-address/)o(lo)o(opb)o(ac)o(k)20 b FA(is)26 -b(an)g(addr)o(ess)f(that)h(always)g(speci\256es)g(the)g(lo-)888 -2326 y(cal)f(machine.)43 b Fw(internet-address)o(/b)o(ro)o(adc)o(as)o(t)20 -b FA(is)26 b(used)f(for)g(network)i(br)o(oad-)888 2425 y(cast)21 -b(communications.)888 2556 y(For)28 b(information)g(on)h(obtaining)f(a)f -(host's)i(addr)o(ess,)e(see)g(the)h Fw(host-info)c FA(func-)888 -2656 y(tion.)681 2841 y Fw(\(socket-address-)o(>u)o(nix)o(-a)o(dd)o(res)o(s) -37 b Fz(socket-addr)o(ess)p Fw(\))56 b Fs(\000)-14 b(!)57 b -Fz(pathname)86 b FA(pr)o(ocedur)o(e)681 2940 y Fw(\(socket-address-)o(>i)o -(nte)o(rn)o(et)o(-ad)o(dr)o(ess)37 b Fz(socket-addr)o(ess)p -Fw(\))42 b Fs(\000)-14 b(!)43 b Fz([host-addr)o(ess)12 b(service-port])87 -b FA(pr)o(ocedur)o(e)888 3077 y(The)227 b(r)o(outines)h Fw(socket-address-)o -(>in)o(te)o(rne)o(t-)o(ad)o(dre)o(ss)220 b FA(and)888 3177 -y Fw(socket-address->u)o(ni)o(x-a)o(dd)o(res)o(s)74 b FA(r)o(eturn)81 -b(the)f(addr)o(ess-family-speci\256c)888 3277 y(addr)o(esses.)95 -b(Be)43 b(awar)o(e)g(that)g(most)i(implementations)g(don't)f(corr)o(ectly)f -(r)o(e-)888 3376 y(turn)e(anything)g(mor)o(e)f(than)g(an)g(empty)g(string)h -(for)f(addr)o(esses)e(in)j(the)f(Unix)888 3476 y(addr)o(ess-family)-9 -b(.)681 3766 y Fu(4.4)99 b(Socket)25 b(primitives)681 3980 -y FA(The)17 b(pr)o(ocedur)o(es)f(in)i(this)g(section)g(ar)o(e)e(pr)o(esented) -g(in)i(the)g(or)o(der)e(in)i(which)h(a)e(typical)g(pr)o(o-)681 -4080 y(gram)h(will)g(use)g(them.)27 b(Consult)19 b(a)f(text)g(on)h(network)f -(systems)h(pr)o(ogramming)g(for)e(mor)o(e)681 4179 y(information)28 -b(on)f(sockets.)1552 4149 y Ft(1)1636 4179 y FA(The)f(last)h(two)h(tutorials) -f(ar)o(e)e(fr)o(eely)h(available)f(as)i(part)f(of)p 681 4252 -1146 4 v 766 4306 a Fo(1)800 4329 y Fr(Some)17 b(r)o(ecommended)d(ones)j(ar)o -(e:)812 4446 y Fd(\017)41 b Fr(\252Unix)17 b(Network)g(Pr)o(ogramming\272)g -(by)f(W)-6 b(.)17 b(Richar)o(d)g(Stevens)812 4554 y Fd(\017)41 -b Fr(\252An)19 b(Intr)o(oductory)g(4.3BSD)f(Interpr)o(ocess)h(Communication)g -(T)-6 b(utorial.\272)30 b(\(r)o(eprinted)17 b(in)i(UNIX)h(Pr)o(o-)888 -4632 y(grammer)5 b('s)17 b(Supplementary)f(Documents)h(V)-7 -b(olume)16 b(1,)g(PS1:7\))812 4741 y Fd(\017)41 b Fr(\252An)25 -b(Advanced)f(4.3BSD)h(Interpr)o(ocess)h(Communication)f(T)-6 -b(utorial.\272)49 b(\(r)o(eprinted)24 b(in)i(UNIX)g(Pr)o(o-)888 -4819 y(grammer)5 b('s)17 b(Supplementary)f(Documents)h(V)-7 -b(olume)16 b(1,)g(PS1:8\))681 5147 y FA(88)p 1952 5071 323 -4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 -323 4 v 435 w FD(November)i(1,)h(1995)h(\261)f(15)13 b(:)f(58)p +88 93 bop 725 1442 2776 4 v 725 1533 4 92 v 778 1506 +a Fk(Scsh)973 b(C)439 b(Meaning)p 3497 1533 V 725 1536 +2776 4 v 725 1553 V 725 1644 4 92 v 780 1617 a(P)t Fg(O)t(S)t(I)t(X)p +3497 1644 V 725 1736 V 778 1708 a Fh(ttyl/canonical)574 +b(ICANON)258 b Fk(Canonical)19 b(input)h(pr)o(ocessing.)p +3497 1736 V 725 1827 V 778 1799 a Fh(ttyl/echo)769 b(ECHO)336 +b Fk(Enable)19 b(echoing.)p 3497 1827 V 725 1918 V 778 +1891 a Fh(ttyl/echo-delete-line)301 b(ECHOK)c Fk(Echo)18 +b(newline)h(after)g(line)f(kill.)p 3497 1918 V 725 2010 +V 778 1982 a Fh(ttyl/echo-nl)652 b(ECHONL)258 b Fk(Echo)18 +b(newline)h(even)g(if)g(echo)g(is)f(of)o(f.)p 3497 2010 +V 725 2101 V 778 2073 a Fh(ttyl/visual-delete)418 b(ECHOE)297 +b Fk(V)l(isually)17 b(erase)h(chars.)p 3497 2101 V 725 +2192 V 778 2165 a Fh(ttyl/enable-signals)379 b(ISIG)336 +b Fk(Enable)19 b Fh(^)p Fk(C,)f Fh(^)p Fk(Z)h(signalling.)p +3497 2192 V 725 2284 V 778 2256 a Fh(ttyl/extended)613 +b(IEXTEN)258 b Fk(Enable)19 b(extensions.)p 3497 2284 +V 725 2375 V 778 2347 a Fh(ttyl/no-flush-on-interrupt)106 +b(NOFLSH)258 b Fk(Don't)19 b(\003ush)g(after)f(interr)o(upt.)p +3497 2375 V 725 2466 V 778 2439 a Fh(ttyl/ttou-signal)496 +b(ITOSTOP)219 b(SIGTTOU)20 b Fk(on)f(backgr)o(ound)f(output.)p +3497 2466 V 725 2469 2776 4 v 725 2486 V 725 2577 4 92 +v 778 2550 a(SVR4)h(and)g(4.3+BSD)p 3497 2577 V 725 2669 +V 778 2641 a Fh(ttyl/echo-ctl)613 b(ECHOCTL)219 b Fk(Echo)18 +b(contr)o(ol)h(chars)g(as)f(\223)p Fh(^X)p Fk(\224.)p +3497 2669 V 725 2760 V 778 2733 a Fh(ttyl/flush-output)457 +b(FLUSHO)258 b Fk(Output)19 b(is)f(being)g(\003ushed.)p +3497 2760 V 725 2851 V 778 2824 a Fh(ttyl/hardcopy-delete)340 +b(ECHOPRT)219 b Fk(V)l(isual)18 b(erase)g(for)f(har)o(dcopy)-8 +b(.)p 3497 2851 V 725 2943 V 778 2915 a Fh(ttyl/reprint-unread-chars) +145 b(PENDIN)258 b Fk(Retype)18 b(pending)g(input.)p +3497 2943 V 725 3034 V 778 3007 a Fh(ttyl/visual-delete-line)223 +b(ECHOKE)258 b Fk(V)l(isually)17 b(erase)h(a)h(line-kill.)p +3497 3034 V 725 3037 2776 4 v 725 3054 V 725 3145 4 92 +v 778 3118 a(4.3+BSD)p 3497 3145 V 725 3237 V 778 3209 +a Fh(ttyl/alt-delete-word)340 b(ALTWERASE)141 b Fk(Alternate)19 +b(wor)o(d)e(erase)h(algorithm)p 3497 3237 V 725 3328 +V 778 3301 a Fh(ttyl/no-kernel-status)301 b(NOKERNINFO)102 +b Fk(No)18 b(kernel)g(status)h(on)g Fh(^T)p Fk(.)p 3497 +3328 V 725 3331 2776 4 v 725 3348 V 725 3439 4 92 v 778 +3412 a(SVR4)p 3497 3439 V 725 3530 V 778 3503 a Fh(ttyl/case-map)613 +b(XCASE)297 b Fk(Canonical)19 b(case)g(pr)o(esentation)p +3497 3530 V 725 3534 2776 4 v 681 3769 a FB(T)-8 b(able)31 +b(3.9:)47 b(Local-\003ags.)58 b(These)32 b(ar)o(e)e(the)i(named)f +(\003ags)h(for)g(the)g Fx(tty-info)c FB(r)o(ecor)o(d's)681 +3868 y FA(local-\003ags)k FB(\002eld.)61 b(These)32 b(\003ags)h +(generally)g(contr)o(ol)g(the)g(details)f(of)h(the)g(line-editting)681 +3968 y(user)20 b(interface.)25 b(Only)c(the)i(P)t Fs(O)t(S)t(I)t(X)i +FB(entries)20 b(ar)o(e)g(guaranteed)f(to)i(be)g(non-)p +Fx(#f)p FB(.)681 5147 y(88)p 1952 5071 323 4 v 1952 5173 +4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 +v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 89 95 -89 94 bop 365 614 a FA(BSD.)28 b(In)g(the)g(absence)g(of)g(these,)h(your)g -(Unix)f(manual)g(pages)f(for)h(socket)g(might)h(be)f(a)365 -714 y(good)22 b(starting)f(point)g(for)g(information.)365 864 -y Fw(\(connect-socket)38 b Fz(socket)20 b(socket-addr)o(ess)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)415 b FA(pr)o(ocedur)o(e)573 -1005 y Fw(connect-socket)52 b FA(sets)58 b(up)g(a)f(connection)i(fr)o(om)f(a) -f Fz(socket)g FA(to)i(a)e(r)o(emote)573 1105 y Fz(socket-addr)o(ess)o -FA(.)112 b(A)49 b(connection)i(has)e(dif)o(fer)o(ent)e(meanings)j(depending)f -(on)573 1205 y(the)38 b(socket)g(type.)79 b(A)38 b(str)o(eam)f(socket)h(must) -h(be)e(connected)h(befor)o(e)f(use.)79 b(A)573 1304 y(datagram)24 -b(socket)j(can)f(be)f(connected)h(multiple)h(times,)g(but)f(need)g(not)h(be)e -(con-)573 1404 y(nected)g(at)g(all)h(if)f(the)h(r)o(emote)g(addr)o(ess)e(is)i -(speci\256ed)f(with)i(each)e Fw(send-message)p FA(,)573 1504 -y(described)k(below)-8 b(.)56 b(Also,)33 b(datagram)c(sockets)i(may)f(be)g -(disassociated)f(fr)o(om)h(a)573 1603 y(r)o(emote)20 b(addr)o(ess)f(by)i -(connecting)h(to)f(a)f(null)i(r)o(emote)e(addr)o(ess.)365 1795 -y Fw(\(bind-socket)39 b Fz(socket)20 b(socket-addr)o(ess)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)546 b FA(pr)o(ocedur)o(e)573 -1937 y Fw(bind-socket)24 b FA(assigns)k(a)g(certain)g(local)g -Fz(socket-addr)o(ess)f FA(to)i(a)f Fz(socket)o FA(.)50 b(Binding)29 -b(a)573 2037 y(socket)17 b(r)o(eserves)f(the)h(local)g(addr)o(ess.)24 -b(T)-8 b(o)18 b(r)o(eceive)d(connections)k(after)d(binding)h(the)573 -2136 y(socket,)25 b(use)f Fw(listen-socket)19 b FA(for)24 b(str)o(eam)f -(sockets)i(and)f Fw(receive-message)18 b FA(for)573 2236 y(datagram)h -(sockets.)573 2369 y(Binding)f(an)f(Internet)h(socket)g(with)g(a)f(host)h -(addr)o(ess)e(of)i Fw(internet-address)o(/a)o(ny)573 2469 y -FA(indicates)f(that)h(the)g(caller)f(does)g(not)i(car)o(e)d(to)i(specify)f -(fr)o(om)h(which)g(local)g(network)573 2568 y(interface)h(connections)j(ar)o -(e)e(r)o(eceived.)25 b(Binding)c(an)g(Internet)f(socket)h(with)h(a)e(ser)o(-) -573 2668 y(vice)i(port)h(number)g(of)f(zer)o(o)g(indicates)g(that)h(the)g -(caller)f(has)g(no)i(pr)o(efer)o(ence)c(as)i(to)573 2768 y(the)f(port)g -(number)g(assigned.)573 2901 y(Binding)e(a)f(socket)h(in)g(the)g(Unix)f(addr) -o(ess)f(family)i(cr)o(eates)e(a)h(socket)h(special)f(\256le)h(in)573 -3000 y(the)g(\256le)g(system)g(that)g(must)g(be)f(deleted)g(befor)o(e)f(the)i -(addr)o(ess)e(can)i(be)f(r)o(eused.)25 b(See)573 3100 y Fw(delete-file)p -FA(.)365 3292 y Fw(\(listen-socket)38 b Fz(socket)21 b(backlog)p -Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(unde\256ned)686 b FA(pr)o(ocedur)o(e)573 -3434 y Fw(listen-socket)21 b FA(allows)27 b(a)e(str)o(eam)h -Fz(socket)g FA(to)h(start)f(r)o(eceiving)f(connections,)k(al-)573 -3533 y(lowing)18 b(a)f(queue)h(of)f(up)g(to)h Fz(backlog)e -FA(connection)j(r)o(equests.)26 b(Queued)17 b(connections)573 -3633 y(may)k(be)f(accepted)f(by)i Fw(accept-connectio)o(n)p -FA(.)365 3825 y Fw(\(accept-connectio)o(n)37 b Fz(socket)p -Fw(\))87 b Fs(\000)-14 b(!)87 b Fz([new-socket)20 b(socket-addr)o(ess])192 -b FA(pr)o(ocedur)o(e)573 3967 y Fw(accept-connectio)o(n)24 -b FA(r)o(eceives)30 b(a)g(connection)i(on)f(a)f Fz(socket)p -FA(,)j(r)o(eturning)d(a)g(new)573 4066 y(socket)19 b(that)g(can)f(be)h(used)g -(for)f(this)i(connection)g(and)e(the)h(r)o(emote)g(socket)g(addr)o(ess)573 -4166 y(associated)h(with)h(the)g(connection.)365 4358 y Fw -(\(socket-local-add)o(re)o(ss)37 b Fz(socket)p Fw(\))87 b Fs(\000)-15 -b(!)88 b Fz(socket-addr)o(ess)503 b FA(pr)o(ocedur)o(e)365 -4458 y Fw(\(socket-remote-ad)o(dr)o(ess)37 b Fz(socket)p Fw(\))86 -b Fs(\000)-14 b(!)87 b Fz(socket-addr)o(ess)460 b FA(pr)o(ocedur)o(e)573 -4599 y(Sockets)15 b(can)g(be)g(associated)g(with)h(a)f(local)h(addr)o(ess)d -(or)j(a)f(r)o(emote)g(addr)o(ess)f(or)h(both.)573 4699 y Fw(socket-local-add) -o(re)o(ss)j FA(r)o(eturns)24 b(the)g(local)g Fz(socket-addr)o(ess)g -FA(r)o(ecor)o(d)e(associated)573 4799 y(with)35 b Fz(socket)p -FA(.)68 b Fw(socket-remote-add)o(re)o(ss)28 b FA(r)o(eturns)34 -b(the)h(r)o(emote)f Fz(socket-addr)o(ess)573 4898 y FA(r)o(ecor)o(d)19 -b(associated)h(with)i Fz(socket)o FA(.)365 5147 y FD(November)c(1,)h(1995)h -(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 -v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FA(89)p -eop +89 94 bop 365 1274 a Fw(Chapter)45 b(4)365 1727 y FC(Networking)365 +2220 y FB(The)28 b(Scheme)g(Shell)g(pr)o(ovides)f(a)h(BSD-style)f +(sockets)i(interface.)46 b(Ther)o(e)27 b(is)h(not)h(an)f(of-)365 +2320 y(\002cial)f(standar)o(d)e(for)i(a)f(network)h(interface)f(for)h +(scsh)g(to)g(adopt)f(\(this)h(is)h(the)f(subject)g(of)365 +2420 y(the)k(forthcoming)h(Posix.8)e(standar)o(d\).)52 +b(However)-6 b(,)33 b(Berkeley)c(sockets)i(ar)o(e)e(a)h +FA(de)g(facto)365 2519 y FB(standar)o(d,)19 b(being)i(found)g(on)g +(most)h(Unix)f(workstations)h(and)e(PC)h(operating)g(systems.)490 +2656 y(It)29 b(is)h(fairly)f(straightforwar)o(d)g(to)h(add)e(higher)o +(-level)h(network)i(pr)o(otocols)f(such)g(as)365 2756 +y(smtp,)22 b(telnet,)f(or)g(http)h(on)f(top)h(of)f(the)g(the)h(basic)e +(socket-level)h(support)h(scsh)g(pr)o(ovides.)365 2855 +y(The)29 b(Scheme)f(Under)o(gr)o(ound)f(has)i(also)g(r)o(eleased)e(a)h +(network)h(library)f(with)i(many)f(of)365 2955 y(these)22 +b(pr)o(otocols)g(as)g(a)f(companion)i(to)f(the)g(curr)o(ent)f(r)o +(elease)f(of)i(scsh.)29 b(See)21 b(this)h(code)g(for)365 +3055 y(examples)e(showing)j(the)e(use)g(of)f(the)h(sockets)h +(interface.)365 3364 y Fv(4.1)99 b(High-level)26 b(interface)365 +3595 y FB(For)18 b(convenience,)h(and)e(to)h(avoid)g(some)g(of)g(the)g +(messy)h(details)e(of)h(the)g(socket)g(interface,)365 +3694 y(we)f(pr)o(ovide)f(a)h(high)g(level)g(socket)g(interface.)23 +b(These)17 b(r)o(outines)g(attempt)g(to)g(make)g(it)g(easy)365 +3794 y(to)23 b(write)f(simple)h(clients)g(and)f(servers)g(without)h +(having)g(to)f(think)i(of)e(many)h(of)f(the)g(de-)365 +3894 y(tails)g(of)f(initiating)h(socket)g(connections.)28 +b(W)-8 b(e)22 b(welcome)f(suggested)h(impr)o(ovements)f(to)365 +3993 y(this)i(interface,)e(including)i(better)f(names,)g(which)h(right) +g(now)g(ar)o(e)d(solely)j(descriptions)365 4093 y(of)28 +b(the)h(pr)o(ocedur)o(e's)d(action.)48 b(This)28 b(might)i(be)d(\002ne) +i(for)f(people)g(who)h(alr)o(eady)d(under)o(-)365 4193 +y(stand)21 b(sockets,)g(but)g(does)g(not)g(help)g(the)g(new)g +(networking)h(pr)o(ogrammer)-6 b(.)365 4350 y Fx(\(socket-connect)38 +b FA(pr)o(otocol-family)18 b(socket-type)h(.)h(ar)o(gs)p +Fx(\))87 b Ft(\000)-15 b(!)87 b FA(socket)139 b FB(pr)o(ocedur)o(e)573 +4500 y Fx(socket-connect)92 b FB(is)98 b(intended)g(for)g(cr)o(eating)f +(client)i(applications.)573 4599 y FA(pr)o(otocol-family)49 +b FB(is)k(speci\002ed)f(as)g(either)g(the)g Fx(protocol-family/i)o(nte) +o(rn)o(et)573 4699 y FB(or)85 b Fx(protocol-family)o(/un)o(ix)o +FB(.)212 b FA(socket-type)83 b FB(is)i(speci\002ed)f(as)h(either)573 +4799 y Fx(socket-type/stre)o(am)44 b FB(or)51 b Fx(socket-type/data)o +(gra)o(m)p FB(.)109 b(See)50 b Fx(socket)f FB(for)h(a)573 +4898 y(mor)o(e)20 b(complete)h(description)g(of)g(these)g(terms.)365 +5147 y FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(89)p eop %%Page: 90 96 -90 95 bop 681 614 a Fw(\(shutdown-socket)37 b Fz(socket)20 -b(how-to)p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)616 -b FA(pr)o(ocedur)o(e)888 781 y Fw(shutdown-socket)19 b FA(shuts)26 -b(down)g(part)e(of)i(a)e(full-duplex)g(socket.)41 b(The)26 -b(method)888 881 y(of)21 b(shutting)h(done)f(is)g(speci\256ed)g(by)f(the)h -Fz(how-to)e FA(ar)o(gument,)h(one)i(of:)1071 1098 y Fw(shutdown/receive)o(s) -1071 1198 y(shutdown/sends)1071 1298 y(shutdown/sends+r)o(ece)o(iv)o(es)681 -1851 y Fu(4.5)99 b(Performing)24 b(input)h(and)g(output)g(on)g(sockets)681 -2128 y Fw(\(receive-message)37 b Fz(socket)13 b(length)g([\257ags])p -Fw(\))43 b Fs(\000)-14 b(!)43 b Fz([string-or-)p Fw(#f)p FA(socket-addr)o -(ess])84 b(pr)o(ocedur)o(e)681 2227 y Fw(\(receive-message)o(!)37 -b Fz(socket)14 b(string)g([start])f([end])g([\257ags])p Fw(\))42 -b Fs(\000)-14 b(!)44 b Fz([count-or-)p Fw(#f)p FA(socket-addr)o(ess])83 -b(pr)o(ocedur)o(e)681 2327 y Fw(\(receive-message)o(/p)o(art)o(ia)o(l)37 -b Fz(socket)14 b(length)f([\257ags])p Fw(\))42 b Fs(\000)-14 -b(!)44 b Fz([string-or-)p Fw(#f)p FA(socket-addr)o(ess])83 -b(pr)o(ocedur)o(e)681 2427 y Fw(\(receive-message)o(!/)o(par)o(ti)o(al)37 -b Fz(socket)14 b(string)f([start])g([end])h([\257ags])p Fw(\))42 -b Fs(\000)-14 b(!)43 b Fz([count-or-)p Fw(#f)p FA(socket-addr)o(ess])83 -b(pr)o(ocedur)o(e)681 2602 y Fw(\(send-message)38 b Fz(socket)14 -b(string)f([start])g([end])g([\257ags])h([socket-addr)o(ess])p -Fw(\))41 b Fs(\000)-14 b(!)43 b Fz(unde\256ned)87 b FA(pr)o(ocedur)o(e)681 -2701 y Fw(\(send-message/pa)o(rt)o(ial)37 b Fz(socket)13 b(string)h([start])f -([end])g([\257ags])g([socket-addr)o(ess])p Fw(\))42 b Fs(\000)-15 -b(!)44 b Fz(count)87 b FA(pr)o(ocedur)o(e)888 2839 y(For)23 -b(most)h(uses,)f(standar)o(d)e(input)i(and)f(output)h(r)o(outines)g(such)g -(as)g Fw(read-string)888 2938 y FA(and)i Fw(write-string)20 -b FA(should)25 b(suf)o(\256ce.)39 b(However)-6 b(,)25 b(in)h(some)f(cases)f -(an)h(extended)888 3038 y(interface)20 b(is)i(r)o(equir)o(ed.)27 -b(The)21 b Fw(receive-message)15 b FA(and)21 b Fw(send-message)16 -b FA(calls)21 b(par)o(-)888 3138 y(allel)37 b(the)h Fw(read-string)33 -b FA(and)j Fw(write-string)d FA(calls)k(with)h(a)f(similar)g(naming)888 -3237 y(scheme.)888 3396 y(One)i(additional)g(featur)o(e)e(of)h(these)h(r)o -(outines)g(is)g(that)g Fw(receive-message)32 b FA(r)o(e-)888 -3495 y(turns)21 b(the)f(r)o(emote)g Fz(socket-addr)o(ess)f -FA(and)h Fz(send-message)g FA(takes)g(an)g(optional)i(r)o(emote)888 -3595 y Fw(socket-address)p FA(.)e(This)c(allows)g(a)f(pr)o(ogram)g(to)h(know) -g(the)g(sour)o(ce)f(of)g(input)h(fr)o(om)888 3695 y(a)23 b(datagram)e(socket) -i(and)g(to)g(use)g(a)f(datagram)g(socket)h(for)f(output)i(without)g(\256rst) -888 3794 y(connecting)e(it.)888 3953 y(All)j(of)g(these)g(pr)o(ocedur)o(es)e -(take)h(an)h(optional)h Fz(\257ags)f FA(\256eld.)39 b(This)26 -b(ar)o(gument)e(is)h(an)888 4053 y(integer)c(bit-mask,)g(composed)g(by)g(or)6 -b('ing)21 b(together)g(the)g(following)i(constants:)1071 4270 -y Fw(message/out-of-b)o(and)1071 4370 y(message/peek)1071 4469 -y(message/dont-rou)o(te)888 4746 y FA(See)15 b Fw(read-string)c -FA(and)j Fw(write-string)d FA(for)k(a)g(mor)o(e)g(detailed)f(description)i -(of)f(the)888 4845 y(ar)o(guments)21 b(and)f(r)o(eturn)g(values.)681 -5147 y(90)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)e(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +90 95 bop 888 614 a FB(The)20 b(variable)e FA(ar)o(gs)g +FB(list)i(is)g(meant)f(to)g(specify)g(pr)o(otocol)h(family)f +(speci\002c)g(informa-)888 714 y(tion.)48 b(For)28 b(Internet)g +(sockets,)i(this)e(consists)i(of)d(two)i(ar)o(guments:)39 +b(a)27 b(host)i(name)888 814 y(and)21 b(a)f(port)h(number)-6 +b(.)25 b(For)c(Unix)g(sockets,)g(this)h(consists)g(of)e(a)h(pathname.) +888 947 y Fx(socket-connect)e FB(r)o(eturns)24 b(a)g +Fx(socket)e FB(which)j(can)f(be)g(used)g(for)g(input)h(and)f(out-)888 +1046 y(put)19 b(fr)o(om)f(a)h(r)o(emote)f(server)-6 b(.)24 +b(See)18 b Fx(socket)e FB(for)i(a)h(description)g(of)f(the)h +FA(socket)g(r)o(ecord)p FB(.)681 1238 y Fx(\(bind-listen-acc)o(ep)o +(t-l)o(oo)o(p)37 b FA(pr)o(otocol-family)13 b(pr)o(oc)i(ar)o(g)p +Fx(\))43 b Ft(\000)-15 b(!)44 b FA(does-not-r)o(eturn)86 +b FB(pr)o(ocedur)o(e)888 1380 y Fx(bind-listen-accep)o(t-)o(loo)o(p)22 +b FB(is)29 b(intended)f(for)g(cr)o(eating)f(server)g(applications.)888 +1480 y FA(pr)o(otocol-family)k FB(is)j(speci\002ed)g(as)f(either)g(the) +h Fx(protocol-family/i)o(nt)o(ern)o(et)27 b FB(or)888 +1579 y Fx(protocol-family/u)o(ni)o(x)p FB(.)d FA(pr)o(oc)d +FB(is)i(a)e(pr)o(ocedur)o(e)g(of)h(two)h(ar)o(guments:)28 +b(a)22 b Fx(socket)888 1679 y FB(and)c(a)f(socket-addr)o(ess.)23 +b FA(ar)o(g)17 b FB(speci\002es)i(a)e(port)h(number)g(for)g(Internet)g +(sockets)g(or)h(a)888 1778 y(pathname)k(for)g(Unix)h(sockets.)33 +b(See)23 b Fx(socket)d FB(for)k(a)e(mor)o(e)h(complete)h(description) +888 1878 y(of)d(these)g(terms.)888 2011 y FA(pr)o(oc)g +FB(is)h(called)f(with)h(a)f(socket)h(and)f(a)g(socket)h(addr)o(ess)e +(each)h(time)h(ther)o(e)f(is)h(a)f(con-)888 2111 y(nection)36 +b(fr)o(om)f(a)g(client)g(application.)69 b(The)35 b(socket)g(allows)h +(communications)888 2210 y(with)30 b(the)g(client.)51 +b(The)29 b(socket)g(addr)o(ess)f(speci\002es)h(the)g(addr)o(ess)f(of)h +(the)h(r)o(emote)888 2310 y(client.)888 2443 y(This)23 +b(pr)o(ocedur)o(e)e(does)h(not)h(r)o(eturn,)f(but)g(loops)i +(inde\002nitely)f(accepting)f(connec-)888 2543 y(tions)g(fr)o(om)f +(client)g(pr)o(ograms.)681 2838 y Fv(4.2)99 b(Sockets)681 +3078 y Fx(\(create-socket)38 b FA(pr)o(otocol-family)18 +b(type)h([pr)o(otocol])p Fx(\))85 b Ft(\000)-15 b(!)88 +b FA(socket)269 b FB(pr)o(ocedur)o(e)681 3178 y Fx(\(create-socket-p)o +(ai)o(r)38 b FA(type)p Fx(\))85 b Ft(\000)-14 b(!)87 +b FA([socket)2275 3190 y Fu(1)2333 3178 y FA(socket)2533 +3190 y Fu(2)2570 3178 y FA(])572 b FB(pr)o(ocedur)o(e)681 +3277 y Fx(\(close-socket)38 b FA(socket)p Fx(\))86 b +Ft(\000)-14 b(!)87 b FA(unde\002ned)998 b FB(pr)o(ocedur)o(e)888 +3402 y(A)28 b(socket)g(is)h(one)f(end)g(of)g(a)g(network)g(connection.) +49 b(Thr)o(ee)27 b(speci\002c)h(pr)o(operties)888 3501 +y(of)i(sockets)f(ar)o(e)f(speci\002ed)h(at)g(cr)o(eation)f(time:)43 +b(the)30 b(pr)o(otocol-family)-9 b(,)30 b(type,)h(and)888 +3601 y(pr)o(otocol.)888 3734 y(The)43 b FA(pr)o(otocol-family)c +FB(speci\002es)k(the)g(pr)o(otocol)f(family)h(to)f(be)g(used)h(with)g +(the)888 3834 y(socket.)75 b(This)37 b(also)g(determines)g(the)g(addr)o +(ess)f(family)h(of)g(socket)g(addr)o(esses,)888 3934 +y(which)30 b(ar)o(e)e(described)g(in)i(mor)o(e)f(detail)f(below)-8 +b(.)52 b(Scsh)29 b(curr)o(ently)f(supports)i(the)888 +4033 y(Unix)i(internal)h(pr)o(otocols)f(and)g(the)g(Internet)h(pr)o +(otocols)f(using)h(the)g(following)888 4133 y(constants:)1071 +4300 y Fx(protocol-family/)o(uns)o(pe)o(ci)o(fie)o(d)1071 +4399 y(protocol-family/)o(uni)o(x)1071 4499 y(protocol-family/)o(int)o +(er)o(ne)o(t)888 4699 y FB(The)23 b FA(type)f FB(speci\002es)h(the)g +(style)g(of)g(communication.)34 b(Examples)22 b(that)h(your)g(oper)o(-) +888 4799 y(ating)c(system)f(pr)o(obably)f(pr)o(ovides)h(ar)o(e)e(str)o +(eam)h(and)h(datagram)e(sockets.)26 b(Others)888 4898 +y(maybe)21 b(available)e(depending)i(on)g(your)g(system.)26 +b(T)-7 b(ypical)20 b(values)h(ar)o(e:)681 5147 y(90)p +1952 5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p eop %%Page: 91 97 -91 96 bop 365 614 a Fu(4.6)99 b(Socket)26 b(options)365 845 -y Fw(\(socket-option)38 b Fz(socket)21 b(level)g(option)p Fw(\))85 -b Fs(\000)-14 b(!)87 b Fz(value)699 b FA(pr)o(ocedur)o(e)365 -944 y Fw(\(set-socket-optio)o(n)37 b Fz(socket)21 b(level)g(option)f(value)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)174 b FA(pr)o(ocedur)o(e)573 -1065 y Fw(socket-option)16 b FA(and)k Fw(set-socket-option)15 -b FA(allow)21 b(the)g(inspection)i(and)d(modi-)573 1164 y(\256cation,)g(r)o -(espectively)-9 b(,)18 b(of)h(several)f(options)i(available)e(on)i(sockets.) -28 b(The)19 b Fz(level)g FA(ar)o(-)573 1264 y(gument)c(speci\256es)g(what)g -(pr)o(otocol)g(level)g(is)g(to)h(be)e(examined)g(or)h(af)o(fected.)23 -b(A)15 b(level)573 1363 y(of)h Fw(level/socket)11 b FA(speci\256es)16 -b(the)g(highest)g(possible)h(level)f(that)f(is)i(available)d(on)j(all)573 -1463 y(socket)i(types.)27 b(A)18 b(speci\256c)h(pr)o(otocol)g(number)f(can)h -(also)g(be)f(used)h(as)f(pr)o(ovided)f(by)573 1563 y Fw(protocol-info)p -FA(,)e(described)20 b(below)-8 b(.)573 1691 y(Ther)o(e)24 b(ar)o(e)g(several) -h(dif)o(fer)o(ent)e(classes)j(of)f(socket)h(options.)43 b(The)25 -b(\256rst)h(class)f(con-)573 1791 y(sists)18 b(of)e(boolean)i(options)g -(which)g(can)e(be)h(either)f(tr)o(ue)h(or)g(false.)26 b(Examples)16 -b(of)h(this)573 1890 y(option)22 b(type)e(ar)o(e:)756 2048 -y Fw(socket/debug)756 2148 y(socket/accept-c)o(on)o(nec)o(t)756 -2247 y(socket/reuse-ad)o(dr)o(ess)756 2347 y(socket/keep-ali)o(ve)756 -2446 y(socket/dont-rou)o(te)756 2546 y(socket/broadcas)o(t)756 -2646 y(socket/use-loop)o(-b)o(ack)756 2745 y(socket/oob-inli)o(ne)756 -2845 y(socket/use-priv)o(il)o(ege)o(d)756 2945 y(socket/cant-sig)o(na)o(l)756 -3044 y(tcp/no-delay)573 3231 y FA(V)-8 b(alue)17 b(options)h(ar)o(e)e -(another)h(category)g(of)g(socket)g(options.)28 b(Options)18 -b(of)f(this)h(type)573 3330 y(ar)o(e)h(an)i(integer)g(value.)26 -b(Examples)21 b(of)f(this)i(option)g(type)e(ar)o(e:)756 3488 -y Fw(socket/send-buf)o(fe)o(r)756 3587 y(socket/receive-)o(bu)o(ffe)o(r)756 -3687 y(socket/send-low)o(-w)o(ate)o(r)756 3786 y(socket/receive-)o(lo)o(w-w)o -(at)o(er)756 3886 y(socket/error)756 3986 y(socket/type)756 -4085 y(ip/time-to-live)756 4185 y(tcp/max-segment)573 4371 -y FA(A)d(thir)o(d)h(option)h(type)e(speci\256es)h(how)h(long)g(for)e(data)g -(to)h(linger)g(after)f(a)g(socket)i(has)573 4471 y(been)24 -b(closed.)38 b(Ther)o(e)23 b(is)i(only)g(one)g(option)g(of)g(this)g(type:)34 -b Fw(socket/linger)p FA(.)f(It)24 b(is)573 4571 y(set)i(with)g(either)g -Fw(#f)p FA(to)f(disable)g(it)h(or)f(an)h(integer)g(number)f(of)h(seconds)g -(to)g(linger)573 4670 y(and)20 b(r)o(eturns)g(a)h(value)f(of)h(the)f(same)h -(type)g(upon)g(inspection.)573 4799 y(The)46 b(fourth)h(and)f(\256nal)h -(option)h(type)e(of)g(this)i(time)f(is)f(a)g(timeout)i(option.)573 -4898 y(Ther)o(e)25 b(ar)o(e)f(two)j(examples)e(of)h(this)h(option)g(type:)38 -b Fw(socket/send-time)o(ou)o(t)20 b FA(and)365 5147 y FD(November)e(1,)h -(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 -4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 -w FA(91)p eop +91 96 bop 756 614 a Fx(socket-type/str)o(ea)o(m)756 714 +y(socket-type/dat)o(ag)o(ram)756 814 y(socket-type/raw)573 +1007 y FB(The)19 b FA(pr)o(otocol)e FB(speci\002es)i(a)g(particular)f +(pr)o(otocol)h(to)g(use)h(within)g(a)e(pr)o(otocol)i(family)573 +1107 y(and)15 b(type.)24 b(Usually)16 b(only)g(one)h(choice)f(exists,)g +(but)g(it's)h(pr)o(obably)e(safest)g(to)h(set)g(this)573 +1207 y(explicitly)-9 b(.)33 b(See)23 b(the)g(pr)o(otocol)h(database)e +(r)o(outines)h(for)h(information)g(on)g(looking)573 1306 +y(up)d(pr)o(otocol)g(constants.)573 1437 y(New)48 b(sockets)h(ar)o(e)e +(typically)i(cr)o(eated)e(with)i Fx(create-socket)p FB(.)103 +b(However)-6 b(,)573 1537 y Fx(create-socket-pa)o(ir)14 +b FB(can)19 b(also)i(be)f(used)g(to)g(cr)o(eate)f(a)g(pair)h(of)g +(connected)g(sock-)573 1637 y(ets)36 b(in)g(the)g Fx(protocol-family/u) +o(nix)29 b FB(pr)o(otocol-family)-9 b(.)71 b(The)36 b(value)f(of)h(a)g +(r)o(e-)573 1736 y(turned)20 b(socket)h(is)h(a)e FA(socket)g(r)o(ecord) +p FB(,)g(de\002ned)h(to)g(have)f(the)h(following)h(str)o(uctur)o(e:)756 +1899 y Fx(\(define-record)37 b(socket)843 1998 y(family)1392 +b(;)43 b(protocol)d(family)843 2098 y(inport)1392 b(;)43 +b(input-port)843 2198 y(outport\))1304 b(;)43 b(output-port)573 +2391 y FB(The)26 b Fx(family)e FB(speci\002es)j(the)f(pr)o(otocol)h +(family)g(of)f(the)h(socket.)43 b(The)26 b Fx(inport)e +FB(and)573 2491 y Fx(outport)h FB(\002elds)j(ar)o(e)f(ports)i(that)f +(can)g(be)g(used)f(for)h(input)h(and)f(output,)i(r)o(espec-)573 +2591 y(tively)-9 b(.)48 b(For)29 b(a)e(str)o(eam)h(socket,)i(they)f(ar) +o(e)e(only)i(usable)f(after)f(a)h(connection)i(has)573 +2690 y(been)18 b(established)g(via)g Fx(connect-socket)13 +b FB(or)19 b Fx(accept-connecti)o(on)p FB(.)f(For)h(a)f(data-)573 +2790 y(gram)j(socket,)g FA(outport)f FB(can)h(be)g(immediately)g(using) +h Fx(send-message)p FB(,)16 b(and)21 b FA(inport)573 +2890 y FB(can)f(be)h(used)f(after)g Fx(bind)f FB(has)i(cr)o(eated)d(a)j +(local)f(addr)o(ess.)573 3021 y Fx(close-socket)j FB(pr)o(ovides)28 +b(a)g(convenient)h(way)g(to)f(close)h(a)f(socket's)h(port.)49 +b(It)28 b(is)573 3120 y(pr)o(eferr)o(ed)14 b(to)j(explicitly)g(closing) +i(the)e(inport)g(and)g(outport)h(because)e(using)i Fx(close)573 +3220 y FB(on)j(sockets)h(is)f(not)g(curr)o(ently)f(portable)h(acr)o +(oss)f(operating)h(systems.)365 3510 y Fv(4.3)99 b(Socket)26 +b(addresses)365 3724 y FB(The)i(format)g(of)g(a)g(socket-addr)o(ess)e +(depends)i(on)g(the)h(addr)o(ess)d(family)i(of)g(the)g(socket.)365 +3824 y(Addr)o(ess-family-speci\002c)21 b(r)o(outines)j(ar)o(e)e(pr)o +(ovided)g(to)i(convert)f(pr)o(otocol-speci\002c)h(ad-)365 +3924 y(dr)o(esses)i(to)i(socket)f(addr)o(esses.)43 b(The)27 +b(value)f(r)o(eturned)g(by)h(these)g(r)o(outines)g(is)h(a)e +FA(socket-)365 4023 y(addr)o(ess)21 b(r)o(ecord)p FB(,)f(de\002ned)g +(to)h(have)f(the)h(following)i(visible)e(str)o(uctur)o(e:)573 +4207 y Fx(\(define-record)38 b(socket-address)660 4307 +y(family\))1348 b(;)43 b(address)e(family)490 4515 y +FB(The)21 b Fx(family)d FB(is)j(one)g(of)g(the)g(following)h +(constants:)573 4699 y Fx(address-family/u)o(ns)o(pec)o(if)o(ied)573 +4799 y(address-family/u)o(ni)o(x)573 4898 y(address-family/i)o(nt)o +(ern)o(et)365 5147 y FE(Mar)o(ch)d(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FB(91)p +eop %%Page: 92 98 -92 97 bop 888 614 a Fw(socket/receive-ti)o(me)o(out)o FA(.)21 -b(These)f(ar)o(e)f(set)h(with)h(a)f(r)o(eal)e(number)j(of)f(micr)o(osec-)888 -714 y(onds)i(r)o(esolution)f(and)f(r)o(eturns)h(a)f(value)g(of)h(the)g(same)f -(type)h(upon)g(inspection.)681 1006 y Fu(4.7)99 b(Database-information)24 -b(entries)681 1242 y Fw(\(host-info)39 b Fz(name-or-socket-addr)o(ess)p -Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(host-info)583 b FA(pr)o(ocedur)o(e)681 -1342 y Fw(\(network-info)38 b Fz(name-or-socket-addr)o(ess)p -Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(network-info)319 b FA(pr)o(ocedur)o(e)681 -1441 y Fw(\(service-info)38 b Fz(name-or-number)17 b([pr)o(otocol-name])p -Fw(\))56 b Fs(\000)-14 b(!)59 b Fz(service-info)88 b FA(pr)o(ocedur)o(e)681 -1541 y Fw(\(protocol-info)38 b Fz(name-or-number)p Fw(\))87 -b Fs(\000)-15 b(!)88 b Fz(pr)o(otocol-info)493 b FA(pr)o(ocedur)o(e)888 -1664 y Fw(host-info)22 b FA(allows)k(a)g(pr)o(ogram)f(to)h(look)g(up)g(a)f -(host)h(entry)g(based)f(on)h(either)g(its)888 1764 y(string)d -Fz(name)e FA(or)h Fz(socket-addr)o(ess)o FA(.)30 b(The)22 b(value)f(r)o -(eturned)f(by)i(this)g(r)o(outine)g(is)g(a)f Fz(host-)888 1864 -y(info)g(r)o(ecord)p FA(,)f(de\256ned)h(to)g(have)f(the)h(following)h(str)o -(uctur)o(e:)1071 2027 y Fw(\(define-record)38 b(host-info)1158 -2127 y(name)1480 b(;)44 b(Host)e(name)1158 2227 y(aliases)1348 -b(;)44 b(Alternative)39 b(names)1158 2326 y(addresses\))1216 -b(;)44 b(Host)e(addresses)888 2522 y(host-info)17 b FA(could)k(fail)f(and)h -(raise)f(an)h(err)o(or)e(for)i(one)g(of)g(the)g(following)h(r)o(easons:)1071 -2685 y Fw(herror/host-not-)o(fou)o(nd)1071 2785 y(herror/try-again)1071 -2885 y(herror/no-recove)o(ry)1071 2984 y(herror/no-data)1071 -3084 y(herror/no-addres)o(s)888 3280 y(network-info)17 b FA(allows)22 -b(a)f(pr)o(ogram)f(to)i(look)g(up)g(a)e(network)j(entry)e(based)f(on)i(ei-) -888 3379 y(ther)e(its)g(string)g Fz(name)f FA(or)h Fz(socket-addr)o(ess)o -FA(.)27 b(The)19 b(value)g(r)o(eturned)f(by)i(this)g(r)o(outine)g(is)888 -3479 y(a)h Fz(network-info)f(r)o(ecord)p FA(,)g(de\256ned)h(to)g(have)f(the)h -(following)h(str)o(uctur)o(e:)1071 3642 y Fw(\(define-record)38 -b(network-info)1158 3742 y(name)1480 b(;)44 b(Network)c(name)1158 -3842 y(aliases)1348 b(;)44 b(Alternative)39 b(names)1158 3941 -y(net\))1480 b(;)44 b(Network)c(number)888 4137 y(service-info)21 -b FA(allows)27 b(a)e(pr)o(ogram)g(to)h(look)h(up)f(a)f(service)g(entry)h -(based)f(on)h(ei-)888 4237 y(ther)20 b(its)f(string)h Fz(name)g -FA(or)f(integer)h Fz(port)o FA(.)27 b(The)19 b(value)g(r)o(eturned)f(by)h -(this)h(r)o(outine)g(is)g(a)888 4336 y Fz(service-info)h(r)o(ecord)p -FA(,)g(de\256ned)f(to)h(have)f(the)h(following)h(str)o(uctur)o(e:)1071 -4500 y Fw(\(define-record)38 b(service-info)1158 4599 y(name)1480 -b(;)44 b(Service)c(name)1158 4699 y(aliases)1348 b(;)44 b(Alternative)39 -b(names)1158 4799 y(port)1480 b(;)44 b(Port)e(number)1158 4898 -y(protocol\))1260 b(;)44 b(Protocol)c(name)681 5147 y FA(92)p -1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 -5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +92 97 bop 681 614 a Fx(\(unix-address->s)o(oc)o(ket)o(-a)o(dd)o(res)o +(s)37 b FA(pathname)p Fx(\))56 b Ft(\000)-14 b(!)57 b +FA(socket-addr)o(ess)86 b FB(pr)o(ocedur)o(e)888 752 +y Fx(unix-address->soc)o(ke)o(t-a)o(dd)o(res)o(s)33 b +FB(r)o(eturns)38 b(a)g FA(socket-addr)o(ess)g FB(based)g(on)i(the)888 +851 y(string)e FA(pathname)n FB(.)75 b(Ther)o(e)36 b(is)h(a)g(system)g +(dependent)g(limit)g(on)h(the)f(length)h(of)888 951 y +FA(pathname)o FB(.)681 1136 y Fx(\(internet-addres)o(s-)o(>so)o(ck)o +(et)o(-ad)o(dr)o(ess)f FA(host-addr)o(ess)14 b(service-port)p +Fx(\))43 b Ft(\000)-15 b(!)44 b FA(socket-addr)o(ess)86 +b FB(pr)o(ocedur)o(e)888 1273 y Fx(internet-address-)o(>s)o(ock)o(et)o +(-ad)o(dr)o(ess)28 b FB(r)o(eturns)34 b(a)h FA(socket-addr)o(ess)e +FB(based)h(on)888 1373 y(an)25 b(integer)g FA(host-addr)o(ess)f +FB(and)g(an)h(integer)g FA(service-port)p FB(.)38 b(Besides)24 +b(being)i(a)e(32-bit)888 1472 y(host)29 b(addr)o(ess,)g(an)f(Internet)g +(host)h(addr)o(ess)d(can)i(also)h(be)f(one)g(of)g(the)h(following)888 +1572 y(constants:)1071 1734 y Fx(internet-address)o(/an)o(y)1071 +1833 y(internet-address)o(/lo)o(op)o(ba)o(ck)1071 1933 +y(internet-address)o(/br)o(oa)o(dc)o(ast)888 2126 y FB(The)h(use)f(of)h +Fx(internet-addres)o(s/a)o(ny)23 b FB(is)30 b(described)e(below)i(in)g +Fx(bind-socket)p FB(.)888 2226 y Fx(internet-address/)o(lo)o(opb)o(ac)o +(k)11 b FB(is)17 b(an)f(addr)o(ess)f(that)i(always)f(speci\002es)h(the) +g(local)888 2326 y(machine.)47 b Fx(internet-address)o(/br)o(oa)o(dca)o +(st)21 b FB(is)28 b(used)g(for)f(network)i(br)o(oadcast)888 +2425 y(communications.)888 2556 y(For)f(information)g(on)h(obtaining)f +(a)f(host's)i(addr)o(ess,)e(see)g(the)h Fx(host-info)c +FB(func-)888 2656 y(tion.)681 2841 y Fx(\(socket-address-)o(>u)o(nix)o +(-a)o(dd)o(res)o(s)37 b FA(socket-addr)o(ess)p Fx(\))56 +b Ft(\000)-14 b(!)57 b FA(pathname)86 b FB(pr)o(ocedur)o(e)681 +2940 y Fx(\(socket-address-)o(>i)o(nte)o(rn)o(et)o(-ad)o(dr)o(ess)37 +b FA(socket-addr)o(ess)p Fx(\))42 b Ft(\000)-14 b(!)43 +b FA([host-addr)o(ess)14 b(service-port])86 b FB(pr)o(ocedur)o(e)888 +3077 y(The)227 b(r)o(outines)h Fx(socket-address-)o(>in)o(te)o(rne)o +(t-)o(ad)o(dre)o(ss)220 b FB(and)888 3177 y Fx(socket-address->u)o(ni)o +(x-a)o(dd)o(res)o(s)74 b FB(r)o(eturn)81 b(the)f(addr)o +(ess-family-speci\002c)888 3277 y(addr)o(esses.)94 b(Be)43 +b(awar)o(e)g(that)g(most)i(implementations)h(don't)e(corr)o(ectly)f(r)o +(e-)888 3376 y(turn)e(anything)g(mor)o(e)f(than)g(an)g(empty)g(string)h +(for)f(addr)o(esses)e(in)j(the)f(Unix)888 3476 y(addr)o(ess-family)-9 +b(.)681 3766 y Fv(4.4)99 b(Socket)25 b(primitives)681 +3980 y FB(The)30 b(pr)o(ocedur)o(es)f(in)i(this)h(section)f(ar)o(e)e +(pr)o(esented)h(in)h(the)g(or)o(der)e(in)j(which)f(a)f(typical)681 +4080 y(pr)o(ogram)24 b(will)i(use)f(them.)39 b(Consult)26 +b(a)e(text)h(on)g(network)h(systems)g(pr)o(ogramming)f(for)681 +4179 y(mor)o(e)18 b(information)h(on)g(sockets.)1743 +4149 y Fu(1)1805 4179 y FB(The)f(last)g(two)h(tutorials)f(ar)o(e)f(fr)o +(eely)g(available)g(as)h(part)p 681 4252 1146 4 v 766 +4306 a Fp(1)800 4329 y Fs(Some)f(r)o(ecommended)d(ones)j(ar)o(e:)812 +4446 y Fd(\017)41 b Fs(\223Unix)17 b(Network)g(Pr)o(ogramming\224)g(by) +f(W)-6 b(.)17 b(Richar)o(d)g(Stevens)812 4554 y Fd(\017)41 +b Fs(\223An)19 b(Intr)o(oductory)g(4.3BSD)g(Interpr)o(ocess)g +(Communication)g(T)-6 b(utorial.\224)28 b(\(r)o(eprinted)18 +b(in)h(UNIX)h(Pr)o(o-)888 4632 y(grammer)5 b('s)17 b(Supplementary)f +(Documents)h(V)-7 b(olume)16 b(1,)g(PS1:7\))812 4741 +y Fd(\017)41 b Fs(\223An)25 b(Advanced)f(4.3BSD)h(Interpr)o(ocess)h +(Communication)g(T)-6 b(utorial.\224)48 b(\(r)o(eprinted)24 +b(in)i(UNIX)g(Pr)o(o-)888 4819 y(grammer)5 b('s)17 b(Supplementary)f +(Documents)h(V)-7 b(olume)16 b(1,)g(PS1:8\))681 5147 +y FB(92)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w +FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)j(10,)g +(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 93 99 -93 98 bop 573 614 a Fw(protocol-info)12 b FA(allows)19 b(a)f(pr)o(ogram)f(to) -h(look)h(up)f(a)g(pr)o(otocol)g(entry)g(based)f(on)i(ei-)573 -714 y(ther)i(its)g(string)h Fz(name)e FA(or)h(integer)g Fz(number)q -FA(.)28 b(The)21 b(value)f(r)o(eturned)g(by)h(this)h(r)o(outine)573 -814 y(is)f(a)f Fz(pr)o(otocol-info)f(r)o(ecord)p FA(,)h(de\256ned)h(to)g -(have)f(the)h(following)h(str)o(uctur)o(e:)756 980 y Fw(\(define-record)37 -b(protocol-info)843 1079 y(name)1480 b(;)43 b(Protocol)d(name)843 -1179 y(aliases)1348 b(;)43 b(Alternative)c(names)843 1279 y(number\))1348 -b(;)43 b(Protocol)d(number\))365 5147 y FD(November)18 b(1,)h(1995)h(\261)f -(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w -FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FA(93)p eop +93 98 bop 365 614 a FB(of)22 b(BSD.)e(In)i(the)g(absence)e(of)i(these,) +f(your)h(Unix)f(manual)h(pages)f(for)g(socket)h(might)g(be)f(a)365 +714 y(good)h(starting)f(point)g(for)g(information.)365 +864 y Fx(\(connect-socket)38 b FA(socket)20 b(socket-addr)o(ess)p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(unde\002ned)415 b +FB(pr)o(ocedur)o(e)573 1005 y Fx(connect-socket)52 b +FB(sets)58 b(up)g(a)f(connection)i(fr)o(om)f(a)f FA(socket)g +FB(to)i(a)e(r)o(emote)573 1105 y FA(socket-addr)o(ess)o +FB(.)62 b(A)32 b(connection)j(has)e(dif)o(fer)o(ent)d(meanings)k +(depending)f(on)g(the)573 1205 y(socket)22 b(type.)30 +b(A)22 b(str)o(eam)g(socket)g(must)h(be)f(connected)g(befor)o(e)f(use.) +30 b(A)22 b(datagram)573 1304 y(socket)h(can)f(be)g(connected)g +(multiple)h(times,)g(but)f(need)g(not)h(be)f(connected)h(at)f(all)573 +1404 y(if)f(the)h(r)o(emote)f(addr)o(ess)f(is)h(speci\002ed)g(with)i +(each)d Fx(send-message)p FB(,)d(described)j(be-)573 +1504 y(low)-8 b(.)26 b(Also,)20 b(datagram)e(sockets)i(may)f(be)g +(disassociated)g(fr)o(om)g(a)g(r)o(emote)g(addr)o(ess)573 +1603 y(by)i(connecting)h(to)f(a)f(null)h(r)o(emote)g(addr)o(ess.)365 +1795 y Fx(\(bind-socket)39 b FA(socket)20 b(socket-addr)o(ess)p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(unde\002ned)546 b +FB(pr)o(ocedur)o(e)573 1937 y Fx(bind-socket)24 b FB(assigns)29 +b(a)f(certain)g(local)g FA(socket-addr)o(ess)f FB(to)i(a)f +FA(socket)p FB(.)48 b(Binding)29 b(a)573 2037 y(socket)h(r)o(eserves)f +(the)h(local)g(addr)o(ess.)52 b(T)-8 b(o)31 b(r)o(eceive)d(connections) +k(after)d(binding)573 2136 y(the)23 b(socket,)h(use)f +Fx(listen-socket)18 b FB(for)k(str)o(eam)h(sockets)g(and)g +Fx(receive-message)573 2236 y FB(for)d(datagram)g(sockets.)573 +2369 y(Binding)e(an)f(Internet)h(socket)g(with)g(a)f(host)h(addr)o(ess) +e(of)i Fx(internet-address)o(/a)o(ny)573 2469 y FB(indicates)f(that)h +(the)g(caller)f(does)g(not)i(car)o(e)d(to)i(specify)f(fr)o(om)h(which)g +(local)g(network)573 2568 y(interface)i(connections)i(ar)o(e)d(r)o +(eceived.)24 b(Binding)d(an)g(Internet)g(socket)g(with)g(a)g(ser)o(-) +573 2668 y(vice)h(port)h(number)g(of)f(zer)o(o)g(indicates)g(that)h +(the)g(caller)f(has)g(no)i(pr)o(efer)o(ence)c(as)i(to)573 +2768 y(the)f(port)g(number)g(assigned.)573 2901 y(Binding)27 +b(a)e(socket)i(in)g(the)f(Unix)g(addr)o(ess)f(family)h(cr)o(eates)e(a)i +(socket)h(special)e(\002le)573 3000 y(in)f(the)f(\002le)g(system)h +(that)f(must)h(be)f(deleted)f(befor)o(e)g(the)i(addr)o(ess)d(can)i(be)g +(r)o(eused.)573 3100 y(See)d Fx(delete-file)p FB(.)365 +3292 y Fx(\(listen-socket)38 b FA(socket)21 b(backlog)p +Fx(\))86 b Ft(\000)-15 b(!)88 b FA(unde\002ned)686 b +FB(pr)o(ocedur)o(e)573 3434 y Fx(listen-socket)21 b FB(allows)27 +b(a)e(str)o(eam)h FA(socket)g FB(to)h(start)f(r)o(eceiving)f +(connections,)k(al-)573 3533 y(lowing)19 b(a)e(queue)g(of)h(up)f(to)h +FA(backlog)f FB(connection)i(r)o(equests.)24 b(Queued)17 +b(connections)573 3633 y(may)k(be)f(accepted)f(by)i Fx +(accept-connectio)o(n)p FB(.)365 3825 y Fx(\(accept-connectio)o(n)37 +b FA(socket)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA([new-socket)20 +b(socket-addr)o(ess])192 b FB(pr)o(ocedur)o(e)573 3967 +y Fx(accept-connectio)o(n)24 b FB(r)o(eceives)30 b(a)g(connection)i(on) +f(a)f FA(socket)p FB(,)j(r)o(eturning)d(a)g(new)573 4066 +y(socket)19 b(that)g(can)f(be)h(used)g(for)f(this)i(connection)g(and)e +(the)h(r)o(emote)g(socket)g(addr)o(ess)573 4166 y(associated)h(with)h +(the)g(connection.)365 4358 y Fx(\(socket-local-add)o(re)o(ss)37 +b FA(socket)p Fx(\))87 b Ft(\000)-15 b(!)88 b FA(socket-addr)o(ess)503 +b FB(pr)o(ocedur)o(e)365 4458 y Fx(\(socket-remote-ad)o(dr)o(ess)37 +b FA(socket)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(socket-addr)o(ess)460 +b FB(pr)o(ocedur)o(e)573 4599 y(Sockets)42 b(can)g(be)g(associated)g +(with)h(a)f(local)g(addr)o(ess)f(or)h(a)g(r)o(emote)g(addr)o(ess)573 +4699 y(or)33 b(both.)62 b Fx(socket-local-ad)o(dr)o(ess)26 +b FB(r)o(eturns)32 b(the)h(local)g FA(socket-addr)o(ess)e +FB(r)o(ecor)o(d)573 4799 y(associated)46 b(with)i FA(socket)o +FB(.)104 b Fx(socket-remote-add)o(res)o(s)41 b FB(r)o(eturns)46 +b(the)h(r)o(emote)573 4898 y FA(socket-addr)o(ess)20 +b FB(r)o(ecor)o(d)f(associated)h(with)h FA(socket)p FB(.)365 +5147 y FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(93)p eop %%Page: 94 100 -94 99 bop 681 1265 a Fv(Chapter)44 b(5)681 1707 y FB(Strings)51 -b(and)i(characters)681 2190 y FA(Scsh)28 b(pr)o(ovides)f(a)h(set)g(of)g(pr)o -(ocedur)o(es)e(for)i(pr)o(ocessing)g(strings)h(and)f(characters.)48 -b(The)681 2289 y(pr)o(ocedur)o(es)38 b(pr)o(ovided)h(match)h(r)o(egular)f -(expr)o(essions,)45 b(sear)o(ch)39 b(strings,)46 b(parse)39 -b(\256le-)681 2389 y(names,)20 b(and)h(manipulate)f(sets)h(of)g(characters.) -805 2516 y(Also)15 b(see)f(chapters)g(6)f(and)h(7)g(on)h(r)o(ecor)o(d)e(I/O,) -h(\256eld)g(parsing,)i(and)d(the)i(awk)f(loop.)26 b(The)681 -2616 y(pr)o(ocedur)o(es)i(documented)h(ther)o(e)g(allow)h(you)g(to)g(r)o(ead) -e(character)o(-delimited)f(r)o(ecor)o(ds)681 2715 y(fr)o(om)18 -b(ports,)i(use)f(r)o(egular)f(expr)o(essions)h(to)g(split)h(the)f(r)o(ecor)o -(ds)f(into)h(\256elds)h(\(for)e(example,)681 2815 y(splitting)28 -b(a)e(string)h(at)g(every)f(occurr)o(ence)f(of)i(colon)h(or)f(white-space\),) -g(and)f(loop)h(over)681 2915 y(str)o(eams)20 b(of)h(these)f(r)o(ecor)o(ds)g -(in)h(a)f(convenient)i(way)-9 b(.)681 3199 y Fu(5.1)99 b(String)25 -b(manipulation)681 3416 y FA(Strings)18 b(ar)o(e)f(the)i(basic)e -(communication)j(medium)f(for)f(Unix)g(pr)o(ocesses,)g(so)h(a)f(shell)g(lan-) -681 3516 y(guage)i(must)i(have)e(r)o(easonable)f(facilities)i(for)f -(manipulating)i(them.)681 3774 y Fy(5.1.1)81 b(Regular)19 b(expressions)681 -3960 y FA(The)24 b(following)h(functions)g(perform)f(r)o(egular)f(expr)o -(ession)h(matching.)38 b(The)24 b(code)g(uses)681 4060 y(Henry)d(Spencer)6 -b('s)20 b(r)o(egular)f(expr)o(ession)i(package.)681 4211 y -Fw(\(string-match)38 b Fz(r)o(egexp)20 b(string)g([start])p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(match)19 b(or)i(false)389 -b FA(pr)o(ocedur)o(e)888 4354 y(Sear)o(ch)20 b Fz(string)i -FA(starting)f(at)g(position)i Fz(start)p FA(,)e(looking)i(for)e(a)g(match)h -(for)f Fz(r)o(egexp)o FA(.)29 b(If)22 b(a)888 4454 y(match)d(is)h(found,)f(r) -o(eturn)g(a)f(match)h(str)o(uctur)o(e)g(describing)g(the)g(match,)g -(otherwise)888 4553 y Fw(#f)p FA(.)27 b Fz(Start)20 b FA(defaults)g(to)h(0.) -681 4849 y Fw(\(regexp-match?)38 b Fz(obj)p Fw(\))87 b Fs(\000)-15 -b(!)88 b Fz(boolean)1135 b FA(pr)o(ocedur)o(e)681 5147 y(94)p -1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p 2271 -5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +94 99 bop 681 614 a Fx(\(shutdown-socket)37 b FA(socket)20 +b(how-to)p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(unde\002ned)616 +b FB(pr)o(ocedur)o(e)888 781 y Fx(shutdown-socket)19 +b FB(shuts)27 b(down)f(part)e(of)h(a)g(full-duplex)g(socket.)39 +b(The)26 b(method)888 881 y(of)21 b(shutting)h(done)f(is)g(speci\002ed) +g(by)f(the)h FA(how-to)e FB(ar)o(gument,)h(one)i(of:)1071 +1098 y Fx(shutdown/receive)o(s)1071 1198 y(shutdown/sends)1071 +1298 y(shutdown/sends+r)o(ece)o(iv)o(es)681 1851 y Fv(4.5)99 +b(Performing)24 b(input)h(and)g(output)g(on)g(sockets)681 +2128 y Fx(\(receive-message)37 b FA(socket)15 b(length)g([\003ags])p +Fx(\))43 b Ft(\000)-15 b(!)44 b FA([string-or-)p Fx(#f)p +FB(socket-addr)o(ess])83 b(pr)o(ocedur)o(e)681 2227 y +Fx(\(receive-message)o(!)37 b FA(socket)16 b(string)g([start])e([end])h +([\003ags])p Fx(\))43 b Ft(\000)-14 b(!)43 b FA([count-or-)p +Fx(#f)p FB(socket-addr)o(ess])83 b(pr)o(ocedur)o(e)681 +2327 y Fx(\(receive-message)o(/p)o(art)o(ia)o(l)37 b +FA(socket)16 b(length)f([\003ags])p Fx(\))42 b Ft(\000)-14 +b(!)44 b FA([string-or-)p Fx(#f)p FB(socket-addr)o(ess])83 +b(pr)o(ocedur)o(e)681 2427 y Fx(\(receive-message)o(!/)o(par)o(ti)o(al) +37 b FA(socket)16 b(string)f([start])g([end])g([\003ags])p +Fx(\))43 b Ft(\000)-15 b(!)44 b FA([count-or-)p Fx(#f)p +FB(socket-addr)o(ess])83 b(pr)o(ocedur)o(e)681 2602 y +Fx(\(send-message)38 b FA(socket)16 b(string)f([start])g([end])g +([\003ags])g([socket-addr)o(ess])p Fx(\))42 b Ft(\000)-15 +b(!)44 b FA(unde\002ned)87 b FB(pr)o(ocedur)o(e)681 2701 +y Fx(\(send-message/pa)o(rt)o(ial)37 b FA(socket)15 b(string)h([start]) +f([end])g([\003ags])g([socket-addr)o(ess])p Fx(\))41 +b Ft(\000)-14 b(!)44 b FA(count)86 b FB(pr)o(ocedur)o(e)888 +2839 y(For)23 b(most)h(uses,)f(standar)o(d)e(input)i(and)f(output)h(r)o +(outines)g(such)g(as)g Fx(read-string)888 2938 y FB(and)i +Fx(write-string)20 b FB(should)26 b(suf)o(\002ce.)37 +b(However)-6 b(,)26 b(in)f(some)h(cases)e(an)h(extended)888 +3038 y(interface)c(is)g(r)o(equir)o(ed.)26 b(The)21 b +Fx(receive-message)15 b FB(and)21 b Fx(send-message)16 +b FB(calls)22 b(par)o(-)888 3138 y(allel)37 b(the)h Fx(read-string)33 +b FB(and)j Fx(write-string)d FB(calls)k(with)h(a)f(similar)g(naming)888 +3237 y(scheme.)888 3396 y(One)i(additional)g(featur)o(e)e(of)h(these)h +(r)o(outines)g(is)g(that)g Fx(receive-message)32 b FB(r)o(e-)888 +3495 y(turns)21 b(the)f(r)o(emote)g FA(socket-addr)o(ess)f +FB(and)h FA(send-message)g FB(takes)g(an)g(optional)i(r)o(emote)888 +3595 y Fx(socket-address)p FB(.)56 b(This)34 b(allows)f(a)g(pr)o(ogram) +f(to)h(know)h(the)f(sour)o(ce)g(of)g(input)888 3695 y(fr)o(om)20 +b(a)g(datagram)e(socket)j(and)f(to)g(use)g(a)g(datagram)f(socket)h(for) +g(output)h(without)888 3794 y(\002rst)g(connecting)h(it.)888 +3953 y(All)j(of)g(these)g(pr)o(ocedur)o(es)f(take)g(an)h(optional)h +FA(\003ags)f FB(\002eld.)38 b(This)25 b(ar)o(gument)g(is)g(an)888 +4053 y(integer)c(bit-mask,)g(composed)g(by)g(or)6 b('ing)21 +b(together)g(the)g(following)i(constants:)1071 4270 y +Fx(message/out-of-b)o(and)1071 4370 y(message/peek)1071 +4469 y(message/dont-rou)o(te)888 4746 y FB(See)29 b Fx(read-string)d +FB(and)j Fx(write-string)c FB(for)k(a)h(mor)o(e)f(detailed)g +(description)h(of)888 4845 y(the)21 b(ar)o(guments)g(and)f(r)o(eturn)g +(values.)681 5147 y(94)p 1952 5071 323 4 v 1952 5173 +4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 +v 538 w FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 95 101 -95 100 bop 573 614 a FA(Is)21 b(the)g(object)g(a)f(r)o(egular)g(expr)o -(ession)g(match?)365 917 y Fw(\(match:start)39 b Fz(match)19 -b([match-number])p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(\256xnum)556 -b FA(pr)o(ocedur)o(e)573 1063 y(Returns)31 b(the)f(start)g(position)i(of)e -(the)h(match)f(denoted)g(by)h Fz(match-number)o FA(.)56 b(The)573 -1162 y(whole)21 b(r)o(egexp)e(is)h(0.)27 b(Each)19 b(further)h(number)g(r)o -(epr)o(esents)f(positions)i(enclosed)f(by)573 1262 y Fw(\()p -Fx(:)14 b(:)g(:)f Fw(\))20 b FA(sections.)29 b Fz(Match-number)20 -b FA(defaults)g(to)h(0.)365 1565 y Fw(\(match:end)40 b Fz(match)19 -b([match-number])p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(\256xnum)643 -b FA(pr)o(ocedur)o(e)573 1710 y(Returns)55 b(the)g(end)g(position)h(of)f(the) -g(match)g(denoted)f(by)h Fz(match-number)o FA(.)573 1810 y -Fz(Match-number)20 b FA(defaults)g(to)h(0)g(\(the)f(whole)i(match\).)365 -2113 y Fw(\(match:substring)37 b Fz(match)19 b([match-number])p -Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(string)422 b FA(pr)o(ocedur)o(e)573 -2258 y(Returns)16 b(the)g(substring)g(matched)f(by)h(match)f -Fz(match-number)o FA(.)26 b Fz(Match-number)15 b FA(de-)573 -2358 y(faults)20 b(to)h(0)g(\(the)f(whole)i(match\).)573 2686 -y FD(Oops:)106 b Fj(Scsh)33 b(r)o(egex)c(matching)k(doesn't)e(curr)o(ently)g -(\257ag)h(un-matched)h(subex-)573 2777 y(pr)o(essions)13 b(in)i(the)h -Fi(match:begin)p Fj(,)h Fi(match:end)p Fj(,)h(and)d Fi(match:substring)k -Fj(functions.)573 2868 y(This)f(needs)g(to)h(be)g(\256xed.)490 -3055 y FA(Regular)h(expr)o(ession)g(matching)g(compiles)h(patterns)f(into)g -(special)g(data)f(str)o(uctur)o(es)365 3155 y(which)26 b(can)f(be)f(ef)o -(\256ciently)h(used)g(to)g(match)g(against)g(strings.)41 b(The)25 -b(over)o(head)e(of)i(com-)365 3254 y(piling)e(patterns)e(that)g(will)h(be)f -(used)h(for)f(multiple)h(sear)o(ches)e(can)h(be)g(avoided)g(by)g(these)365 -3354 y(lower)o(-level)f(r)o(outines:)365 3508 y Fw(\(make-regexp)39 -b Fz(str)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(r)o(e)1416 b -FA(pr)o(ocedur)o(e)573 3653 y(Generate)20 b(a)g(compiled)h(r)o(egular)f(expr) -o(ession)g(fr)o(om)h(the)f(given)i(string.)365 3956 y Fw(\(regexp?)41 -b Fz(obj)p Fw(\))87 b Fs(\000)-15 b(!)88 b Fz(boolean)1397 -b FA(pr)o(ocedur)o(e)573 4101 y(Is)21 b(the)g(object)g(a)f(r)o(egular)g(expr) -o(ession?)365 4404 y Fw(\(regexp-exec)39 b Fz(r)o(egexp)20 -b(str)h([start])p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(match)19 -b(or)i(false)544 b FA(pr)o(ocedur)o(e)573 4550 y(Apply)26 b(the)g(r)o(egular) -e(expr)o(ession)i Fz(r)o(egexp)f FA(to)h(the)g(string)h Fz(str)f -FA(starting)h(at)e(position)573 4649 y Fz(start)p FA(.)i(If)19 -b(the)h(match)g(succeeds)g(it)g(r)o(eturns)f(a)h(r)o(egexp-match,)e -(otherwise)j Fw(#f)p FA(.)26 b Fz(Start)573 4749 y FA(defaults)20 -b(to)h(0.)365 5147 y FD(November)d(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1216 w FA(95)p eop +95 100 bop 365 614 a Fv(4.6)99 b(Socket)26 b(options)365 +845 y Fx(\(socket-option)38 b FA(socket)21 b(level)g(option)p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(value)699 b FB(pr)o(ocedur)o(e)365 +944 y Fx(\(set-socket-optio)o(n)37 b FA(socket)21 b(level)g(option)f +(value)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(unde\002ned)174 +b FB(pr)o(ocedur)o(e)573 1065 y Fx(socket-option)19 b +FB(and)24 b Fx(set-socket-option)18 b FB(allow)25 b(the)g(inspection)g +(and)g(mod-)573 1164 y(i\002cation,)30 b(r)o(espectively)-9 +b(,)29 b(of)f(several)f(options)i(available)e(on)i(sockets.)48 +b(The)28 b FA(level)573 1264 y FB(ar)o(gument)d(speci\002es)g(what)g +(pr)o(otocol)h(level)f(is)g(to)h(be)f(examined)f(or)i(af)o(fected.)36 +b(A)573 1363 y(level)30 b(of)h Fx(level/socket)26 b FB(speci\002es)31 +b(the)f(highest)i(possible)f(level)g(that)g(is)g(avail-)573 +1463 y(able)24 b(on)h(all)f(socket)g(types.)37 b(A)24 +b(speci\002c)g(pr)o(otocol)h(number)f(can)g(also)h(be)f(used)g(as)573 +1563 y(pr)o(ovided)19 b(by)i Fx(protocol-info)p FB(,)15 +b(described)20 b(below)-8 b(.)573 1691 y(Ther)o(e)25 +b(ar)o(e)f(several)g(dif)o(fer)o(ent)g(classes)h(of)h(socket)g +(options.)41 b(The)26 b(\002rst)g(class)f(con-)573 1791 +y(sists)k(of)g(boolean)g(options)h(which)f(can)f(be)h(either)f(tr)o(ue) +h(or)f(false.)49 b(Examples)28 b(of)573 1890 y(this)21 +b(option)h(type)f(ar)o(e:)756 2048 y Fx(socket/debug)756 +2148 y(socket/accept-c)o(on)o(nec)o(t)756 2247 y(socket/reuse-ad)o(dr)o +(ess)756 2347 y(socket/keep-ali)o(ve)756 2446 y(socket/dont-rou)o(te) +756 2546 y(socket/broadcas)o(t)756 2646 y(socket/use-loop)o(-b)o(ack) +756 2745 y(socket/oob-inli)o(ne)756 2845 y(socket/use-priv)o(il)o(ege)o +(d)756 2945 y(socket/cant-sig)o(na)o(l)756 3044 y(tcp/no-delay)573 +3231 y FB(V)-8 b(alue)17 b(options)h(ar)o(e)e(another)i(category)f(of)g +(socket)g(options.)26 b(Options)18 b(of)g(this)g(type)573 +3330 y(ar)o(e)h(an)i(integer)g(value.)j(Examples)d(of)f(this)i(option)g +(type)e(ar)o(e:)756 3488 y Fx(socket/send-buf)o(fe)o(r)756 +3587 y(socket/receive-)o(bu)o(ffe)o(r)756 3687 y(socket/send-low)o(-w)o +(ate)o(r)756 3786 y(socket/receive-)o(lo)o(w-w)o(at)o(er)756 +3886 y(socket/error)756 3986 y(socket/type)756 4085 y(ip/time-to-live) +756 4185 y(tcp/max-segment)573 4371 y FB(A)d(thir)o(d)h(option)h(type)e +(speci\002es)h(how)h(long)g(for)e(data)g(to)h(linger)g(after)f(a)g +(socket)i(has)573 4471 y(been)24 b(closed.)37 b(Ther)o(e)24 +b(is)h(only)h(one)f(option)h(of)e(this)i(type:)33 b Fx(socket/linger)p +FB(.)f(It)24 b(is)573 4571 y(set)i(with)g(either)g Fx(#f)p +FB(to)f(disable)g(it)h(or)f(an)h(integer)g(number)f(of)h(seconds)g(to)g +(linger)573 4670 y(and)20 b(r)o(eturns)g(a)h(value)f(of)h(the)f(same)h +(type)g(upon)g(inspection.)573 4799 y(The)46 b(fourth)h(and)f(\002nal)h +(option)h(type)e(of)g(this)i(time)f(is)f(a)g(timeout)i(option.)573 +4898 y(Ther)o(e)25 b(ar)o(e)g(two)i(examples)e(of)h(this)h(option)h +(type:)36 b Fx(socket/send-tim)o(eou)o(t)20 b FB(and)365 +5147 y FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(95)p eop %%Page: 96 102 -96 101 bop 888 614 a FD(Remark:)114 b Fj(The)34 b(tr)o(uth:)55 -b(S48)35 b(doesn't)e(have)h(the)g(facilities)f(for)g(extending)g(the)888 -706 y(garbage)16 b(collector)g(to)g(malloc'd)g(C)g(storage)g(\(unlike)g -(elk\).)22 b(So)17 b(we)f(do)g(not)h(r)o(eally)e(ex-)888 797 -y(port)k(r)o(egular)d(expr)o(ession)h(compilation.)24 b(What)c(we)f(curr)o -(ently)e(do)h(is)h(this:)1071 888 y Fi(\(define)41 b(regexp?)g(string?\))1071 -980 y(\(define)g(\(make-regexp)h(str\))e(str\))1071 1071 y(\(define)h -(\(regexp-exec)h(regexp)e(str)g([start]\))1149 1162 y(\(string-match)j -(regexp)d(str)g([start]\)\))888 1254 y Fj(This)19 b(could)f(be)h(impr)o(oved) -e(upon)h(in)h(another)h(implementation)f(\(like)e(elk\).)681 -1454 y Fw(\(regexp-quote)38 b Fz(str)p Fw(\))87 b Fs(\000)-14 -b(!)87 b Fz(string)1232 b FA(pr)o(ocedur)o(e)888 1595 y(Returns)24 -b(a)e(r)o(egular)g(expr)o(ession)g(that)h(matches)g(the)g(string)h -Fz(str)f FA(exactly)-9 b(.)33 b(In)23 b(other)888 1695 y(wor)o(ds,)18 -b(it)g(quotes)h(the)f(r)o(egular)f(expr)o(ession,)h(pr)o(epending)f -(backslashes)h(to)g(all)g(the)888 1794 y(special)j(r)o(egexp)e(characters)h -(in)h Fz(str)p FA(.)1071 1961 y Fw(\(regexp-quote)38 b("*Hello*)i(world."\)) -1245 2061 y Fl(=)-14 b Fs(\))44 b Fw("\\\\*Hello\\\\*)38 b(world\\\\.")681 -2414 y Fy(5.1.2)81 b(Other)20 b(string)g(manipulation)d(facilities)681 -2622 y Fw(\(index)41 b Fz(string)21 b(char)f([start])p Fw(\))86 -b Fs(\000)-15 b(!)88 b Fz(\256xnum)20 b(or)g(false)732 b FA(pr)o(ocedur)o(e) -681 2722 y Fw(\(rindex)40 b Fz(string)21 b(char)f([start])p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(\256xnum)20 b(or)h(false)688 -b FA(pr)o(ocedur)o(e)888 2846 y(These)17 b(pr)o(ocedur)o(es)e(sear)o(ch)h -(thr)o(ough)h Fz(string)g FA(looking)i(for)d(an)h(occurr)o(ence)f(of)g(char)o -(-)888 2946 y(acter)k Fz(char)p FA(.)27 b Fw(index)19 b FA(sear)o(ches)g -(left-to-right;)i Fw(rindex)d FA(sear)o(ches)i(right-to-left.)888 -3079 y Fw(index)j FA(r)o(eturns)g(the)i(smallest)f(index)g -Fx(i)g FA(of)h Fz(string)f FA(gr)o(eater)e(than)j(or)f(equal)h(to)f -Fz(start)888 3179 y FA(such)f(that)g Fz(string)p Fl([)p Fx(i)p -Fl(])28 b(=)g Fz(char)p FA(.)k(The)22 b(default)g(for)g Fz(start)g -FA(is)h(zer)o(o.)31 b(If)22 b(ther)o(e)g(is)h(no)g(such)888 -3278 y(match,)e Fw(index)e FA(r)o(eturns)h(false.)888 3412 -y Fw(rindex)39 b FA(r)o(eturns)h(the)h(lar)o(gest)f(index)g -Fx(i)h FA(of)f Fz(string)h FA(less)g(than)g Fz(start)g FA(such)g(that)888 -3511 y Fz(string)p Fl([)p Fx(i)p Fl(])30 b(=)g Fz(char)o FA(.)k(The)22 -b(default)g(for)h Fz(start)f FA(is)h Fw(\(string-length)38 -b Fz(string)p Fw(\))p FA(.)33 b(If)23 b(ther)o(e)888 3611 y(is)e(no)h(such)f -(match,)g Fw(rindex)d FA(r)o(eturns)i(false.)805 3778 y(I)f(should)g(pr)o -(obably)f(snarf)g(all)g(the)h(MIT)f(Scheme)g(string)h(functions,)h(and)e -(stick)h(them)681 3878 y(in)i(a)f(package.)27 b(Unix)20 b(pr)o(ograms)g(need) -h(to)g(mung)h(character)d(strings)i(a)g(lot.)805 4003 y(MIT)f(string)i(match) -f(commands:)888 4102 y Fw([sub]string-match)o(-f)o(orw)o(ar)o(d,b)o(ac)o(kwa) -o(rd)o([-)o(ci])888 4202 y([sub]string-prefi)o(x,)o(suf)o(fi)o(x[-)o(ci)o(]?) -888 4302 y([sub]string-find-)o(ne)o(xt,)o(pr)o(evi)o(ou)o(s-c)o(ha)o(r[)o -(-ci)o(])888 4401 y([sub]string-find-)o(ne)o(xt,)o(pr)o(evi)o(ou)o(s-c)o(ha)o -(r-)o(in-)o(se)o(t)888 4501 y([sub]string-repla)o(ce)o([!])888 -4600 y Fx(:)14 b(:)g(:)g Fq(etc.)681 4700 y FA(These)20 b(ar)o(e)g(not)h -(curr)o(ently)g(pr)o(ovided.)681 4850 y Fw(\(substitute-env-)o(va)o(rs)37 -b Fz(fname)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(string)816 -b FA(pr)o(ocedur)o(e)681 5147 y(96)p 1952 5071 323 4 v 1952 -5173 4 102 v 1215 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 -v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +96 101 bop 888 614 a Fx(socket/receive-ti)o(me)o(out)o +FB(.)20 b(These)g(ar)o(e)f(set)h(with)h(a)f(r)o(eal)f(number)h(of)h +(micr)o(osec-)888 714 y(onds)h(r)o(esolution)f(and)f(r)o(eturns)h(a)f +(value)g(of)h(the)g(same)f(type)h(upon)g(inspection.)681 +1006 y Fv(4.7)99 b(Database-information)24 b(entries)681 +1242 y Fx(\(host-info)39 b FA(name-or-socket-addr)o(ess)p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(host-info)583 b FB(pr)o(ocedur)o(e) +681 1342 y Fx(\(network-info)38 b FA(name-or-socket-addr)o(ess)p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(network-info)319 b +FB(pr)o(ocedur)o(e)681 1441 y Fx(\(service-info)38 b +FA(name-or-number)18 b([pr)o(otocol-name])p Fx(\))56 +b Ft(\000)-15 b(!)59 b FA(service-info)88 b FB(pr)o(ocedur)o(e)681 +1541 y Fx(\(protocol-info)38 b FA(name-or-number)p Fx(\))87 +b Ft(\000)-15 b(!)88 b FA(pr)o(otocol-info)493 b FB(pr)o(ocedur)o(e)888 +1664 y Fx(host-info)22 b FB(allows)k(a)g(pr)o(ogram)f(to)h(look)g(up)g +(a)f(host)h(entry)g(based)f(on)h(either)g(its)888 1764 +y(string)d FA(name)f FB(or)f FA(socket-addr)o(ess)o FB(.)29 +b(The)22 b(value)f(r)o(eturned)f(by)i(this)h(r)o(outine)f(is)g(a)f +FA(host-)888 1864 y(info)g(r)o(ecord)p FB(,)f(de\002ned)h(to)g(have)f +(the)h(following)h(str)o(uctur)o(e:)1071 2027 y Fx(\(define-record)38 +b(host-info)1158 2127 y(name)1480 b(;)44 b(Host)e(name)1158 +2227 y(aliases)1348 b(;)44 b(Alternative)39 b(names)1158 +2326 y(addresses\))1216 b(;)44 b(Host)e(addresses)888 +2522 y(host-info)17 b FB(could)k(fail)f(and)h(raise)f(an)h(err)o(or)e +(for)i(one)g(of)g(the)g(following)h(r)o(easons:)1071 +2685 y Fx(herror/host-not-)o(fou)o(nd)1071 2785 y(herror/try-again)1071 +2885 y(herror/no-recove)o(ry)1071 2984 y(herror/no-data)1071 +3084 y(herror/no-addres)o(s)888 3280 y(network-info)27 +b FB(allows)32 b(a)f(pr)o(ogram)g(to)h(look)h(up)e(a)h(network)g(entry) +g(based)e(on)888 3379 y(either)21 b(its)h(string)f FA(name)g +FB(or)h FA(socket-addr)o(ess)o FB(.)k(The)21 b(value)f(r)o(eturned)g +(by)h(this)h(r)o(outine)888 3479 y(is)f(a)g FA(network-info)f(r)o +(ecord)p FB(,)g(de\002ned)h(to)g(have)f(the)h(following)h(str)o(uctur)o +(e:)1071 3642 y Fx(\(define-record)38 b(network-info)1158 +3742 y(name)1480 b(;)44 b(Network)c(name)1158 3842 y(aliases)1348 +b(;)44 b(Alternative)39 b(names)1158 3941 y(net\))1480 +b(;)44 b(Network)c(number)888 4137 y(service-info)21 +b FB(allows)27 b(a)e(pr)o(ogram)g(to)h(look)h(up)f(a)f(service)g(entry) +h(based)f(on)h(ei-)888 4237 y(ther)e(its)g(string)h FA(name)e +FB(or)h(integer)g FA(port)o FB(.)35 b(The)24 b(value)f(r)o(eturned)g +(by)g(this)i(r)o(outine)f(is)888 4336 y(a)d FA(service-info)g(r)o +(ecord)p FB(,)f(de\002ned)g(to)h(have)f(the)h(following)i(str)o(uctur)o +(e:)1071 4500 y Fx(\(define-record)38 b(service-info)1158 +4599 y(name)1480 b(;)44 b(Service)c(name)1158 4699 y(aliases)1348 +b(;)44 b(Alternative)39 b(names)1158 4799 y(port)1480 +b(;)44 b(Port)e(number)1158 4898 y(protocol\))1260 b(;)44 +b(Protocol)c(name)681 5147 y FB(96)p 1952 5071 323 4 +v 1952 5173 4 102 v 1215 w FD(DRAFT)p 2271 5173 V 1952 +5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 97 103 -97 102 bop 573 614 a FA(Replace)23 b(occurr)o(ences)h(of)g(envir)o(onment)g -(variables)f(with)i(their)g(values.)37 b(An)24 b(en-)573 714 -y(vir)o(onment)18 b(variable)f(is)h(denoted)g(by)g(a)f(dollar)h(sign)h -(followed)f(by)g(alphanumeric)573 814 y(chars)i(and)h(underscor)o(es,)e(or)i -(is)g(surr)o(ounded)f(by)h(braces.)756 967 y Fw(\(substitute-env)o(-v)o(ars) -37 b("$)o(USER/.login"\))922 1067 y Fl(=)-14 b Fs(\))103 b -Fw("shivers/.login")756 1166 y(\(substitute-env)o(-v)o(ars)37 -b("$)p Fs(f)p Fw(USER)p Fs(g)p Fw(_log"\))77 b Fl(=)-14 b Fs(\))103 -b Fw("shivers_log")365 1559 y Fy(5.1.3)81 b(Manipulating)18 -b(\256le-names)365 1742 y FA(These)27 b(pr)o(ocedur)o(es)d(do)j(not)g(access) -f(the)g(\256le-system)h(at)f(all;)j(they)e(mer)o(ely)e(operate)h(on)365 -1842 y(\256le-name)f(strings.)39 b(Much)25 b(of)f(this)i(str)o(uctur)o(e)e -(is)h(patterned)e(after)g(the)i(gnu)g(emacs)f(de-)365 1942 -y(sign.)61 b(Per)o(haps)30 b(a)i(mor)o(e)f(sophisticated)h(system)g(would)g -(be)f(better)-6 b(,)33 b(something)g(like)365 2041 y(the)23 -b(pathname)f(abstractions)g(of)i(C)t Fr(O)t(M)t(M)t(O)t(N)j -FA(L)t Fr(I)t(S)t(P)e FA(or)d(MIT)g(Scheme.)31 b(However)-6 -b(,)22 b(being)365 2141 y(Unix-speci\256c,)e(we)h(can)g(be)f(a)g(little)h -(less)g(general.)365 2389 y Fy(T)-9 b(erminology)365 2572 y -FA(These)23 b(pr)o(ocedur)o(es)d(car)o(efully)i(adher)o(e)e(to)j(the)i(P)t -Fr(O)t(S)t(I)t(X)h FA(standar)o(d)21 b(for)h(\256le-name)g(r)o(esolu-)365 -2671 y(tion,)g(which)g(occasionally)g(entails)f(some)h(slightly)h(odd)e -(things.)30 b(This)22 b(section)f(will)h(de-)365 2771 y(scribe)f(these)g(r)o -(ules,)f(and)h(give)g(some)g(basic)f(terminology)-9 b(.)490 -2895 y(A)17 b Fz(\256le-name)g FA(is)h(either)f(the)g(\256le-system)h(r)o -(oot)g(\(\252/\272\),)e(or)i(a)e(series)i(of)f(slash-terminated)365 -2995 y(dir)o(ectory)27 b(components,)k(followed)d(by)g(a)f(a)g(\256le)h -(component.)50 b(Root)29 b(is)f(the)g(only)h(\256le-)365 3095 -y(name)21 b(that)g(may)f(end)h(in)g(slash.)28 b(Some)21 b(examples:)738 -3274 y(File)g(name)395 b(Dir)21 b(components)207 b(File)21 -b(component)p 688 3307 2220 4 v 738 3377 a Fw(src/des/main.c)137 -b(\("src")41 b("des"\))228 b("main.c")738 3477 y(/src/des/main.c)93 -b(\("")42 b("src")g("des"\))97 b("main.c")738 3576 y(main.c)489 -b(\(\))709 b("main.c")490 3753 y FA(Note)24 b(that)g(the)g(r)o(elative)f -(\256lename)h Fw(src/des/main.c)18 b FA(and)23 b(the)i(absolute)e(\256lename) -365 3852 y Fw(/src/des/main.c)17 b FA(ar)o(e)k(distinguished)j(by)f(the)g(pr) -o(esence)e(of)i(the)g(r)o(oot)f(component)i Fw("")365 3952 -y FA(in)e(the)e(absolute)h(path.)490 4076 y(Multiple)h(embedded)f(slashes)h -(within)i(a)d(path)h(have)g(the)g(same)g(meaning)h(as)f(a)f(sin-)365 -4176 y(gle)27 b(slash.)44 b(Mor)o(e)25 b(than)h(two)h(leading)f(slashes)h(at) -f(the)g(beginning)i(of)e(a)g(path)g(have)f(the)365 4276 y(same)d(meaning)h -(as)f(a)g(single)h(leading)f(slash\320they)h(indicate)f(that)h(the)f -(\256le-name)g(is)h(an)365 4375 y(absolute)d(one,)f(with)h(the)g(path)f -(leading)g(fr)o(om)g(r)o(oot.)27 b(However)-6 b(,)21 b(P)t -Fr(O)t(S)t(I)t(X)i FA(permits)c(the)h(OS)365 4475 y(to)j(give)f(special)g -(meaning)h(to)g Fz(two)e FA(leading)h(slashes.)33 b(For)22 -b(this)h(r)o(eason,)f(the)h(r)o(outines)f(in)365 4575 y(this)g(section)f(do)g -(not)h(simplify)f(two)g(leading)g(slashes)g(to)g(a)f(single)i(slash.)490 -4699 y(A)e(\256le-name)g(in)h Fz(dir)o(ectory)e(form)h FA(is)h(either)f(a)g -(\256le-name)g(terminated)g(by)g(a)g(slash,)g Fz(e.g.)p FA(,)365 -4799 y(\252)p Fw(/src/des/)p FA(\272,)14 b(or)k(the)h(empty)f(string,)h -(\252\272.)26 b(The)18 b(empty)g(string)h(corr)o(esponds)f(to)g(the)h(cur)o -(-)365 4898 y(r)o(ent)g(working)h(dir)o(ectory)-9 b(,)18 b(whose)i -(\256le-name)e(is)i(dot)f(\(\252)p Fw(.)p FA(\272\).)24 b(W)-8 -b(orking)21 b(backwar)o(ds)c(fr)o(om)365 5147 y FD(November)h(1,)h(1995)h -(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 -v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1216 w FA(97)p -eop +97 102 bop 573 614 a Fx(protocol-info)12 b FB(allows)19 +b(a)f(pr)o(ogram)f(to)h(look)h(up)f(a)g(pr)o(otocol)g(entry)g(based)f +(on)i(ei-)573 714 y(ther)i(its)g(string)h FA(name)f FB(or)g(integer)g +FA(number)q FB(.)26 b(The)21 b(value)g(r)o(eturned)f(by)h(this)h(r)o +(outine)573 814 y(is)f(a)f FA(pr)o(otocol-info)f(r)o(ecord)p +FB(,)h(de\002ned)h(to)g(have)f(the)h(following)h(str)o(uctur)o(e:)756 +980 y Fx(\(define-record)37 b(protocol-info)843 1079 +y(name)1480 b(;)43 b(Protocol)d(name)843 1179 y(aliases)1348 +b(;)43 b(Alternative)c(names)843 1279 y(number\))1348 +b(;)43 b(Protocol)d(number\))365 5147 y FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p 1636 5071 323 +4 v 1636 5173 4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 +5176 323 4 v 1216 w FB(97)p eop %%Page: 98 104 -98 103 bop 681 614 a FA(the)18 b(append-a-slash)e(r)o(ule,)i(we)g(extend)f -(the)h(syntax)g(of)h(P)t Fr(O)t(S)t(I)t(X)j FA(\256le-names)17 -b(to)h(de\256ne)g(the)681 714 y(empty)j(string)h(to)f(be)g(a)f(\256le-name)h -(form)g(of)g(the)g(r)o(oot)g(dir)o(ectory)f(\252)p Fw(/)p FA(\272.)27 -b(\(However)-6 b(,)20 b(\252)p Fw(/)p FA(\272)g(is)681 814 -y(also)f(acceptable)e(as)h(a)g(\256le-name)h(form)g(for)f(r)o(oot.\))27 -b(So)18 b(the)h(empty)g(string)h(has)e(two)i(inter)o(-)681 -913 y(pr)o(etations:)29 b(as)21 b(a)h(\256le-name)f(form,)h(it)g(is)g(the)g -(\256le-system)g(r)o(oot;)g(as)g(a)f(dir)o(ectory)g(form,)h(it)681 -1013 y(is)i(the)g(curr)o(ent)f(working)i(dir)o(ectory)-9 b(.)35 -b(Slash)23 b(is)h(also)g(an)g(ambiguous)g(form:)34 b Fw(/)23 -b FA(is)h(both)h(a)681 1112 y(dir)o(ectory-form)19 b(and)i(a)f(\256le-name)g -(form.)805 1237 y(The)15 b(dir)o(ectory)e(form)i(of)f(a)g(\256le-name)g(is)h -(very)f(rar)o(ely)f(used.)25 b(Almost)15 b(all)f(of)h(the)f(pr)o(oce-)681 -1337 y(dur)o(es)i(in)h(scsh)h(name)f(dir)o(ectories)f(by)h(giving)h(their)f -(\256le-name)g(form)g(\(without)h(the)f(trail-)681 1436 y(ing)23 -b(slash\),)f(not)h(their)f(dir)o(ectory)f(form.)32 b(So,)22 -b(you)h(say)f(\252)p Fw(/usr/include)p FA(\272,)16 b(and)21 -b(\252)p Fw(.)p FA(\272,)g(not)681 1536 y(\252)p Fw(/usr/include/)p -FA(\272)h(and)29 b(\252\272.)51 b(The)29 b(sole)g(exceptions)h(ar)o(e)d -Fw(file-name-as-dire)o(ct)o(or)o(y)681 1636 y FA(and)i Fw(directory-as-fil)o -(e-)o(na)o(me)p FA(,)c(whose)30 b(jobs)h(ar)o(e)d(to)h(convert)h -(back-and-forth)e(be-)681 1735 y(tween)c(these)h(forms,)h(and)e -Fw(file-name-direc)o(tor)o(y)p FA(,)19 b(whose)25 b(job)g(it)g(is)g(to)g -(split)g(out)g(the)681 1835 y(dir)o(ectory)g(portion)i(of)f(a)f(\256le-name.) -43 b(However)-6 b(,)27 b(most)g(pr)o(ocedur)o(es)d(that)i(expect)f(a)h(di-) -681 1934 y(r)o(ectory)20 b(ar)o(gument)h(will)h(coer)o(ce)e(a)h(\256le-name)g -(in)h(dir)o(ectory)f(form)g(to)h(\256le-name)f(form)g(if)681 -2034 y(it)h(does)g(not)g(have)g(a)f(trailing)h(slash.)31 b(Bear)21 -b(in)h(mind)g(that)g(the)g(ambiguous)h(case,)e(empty)681 2134 -y(string,)g(will)g(be)g(interpr)o(eted)e(in)i(\256le-name)g(form,)g -Fz(i.e.)o FA(,)g(as)f(r)o(oot.)681 2384 y Fy(Procedures)681 -2590 y Fw(\(file-name-direc)o(to)o(ry?)37 b Fz(fname)p Fw(\))86 -b Fs(\000)-14 b(!)87 b Fz(boolean)726 b FA(pr)o(ocedur)o(e)681 -2689 y Fw(\(file-name-non-d)o(ir)o(ect)o(or)o(y?)37 b Fz(fname)p -Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(boolean)551 b FA(pr)o(ocedur)o(e)888 -2813 y(These)18 b(pr)o(edicates)f(r)o(eturn)g(tr)o(ue)i(if)f(the)g(string)h -(is)f(in)h(dir)o(ectory)e(form,)i(or)f(\256le-name)888 2913 -y(form)24 b(\(see)f(the)h(above)f(discussion)h(of)g(these)f(two)i(forms\).)35 -b(Note)24 b(that)g(they)f(both)888 3012 y(r)o(eturn)c(tr)o(ue)h(on)g(the)g -(ambiguous)h(case)e(of)g(empty)h(string,)g(which)h(is)f(both)g(a)g(dir)o(ec-) -888 3112 y(tory)h(\(curr)o(ent)f(working)i(dir)o(ectory\),)d(and)i(a)f -(\256le)h(name)f(\(the)h(\256le-system)g(r)o(oot\).)1222 3246 -y(File)g(name)177 b Fx(:)14 b(:)g(:)g Fw(-directory?)95 b Fx(:)14 -b(:)g(:)g Fw(-non-directory?)p 1172 3279 2090 4 v 1222 3349 -a("src/des")139 b(#f)602 b(#t)1222 3448 y("src/des/")95 b(#t)602 -b(#f)1222 3548 y("/")403 b(#t)602 b(#f)1222 3648 y(".")403 -b(#f)602 b(#t)1222 3747 y("")447 b(#t)602 b(#t)681 3935 y(\(file-name-as-di)o -(re)o(cto)o(ry)37 b Fz(fname)p Fw(\))87 b Fs(\000)-15 b(!)88 -b Fz(string)685 b FA(pr)o(ocedur)o(e)888 4074 y(Convert)29 -b(a)f(\256le-name)h(to)g(dir)o(ectory)f(form.)51 b(Basically)-9 -b(,)29 b(add)f(a)g(trailing)h(slash)g(if)888 4174 y(needed:)1071 -4292 y Fw(\(file-name-as-di)o(rec)o(to)o(ry)37 b("src/des"\))123 -b Fl(=)-14 b Fs(\))103 b Fw("src/des/")1071 4392 y(\(file-name-as-di)o(rec)o -(to)o(ry)37 b("src/des/"\))79 b Fl(=)-14 b Fs(\))103 b Fw("src/des/")1071 -4570 y(.)p FA(,)20 b Fw(/)p FA(,)g(and)g Fw("")g FA(ar)o(e)g(special:)1071 -4669 y Fw(\(file-name-as-di)o(rec)o(to)o(ry)37 b("."\))387 -b Fl(=)-14 b Fs(\))103 b Fw("")1071 4769 y(\(file-name-as-di)o(rec)o(to)o(ry) -37 b("/"\))387 b Fl(=)-14 b Fs(\))103 b Fw("/")1071 4868 y(\(file-name-as-di) -o(rec)o(to)o(ry)37 b(""\))431 b Fl(=)-14 b Fs(\))103 b Fw("/")681 -5147 y FA(98)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +98 103 bop 681 1265 a Fw(Chapter)44 b(5)681 1707 y FC(Strings)51 +b(and)i(characters)681 2190 y FB(Scsh)28 b(pr)o(ovides)f(a)h(set)g(of)h +(pr)o(ocedur)o(es)d(for)i(pr)o(ocessing)h(strings)g(and)e(characters.) +47 b(The)681 2290 y(pr)o(ocedur)o(es)38 b(pr)o(ovided)h(match)h(r)o +(egular)f(expr)o(essions,)45 b(sear)o(ch)39 b(strings,)46 +b(parse)39 b(\002le-)681 2390 y(names,)20 b(and)h(manipulate)f(sets)h +(of)g(characters.)805 2517 y(Also)43 b(see)e(chapters)h(6)f(and)h(7)f +(on)i(r)o(ecor)o(d)d(I/O,)i(\002eld)g(parsing,)47 b(and)42 +b(the)g(awk)681 2616 y(loop.)26 b(The)19 b(pr)o(ocedur)o(es)f +(documented)i(ther)o(e)e(allow)i(you)h(to)f(r)o(ead)e(character)o +(-delimited)681 2716 y(r)o(ecor)o(ds)k(fr)o(om)i(ports,)h(use)f(r)o +(egular)f(expr)o(essions)h(to)h(split)f(the)h(r)o(ecor)o(ds)d(into)j +(\002elds)g(\(for)681 2816 y(example,)k(splitting)h(a)f(string)g(at)f +(every)g(occurr)o(ence)g(of)g(colon)i(or)f(white-space\),)g(and)681 +2915 y(loop)21 b(over)g(str)o(eams)f(of)h(these)g(r)o(ecor)o(ds)e(in)i +(a)f(convenient)i(way)-9 b(.)681 3199 y Fv(5.1)99 b(String)25 +b(manipulation)681 3417 y FB(Strings)33 b(ar)o(e)e(the)h(basic)h +(communication)h(medium)f(for)f(Unix)g(pr)o(ocesses,)j(so)e(a)f(shell) +681 3516 y(language)20 b(must)i(have)e(r)o(easonable)f(facilities)i +(for)f(manipulating)i(them.)681 3774 y Fz(5.1.1)81 b(Regular)19 +b(expressions)681 3960 y FB(The)24 b(following)i(functions)f(perform)f +(r)o(egular)f(expr)o(ession)h(matching.)37 b(The)24 b(code)g(uses)681 +4060 y(Henry)d(Spencer)6 b('s)20 b(r)o(egular)f(expr)o(ession)i +(package.)681 4211 y Fx(\(string-match)38 b FA(r)o(egexp)20 +b(string)g([start])p Fx(\))86 b Ft(\000)-14 b(!)87 b +FA(match)19 b(or)i(false)389 b FB(pr)o(ocedur)o(e)888 +4354 y(Sear)o(ch)20 b FA(string)i FB(starting)g(at)f(position)i +FA(start)o FB(,)f(looking)h(for)f(a)f(match)g(for)h FA(r)o(egexp)n +FB(.)28 b(If)22 b(a)888 4454 y(match)d(is)h(found,)f(r)o(eturn)g(a)f +(match)h(str)o(uctur)o(e)g(describing)g(the)g(match,)g(otherwise)888 +4553 y Fx(#f)p FB(.)25 b FA(Start)20 b FB(defaults)g(to)h(0.)681 +4849 y Fx(\(regexp-match?)38 b FA(obj)p Fx(\))87 b Ft(\000)-15 +b(!)88 b FA(boolean)1135 b FB(pr)o(ocedur)o(e)681 5147 +y(98)p 1952 5071 323 4 v 1952 5173 4 102 v 1215 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226) +f(21)13 b(:)f(47)p eop %%Page: 99 105 -99 104 bop 365 780 a Fw(\(directory-as-fil)o(e-)o(nam)o(e)37 -b Fz(fname)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(string)686 -b FA(pr)o(ocedur)o(e)573 937 y(Convert)21 b(a)f(dir)o(ectory)g(to)h(a)f -(simple)h(\256le-name.)27 b(Basically)-9 b(,)20 b(kill)h(a)g(trailing)g -(slash)g(if)573 1036 y(one)g(is)g(pr)o(esent:)756 1214 y Fw(\(directory-as-f) -o(il)o(e-n)o(am)o(e)38 b("foo/bar/"\))78 b Fl(=)-14 b Fs(\))104 -b Fw("foo/bar")756 1391 y(/)20 b FA(and)g Fw("")g FA(ar)o(e)f(special:)756 -1491 y Fw(\(directory-as-f)o(il)o(e-n)o(am)o(e)38 b("/"\))386 -b Fl(=)-14 b Fs(\))104 b Fw("/")756 1590 y(\(directory-as-f)o(il)o(e-n)o(am)o -(e)38 b(""\))430 b Fl(=)-14 b Fs(\))104 b Fw(".")19 b FA(\()p -Fz(i.e.)p FA(,)h(the)h(cwd\))365 1967 y Fw(\(file-name-absolu)o(te)o(?)38 -b Fz(fname)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(boolean)770 -b FA(pr)o(ocedur)o(e)573 2124 y(Does)20 b Fz(fname)f FA(begin)h(with)g(a)f(r) -o(oot)g(or)g Fw(~)g FA(component?)29 b(\(Recognising)20 b Fw(~)f -FA(as)g(a)g(home-)573 2224 y(dir)o(ectory)h(speci\256cation)h(is)g(an)g -(extension)g(of)i(P)t Fr(O)t(S)t(I)t(X)h FA(r)o(ules.\))756 -2401 y Fw(\(file-name-abso)o(lu)o(te?)37 b("/usr/shivers"\))77 -b Fl(=)-14 b Fs(\))103 b Fw(#t)756 2501 y(\(file-name-abso)o(lu)o(te?)37 -b("src/des"\))297 b Fl(=)-14 b Fs(\))103 b Fw(#f)756 2601 y(\(file-name-abso) -o(lu)o(te?)37 b("~/src/des"\))209 b Fl(=)-14 b Fs(\))103 b -Fw(#t)756 2778 y FA(Non-obvious)21 b(case:)756 2878 y Fw(\(file-name-abso)o -(lu)o(te?)37 b(""\))605 b Fl(=)-14 b Fs(\))103 b Fw(#t)20 b -FA(\()p Fz(i.e.)p FA(,)g(r)o(oot\))365 3255 y Fw(\(file-name-direct)o(or)o(y) -38 b Fz(fname)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(string)21 -b(or)g(false)559 b FA(pr)o(ocedur)o(e)573 3412 y(Return)29 -b(the)h(dir)o(ectory)e(component)j(of)e Fz(fname)g FA(in)h(dir)o(ectory)e -(form.)53 b(If)28 b(the)i(\256le-)573 3511 y(name)21 b(is)g(alr)o(eady)e(in)i -(dir)o(ectory)f(form,)g(r)o(eturn)g(it)h(as-is.)756 3689 y -Fw(\(file-name-dire)o(ct)o(ory)37 b("/usr/bdc"\))165 b Fl(=)-14 -b Fs(\))104 b Fw("/usr/")756 3788 y(\(file-name-dire)o(ct)o(ory)37 -b("/usr/bdc/"\))121 b Fl(=)-14 b Fs(\))104 b Fw("/usr/bdc/")756 -3888 y(\(file-name-dire)o(ct)o(ory)37 b("bdc/.login"\))77 b -Fl(=)-14 b Fs(\))104 b Fw("bdc/")756 3988 y(\(file-name-dire)o(ct)o(ory)37 -b("main.c"\))253 b Fl(=)-14 b Fs(\))104 b Fw("")756 4165 y -FA(Root)21 b(has)g(no)h(dir)o(ectory)e(component:)756 4265 -y Fw(\(file-name-dire)o(ct)o(ory)37 b("/"\))473 b Fl(=)-14 -b Fs(\))104 b Fw("")756 4364 y(\(file-name-dire)o(ct)o(ory)37 -b(""\))517 b Fl(=)-14 b Fs(\))104 b Fw("")365 4741 y(\(file-name-nondir)o(ec) -o(tor)o(y)37 b Fz(fname)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(string)686 -b FA(pr)o(ocedur)o(e)573 4898 y(Return)21 b(non-dir)o(ectory)g(component)h -(of)e(fname.)365 5147 y FD(November)e(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1216 w FA(99)p eop +99 104 bop 573 614 a FB(Is)21 b(the)g(object)g(a)f(r)o(egular)g(expr)o +(ession)g(match?)365 894 y Fx(\(match:start)39 b FA(match)19 +b([match-number])p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(\002xnum)556 +b FB(pr)o(ocedur)o(e)573 1028 y(Returns)31 b(the)g(start)f(position)i +(of)e(the)h(match)f(denoted)g(by)h FA(match-number)o +FB(.)55 b(The)573 1127 y(whole)21 b(r)o(egexp)e(is)i(0.)j(Each)c +(further)g(number)g(r)o(epr)o(esents)f(positions)j(enclosed)e(by)573 +1227 y Fx(\(...\))f FB(sections.)26 b FA(Match-number)20 +b FB(defaults)g(to)h(0.)573 1356 y(If)k(the)h(r)o(egular)e(expr)o +(ession)h(matches)h(as)f(a)g(whole,)i(but)f(a)f(particular)f(par)o +(enthe-)573 1456 y(sized)c(sub-expr)o(ession)g(does)h(not)h(match,)e +(then)h Fx(match:start)c FB(r)o(eturns)j Fx(#f)p FB(.)365 +1736 y Fx(\(match:end)40 b FA(match)19 b([match-number])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(\002xnum)643 b FB(pr)o(ocedur)o(e) +573 1869 y(Returns)55 b(the)g(end)g(position)h(of)f(the)g(match)g +(denoted)f(by)h FA(match-number)o FB(.)573 1969 y FA(Match-number)20 +b FB(defaults)g(to)h(0)g(\(the)f(whole)i(match\).)573 +2098 y(If)j(the)h(r)o(egular)e(expr)o(ession)h(matches)h(as)f(a)g +(whole,)i(but)f(a)f(particular)f(par)o(enthe-)573 2198 +y(sized)c(sub-expr)o(ession)g(does)h(not)h(match,)e(then)h +Fx(match:end)c FB(r)o(eturns)k Fx(#f)p FB(.)365 2477 +y Fx(\(match:substring)37 b FA(match)19 b([match-number])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(string)422 b FB(pr)o(ocedur)o(e)573 +2611 y(Returns)33 b(the)f(substring)h(matched)f(by)g(match)g +FA(match-number)o FB(.)60 b FA(Match-number)573 2711 +y FB(defaults)20 b(to)h(0)f(\(the)h(whole)g(match\).)490 +2973 y(Regular)f(expr)o(ession)g(matching)g(compiles)h(patterns)f(into) +g(special)g(data)f(str)o(uctur)o(es)365 3073 y(which)26 +b(can)f(be)g(ef)o(\002ciently)g(used)f(to)i(match)f(against)g(strings.) +40 b(The)25 b(over)o(head)e(of)i(com-)365 3172 y(piling)e(patterns)e +(that)g(will)h(be)f(used)h(for)f(multiple)h(sear)o(ches)e(can)h(be)g +(avoided)g(by)g(these)365 3272 y(lower)o(-level)f(r)o(outines:)365 +3414 y Fx(\(make-regexp)39 b FA(str)p Fx(\))87 b Ft(\000)-14 +b(!)87 b FA(r)o(e)1416 b FB(pr)o(ocedur)o(e)573 3548 +y(Generate)20 b(a)g(compiled)h(r)o(egular)f(expr)o(ession)g(fr)o(om)h +(the)f(given)i(string.)365 3827 y Fx(\(regexp?)41 b FA(obj)p +Fx(\))87 b Ft(\000)-15 b(!)88 b FA(boolean)1397 b FB(pr)o(ocedur)o(e) +573 3961 y(Is)21 b(the)g(object)g(a)f(r)o(egular)g(expr)o(ession?)365 +4241 y Fx(\(regexp-exec)39 b FA(r)o(egexp)20 b(str)h([start])p +Fx(\))85 b Ft(\000)-14 b(!)87 b FA(match)19 b(or)i(false)544 +b FB(pr)o(ocedur)o(e)573 4375 y(Apply)26 b(the)g(r)o(egular)e(expr)o +(ession)i FA(r)o(egexp)f FB(to)h(the)g(string)h FA(str)f +FB(starting)h(at)e(position)573 4474 y FA(start)p FB(.)g(If)20 +b(the)g(match)h(succeeds)f(it)g(r)o(eturns)g(a)g(r)o(egexp-match,)e +(otherwise)j Fx(#f)p FB(.)k FA(Start)573 4574 y FB(defaults)20 +b(to)h(0.)365 4854 y Fx(\(regexp-quote)39 b FA(str)p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(string)1233 b FB(pr)o(ocedur)o(e)365 +5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1216 w FB(99)p eop %%Page: 100 106 -100 105 bop 1071 601 a Fw(\(file-name-nondi)o(rec)o(to)o(ry)37 -b("/usr/ian"\))166 b Fl(=)-14 b Fs(\))103 b Fw("ian")1071 701 -y(\(file-name-nondi)o(rec)o(to)o(ry)37 b("/usr/ian/"\))122 -b Fl(=)-14 b Fs(\))103 b Fw("")1071 800 y(\(file-name-nondi)o(rec)o(to)o(ry) -37 b("ian/.login"\))78 b Fl(=)-14 b Fs(\))103 b Fw(".login")1071 -900 y(\(file-name-nondi)o(rec)o(to)o(ry)37 b("main.c"\))254 -b Fl(=)-14 b Fs(\))103 b Fw("main.c")1071 1000 y(\(file-name-nondi)o(rec)o -(to)o(ry)37 b(""\))518 b Fl(=)-14 b Fs(\))103 b Fw("")1071 -1099 y(\(file-name-nondi)o(rec)o(to)o(ry)37 b("/"\))474 b Fl(=)-14 -b Fs(\))103 b Fw("/")681 1390 y(\(split-file-name)37 b Fz(fname)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(string)21 b(list)864 b FA(pr)o(ocedur)o(e) -888 1532 y(Split)21 b(a)f(\256le-name)h(into)g(its)g(components.)1071 -1674 y Fw(\(split-file-name)37 b("src/des/main.c")o(\))1237 -1774 y Fl(=)-14 b Fs(\))267 b Fw(\("src")41 b("des")g("main.c"\))1071 -1932 y(\(split-file-name)c("/src/des/main.c)o("\))1237 2032 -y Fl(=)-14 b Fs(\))136 b Fw(\("")42 b("src")g("des")f("main.c"\))1071 -2190 y(\(split-file-name)c("main.c"\))1237 2289 y Fl(=)-14 -b Fs(\))790 b Fw(\("main.c"\))1071 2447 y(\(split-file-name)37 -b("/"\))1237 2547 y Fl(=)-14 b Fs(\))104 b Fw(\(""\))681 2837 -y(\(path-list->file)o(-n)o(ame)37 b Fz(path-list)19 b([dir])p -Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(string)521 b FA(pr)o(ocedur)o(e)888 -2979 y(Inverse)21 b(of)g Fw(split-file-name)o FA(.)1071 3147 -y Fw(\(path-list->file)o(-na)o(me)37 b('\("src")k("des")g("main.c"\)\))1245 -3247 y Fl(=)-14 b Fs(\))87 b Fw("src/des/main.c")1071 3347 -y(\(path-list->file)o(-na)o(me)37 b('\("")42 b("src")f("des")h("main.c"\)\)) -1245 3446 y Fl(=)-14 b Fs(\))87 b Fw("/src/des/main.c")1071 -3646 y FA(Optional)21 b Fz(dir)g FA(ar)o(g)f(anchors)h(r)o(elative)e -(path-lists:)1071 3745 y Fw(\(path-list->file)o(-na)o(me)37 -b('\("src")k("des")g("main.c"\))2030 3845 y("/usr/shivers"\))1245 -3944 y Fl(=)-14 b Fs(\))87 b Fw("/usr/shivers/src)o(/d)o(es/)o(ma)o(in)o(.c") -888 4112 y FA(The)21 b(optional)h Fz(dir)e FA(ar)o(gument)g(is)i(usefully)f -Fw(\(cwd\))p FA(.)681 4406 y Fw(\(file-name-exten)o(si)o(on)37 -b Fz(fname)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(string)816 -b FA(pr)o(ocedur)o(e)888 4548 y(Return)22 b(the)e(\256le-name's)h(extension.) -1071 4669 y Fw(\(file-name-exten)o(sio)o(n)37 b("main.c"\))341 -b Fl(=)-14 b Fs(\))104 b Fw(".c")1071 4769 y(\(file-name-exten)o(sio)o(n)37 -b("main.c.old"\))165 b Fl(=)-14 b Fs(\))104 b Fw(".old")1071 -4868 y(\(file-name-exten)o(sio)o(n)37 b("/usr/shivers"\))77 -b Fl(=)-14 b Fs(\))104 b Fw("")681 5147 y FA(100)p 1952 5071 -323 4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p 2271 5173 V 1952 -5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +100 105 bop 888 614 a FB(Returns)24 b(a)f(r)o(egular)e(expr)o(ession)i +(that)g(matches)g(the)g(string)h FA(str)f FB(exactly)-9 +b(.)31 b(In)24 b(other)888 714 y(wor)o(ds,)18 b(it)g(quotes)h(the)f(r)o +(egular)f(expr)o(ession,)h(pr)o(epending)f(backslashes)h(to)g(all)g +(the)888 814 y(special)j(r)o(egexp)e(characters)h(in)h +FA(str)p FB(.)1071 993 y Fx(\(regexp-quote)38 b("*Hello*)i(world."\)) +1245 1093 y Fm(=)-14 b Ft(\))44 b Fx("\\\\*Hello\\\\*)38 +b(world\\\\.")681 1489 y Fz(5.1.2)81 b(Other)20 b(string)g +(manipulation)d(facilities)681 1707 y Fx(\(index)41 b +FA(string)21 b(char)f([start])p Fx(\))86 b Ft(\000)-15 +b(!)88 b FA(\002xnum)20 b(or)g(false)732 b FB(pr)o(ocedur)o(e)681 +1806 y Fx(\(rindex)40 b FA(string)21 b(char)f([start])p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(\002xnum)20 b(or)h(false)688 +b FB(pr)o(ocedur)o(e)888 1934 y(These)17 b(pr)o(ocedur)o(es)e(sear)o +(ch)h(thr)o(ough)h FA(string)g FB(looking)i(for)d(an)h(occurr)o(ence)f +(of)g(char)o(-)888 2034 y(acter)k FA(char)p FB(.)25 b +Fx(index)19 b FB(sear)o(ches)g(left-to-right;)i Fx(rindex)d +FB(sear)o(ches)i(right-to-left.)888 2173 y Fx(index)j +FB(r)o(eturns)g(the)i(smallest)f(index)g Fy(i)g FB(of)h +FA(string)f FB(gr)o(eater)e(than)j(or)f(equal)h(to)f +FA(start)888 2273 y FB(such)g(that)e FA(string)p Fm([)p +Fy(i)p Fm(])27 b(=)g FA(char)o FB(.)32 b(The)23 b(default)e(for)i +FA(start)g FB(is)g(zer)o(o.)30 b(If)23 b(ther)o(e)f(is)h(no)h(such)888 +2373 y(match,)d Fx(index)e FB(r)o(eturns)h(false.)888 +2512 y Fx(rindex)39 b FB(r)o(eturns)h(the)h(lar)o(gest)f(index)g +Fy(i)h FB(of)f FA(string)h FB(less)g(than)g FA(start)g +FB(such)g(that)888 2612 y FA(string)p Fm([)p Fy(i)p Fm(])28 +b(=)g FA(char)o FB(.)34 b(The)23 b(default)g(for)g FA(start)g +FB(is)h Fx(\(string-length)38 b FA(string)p Fx(\))p FB(.)33 +b(If)23 b(ther)o(e)888 2711 y(is)e(no)h(such)f(match,)g +Fx(rindex)d FB(r)o(eturns)i(false.)805 2901 y(I)f(should)g(pr)o(obably) +f(snarf)g(all)g(the)h(MIT)f(Scheme)g(string)h(functions,)h(and)e(stick) +h(them)681 3000 y(in)i(a)f(package.)25 b(Unix)20 b(pr)o(ograms)h(need)f +(to)h(mung)h(character)d(strings)j(a)e(lot.)805 3135 +y(MIT)g(string)i(match)f(commands:)888 3235 y Fx([sub]string-match)o +(-f)o(orw)o(ar)o(d,b)o(ac)o(kwa)o(rd)o([-)o(ci])888 3334 +y([sub]string-prefi)o(x,)o(suf)o(fi)o(x[-)o(ci)o(]?)888 +3434 y([sub]string-find-)o(ne)o(xt,)o(pr)o(evi)o(ou)o(s-c)o(ha)o(r[)o +(-ci)o(])888 3533 y([sub]string-find-)o(ne)o(xt,)o(pr)o(evi)o(ou)o(s-c) +o(ha)o(r-)o(in-)o(se)o(t)888 3633 y([sub]string-repla)o(ce)o([!])888 +3733 y(...)p Fr(etc.)681 3832 y FB(These)f(ar)o(e)g(not)h(curr)o(ently) +g(pr)o(ovided.)681 3988 y Fx(\(substitute-env-)o(va)o(rs)37 +b FA(fname)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(string)816 +b FB(pr)o(ocedur)o(e)888 4136 y(Replace)24 b(occurr)o(ences)f(of)i +(envir)o(onment)g(variables)e(with)i(their)f(values.)36 +b(An)24 b(en-)888 4236 y(vir)o(onment)19 b(variable)d(is)j(denoted)e +(by)h(a)g(dollar)f(sign)i(followed)f(by)g(alphanumeric)888 +4336 y(chars)j(and)f(underscor)o(es,)g(or)h(is)g(surr)o(ounded)f(by)h +(braces.)1071 4512 y Fx(\(substitute-env-)o(var)o(s)37 +b("$USER/.login"\))1237 4611 y Fm(=)-14 b Ft(\))104 b +Fx("shivers/.login)o(")1071 4711 y(\(substitute-env-)o(var)o(s)37 +b("$)p Ft(f)p Fx(USER)p Ft(g)p Fx(_log"\))77 b Fm(=)-14 +b Ft(\))104 b Fx("shivers_log")681 5147 y FB(100)p 1952 +5071 323 4 v 1952 5173 4 102 v 1173 w FD(DRAFT)p 2271 +5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21) +13 b(:)f(47)p eop %%Page: 101 107 -101 106 bop 756 601 a FA(W)-8 b(eir)o(d)20 b(cases:)756 701 -y Fw(\(file-name-exte)o(ns)o(ion)37 b("foo."\))124 b Fl(=)-14 -b Fs(\))103 b Fw(".")756 800 y(\(file-name-exte)o(ns)o(ion)37 -b("foo.."\))80 b Fl(=)-14 b Fs(\))103 b Fw(".")756 949 y FA(Dot)21 -b(\256les)g(ar)o(e)e(not)j(extensions:)756 1048 y Fw(\(file-name-exte)o(ns)o -(ion)37 b("/usr/shivers/.l)o(og)o(in")o(\))77 b Fl(=)-14 b -Fs(\))103 b Fw("")365 1349 y(\(file-name-sans-e)o(xt)o(ens)o(io)o(n)38 -b Fz(fname)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(string)599 -b FA(pr)o(ocedur)o(e)573 1491 y(Return)21 b(everything)g(but)g(the)g -(extension.)756 1632 y Fw(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 -b("main.c"\))253 b Fl(=)-14 b Fs(\))104 b Fw("main")756 1732 -y(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 b("main.c.old"\))77 -b Fl(=)-14 b Fs(\))104 b Fw("main.c"")756 1832 y(\(file-name-sans)o(-e)o(xte) -o(ns)o(ion)37 b("/usr/shivers"\))922 1931 y Fl(=)-14 b Fs(\))103 -b Fw("/usr/shivers")756 2079 y FA(W)-8 b(eir)o(d)20 b(cases:)756 -2179 y Fw(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 b("foo."\))123 -b Fl(=)-14 b Fs(\))104 b Fw("foo")756 2279 y(\(file-name-sans)o(-e)o(xte)o -(ns)o(ion)37 b("foo.."\))79 b Fl(=)-14 b Fs(\))104 b Fw("foo.")756 -2456 y FA(Dot)21 b(\256les)g(ar)o(e)e(not)j(extensions:)756 -2556 y Fw(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 b("/usr/shivers/.l)o(og)o -(in)o("\))922 2655 y Fl(=)-14 b Fs(\))103 b Fw("/usr/shivers/.l)o(ogi)o(n)573 -2867 y FA(Note)39 b(that)h(appending)f(the)h(r)o(esults)f(of)g -Fw(file-name-extens)o(ion)33 b FA(and)39 b Fw(file-)573 2967 -y(name-sans-extens)o(io)o(n)15 b FA(in)21 b(all)g(cases)f(pr)o(oduces)g(the)h -(original)g(\256le-name.)365 3259 y Fw(\(parse-file-name)37 -b Fz(fname)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz([dir)20 b(name)h(extension]) -502 b FA(pr)o(ocedur)o(e)573 3401 y(Let)30 b Fx(f)40 b FA(be)31 -b Fw(\(file-name-nondi)o(re)o(ct)o(ory)37 b Fz(fname)p Fw(\))p -FA(.)58 b(This)31 b(function)h(r)o(eturns)e(the)573 3501 y(thr)o(ee)20 -b(values:)672 3668 y Fs(\017)42 b Fw(\(file-name-dire)o(ct)o(ory)37 -b Fz(fname)p Fw(\))672 3801 y Fs(\017)42 b Fw(\(file-name-sans)o(-e)o(xte)o -(ns)o(ion)37 b Fz(f)p Fw(\)\))672 3935 y Fs(\017)42 b Fw(\(file-name-exte)o -(ns)o(ion)37 b Fz(f)p Fw(\))573 4102 y FA(The)d(inverse)g(of)g -Fw(parse-file-name)p FA(,)d(in)j(all)g(cases,)i(is)f Fw(string-append)p -FA(.)62 b(The)573 4202 y(boundary)20 b(case)h(of)f Fw(/)h FA(was)f(chosen)i -(to)f(pr)o(eserve)e(this)j(inverse.)365 4494 y Fw(\(replace-extensio)o(n)37 -b Fz(fname)21 b(ext)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(string)782 -b FA(pr)o(ocedur)o(e)573 4636 y(This)15 b(pr)o(ocedur)o(e)e(r)o(eplaces)h -Fz(fname)p FA('s)h(extension)h(with)g Fz(ext)o FA(.)26 b(It)15 -b(is)g(exactly)f(equivalent)573 4735 y(to)756 4875 y Fw(\(string-append)37 -b(\(file-name-sans-e)o(xt)o(ens)o(io)o(n)h Fz(fname)p Fw(\))43 -b Fz(ext)o Fw(\))365 5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1174 w FA(101)p eop +101 106 bop 365 614 a Fz(5.1.3)81 b(Manipulating)18 b(\002le-names)365 +797 y FB(These)27 b(pr)o(ocedur)o(es)d(do)j(not)g(access)f(the)g +(\002le-system)h(at)f(all;)j(they)e(mer)o(ely)e(operate)h(on)365 +897 y(\002le-name)f(strings.)38 b(Much)24 b(of)h(this)h(str)o(uctur)o +(e)e(is)h(patterned)e(after)h(the)h(gnu)g(emacs)f(de-)365 +997 y(sign.)59 b(Per)o(haps)31 b(a)g(mor)o(e)h(sophisticated)g(system)g +(would)g(be)g(better)-6 b(,)33 b(something)g(like)365 +1096 y(the)23 b(pathname)f(abstractions)g(of)j(C)t Fs(O)t(M)t(M)t(O)t +(N)i FB(L)t Fs(I)t(S)t(P)e FB(or)d(MIT)g(Scheme.)30 b(However)-6 +b(,)22 b(being)365 1196 y(Unix-speci\002c,)e(we)h(can)g(be)f(a)g +(little)h(less)g(general.)365 1446 y Fz(T)-9 b(erminology)365 +1629 y FB(These)30 b(pr)o(ocedur)o(es)e(car)o(efully)h(adher)o(e)f(to)i +(the)i(P)t Fs(O)t(S)t(I)t(X)i FB(standar)o(d)28 b(for)i(\002le-name)f +(r)o(eso-)365 1729 y(lution,)g(which)f(occasionally)f(entails)g(some)g +(slightly)h(odd)f(things.)44 b(This)27 b(section)h(will)365 +1828 y(describe)20 b(these)h(r)o(ules,)g(and)f(give)h(some)g(basic)g +(terminology)-9 b(.)490 1953 y(A)17 b FA(\002le-name)g +FB(is)h(either)f(the)g(\002le-system)h(r)o(oot)g(\(\223/\224\),)e(or)i +(a)e(series)i(of)f(slash-terminated)365 2053 y(dir)o(ectory)27 +b(components,)k(followed)d(by)g(a)g(a)f(\002le)h(component.)48 +b(Root)30 b(is)e(the)g(only)h(\002le-)365 2152 y(name)21 +b(that)g(may)f(end)h(in)g(slash.)26 b(Some)21 b(examples:)738 +2342 y(File)g(name)395 b(Dir)21 b(components)207 b(File)21 +b(component)p 688 2375 2220 4 v 738 2445 a Fx(src/des/main.c)137 +b(\("src")41 b("des"\))228 b("main.c")738 2544 y(/src/des/main.c)93 +b(\("")42 b("src")g("des"\))97 b("main.c")738 2644 y(main.c)489 +b(\(\))709 b("main.c")490 2831 y FB(Note)24 b(that)g(the)g(r)o(elative) +f(\002lename)h Fx(src/des/main.c)18 b FB(and)23 b(the)i(absolute)e +(\002lename)365 2931 y Fx(/src/des/main.c)17 b FB(ar)o(e)k +(distinguished)j(by)f(the)g(pr)o(esence)e(of)i(the)g(r)o(oot)f +(component)i Fx("")365 3030 y FB(in)e(the)e(absolute)h(path.)490 +3155 y(Multiple)h(embedded)f(slashes)h(within)i(a)d(path)h(have)g(the)g +(same)g(meaning)h(as)f(a)f(sin-)365 3254 y(gle)27 b(slash.)42 +b(Mor)o(e)26 b(than)g(two)h(leading)f(slashes)h(at)f(the)h(beginning)g +(of)g(a)e(path)i(have)e(the)365 3354 y(same)d(meaning)h(as)f(a)g +(single)h(leading)f(slash\227they)h(indicate)f(that)h(the)f +(\002le-name)g(is)h(an)365 3454 y(absolute)d(one,)g(with)g(the)g(path)f +(leading)g(fr)o(om)g(r)o(oot.)25 b(However)-6 b(,)21 +b(P)t Fs(O)t(S)t(I)t(X)i FB(permits)d(the)g(OS)365 3553 +y(to)j(give)f(special)g(meaning)h(to)g FA(two)f FB(leading)g(slashes.) +31 b(For)23 b(this)g(r)o(eason,)f(the)g(r)o(outines)h(in)365 +3653 y(this)f(section)f(do)g(not)h(simplify)f(two)g(leading)g(slashes)g +(to)g(a)f(single)i(slash.)490 3778 y(A)e(\002le-name)g(in)h +FA(dir)o(ectory)e(form)h FB(is)h(either)f(a)g(\002le-name)g(terminated) +g(by)g(a)g(slash,)g FA(e.g.)p FB(,)365 3877 y(\223)p +Fx(/src/des/)p FB(\224,)14 b(or)19 b(the)f(empty)h(string,)g(\223\224.) +24 b(The)18 b(empty)g(string)h(corr)o(esponds)f(to)h(the)g(cur)o(-)365 +3977 y(r)o(ent)g(working)h(dir)o(ectory)-9 b(,)18 b(whose)i +(\002le-name)f(is)h(dot)f(\(\223)p Fx(.)p FB(\224\).)k(W)-8 +b(orking)20 b(backwar)o(ds)e(fr)o(om)365 4076 y(the)g(append-a-slash)e +(r)o(ule,)i(we)g(extend)f(the)h(syntax)g(of)i(P)t Fs(O)t(S)t(I)t(X)h +FB(\002le-names)d(to)g(de\002ne)f(the)365 4176 y(empty)22 +b(string)f(to)h(be)f(a)f(\002le-name)h(form)g(of)g(the)h(r)o(oot)f(dir) +o(ectory)f(\223)p Fx(/)p FB(\224.)25 b(\(However)-6 b(,)20 +b(\223)p Fx(/)p FB(\224)g(is)365 4276 y(also)26 b(acceptable)d(as)j(a)e +(\002le-name)h(form)h(for)f(r)o(oot.\))39 b(So)25 b(the)h(empty)f +(string)h(has)f(two)h(in-)365 4375 y(terpr)o(etations:)f(as)19 +b(a)h(\002le-name)f(form,)h(it)h(is)f(the)g(\002le-system)g(r)o(oot;)g +(as)g(a)g(dir)o(ectory)f(form,)365 4475 y(it)24 b(is)g(the)f(curr)o +(ent)g(working)h(dir)o(ectory)-9 b(.)33 b(Slash)23 b(is)h(also)f(an)g +(ambiguous)h(form:)31 b Fx(/)23 b FB(is)h(both)365 4575 +y(a)d(dir)o(ectory-form)e(and)i(a)f(\002le-name)g(form.)490 +4699 y(The)51 b(dir)o(ectory)g(form)g(of)h(a)f(\002le-name)g(is)g(very) +g(rar)o(ely)f(used.)118 b(Almost)52 b(all)365 4799 y(of)61 +b(the)f(pr)o(ocedur)o(es)f(in)h(scsh)h(name)f(dir)o(ectories)g(by)g +(giving)h(their)g(\002le-name)365 4898 y(form)45 b(\(without)g(the)f +(trailing)g(slash\),)50 b(not)45 b(their)f(dir)o(ectory)g(form.)95 +b(So,)50 b(you)45 b(say)365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v +540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1174 w +FB(101)p eop %%Page: 102 108 -102 107 bop 681 751 a Fw(\(simplify-file-n)o(am)o(e)38 b Fz(fname)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(string)860 b FA(pr)o(ocedur)o(e)888 -880 y(Removes)30 b(leading)e(and)g(internal)g(occurr)o(ences)g(of)g(dot.)51 -b(A)28 b(trailing)h(dot)g(is)f(left)888 979 y(alone,)h(as)e(the)h(par)o(ent)e -(could)i(be)f(a)g(symlink.)49 b(Removes)28 b(internal)g(and)f(trailing)888 -1079 y(double-slashes.)39 b(A)25 b(leading)f(double-slash)h(is)g(left)f -(alone,)h(in)h(accor)o(dance)c(with)890 1179 y(P)t Fr(O)t(S)t(I)t(X)r -FA(.)32 b(However)-6 b(,)22 b(triple)f(and)h(mor)o(e)f(leading)h(slashes)g -(ar)o(e)e(r)o(educed)g(to)i(a)f(single)888 1278 y(slash,)27 -b(in)e(accor)o(dance)e(with)28 b(P)t Fr(O)t(S)t(I)t(X)r FA(.)42 -b(Double-dots)25 b(\(par)o(ent)f(dir)o(ectory\))g(ar)o(e)f(left)888 -1378 y(alone,)29 b(in)e(case)g(they)g(come)g(after)f(symlinks)j(or)e(appear)e -(in)j(a)e Fw(/../)p Fz(machine)n Fw(/)p Fx(:)14 b(:)g(:)888 -1477 y FA(\252super)o(-r)o(oot\272)19 b(form)i(\(which)i(P)t -Fr(O)t(S)t(I)t(X)h FA(permits\).)681 1649 y Fw(\(resolve-file-na)o(me)37 -b Fz(fname)21 b([dir])p Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(string)730 -b FA(pr)o(ocedur)o(e)988 1778 y Fs(\017)41 b FA(Do)21 b Fw(~)g -FA(expansion.)988 1898 y Fs(\017)41 b FA(If)23 b Fz(dir)h FA(is)g(given,)g -(convert)g(a)f(r)o(elative)g(\256le-name)g(to)h(an)g(absolute)g(\256le-name,) -1071 1998 y(r)o(elative)19 b(to)j(dir)o(ectory)d Fz(dir)p FA(.)681 -2170 y Fw(\(expand-file-nam)o(e)37 b Fz(fname)21 b([dir])p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(string)774 b FA(pr)o(ocedur)o(e)888 -2298 y(Resolve)22 b(and)e(simplify)h(the)g(\256le-name.)681 -2570 y Fw(\(home-dir)40 b Fz([user])p Fw(\))87 b Fs(\000)-15 -b(!)88 b Fz(string)1300 b FA(pr)o(ocedur)o(e)888 2698 y Fw(home-dir)17 -b FA(r)o(eturns)i Fz(user)q FA('s)h(home)h(dir)o(ectory)-9 -b(.)26 b Fz(User)20 b FA(defaults)f(to)i(the)f(curr)o(ent)f(user)-6 -b(.)1071 2849 y Fw(\(home-dir\))471 b Fl(=)-14 b Fs(\))104 -b Fw("/user1/lecture)o(r/s)o(hi)o(ver)o(s")1071 2949 y(\(home-dir)40 -b("ctkwan"\))79 b Fl(=)-14 b Fs(\))104 b Fw("/user0/researc)o(h/c)o(tk)o(wan) -o(")681 3237 y(\(home-file)39 b Fz([user])21 b(fname)p Fw(\))87 -b Fs(\000)-14 b(!)87 b Fz(string)1033 b FA(pr)o(ocedur)o(e)888 -3366 y(Returns)21 b(\256le-name)e Fz(fname)h FA(r)o(elative)f(to)h -Fz(user)q FA('s)g(home)h(dir)o(ectory;)e Fz(user)i FA(defaults)e(to)888 -3465 y(the)i(curr)o(ent)f(user)-6 b(.)1071 3584 y Fw(\(home-file)39 -b("man"\))473 b Fl(=)-14 b Fs(\))104 b Fw("/usr/shivers/ma)o(n")1071 -3684 y(\(home-file)39 b("fcmlau")i("man"\))80 b Fl(=)-14 b -Fs(\))104 b Fw("/usr/fcmlau/man)o(")805 3950 y FA(The)26 b(general)e -Fw(substitute-env-va)o(rs)19 b FA(string)26 b(pr)o(ocedur)o(e,)e(de\256ned)h -(in)h(the)f(pr)o(evi-)681 4049 y(ous)c(section,)g(is)g(also)g(fr)o(equently)g -(useful)g(for)f(expanding)h(\256le-names.)681 4321 y Fu(5.2)99 -b(ASCII)24 b(encoding)681 4547 y Fw(\(char->ascii)38 b Fz(character)p -Fw(\))87 b Fs(\000)-15 b(!)87 b Fz(integer)1029 b FA(pr)o(ocedur)o(e)681 -4647 y Fw(\(ascii->char)38 b Fz(integer)p Fw(\))87 b Fs(\000)-14 -b(!)87 b Fz(character)1028 b FA(pr)o(ocedur)o(e)888 4765 y(These)14 -b(ar)o(e)f(identical)h(to)g Fw(char->integer)8 b FA(and)14 -b Fw(integer->char)9 b FA(except)k(that)h(they)888 4865 y(use)21 -b(the)i(A)t Fr(S)t(C)t(I)t(I)h FA(encoding.)681 5147 y(102)p -1952 5071 323 4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p 2271 -5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +102 107 bop 681 614 a FB(\223)p Fx(/usr/include)p FB(\224,)22 +b(and)k(\223)p Fx(.)p FB(\224,)h(not)h(\223)p Fx(/usr/include/)p +FB(\224)20 b(and)27 b(\223\224.)43 b(The)27 b(sole)g(exceptions)681 +714 y(ar)o(e)g Fx(file-name-as-dire)o(cto)o(ry)22 b FB(and)29 +b Fx(directory-as-fil)o(e-)o(nam)o(e)p FB(,)c(whose)30 +b(jobs)f(ar)o(e)681 814 y(to)34 b(convert)h(back-and-forth)d(between)i +(these)h(forms,)i(and)d Fx(file-name-directo)o(ry)o FB(,)681 +913 y(whose)22 b(job)h(it)e(is)h(to)g(split)g(out)g(the)g(dir)o(ectory) +f(portion)h(of)g(a)f(\002le-name.)28 b(However)-6 b(,)21 +b(most)681 1013 y(pr)o(ocedur)o(es)k(that)i(expect)g(a)g(dir)o(ectory)f +(ar)o(gument)h(will)h(coer)o(ce)e(a)h(\002le-name)g(in)h(dir)o(ec-)681 +1112 y(tory)f(form)g(to)g(\002le-name)f(form)h(if)f(it)h(does)g(not)h +(have)e(a)g(trailing)h(slash.)44 b(Bear)25 b(in)j(mind)681 +1212 y(that)e(the)h(ambiguous)g(case,)g(empty)g(string,)h(will)f(be)f +(interpr)o(eted)f(in)i(\002le-name)f(form,)681 1312 y +FA(i.e.)p FB(,)20 b(as)h(r)o(oot.)681 1624 y Fz(Procedures)681 +1855 y Fx(\(file-name-direc)o(to)o(ry?)37 b FA(fname)p +Fx(\))86 b Ft(\000)-14 b(!)87 b FA(boolean)726 b FB(pr)o(ocedur)o(e)681 +1955 y Fx(\(file-name-non-d)o(ir)o(ect)o(or)o(y?)37 b +FA(fname)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(boolean)551 +b FB(pr)o(ocedur)o(e)888 2087 y(These)18 b(pr)o(edicates)f(r)o(eturn)g +(tr)o(ue)i(if)f(the)g(string)h(is)f(in)h(dir)o(ectory)e(form,)i(or)f +(\002le-name)888 2187 y(form)24 b(\(see)f(the)h(above)f(discussion)i +(of)f(these)f(two)i(forms\).)34 b(Note)24 b(that)f(they)h(both)888 +2286 y(r)o(eturn)19 b(tr)o(ue)h(on)g(the)g(ambiguous)h(case)e(of)g +(empty)h(string,)g(which)h(is)f(both)g(a)g(dir)o(ec-)888 +2386 y(tory)h(\(curr)o(ent)f(working)i(dir)o(ectory\),)d(and)i(a)f +(\002le)h(name)f(\(the)h(\002le-system)g(r)o(oot\).)1202 +2536 y(File)g(name)177 b Fx(...-directory?)94 b(...-non-director)o(y?)p +1152 2570 2130 4 v 1202 2639 a("src/des")139 b(#f)622 +b(#t)1202 2739 y("src/des/")95 b(#t)622 b(#f)1202 2839 +y("/")403 b(#t)622 b(#f)1202 2938 y(".")403 b(#f)622 +b(#t)1202 3038 y("")447 b(#t)622 b(#t)681 3276 y(\(file-name-as-di)o +(re)o(cto)o(ry)37 b FA(fname)p Fx(\))87 b Ft(\000)-15 +b(!)88 b FA(string)685 b FB(pr)o(ocedur)o(e)888 3433 +y(Convert)29 b(a)g(\002le-name)f(to)h(dir)o(ectory)f(form.)50 +b(Basically)-9 b(,)30 b(add)e(a)g(trailing)h(slash)g(if)888 +3532 y(needed:)1071 3688 y Fx(\(file-name-as-di)o(rec)o(to)o(ry)37 +b("src/des"\))123 b Fm(=)-14 b Ft(\))103 b Fx("src/des/")1071 +3788 y(\(file-name-as-di)o(rec)o(to)o(ry)37 b("src/des/"\))79 +b Fm(=)-14 b Ft(\))103 b Fx("src/des/")1071 3965 y(.)p +FB(,)20 b Fx(/)p FB(,)g(and)g Fx("")g FB(ar)o(e)g(special:)1071 +4065 y Fx(\(file-name-as-di)o(rec)o(to)o(ry)37 b("."\))387 +b Fm(=)-14 b Ft(\))103 b Fx("")1071 4165 y(\(file-name-as-di)o(rec)o +(to)o(ry)37 b("/"\))387 b Fm(=)-14 b Ft(\))103 b Fx("/")1071 +4264 y(\(file-name-as-di)o(rec)o(to)o(ry)37 b(""\))431 +b Fm(=)-14 b Ft(\))103 b Fx("/")681 4642 y(\(directory-as-fi)o(le)o +(-na)o(me)37 b FA(fname)p Fx(\))87 b Ft(\000)-15 b(!)88 +b FA(string)685 b FB(pr)o(ocedur)o(e)888 4799 y(Convert)21 +b(a)g(dir)o(ectory)f(to)h(a)f(simple)i(\002le-name.)j(Basically)-9 +b(,)20 b(kill)h(a)g(trailing)g(slash)g(if)888 4898 y(one)h(is)f(pr)o +(esent:)681 5147 y(102)p 1952 5071 323 4 v 1952 5173 +4 102 v 1173 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 +v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 103 109 -103 108 bop 365 614 a Fu(5.3)99 b(Character)25 b(sets)365 828 -y FA(Scsh)c(pr)o(ovides)f(a)h Fw(char-set)c FA(type)k(for)g(expr)o(essing)f -(sets)i(of)e(characters.)27 b(These)21 b(sets)g(ar)o(e)365 -928 y(used)d(by)g(some)h(of)f(the)h(delimited-input)f(pr)o(ocedur)o(es)e -(\(section)j(7.1\).)25 b(The)18 b(character)f(set)365 1028 -y(package)j(that)h(scsh)g(uses)g(was)g(taken)f(fr)o(om)h(Pr)o(oject)f(Mac's)g -(MIT)g(Scheme.)365 1175 y Fw(\(char-set?)40 b Fz(x)p Fw(\))86 -b Fs(\000)-14 b(!)87 b Fz(boolean)1367 b FA(pr)o(ocedur)o(e)573 -1315 y(Returns)21 b(tr)o(ue)g(if)g(the)g(object)g Fz(x)f FA(is)h(a)f -(character)g(set.)365 1580 y Fy(5.3.1)81 b(Creating)20 b(character)f(sets)365 -1786 y Fw(\(char-set)40 b Fz(char)946 1798 y Ft(1)983 1786 -y Fx(:)14 b(:)g(:)g Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(char-set)1145 -b FA(pr)o(ocedur)o(e)573 1910 y(Return)21 b(a)f(character)g(set)g(containing) -i(the)f(given)g(characters.)365 2098 y Fw(\(chars->char-set)37 -b Fz(chars)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(char-set)955 -b FA(pr)o(ocedur)o(e)573 2238 y(Return)21 b(a)f(character)g(set)g(containing) -i(the)f(characters)f(in)h(the)g(list)g Fz(chars)p FA(.)365 -2426 y Fw(\(string->char-set)37 b Fz(s)p Fw(\))87 b Fs(\000)-14 -b(!)87 b Fz(char-set)1056 b FA(pr)o(ocedur)o(e)573 2565 y(Return)21 -b(a)f(character)g(set)g(containing)i(the)f(characters)f(in)h(the)g(string)g -Fz(s)q FA(.)365 2753 y Fw(\(predicate->char-)o(se)o(t)38 b -Fz(pr)o(ed)p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(char-set)812 -b FA(pr)o(ocedur)o(e)573 2892 y(Returns)18 b(a)g(character)e(set)i -(containing)h(every)e(character)g Fz(c)g FA(such)i(that)e Fw(\()p -Fz(pr)o(ed)43 b(c)o Fw(\))18 b FA(r)o(e-)573 2992 y(turns)j(tr)o(ue.)365 -3180 y Fw(\(ascii-range->cha)o(r-)o(set)37 b Fz(lower)21 b(upper)p -Fw(\))87 b Fs(\000)-15 b(!)87 b Fz(char-set)472 b FA(pr)o(ocedur)o(e)573 -3319 y(Returns)21 b(a)g(character)e(set)i(containing)h(every)e(character)f -(whose)24 b(A)t Fr(S)t(C)t(I)t(I)g FA(code)c(lies)573 3419 -y(in)h(the)g(half-open)f(range)h Fl([)p Fz(lower)p Fx(;)14 -b Fz(upper)p Fl(\))p FA(.)365 3685 y Fy(5.3.2)81 b(Querying)20 -b(character)f(sets)365 3891 y Fw(\(char-set-members)37 b Fz(char-set)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(character-list)647 b FA(pr)o(ocedur)o(e) -573 4015 y(This)21 b(pr)o(ocedur)o(e)e(r)o(eturns)h(a)g(list)i(of)f(the)f -(members)h(of)g Fz(char-set)o FA(.)365 4155 y Fw(\(char-set-contain)o(s?)37 -b Fz(char-set)20 b(char)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(boolean)587 -b FA(pr)o(ocedur)o(e)573 4286 y(This)21 b(pr)o(ocedur)o(e)e(tests)i -Fz(char)f FA(for)h(membership)g(in)g(set)g Fz(char-set)o FA(.)756 -4442 y FD(Remark:)228 b Fj(Pr)o(evious)61 b(r)o(eleases)g(of)h(scsh)g(called) -g(this)g(pr)o(ocedur)o(e)756 4533 y Fi(char-set-member?)p Fj(,)53 -b(r)o(eversing)41 b(the)j(or)o(der)e(of)h(the)h(ar)o(guments.)99 -b(This)756 4624 y(made)30 b(sense,)k(but)e(was)f(unfortunately)h(the)f(r)o -(everse)f(or)o(der)f(in)i(which)h(the)756 4716 y(ar)o(guments)i(appear)g(in)h -(MIT)f(Scheme.)74 b(A)34 b(r)o(easonable)h(ar)o(gument)f(or)o(der)756 -4807 y(was)20 b(not)h(backwar)o(ds-compatible)f(with)i(MIT)e(Scheme;)h(on)g -(the)g(other)f(hand,)756 4898 y(the)28 b(MIT)g(Scheme)g(ar)o(gument)g(or)o -(der)e(was)i(counter)o(-intuitive)g(and)g(at)h(odds)365 5147 -y FD(November)18 b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 -5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V -1636 5176 323 4 v 1174 w FA(103)p eop +103 108 bop 756 601 a Fx(\(directory-as-f)o(il)o(e-n)o(am)o(e)38 +b("foo/bar/"\))78 b Fm(=)-14 b Ft(\))104 b Fx("foo/bar")756 +779 y(/)20 b FB(and)g Fx("")g FB(ar)o(e)f(special:)756 +878 y Fx(\(directory-as-f)o(il)o(e-n)o(am)o(e)38 b("/"\))386 +b Fm(=)-14 b Ft(\))104 b Fx("/")756 978 y(\(directory-as-f)o(il)o(e-n)o +(am)o(e)38 b(""\))430 b Fm(=)-14 b Ft(\))104 b Fx(".")19 +b FB(\()p FA(i.e.)p FB(,)h(the)h(cwd\))365 1269 y Fx +(\(file-name-absolu)o(te)o(?)38 b FA(fname)p Fx(\))86 +b Ft(\000)-14 b(!)87 b FA(boolean)770 b FB(pr)o(ocedur)o(e)573 +1412 y(Does)20 b FA(fname)f FB(begin)h(with)g(a)f(r)o(oot)h(or)f +Fx(~)h FB(component?)26 b(\(Recognising)21 b Fx(~)e FB(as)g(a)g(home-) +573 1511 y(dir)o(ectory)h(speci\002cation)h(is)g(an)g(extension)g(of)i +(P)t Fs(O)t(S)t(I)t(X)h FB(r)o(ules.\))756 1654 y Fx(\(file-name-abso)o +(lu)o(te?)37 b("/usr/shivers"\))77 b Fm(=)-14 b Ft(\))103 +b Fx(#t)756 1754 y(\(file-name-abso)o(lu)o(te?)37 b("src/des"\))297 +b Fm(=)-14 b Ft(\))103 b Fx(#f)756 1854 y(\(file-name-abso)o(lu)o(te?) +37 b("~/src/des"\))209 b Fm(=)-14 b Ft(\))103 b Fx(#t)756 +2031 y FB(Non-obvious)21 b(case:)756 2131 y Fx(\(file-name-abso)o(lu)o +(te?)37 b(""\))605 b Fm(=)-14 b Ft(\))103 b Fx(#t)20 +b FB(\()p FA(i.e.)p FB(,)g(r)o(oot\))365 2422 y Fx(\(file-name-direct)o +(or)o(y)38 b FA(fname)p Fx(\))86 b Ft(\000)-14 b(!)87 +b FA(string)21 b(or)g(false)559 b FB(pr)o(ocedur)o(e)573 +2565 y(Return)30 b(the)f(dir)o(ectory)g(component)h(of)f +FA(fname)h FB(in)g(dir)o(ectory)e(form.)51 b(If)29 b(the)h(\002le-)573 +2664 y(name)21 b(is)g(alr)o(eady)e(in)i(dir)o(ectory)f(form,)g(r)o +(eturn)g(it)h(as-is.)756 2807 y Fx(\(file-name-dire)o(ct)o(ory)37 +b("/usr/bdc"\))165 b Fm(=)-14 b Ft(\))104 b Fx("/usr/")756 +2907 y(\(file-name-dire)o(ct)o(ory)37 b("/usr/bdc/"\))121 +b Fm(=)-14 b Ft(\))104 b Fx("/usr/bdc/")756 3007 y(\(file-name-dire)o +(ct)o(ory)37 b("bdc/.login"\))77 b Fm(=)-14 b Ft(\))104 +b Fx("bdc/")756 3106 y(\(file-name-dire)o(ct)o(ory)37 +b("main.c"\))253 b Fm(=)-14 b Ft(\))104 b Fx("")756 3284 +y FB(Root)21 b(has)g(no)h(dir)o(ectory)e(component:)756 +3383 y Fx(\(file-name-dire)o(ct)o(ory)37 b("/"\))473 +b Fm(=)-14 b Ft(\))104 b Fx("")756 3483 y(\(file-name-dire)o(ct)o(ory) +37 b(""\))517 b Fm(=)-14 b Ft(\))104 b Fx("")365 3774 +y(\(file-name-nondir)o(ec)o(tor)o(y)37 b FA(fname)p Fx(\))87 +b Ft(\000)-14 b(!)87 b FA(string)686 b FB(pr)o(ocedur)o(e)573 +3917 y(Return)21 b(non-dir)o(ectory)g(component)h(of)e(fname.)756 +4060 y Fx(\(file-name-nond)o(ir)o(ect)o(or)o(y)38 b("/usr/ian"\))165 +b Fm(=)-14 b Ft(\))104 b Fx("ian")756 4159 y(\(file-name-nond)o(ir)o +(ect)o(or)o(y)38 b("/usr/ian/"\))121 b Fm(=)-14 b Ft(\))104 +b Fx("")756 4259 y(\(file-name-nond)o(ir)o(ect)o(or)o(y)38 +b("ian/.login"\))77 b Fm(=)-14 b Ft(\))104 b Fx(".login")756 +4359 y(\(file-name-nond)o(ir)o(ect)o(or)o(y)38 b("main.c"\))253 +b Fm(=)-14 b Ft(\))104 b Fx("main.c")756 4458 y(\(file-name-nond)o(ir)o +(ect)o(or)o(y)38 b(""\))517 b Fm(=)-14 b Ft(\))104 b +Fx("")756 4558 y(\(file-name-nond)o(ir)o(ect)o(or)o(y)38 +b("/"\))473 b Fm(=)-14 b Ft(\))104 b Fx("/")365 4849 +y(\(split-file-name)37 b FA(fname)p Fx(\))87 b Ft(\000)-14 +b(!)87 b FA(string)21 b(list)864 b FB(pr)o(ocedur)o(e)365 +5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1174 w FB(103)p eop %%Page: 104 110 -104 109 bop 1071 614 a Fj(with)23 b(common)g(mathematical)i(notation)f(and)f -(the)g Fi(member)h Fj(family)e(of)g(R4RS)1071 706 y(pr)o(ocedur)o(es.)1071 -814 y(W)-7 b(e)18 b(sought)h(to)g(escape)f(the)h(dilemma)f(by)h(shifting)g -(to)f(a)h(new)h(name.)681 1131 y Fy(5.3.3)81 b(Character)19 -b(set)h(algebra)681 1339 y Fw(\(char-set-invert)37 b Fz(char-set)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(char-set)867 b FA(pr)o(ocedur)o(e)681 -1439 y Fw(\(char-set-union)37 b Fz(char-set)1642 1451 y Ft(1)1700 -1439 y Fz(char-set)1965 1451 y Ft(2)2002 1439 y Fw(\))87 b -Fs(\000)-14 b(!)87 b Fz(char-set)551 b FA(pr)o(ocedur)o(e)681 -1538 y Fw(\(char-set-inters)o(ec)o(tio)o(n)37 b Fz(char-set)1948 -1550 y Ft(1)2006 1538 y Fz(char-set)2270 1550 y Ft(2)2307 1538 -y Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(char-set)246 b FA(pr)o(ocedur)o(e)681 -1638 y Fw(\(char-set-differ)o(en)o(ce)37 b Fz(char-set)1860 -1650 y Ft(1)1918 1638 y Fz(char-set)2183 1650 y Ft(2)2220 1638 -y Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(char-set)333 b FA(pr)o(ocedur)o(e)888 -1762 y(These)31 b(pr)o(ocedur)o(es)f(implement)h(set)h(complement,)i(union,)g -(intersection,)g(and)888 1862 y(dif)o(fer)o(ence)19 b(for)h(character)f -(sets.)681 2130 y Fy(5.3.4)81 b(Standard)18 b(character)h(sets)681 -2313 y FA(Several)g(character)g(sets)i(ar)o(e)f(pr)o(ede\256ned)f(for)h -(convenience:)p 749 2456 2729 4 v 749 2555 4 100 v 802 2525 -a Fw(char-set:upper-c)o(as)o(e)268 b FA(A\261Z)p 3474 2555 -V 749 2655 V 802 2625 a Fw(char-set:lower-c)o(as)o(e)g FA(a\261z)p -3474 2655 V 749 2754 V 802 2725 a Fw(char-set:numeric)398 b -FA(0\2619)p 3474 2754 V 749 2854 V 802 2824 a Fw(char-set:whitesp)o(ac)o(e) -268 b FA(space,)20 b(newline,)h(tab,)f(linefeed,)g(page,)g(r)o(eturn)p -3474 2854 V 749 2954 V 802 2924 a Fw(char-set:not-whi)o(te)o(spa)o(ce)93 -b FA(Complement)22 b(of)e Fw(char-set:whitespa)o(ce)p 3474 -2954 V 749 3053 V 802 3023 a(char-set:alphabe)o(ti)o(c)268 -b FA(A\261Z)20 b(and)h(a\261z)p 3474 3053 V 749 3153 V 802 -3123 a Fw(char-set:alphanu)o(me)o(ric)180 b FA(Alphabetic)20 -b(or)h(numeric)p 3474 3153 V 749 3253 V 802 3223 a Fw(char-set:graphic)398 -b FA(Printing)22 b(characters)d(and)i(space)p 3474 3253 V 749 -3256 2729 4 v 681 3458 a Fw(\(char-upper-case)o(?)37 b Fz(character)p -Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(boolean)796 b FA(pr)o(ocedur)o(e)681 -3558 y Fw(\(char-lower-case)o(?)37 b Fz(character)p Fw(\))86 -b Fs(\000)-14 b(!)87 b Fz(boolean)796 b FA(pr)o(ocedur)o(e)681 -3657 y Fw(\(char-numeric?)81 b Fz(character)p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(boolean)883 b FA(pr)o(ocedur)o(e)681 3757 y Fw(\(char-whitespace) -o(?)37 b Fz(character)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(boolean)796 -b FA(pr)o(ocedur)o(e)681 3856 y Fw(\(char-alphabetic)o(?)37 -b Fz(character)p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(boolean)796 -b FA(pr)o(ocedur)o(e)681 3956 y Fw(\(char-alphanumer)o(ic)o(?)38 -b Fz(character)p Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(boolean)708 -b FA(pr)o(ocedur)o(e)681 4056 y Fw(\(char-graphic?)38 b Fz(character)p -Fw(\))86 b Fs(\000)-15 b(!)88 b Fz(boolean)926 b FA(pr)o(ocedur)o(e)888 -4197 y(These)21 b(pr)o(edicates)e(ar)o(e)g(de\256ned)i(in)g(terms)g(of)g(the) -f(above)h(character)e(sets.)681 5147 y(104)p 1952 5071 323 -4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p 2271 5173 V 1952 5176 -323 4 v 435 w FD(November)f(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +104 109 bop 888 614 a FB(Split)21 b(a)f(\002le-name)h(into)g(its)g +(components.)1071 757 y Fx(\(split-file-name)37 b("src/des/main.c")o +(\))1237 857 y Fm(=)-14 b Ft(\))267 b Fx(\("src")41 b("des")g +("main.c"\))1071 1015 y(\(split-file-name)c("/src/des/main.c)o("\))1237 +1114 y Fm(=)-14 b Ft(\))136 b Fx(\("")42 b("src")g("des")f("main.c"\)) +1071 1272 y(\(split-file-name)c("main.c"\))1237 1372 +y Fm(=)-14 b Ft(\))790 b Fx(\("main.c"\))1071 1530 y(\(split-file-name) +37 b("/"\))1237 1630 y Fm(=)-14 b Ft(\))104 b Fx(\(""\))681 +1920 y(\(path-list->file)o(-n)o(ame)37 b FA(path-list)19 +b([dir])p Fx(\))86 b Ft(\000)-15 b(!)88 b FA(string)521 +b FB(pr)o(ocedur)o(e)888 2062 y(Inverse)21 b(of)g Fx(split-file-name)o +FB(.)1071 2230 y Fx(\(path-list->file)o(-na)o(me)37 b('\("src")k("des") +g("main.c"\)\))1245 2329 y Fm(=)-14 b Ft(\))87 b Fx("src/des/main.c") +1071 2429 y(\(path-list->file)o(-na)o(me)37 b('\("")42 +b("src")f("des")h("main.c"\)\))1245 2528 y Fm(=)-14 b +Ft(\))87 b Fx("/src/des/main.c")1071 2728 y FB(Optional)21 +b FA(dir)g FB(ar)o(g)f(anchors)h(r)o(elative)e(path-lists:)1071 +2827 y Fx(\(path-list->file)o(-na)o(me)37 b('\("src")k("des")g +("main.c"\))2030 2927 y("/usr/shivers"\))1245 3027 y +Fm(=)-14 b Ft(\))87 b Fx("/usr/shivers/src)o(/d)o(es/)o(ma)o(in)o(.c") +888 3194 y FB(The)21 b(optional)h FA(dir)e FB(ar)o(gument)g(is)i +(usefully)f Fx(\(cwd\))p FB(.)681 3488 y Fx(\(file-name-exten)o(si)o +(on)37 b FA(fname)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(string)816 +b FB(pr)o(ocedur)o(e)888 3630 y(Return)22 b(the)e(\002le-name's)h +(extension.)1071 3751 y Fx(\(file-name-exten)o(sio)o(n)37 +b("main.c"\))341 b Fm(=)-14 b Ft(\))104 b Fx(".c")1071 +3850 y(\(file-name-exten)o(sio)o(n)37 b("main.c.old"\))165 +b Fm(=)-14 b Ft(\))104 b Fx(".old")1071 3950 y(\(file-name-exten)o(sio) +o(n)37 b("/usr/shivers"\))77 b Fm(=)-14 b Ft(\))104 b +Fx("")1071 4099 y FB(W)-8 b(eir)o(d)20 b(cases:)1071 +4199 y Fx(\(file-name-exten)o(sio)o(n)37 b("foo."\))124 +b Fm(=)-14 b Ft(\))104 b Fx(".")1071 4298 y(\(file-name-exten)o(sio)o +(n)37 b("foo.."\))80 b Fm(=)-14 b Ft(\))104 b Fx(".")1071 +4447 y FB(Dot)21 b(\002les)h(ar)o(e)d(not)i(extensions:)1071 +4547 y Fx(\(file-name-exten)o(sio)o(n)37 b("/usr/shivers/.lo)o(gi)o +(n"\))76 b Fm(=)-14 b Ft(\))104 b Fx("")681 4850 y(\(file-name-sans-)o +(ex)o(ten)o(si)o(on)37 b FA(fname)p Fx(\))87 b Ft(\000)-14 +b(!)87 b FA(string)598 b FB(pr)o(ocedur)o(e)681 5147 +y(104)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226) +f(21)13 b(:)f(47)p eop %%Page: 105 111 -105 110 bop 365 1266 a Fv(Chapter)45 b(6)365 1711 y FB(Reading)53 -b(delimited)e(strings)365 2195 y FA(Scsh)21 b(pr)o(ovides)g(a)f(set)h(of)g -(pr)o(ocedur)o(es)e(that)i(r)o(ead)f(delimited)g(strings)i(fr)o(om)f(input)h -(ports.)365 2295 y(Ther)o(e)17 b(ar)o(e)f(pr)o(ocedur)o(es)g(to)i(r)o(ead)d -(a)i(single)i(line)f(of)f(text)g(\(terminated)g(by)h(a)f(newline)h(char)o(-) -365 2395 y(acter\),)24 b(a)g(single)h(paragraph)e(\(terminated)h(by)g(a)g -(blank)h(line\),)g(and)f(general)g(delimited)365 2494 y(strings)e -(\(terminated)e(by)h(a)f(character)f(belonging)j(to)f(an)g(arbitrary)e -(character)h(set\).)490 2623 y(These)k(pr)o(ocedur)o(es)f(can)h(be)g(applied) -g(to)h(any)g(Scheme)f(input)h(port.)38 b(However)-6 b(,)25 -b(the)365 2723 y(scsh)h(virtual)f(machine)h(has)f(native-code)g(support)g -(for)g(performing)h(delimited)f(r)o(eads)365 2823 y(on)i(Unix)g(ports,)h(and) -e(these)h(input)g(operations)f(should)i(be)e(particularly)g(fast\320much)365 -2922 y(faster)33 b(than)h(doing)h(the)f(equivalent)g(character)o(-at-a-time)c -(operation)k(fr)o(om)f(Scheme)365 3022 y(code.)490 3151 y(All)19 -b(of)h(the)g(delimited)f(input)i(operations)f(described)e(below)i(take)f(a)h -Fw(handle-delim)365 3251 y FA(parameter)-6 b(,)14 b(which)i(determines)f -(what)g(the)h(pr)o(ocedur)o(e)d(does)i(with)h(the)f(terminating)g(de-)365 -3350 y(limiter)g(character)-6 b(.)23 b(Ther)o(e)14 b(ar)o(e)e(four)i -(possible)h(choices)g(for)f(a)f Fw(handle-delim)c FA(parameter:)p -573 3431 2428 4 v 573 3531 4 100 v 626 3501 a Fw(handle-delim)p -1199 3531 V 98 w FA(Meaning)p 2997 3531 V 573 3534 2428 4 v -573 3551 V 573 3650 4 100 v 626 3620 a Fw('trim)p 1199 3650 -V 406 w FA(Ignor)o(e)21 b(delimiter)f(character)-6 b(.)p 2997 -3650 V 573 3750 V 626 3720 a Fw('peek)p 1199 3750 V 406 w FA(Leave)19 -b(delimiter)i(character)e(in)j(input)f(str)o(eam.)p 2997 3750 -V 573 3850 V 626 3820 a Fw('concat)p 1199 3850 V 318 w FA(Append)f(delimiter) -h(character)e(to)i(r)o(eturned)f(value.)p 2997 3850 V 573 3949 -V 626 3919 a Fw('split)p 1199 3949 V 362 w FA(Return)h(delimiter)g(as)f -(second)h(value.)p 2997 3949 V 573 3953 2428 4 v 365 4067 a(The)i(last)f(thr) -o(ee)g(cases)g(allow)h(the)g(pr)o(ogrammer)f(to)h(distinguish)h(between)e -(strings)i(that)365 4167 y(ar)o(e)f(terminated)h(by)h(a)e(delimiter)i -(character)-6 b(,)23 b(and)h(strings)h(that)g(ar)o(e)d(terminated)i(by)h(an) -365 4267 y(end-of-\256le.)365 4419 y Fw(\(read-line)40 b Fz([port)19 -b(handle-newline])p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(string)21 -b(or)g(eof-object)306 b FA(pr)o(ocedur)o(e)573 4563 y(Reads)20 -b(and)g(r)o(eturns)g(one)h(line)g(of)f(text;)g(on)h(eof,)f(r)o(eturns)g(the)h -(eof)f(object.)27 b(A)20 b(line)h(is)573 4663 y(terminated)f(by)h(newline)g -(or)g(eof.)573 4799 y Fz(handle-newline)d FA(determines)h(what)f -Fw(read-line)d FA(does)k(with)g(the)g(newline)g(or)f(EOF)573 -4898 y(that)g(terminates)g(the)g(line;)h(it)f(takes)f(the)h(general)g(set)g -(of)f(values)h(described)f(for)g(the)365 5147 y FD(November)h(1,)h(1995)h -(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 -v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1174 w FA(105)p -eop +105 110 bop 573 614 a FB(Return)21 b(everything)g(but)g(the)g +(extension.)756 757 y Fx(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 +b("main.c"\))253 b Fm(=)-14 b Ft(\))104 b Fx("main")756 +856 y(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 b("main.c.old"\))77 +b Fm(=)-14 b Ft(\))104 b Fx("main.c"")756 956 y(\(file-name-sans)o(-e)o +(xte)o(ns)o(ion)37 b("/usr/shivers"\))922 1056 y Fm(=)-14 +b Ft(\))103 b Fx("/usr/shivers")756 1205 y FB(W)-8 b(eir)o(d)20 +b(cases:)756 1304 y Fx(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 +b("foo."\))123 b Fm(=)-14 b Ft(\))104 b Fx("foo")756 +1404 y(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 b("foo.."\))79 +b Fm(=)-14 b Ft(\))104 b Fx("foo.")756 1581 y FB(Dot)21 +b(\002les)g(ar)o(e)e(not)j(extensions:)756 1681 y Fx(\(file-name-sans)o +(-e)o(xte)o(ns)o(ion)37 b("/usr/shivers/.l)o(og)o(in)o("\))922 +1781 y Fm(=)-14 b Ft(\))103 b Fx("/usr/shivers/.l)o(ogi)o(n)573 +1994 y FB(Note)39 b(that)h(appending)f(the)h(r)o(esults)f(of)g +Fx(file-name-extens)o(ion)33 b FB(and)39 b Fx(file-)573 +2093 y(name-sans-extens)o(io)o(n)15 b FB(in)21 b(all)g(cases)f(pr)o +(oduces)g(the)h(original)g(\002le-name.)365 2386 y Fx +(\(parse-file-name)37 b FA(fname)p Fx(\))87 b Ft(\000)-14 +b(!)87 b FA([dir)20 b(name)h(extension])502 b FB(pr)o(ocedur)o(e)573 +2529 y(Let)31 b Fy(f)39 b FB(be)31 b Fx(\(file-name-nondir)o(ec)o(tor)o +(y)37 b FA(fname)p Fx(\))p FB(.)57 b(This)32 b(function)g(r)o(eturns)e +(the)573 2628 y(thr)o(ee)20 b(values:)672 2796 y Ft(\017)42 +b Fx(\(file-name-dire)o(ct)o(ory)37 b FA(fname)p Fx(\))672 +2930 y Ft(\017)42 b Fx(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 +b FA(f)p Fx(\)\))672 3063 y Ft(\017)42 b Fx(\(file-name-exte)o(ns)o +(ion)37 b FA(f)p Fx(\))573 3231 y FB(The)d(inverse)g(of)g +Fx(parse-file-name)p FB(,)d(in)k(all)f(cases,)j(is)d +Fx(string-append)p FB(.)61 b(The)573 3331 y(boundary)20 +b(case)h(of)f Fx(/)h FB(was)f(chosen)i(to)f(pr)o(eserve)e(this)j +(inverse.)365 3624 y Fx(\(replace-extensio)o(n)37 b FA(fname)21 +b(ext)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(string)782 +b FB(pr)o(ocedur)o(e)573 3766 y(This)26 b(pr)o(ocedur)o(e)e(r)o +(eplaces)g FA(fname)p FB('s)i(extension)h(with)f FA(ext)p +FB(.)40 b(It)26 b(is)g(exactly)f(equiva-)573 3866 y(lent)c(to)756 +4006 y Fx(\(string-append)37 b(\(file-name-sans-e)o(xt)o(ens)o(io)o(n)h +FA(fname)p Fx(\))43 b FA(ext)o Fx(\))365 4358 y(\(simplify-file-na)o +(me)37 b FA(fname)p Fx(\))87 b Ft(\000)-15 b(!)88 b FA(string)860 +b FB(pr)o(ocedur)o(e)573 4500 y(Removes)29 b(leading)g(and)f(internal)h +(occurr)o(ences)e(of)i(dot.)49 b(A)28 b(trailing)h(dot)g(is)g(left)573 +4599 y(alone,)g(as)e(the)h(par)o(ent)e(could)i(be)f(a)h(symlink.)47 +b(Removes)28 b(internal)g(and)f(trailing)573 4699 y(double-slashes.)37 +b(A)25 b(leading)g(double-slash)f(is)h(left)g(alone,)h(in)f(accor)o +(dance)e(with)575 4799 y(P)t Fs(O)t(S)t(I)t(X)r FB(.)30 +b(However)-6 b(,)22 b(triple)g(and)f(mor)o(e)h(leading)f(slashes)i(ar)o +(e)d(r)o(educed)g(to)i(a)g(single)573 4898 y(slash,)k(in)g(accor)o +(dance)d(with)28 b(P)t Fs(O)t(S)t(I)t(X)r FB(.)41 b(Double-dots)25 +b(\(par)o(ent)f(dir)o(ectory\))g(ar)o(e)g(left)365 5147 +y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1174 w FB(105)p eop %%Page: 106 112 -106 111 bop 888 614 a FA(general)14 b Fw(handle-delim)9 b FA(case)14 -b(above,)g(and)g(defaults)f(to)i Fw('trim)d FA(\(discar)o(d)g(the)i(new-)888 -714 y(line\).)36 b(Using)24 b(this)g(ar)o(gument)f(allows)h(one)g(to)g(tell)f -(whether)h(or)f(not)i(the)e(last)h(line)888 814 y(of)d(input)g(in)h(a)e -(\256le)h(is)g(newline)g(terminated.)681 1109 y Fw(\(read-paragraph)37 -b Fz([port)20 b(handle-delim])p Fw(\))85 b Fs(\000)-14 b(!)87 -b Fz(string)21 b(or)f(eof)387 b FA(pr)o(ocedur)o(e)888 1252 -y(This)19 b(pr)o(ocedur)o(e)e(skips)i(blank)f(lines,)h(then)g(r)o(eads)e -(text)h(fr)o(om)g(a)g(port)h(until)g(a)f(blank)888 1352 y(line)25 -b(or)f(eof)g(is)g(found.)37 b(A)24 b(\252blank)g(line\272)g(is)g(a)g -(\(possibly)g(empty\))g(line)h(composed)888 1452 y(only)e(of)e(white)h -(space.)28 b(The)22 b Fz(handle-delim)e FA(parameter)f(determines)j(how)g -(the)f(ter)o(-)888 1551 y(minating)33 b(blank)e(line)h(is)g(handled.)60 -b(It)31 b(is)h(described)e(above,)k(and)d(defaults)g(to)888 -1651 y Fw('trim)p FA(.)26 b(The)20 b Fw('peek)f FA(option)j(is)f(not)h -(available.)805 1823 y(The)17 b(following)h(pr)o(ocedur)o(es)c(r)o(ead)h(in)i -(strings)h(fr)o(om)e(ports)g(delimited)h(by)f(characters)681 -1923 y(belonging)22 b(to)g(a)f(speci\256c)g(set.)29 b(See)20 -b(section)i(5.3)e(for)h(information)h(on)g(character)d(set)j(ma-)681 -2022 y(nipulation.)681 2174 y Fw(\(read-delimited)37 b Fz(char-set)20 -b([port)g(handle-delim])p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(string)21 -b(or)g(eof)101 b FA(pr)o(ocedur)o(e)888 2316 y(Read)46 b(until)h(we)g -(encounter)f(one)h(of)f(the)h(chars)f(in)h Fz(char-set)f FA(or)g(eof.)104 -b(The)888 2416 y Fz(handle-delim)19 b FA(parameter)f(determines)i(how)h(the)g -(terminating)f(character)f(is)h(han-)888 2516 y(dled.)27 b(It)21 -b(is)g(described)f(above,)g(and)g(defaults)g(to)h Fw('peek)p -FA(.)888 2650 y(The)15 b Fz(char-set)g FA(ar)o(gument)f(may)h(be)g(a)f -(charset,)i(a)e(string,)j(a)e(character)-6 b(,)14 b(or)h(a)g(character)888 -2750 y(pr)o(edicate;)k(it)i(is)g(coer)o(ced)e(to)j(a)e(charset.)681 -2946 y Fw(\(read-delimited!)37 b Fz(char-set)13 b(buf)h([port)f(handle-delim) -g(start)g(end])p Fw(\))43 b Fs(\000)-14 b(!)44 b Fz(nchars)13 -b(or)h(eof)g(or)g(#f)87 b FA(pr)o(ocedur)o(e)888 3089 y(A)21 -b(side-ef)o(fecting)e(variant)h(of)h Fw(read-delimited)p FA(.)888 -3224 y(The)26 b(data)f(is)i(written)f(into)h(the)f(string)h -Fz(buf)g FA(at)e(the)h(indices)h(in)f(the)g(half-open)g(in-)888 -3323 y(terval)f Fl([)p Fz(start)p Fx(;)14 b Fz(end)p Fl(\))p -FA(;)29 b(the)d(default)f(interval)g(is)i(the)f(whole)g(string:)39 -b Fz(start)h Fl(=)g(0)25 b FA(and)888 3423 y Fz(end)33 b Fl(=)g -Fw(\(string-length)38 b Fz(buf)p Fw(\))p FA(.)e(The)24 b(values)f(of)h -Fz(start)g FA(and)f Fz(end)h FA(must)g(specify)g(a)888 3523 -y(well-de\256ned)d(interval)f(in)h Fz(str)p FA(,)g Fz(i.e.)p -FA(,)f Fl(0)j Fs(\024)g Fz(start)f Fs(\024)h Fz(end)g Fs(\024)g -Fw(\(string-length)37 b Fz(buf)q Fw(\))p FA(.)888 3657 y(It)20 -b(r)o(eturns)g Fz(nbytes)p FA(,)g(the)h(number)f(of)g(bytes)g(r)o(ead.)25 -b(If)20 b(the)g(buf)o(fer)f(\256lled)h(up)g(without)888 3757 -y(a)c(delimiter)g(character)e(being)j(found,)f Fw(#f)g FA(is)g(r)o(eturned.) -25 b(If)15 b(the)i(port)f(is)g(at)g(eof)f(when)888 3856 y(the)21 -b(r)o(ead)e(starts,)i(the)g(eof)f(object)h(is)g(r)o(eturned.)888 -3991 y(If)14 b(an)g(integer)g(is)h(r)o(eturned)e(\()p Fz(i.e.)o -FA(,)i(the)g(r)o(ead)d(is)j(successfully)f(terminated)g(by)g(r)o(eading)888 -4091 y(a)28 b(delimiter)h(character\),)f(then)h(the)f Fz(handle-delim)f -FA(parameter)g(determines)h(how)888 4190 y(the)23 b(terminating)h(character)d -(is)j(handled.)33 b(It)23 b(is)g(described)f(above,)g(and)h(defaults)888 -4290 y(to)e Fw('peek)p FA(.)681 4486 y Fw(\(\045read-delimited)o(!)37 -b Fz(char-set)14 b(buf)g(gobble?)g([port)f(start)h(end])p Fw(\))42 -b Fs(\000)-14 b(!)44 b Fz([char-or-eof-or-#f)11 b(integer])87 -b FA(pr)o(ocedur)o(e)888 4629 y(This)20 b(low-level)e(delimited)h(r)o(eader)e -(uses)i(an)f(alternate)g(interface.)25 b(It)19 b(r)o(eturns)f(two)888 -4729 y(values:)27 b Fz(terminator)21 b FA(and)f Fz(num-r)o(ead)o -FA(.)888 4898 y Fy(terminator)40 b FA(A)20 b(value)h(describing)f(why)i(the)f -(r)o(ead)e(was)i(terminated:)681 5147 y(106)p 1952 5071 323 -4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p 2271 5173 V 1952 5176 -323 4 v 435 w FD(November)d(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +106 111 bop 888 614 a FB(alone,)27 b(in)e(case)g(they)g(come)h(after)e +(symlinks)j(or)e(appear)f(in)h(a)g Fx(/../)p FA(machine)n +Fx(/...)888 714 y FB(\223super)o(-r)o(oot\224)19 b(form)i(\(which)i(P)t +Fs(O)t(S)t(I)t(X)h FB(permits\).)681 950 y Fx(\(resolve-file-na)o(me)37 +b FA(fname)21 b([dir])p Fx(\))86 b Ft(\000)-15 b(!)88 +b FA(string)730 b FB(pr)o(ocedur)o(e)988 1106 y Ft(\017)41 +b FB(Do)21 b Fx(~)g FB(expansion.)988 1254 y Ft(\017)41 +b FB(If)23 b FA(dir)h FB(is)g(given,)g(convert)g(a)f(r)o(elative)g +(\002le-name)g(to)h(an)g(absolute)g(\002le-name,)1071 +1354 y(r)o(elative)19 b(to)j(dir)o(ectory)d FA(dir)p +FB(.)681 1590 y Fx(\(expand-file-nam)o(e)37 b FA(fname)21 +b([dir])p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(string)774 +b FB(pr)o(ocedur)o(e)888 1746 y(Resolve)22 b(and)e(simplify)h(the)g +(\002le-name.)681 2082 y Fx(\(home-dir)40 b FA([user])p +Fx(\))87 b Ft(\000)-15 b(!)88 b FA(string)1300 b FB(pr)o(ocedur)o(e)888 +2238 y Fx(home-dir)17 b FB(r)o(eturns)j FA(user)q FB('s)g(home)h(dir)o +(ectory)-9 b(.)24 b FA(User)d FB(defaults)e(to)h(the)g(curr)o(ent)g +(user)-6 b(.)1071 2438 y Fx(\(home-dir\))471 b Fm(=)-14 +b Ft(\))104 b Fx("/user1/lecture)o(r/s)o(hi)o(ver)o(s")1071 +2537 y(\(home-dir)40 b("ctkwan"\))79 b Fm(=)-14 b Ft(\))104 +b Fx("/user0/researc)o(h/c)o(tk)o(wan)o(")681 2946 y(\(home-file)39 +b FA([user])21 b(fname)p Fx(\))87 b Ft(\000)-14 b(!)87 +b FA(string)1033 b FB(pr)o(ocedur)o(e)888 3103 y(Returns)21 +b(\002le-name)e FA(fname)h FB(r)o(elative)f(to)h FA(user)q +FB('s)g(home)h(dir)o(ectory;)e FA(user)i FB(defaults)e(to)888 +3202 y(the)i(curr)o(ent)f(user)-6 b(.)1071 3356 y Fx(\(home-file)39 +b("man"\))473 b Fm(=)-14 b Ft(\))104 b Fx("/usr/shivers/ma)o(n")1071 +3456 y(\(home-file)39 b("fcmlau")i("man"\))80 b Fm(=)-14 +b Ft(\))104 b Fx("/usr/fcmlau/man)o(")805 3824 y FB(The)26 +b(general)e Fx(substitute-env-va)o(rs)19 b FB(string)26 +b(pr)o(ocedur)o(e,)e(de\002ned)h(in)h(the)f(pr)o(evi-)681 +3923 y(ous)c(section,)g(is)g(also)g(fr)o(equently)g(useful)g(for)f +(expanding)h(\002le-names.)681 4258 y Fv(5.2)99 b(ASCII)24 +b(encoding)681 4519 y Fx(\(char->ascii)38 b FA(character)p +Fx(\))87 b Ft(\000)-15 b(!)87 b FA(integer)1029 b FB(pr)o(ocedur)o(e) +681 4619 y Fx(\(ascii->char)38 b FA(integer)p Fx(\))87 +b Ft(\000)-14 b(!)87 b FA(character)1028 b FB(pr)o(ocedur)o(e)888 +4751 y(These)36 b(ar)o(e)f(identical)g(to)i Fx(char->integer)30 +b FB(and)35 b Fx(integer->char)c FB(except)k(that)888 +4851 y(they)21 b(use)g(the)i(A)t Fs(S)t(C)t(I)t(I)h FB(encoding.)681 +5147 y(106)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 107 113 -107 112 bop 805 692 a FA(Character)20 b(or)g(eof-object)166 -b Fs(\))g FA(Read)21 b(terminated)f(by)h(this)g(value.)805 -792 y Fw(#f)912 b Fs(\))166 b FA(Filled)21 b(buf)o(fer)e(without)j(\256nding) -g(a)e(delimiter)-6 b(.)573 941 y Fy(num-read)39 b FA(Number)21 -b(of)g(characters)e(r)o(ead)g(into)j Fz(buf)p FA(.)573 1107 -y(If)31 b(the)g(r)o(ead)f(is)i(successfully)g(terminated)e(by)i(r)o(eading)e -(a)h(delimiter)g(character)-6 b(,)573 1207 y(then)27 b(the)g -Fz(gobble?)f FA(parameter)f(determines)i(what)f(to)h(do)g(with)g(the)g -(terminating)573 1306 y(character)-6 b(.)25 b(If)19 b(tr)o(ue,)g(the)g -(character)f(is)h(r)o(emoved)f(fr)o(om)h(the)g(input)h(str)o(eam;)f(if)g -(false,)573 1406 y(the)c(character)f(is)i(left)f(in)h(the)g(input)g(str)o -(eam)e(wher)o(e)h(a)g(subsequent)i(r)o(ead)c(operation)573 -1505 y(will)20 b(r)o(etrieve)e(it.)27 b(In)19 b(either)g(case,)g(the)g -(character)f(is)i(also)f(the)h(\256rst)f(value)g(r)o(eturned)573 -1605 y(by)i(the)g(pr)o(ocedur)o(e)d(call.)365 5147 y FD(November)g(1,)h(1995) -h(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 -v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1174 w FA(107)p -eop +107 112 bop 365 614 a Fv(5.3)99 b(Character)25 b(sets)365 +828 y FB(Scsh)c(pr)o(ovides)g(a)f Fx(char-set)e FB(type)j(for)g(expr)o +(essing)f(sets)i(of)f(characters.)k(These)c(sets)g(ar)o(e)365 +928 y(used)d(by)h(some)g(of)f(the)h(delimited-input)f(pr)o(ocedur)o(es) +f(\(section)h(7.1\).)23 b(The)c(character)e(set)365 1028 +y(package)j(that)h(scsh)g(uses)g(was)g(taken)f(fr)o(om)h(Pr)o(oject)f +(Mac's)g(MIT)g(Scheme.)365 1175 y Fx(\(char-set?)40 b +FA(x)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(boolean)1367 +b FB(pr)o(ocedur)o(e)573 1315 y(Returns)21 b(tr)o(ue)g(if)g(the)g +(object)g FA(x)f FB(is)h(a)f(character)g(set.)365 1580 +y Fz(5.3.1)81 b(Creating)20 b(character)f(sets)365 1786 +y Fx(\(char-set)40 b FA(char)946 1798 y Fu(1)983 1786 +y FA(.)12 b(.)g(.)g Fx(\))87 b Ft(\000)-14 b(!)87 b FA(char-set)1156 +b FB(pr)o(ocedur)o(e)573 1910 y(Return)21 b(a)f(character)g(set)g +(containing)i(the)f(given)g(characters.)365 2098 y Fx +(\(chars->char-set)37 b FA(chars)p Fx(\))87 b Ft(\000)-14 +b(!)87 b FA(char-set)955 b FB(pr)o(ocedur)o(e)573 2238 +y(Return)21 b(a)f(character)g(set)g(containing)i(the)f(characters)f(in) +h(the)g(list)g FA(chars)p FB(.)365 2426 y Fx(\(string->char-set)37 +b FA(s)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(char-set)1056 +b FB(pr)o(ocedur)o(e)573 2565 y(Return)21 b(a)f(character)g(set)g +(containing)i(the)f(characters)f(in)h(the)g(string)g +FA(s)q FB(.)365 2753 y Fx(\(predicate->char-)o(se)o(t)38 +b FA(pr)o(ed)p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(char-set)812 +b FB(pr)o(ocedur)o(e)573 2892 y(Returns)30 b(a)f(character)f(set)i +(containing)g(every)f(character)f FA(c)h FB(such)h(that)g +Fx(\()p FA(pr)o(ed)42 b(c)p Fx(\))573 2992 y FB(r)o(eturns)20 +b(tr)o(ue.)365 3180 y Fx(\(ascii-range->cha)o(r-)o(set)37 +b FA(lower)21 b(upper)p Fx(\))87 b Ft(\000)-15 b(!)87 +b FA(char-set)472 b FB(pr)o(ocedur)o(e)573 3319 y(Returns)21 +b(a)g(character)e(set)i(containing)h(every)e(character)f(whose)24 +b(A)t Fs(S)t(C)t(I)t(I)g FB(code)c(lies)573 3419 y(in)h(the)g +(half-open)f(range)h Fm([)p FA(lower)p Fy(;)14 b FA(upper)p +Fm(\))p FB(.)365 3685 y Fz(5.3.2)81 b(Querying)20 b(character)f(sets) +365 3891 y Fx(\(char-set-members)37 b FA(char-set)p Fx(\))86 +b Ft(\000)-14 b(!)87 b FA(character-list)647 b FB(pr)o(ocedur)o(e)573 +4015 y(This)21 b(pr)o(ocedur)o(e)e(r)o(eturns)h(a)g(list)i(of)f(the)f +(members)h(of)g FA(char-set)o FB(.)365 4155 y Fx(\(char-set-contain)o +(s?)37 b FA(char-set)20 b(char)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(boolean)587 b FB(pr)o(ocedur)o(e)573 4286 +y(This)21 b(pr)o(ocedur)o(e)e(tests)i FA(char)f FB(for)h(membership)g +(in)g(set)g FA(char-set)o FB(.)756 4442 y FE(Remark:)226 +b Fk(Pr)o(evious)62 b(r)o(eleases)e(of)j(scsh)f(called)g(this)h(pr)o +(ocedur)o(e)756 4533 y Fh(char-set-member?)p Fk(,)25 +b(r)o(eversing)19 b(the)k(or)o(der)c(of)i(the)h(ar)o(guments.)31 +b(This)21 b(made)756 4624 y(sense,)34 b(but)e(was)h(unfortunately)f +(the)h(r)o(everse)c(or)o(der)h(in)i(which)h(the)g(ar)o(gu-)756 +4716 y(ments)g(appear)h(in)g(MIT)f(Scheme.)68 b(A)34 +b(r)o(easonable)f(ar)o(gument)g(or)o(der)f(was)756 4807 +y(not)23 b(backwar)o(ds-compatible)g(with)h(MIT)f(Scheme;)j(on)d(the)h +(other)f(hand,)i(the)756 4898 y(MIT)d(Scheme)h(ar)o(gument)f(or)o(der)f +(was)i(counter)o(-intuitive)f(and)h(at)h(odds)d(with)365 +5147 y FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1174 w FB(107)p eop %%Page: 108 114 -108 113 bop 681 1262 a Fv(Chapter)44 b(7)681 1702 y FB(A)-14 -b(wk,)51 b(record)h(I/O,)g(and)g(\256eld)681 1951 y(parsing)681 -2431 y FA(Unix)20 b(pr)o(ograms)f(fr)o(equently)h(pr)o(ocess)f(str)o(eams)g -(of)h(r)o(ecor)o(ds,)f(wher)o(e)g(each)g(r)o(ecor)o(d)g(is)h(de-)681 -2531 y(limited)25 b(by)f(a)g(newline,)i(and)e(r)o(ecor)o(ds)f(ar)o(e)g(br)o -(oken)h(into)h(\256elds)g(with)g(other)g(delimiters)681 2630 -y(\(for)17 b(example,)h(the)g(colon)i(character)c(in)j Fw(/etc/passwd)p -FA(\).)j(Scsh)c(has)g(pr)o(ocedur)o(es)f(that)h(al-)681 2730 -y(low)d(the)f(pr)o(ogrammer)f(to)h(easily)g(do)g(this)h(kind)g(of)f(pr)o -(ocessing.)25 b(Scsh's)14 b(\256eld)g(parsers)f(can)681 2829 -y(also)21 b(be)h(used)f(to)h(parse)e(other)i(kinds)g(of)f(delimited)h -(strings,)g(such)g(as)f(colon-separated)681 2929 y Fw($PATH)16 -b FA(lists.)27 b(These)18 b(r)o(outines)g(can)g(be)f(used)h(with)h(scsh's)g -Fw(awk)d FA(loop)j(constr)o(uct)g(to)f(conve-)681 3029 y(niently)j(perform)g -(pattern-dir)o(ected)d(computation)k(over)e(str)o(eams)g(of)h(r)o(ecor)o(ds.) -681 3306 y Fu(7.1)99 b(Record)25 b(I/O)g(and)f(\256eld)h(parsing)681 -3520 y FA(The)f(pr)o(ocedur)o(es)e(in)i(this)h(section)g(ar)o(e)d(used)i(to)g -(r)o(ead)f(r)o(ecor)o(ds)f(fr)o(om)i(I/O)g(str)o(eams)f(and)681 -3619 y(parse)16 b(them)i(into)g(\256elds.)26 b(A)17 b(r)o(ecor)o(d)e(is)j -(de\256ned)f(as)g(text)f(terminated)h(by)g(some)h(delimiter)681 -3719 y(\(usually)24 b(a)h(newline\).)39 b(A)25 b(r)o(ecor)o(d)e(can)h(be)g -(split)h(into)h(\256elds)f(by)g(using)g(r)o(egular)f(expr)o(es-)681 -3818 y(sions)k(in)f(one)g(of)f(several)g(ways:)39 b(to)27 b -Fz(match)e FA(\256elds,)j(to)f Fz(separate)g FA(\256elds,)g(or)g(to)g -Fz(terminate)681 3918 y FA(\256elds.)42 b(The)26 b(\256eld)f(parsers)g(can)h -(be)f(applied)g(to)h(arbitrary)e(strings)j(\(one)f(common)h(use)681 -4018 y(is)f(splitting)g(envir)o(onment)g(variables)f(such)g(as)h -Fw($)o(PATH)e FA(at)h(colons)i(into)f(its)g(component)681 4117 -y(elements\).)805 4242 y(The)18 b(general)g(delimited-input)g(pr)o(ocedur)o -(es)e(described)h(in)h(chapter)f(6)h(ar)o(e)e(also)i(use-)681 -4342 y(ful)d(for)g(r)o(eading)f(simple)i(r)o(ecor)o(ds,)f(such)h(as)f(single) -h(lines,)h(paragraphs)c(of)j(text,)g(or)f(strings)681 4441 -y(terminated)20 b(by)h(speci\256c)g(characters.)681 4692 y -Fy(7.1.1)81 b(Reading)19 b(records)681 4898 y Fw(\(record-reader)38 -b Fz([delims)13 b(elide-delims?)g(handle-delim])p Fw(\))41 -b Fs(\000)-14 b(!)44 b Fz(pr)o(ocedur)o(e)86 b FA(pr)o(ocedur)o(e)681 -5147 y(108)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +108 113 bop 1071 614 a Fk(common)24 b(mathematical)i(notation)f(and)g +(the)g Fh(member)g Fk(family)e(of)h(R4RS)h(pr)o(o-)1071 +706 y(cedur)o(es.)1071 814 y(W)-7 b(e)18 b(sought)h(to)g(escape)f(the)h +(dilemma)f(by)h(shifting)g(to)f(a)h(new)h(name.)681 1131 +y Fz(5.3.3)81 b(Character)19 b(set)h(algebra)681 1339 +y Fx(\(char-set-invert)37 b FA(char-set)p Fx(\))86 b +Ft(\000)-14 b(!)87 b FA(char-set)867 b FB(pr)o(ocedur)o(e)681 +1439 y Fx(\(char-set-union)37 b FA(char-set)1642 1451 +y Fu(1)1700 1439 y FA(char-set)1965 1451 y Fu(2)2002 +1439 y Fx(\))87 b Ft(\000)-14 b(!)87 b FA(char-set)551 +b FB(pr)o(ocedur)o(e)681 1538 y Fx(\(char-set-inters)o(ec)o(tio)o(n)37 +b FA(char-set)1948 1550 y Fu(1)2006 1538 y FA(char-set)2270 +1550 y Fu(2)2307 1538 y Fx(\))87 b Ft(\000)-14 b(!)87 +b FA(char-set)246 b FB(pr)o(ocedur)o(e)681 1638 y Fx(\(char-set-differ) +o(en)o(ce)37 b FA(char-set)1860 1650 y Fu(1)1918 1638 +y FA(char-set)2183 1650 y Fu(2)2220 1638 y Fx(\))87 b +Ft(\000)-14 b(!)87 b FA(char-set)333 b FB(pr)o(ocedur)o(e)888 +1762 y(These)31 b(pr)o(ocedur)o(es)f(implement)h(set)h(complement,)i +(union,)g(intersection,)g(and)888 1862 y(dif)o(fer)o(ence)19 +b(for)h(character)f(sets.)681 2130 y Fz(5.3.4)81 b(Standard)18 +b(character)h(sets)681 2313 y FB(Several)g(character)g(sets)i(ar)o(e)f +(pr)o(ede\002ned)f(for)h(convenience:)p 749 2456 2729 +4 v 749 2555 4 100 v 802 2525 a Fx(char-set:upper-c)o(as)o(e)268 +b FB(A\226Z)p 3474 2555 V 749 2655 V 802 2625 a Fx(char-set:lower-c)o +(as)o(e)g FB(a\226z)p 3474 2655 V 749 2754 V 802 2725 +a Fx(char-set:numeric)398 b FB(0\2269)p 3474 2754 V 749 +2854 V 802 2824 a Fx(char-set:whitesp)o(ac)o(e)268 b +FB(space,)20 b(newline,)h(tab,)f(linefeed,)g(page,)g(r)o(eturn)p +3474 2854 V 749 2954 V 802 2924 a Fx(char-set:not-whi)o(te)o(spa)o(ce) +93 b FB(Complement)22 b(of)e Fx(char-set:whitespa)o(ce)p +3474 2954 V 749 3053 V 802 3023 a(char-set:alphabe)o(ti)o(c)268 +b FB(A\226Z)20 b(and)h(a\226z)p 3474 3053 V 749 3153 +V 802 3123 a Fx(char-set:alphanu)o(me)o(ric)180 b FB(Alphabetic)20 +b(or)h(numeric)p 3474 3153 V 749 3253 V 802 3223 a Fx(char-set:graphic) +398 b FB(Printing)22 b(characters)d(and)i(space)p 3474 +3253 V 749 3256 2729 4 v 681 3458 a Fx(\(char-upper-case)o(?)37 +b FA(character)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(boolean)796 +b FB(pr)o(ocedur)o(e)681 3558 y Fx(\(char-lower-case)o(?)37 +b FA(character)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(boolean)796 +b FB(pr)o(ocedur)o(e)681 3657 y Fx(\(char-numeric?)81 +b FA(character)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(boolean)883 +b FB(pr)o(ocedur)o(e)681 3757 y Fx(\(char-whitespace)o(?)37 +b FA(character)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(boolean)796 +b FB(pr)o(ocedur)o(e)681 3856 y Fx(\(char-alphabetic)o(?)37 +b FA(character)p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(boolean)796 +b FB(pr)o(ocedur)o(e)681 3956 y Fx(\(char-alphanumer)o(ic)o(?)38 +b FA(character)p Fx(\))86 b Ft(\000)-15 b(!)88 b FA(boolean)708 +b FB(pr)o(ocedur)o(e)681 4056 y Fx(\(char-graphic?)38 +b FA(character)p Fx(\))86 b Ft(\000)-15 b(!)88 b FA(boolean)926 +b FB(pr)o(ocedur)o(e)888 4197 y(These)21 b(pr)o(edicates)e(ar)o(e)g +(de\002ned)i(in)g(terms)g(of)g(the)f(above)h(character)e(sets.)681 +5147 y(108)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)g(10,)g +(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 109 115 -109 114 bop 573 614 a FA(Returns)22 b(a)g(pr)o(ocedur)o(e)d(that)j(r)o(eads)e -(r)o(ecor)o(ds)h(fr)o(om)g(a)g(port.)31 b(The)22 b(pr)o(ocedur)o(e)d(is)j -(in-)573 714 y(voked)e(as)h(follows:)756 884 y Fw(\()p Fz(r)o(eader)43 -b([port])n Fw(\))h Fs(\000)-15 b(!)44 b Fz(string)21 b(or)g(eof)573 -1054 y FA(A)i(r)o(ecor)o(d)f(is)i(a)f(sequence)h(of)f(characters)g -(terminated)g(by)h(one)g(of)f(the)h(characters)573 1154 y(in)e -Fz(delims)g FA(or)g(eof.)30 b(If)21 b Fz(elide-delims?)g FA(is)h(tr)o(ue,)g -(then)g(a)f(contiguous)j(sequence)e(of)f(de-)573 1253 y(limiter)e(chars)g(ar) -o(e)f(taken)h(as)g(a)f(single)i(r)o(ecor)o(d)d(delimiter)-6 -b(.)27 b(If)19 b Fz(elide-delims?)f FA(is)i(false,)573 1353 -y(then)e(a)e(delimiter)i(char)f(coming)h(immediately)f(after)g(a)f(delimiter) -i(char)e(pr)o(oduces)573 1453 y(an)24 b(empty-string)h(r)o(ecor)o(d.)37 -b(The)24 b(r)o(eader)e(consumes)k(the)e(delimiting)i(char\(s\))d(be-)573 -1552 y(for)o(e)d(r)o(eturning)g(fr)o(om)h(a)f(r)o(ead.)573 -1699 y(The)26 b Fz(delims)g FA(set)g(defaults)f(to)h(the)g(set)g -Fs(f)p FA(newline)p Fs(g)p FA(.)43 b(It)26 b(may)g(be)f(a)h(charset,)g -(string,)573 1798 y(character)-6 b(,)48 b(or)d(character)e(pr)o(edicate,)48 -b(and)c(is)h(coer)o(ced)e(to)i(a)f(charset.)99 b(The)573 1898 -y Fz(elide-delims?)20 b FA(\257ag)h(defaults)f(to)h Fw(#f)p -FA(.)573 2044 y(The)f Fz(handle-delim)f FA(ar)o(gument)g(contr)o(ols)i(what)f -(is)h(done)f(with)h(the)f(r)o(ecor)o(d's)f(termi-)573 2144 -y(nating)i(delimiter)-6 b(.)805 2316 y Fw('trim)185 b FA(Delimiters)19 -b(ar)o(e)d(trimmed.)27 b(\(The)17 b(default\))805 2415 y Fw('split)141 -b FA(Reader)36 b(r)o(eturns)g(delimiter)g(string)h(as)f(a)1210 -2515 y(second)29 b(ar)o(gument.)50 b(If)28 b(r)o(ecor)o(d)f(is)i(termi-)1210 -2615 y(nated)16 b(by)i(EOF)-8 b(,)17 b(then)g(the)h(eof)e(object)i(is)f(r)o -(e-)1210 2714 y(turned)k(as)f(this)h(second)g(ar)o(gument.)805 -2814 y Fw('concat)97 b FA(The)38 b(r)o(ecor)o(d)e(and)h(its)h(delimiter)g(ar) -o(e)e(r)o(e-)1210 2913 y(turned)21 b(as)f(a)g(single)i(string.)573 -3129 y(The)34 b(r)o(eader)e(pr)o(ocedur)o(e)g(r)o(eturned)h(takes)g(one)i -(optional)g(ar)o(gument,)h(the)e(port)573 3229 y(fr)o(om)25 -b(which)h(to)g(r)o(ead,)f(which)i(defaults)d(to)i(the)g(curr)o(ent)f(input)h -(port.)41 b(It)26 b(r)o(eturns)573 3328 y(a)20 b(string)i(or)e(eof.)365 -3655 y Fy(7.1.2)81 b(Parsing)20 b(\256elds)365 3882 y Fw(\(field-splitter)38 -b Fz([r)o(egexp)19 b(num-\256elds])p Fw(\))86 b Fs(\000)-14 -b(!)87 b Fz(pr)o(ocedur)o(e)460 b FA(pr)o(ocedur)o(e)365 3982 -y Fw(\(infix-splitter)38 b Fz([delim)17 b(num-\256elds)g(handle-delim])p -Fw(\))65 b Fs(\000)-14 b(!)67 b Fz(pr)o(ocedur)o(e)87 b FA(pr)o(ocedur)o(e) -365 4081 y Fw(\(suffix-splitter)37 b Fz([delim)14 b(num-\256elds)g -(handle-delim])p Fw(\))47 b Fs(\000)-14 b(!)48 b Fz(pr)o(ocedur)o(e)87 -b FA(pr)o(ocedur)o(e)365 4181 y Fw(\(sloppy-suffix-sp)o(li)o(tte)o(r)37 -b Fz([delim)13 b(num-\256elds)h(handle-delim])p Fw(\))41 b -Fs(\000)-14 b(!)44 b Fz(pr)o(ocedur)o(e)86 b FA(pr)o(ocedur)o(e)573 -4312 y(These)21 b(functions)g(r)o(eturn)f(a)h(parser)e(function)j(that)f(can) -f(be)g(used)h(as)f(follows:)756 4482 y Fw(\()p Fz(parser)43 -b(string)h([start])o Fw(\))f Fs(\000)-14 b(!)43 b Fz(string-list)573 -4699 y FA(The)27 b(r)o(eturned)f(parsers)h(split)g(strings)h(into)h(\256elds) -e(de\256ned)g(by)g(r)o(egular)f(expr)o(es-)573 4799 y(sions.)h(Y)-8 -b(ou)19 b(can)f(parse)f(by)h(specifying)g(a)f(pattern)h(that)f -Fz(separates)i FA(\256elds,)f(a)f(pattern)573 4898 y(that)k -Fz(terminates)f FA(\256elds,)h(or)g(a)f(pattern)g(that)h Fz(matches)f -FA(\256elds:)365 5147 y FD(November)e(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1174 w FA(109)p eop +109 114 bop 365 1272 a Fw(Chapter)45 b(6)365 1723 y FC(Reading)53 +b(delimited)e(strings)365 2214 y FB(Scsh)21 b(pr)o(ovides)g(a)f(set)h +(of)g(pr)o(ocedur)o(es)e(that)i(r)o(ead)f(delimited)g(strings)i(fr)o +(om)f(input)h(ports.)365 2314 y(Ther)o(e)17 b(ar)o(e)f(pr)o(ocedur)o +(es)g(to)i(r)o(ead)d(a)i(single)i(line)f(of)f(text)g(\(terminated)g(by) +h(a)f(newline)h(char)o(-)365 2414 y(acter\),)24 b(a)g(single)h +(paragraph)e(\(terminated)h(by)g(a)g(blank)h(line\),)g(and)f(general)g +(delimited)365 2513 y(strings)e(\(terminated)e(by)h(a)f(character)f +(belonging)j(to)f(an)g(arbitrary)e(character)h(set\).)490 +2648 y(These)k(pr)o(ocedur)o(es)f(can)i(be)f(applied)g(to)h(any)g +(Scheme)f(input)h(port.)37 b(However)-6 b(,)25 b(the)365 +2748 y(scsh)h(virtual)f(machine)h(has)f(native-code)g(support)g(for)g +(performing)h(delimited)f(r)o(eads)365 2848 y(on)i(Unix)g(ports,)h(and) +e(these)h(input)g(operations)f(should)i(be)e(particularly)g +(fast\227much)365 2947 y(faster)33 b(than)h(doing)h(the)f(equivalent)g +(character)o(-at-a-time)c(operation)k(fr)o(om)f(Scheme)365 +3047 y(code.)490 3182 y(All)19 b(of)h(the)g(delimited)f(input)i +(operations)f(described)e(below)i(take)f(a)h Fx(handle-delim)365 +3281 y FB(parameter)-6 b(,)30 b(which)h(determines)e(what)h(the)g(pr)o +(ocedur)o(e)e(does)i(with)g(the)g(terminating)365 3381 +y(delimiter)19 b(character)-6 b(.)23 b(Ther)o(e)18 b(ar)o(e)g(four)g +(possible)i(choices)f(for)g(a)f Fx(handle-delim)c FB(param-)365 +3481 y(eter:)p 573 3550 2428 4 v 573 3649 4 100 v 626 +3619 a Fx(handle-delim)p 1199 3649 V 98 w FB(Meaning)p +2997 3649 V 573 3653 2428 4 v 573 3669 V 573 3769 4 100 +v 626 3739 a Fx('trim)p 1199 3769 V 406 w FB(Ignor)o(e)21 +b(delimiter)f(character)-6 b(.)p 2997 3769 V 573 3868 +V 626 3838 a Fx('peek)p 1199 3868 V 406 w FB(Leave)19 +b(delimiter)i(character)e(in)j(input)f(str)o(eam.)p 2997 +3868 V 573 3968 V 626 3938 a Fx('concat)p 1199 3968 V +318 w FB(Append)f(delimiter)h(character)e(to)i(r)o(eturned)f(value.)p +2997 3968 V 573 4068 V 626 4038 a Fx('split)p 1199 4068 +V 362 w FB(Return)h(delimiter)g(as)f(second)h(value.)p +2997 4068 V 573 4071 2428 4 v 365 4195 a(The)28 b(\002rst)g(case,)h +Fx('trim)p FB(,)e(is)h(the)g(standar)o(d)e(default)h(for)h(all)f(the)h +(r)o(outines)g(described)f(in)365 4295 y(this)21 b(section.)26 +b(The)21 b(last)f(thr)o(ee)g(cases)f(allow)i(the)g(pr)o(ogrammer)e(to)i +(distinguish)h(between)365 4394 y(strings)h(that)f(ar)o(e)e(terminated) +h(by)h(a)g(delimiter)f(character)-6 b(,)21 b(and)g(strings)i(that)e(ar) +o(e)g(termi-)365 4494 y(nated)f(by)h(an)g(end-of-\002le.)365 +4651 y Fx(\(read-line)40 b FA([port)19 b(handle-newline])p +Fx(\))87 b Ft(\000)-14 b(!)87 b FA(string)21 b(or)g(eof-object)306 +b FB(pr)o(ocedur)o(e)573 4799 y(Reads)20 b(and)g(r)o(eturns)g(one)h +(line)g(of)g(text;)f(on)h(eof,)f(r)o(eturns)g(the)h(eof)f(object.)26 +b(A)20 b(line)h(is)573 4898 y(terminated)f(by)h(newline)g(or)g(eof.)365 +5147 y FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1174 w FB(109)p eop %%Page: 110 116 -110 115 bop 1121 601 a FA(Pr)o(ocedur)o(e)748 b(Pattern)p 1071 -634 1835 4 v 1121 704 a Fw(field-splitter)509 b FA(matches)21 -b(\256elds)1121 804 y Fw(infix-splitter)509 b FA(separates)19 -b(\256elds)1121 903 y Fw(suffix-splitter)465 b FA(terminates)20 -b(\256elds)1121 1003 y Fw(sloppy-suffix-sp)o(li)o(tte)o(r)160 -b FA(terminates)20 b(\256elds)888 1189 y(These)i(parser)e(generators)i(ar)o -(e)e(contr)o(olled)h(by)h(a)f(range)g(of)h(options,)h(so)f(that)f(you)888 -1288 y(can)e(pr)o(ecisely)f(specify)h(what)g(kind)h(of)f(parsing)g(you)g -(want.)27 b(However)-6 b(,)19 b(these)g(op-)888 1388 y(tions)j(default)e(to)h -(r)o(easonable)f(values)g(for)g(general)h(use.)888 1525 y(Defaults:)1121 -1605 y Fz(delim)331 b FA(=)84 b Fw("[)43 b(\\t\\n]+|$")95 b -FA(\(suf)o(\256x)20 b(delimiter:)28 b(white)21 b(space)f(or)h(eos\))1771 -1705 y Fw("[)43 b(\\t\\n]+")183 b FA(\(in\256x)21 b(delimiter:)28 -b(white)21 b(space\))1121 1805 y Fz(r)o(e)453 b FA(=)84 b Fw("[^)42 -b(\\t\\n]+")140 b FA(\(non-white-space\))1121 1904 y Fz(num-\256elds)158 -b FA(=)84 b Fw(#f)534 b FA(\(as)21 b(many)g(\256elds)f(as)h(possible\))1121 -2004 y Fz(handle-delim)81 b FA(=)j Fw('trim)402 b FA(\(discar)o(d)19 -b(delimiter)i(chars\))888 2102 y Fx(:)14 b(:)g(:)g FA(which)30 -b(means:)45 b(br)o(eak)29 b(the)g(string)h(at)f(white)i(space,)f(discar)o -(ding)f(the)g(white)888 2202 y(space,)20 b(and)g(parse)g(as)h(many)g -(\256elds)g(as)f(possible.)888 2339 y(The)25 b(r)o(egular)f(expr)o(ession)h -Fz(delim)g FA(is)g(used)g(to)h(match)f(\256eld)g(delimiters.)40 -b(It)26 b(can)e(be)888 2439 y(either)16 b(a)g(string)h(or)g(a)e(compiled)i(r) -o(egexp)e(str)o(uctur)o(e)h(\(see)f(the)i Fw(make-regexp)11 -b FA(pr)o(oce-)888 2539 y(dur)o(e\).)32 b(In)23 b(the)g(separator)e(case,)i -(it)f(defaults)g(to)h(a)f(r)o(egular)g(expr)o(ession)g(matching)888 -2638 y(white)j(space;)g(in)g(the)f(terminator)h(case,)f(it)g(defaults)g(to)g -(white)h(space)f(or)g(end-of-)888 2738 y(string.)888 2875 y(The)f(r)o(egular) -f(expr)o(ession)h Fz(r)o(e)g FA(is)g(a)g(r)o(egular)f(expr)o(ession)g(used)h -(to)h(match)f(\256elds.)34 b(It)888 2975 y(defaults)20 b(to)h -(non-white-space.)888 3112 y(The)g(boolean)g Fz(handle-delim)f -FA(determines)g(what)h(to)g(do)g(with)h(delimiters.)1121 3192 -y Fw('trim)185 b FA(Delimiters)21 b(ar)o(e)e(thr)o(own)j(away)e(after)f -(parsing.)28 b(\(default\))1121 3292 y Fw('concat)97 b FA(Delimiters)21 -b(ar)o(e)e(appended)h(to)h(the)g(\256eld)f(pr)o(eceding)g(them.)1121 -3391 y Fw('split)141 b FA(Delimiters)21 b(ar)o(e)e(r)o(eturned)h(as)g -(separate)g(elements)h(in)g(the)g(\256eld)f(list.)888 3528 -y(The)31 b Fz(num-\256elds)f FA(ar)o(gument)h(used)f(to)h(cr)o(eate)f(the)g -(parser)g(speci\256es)h(how)h(many)888 3628 y(\256elds)20 b(to)g(parse.)26 -b(If)20 b Fw(#f)e FA(\(the)i(default\),)e(the)i(pr)o(ocedur)o(e)e(parses)h -(them)h(all.)27 b(If)19 b(a)g(pos-)888 3727 y(itive)25 b(integer)g -Fx(n)p FA(,)h(exactly)e(that)h(many)g(\256elds)g(ar)o(e)e(parsed;)i(it)h(is)f -(an)f(err)o(or)g(if)h(ther)o(e)888 3827 y(ar)o(e)17 b(mor)o(e)h(or)g(fewer)f -(than)i Fx(n)f FA(\256elds)g(in)h(the)f(r)o(ecor)o(d.)25 b(If)17 -b Fz(num-\256elds)h FA(is)h(a)e(negative)h(in-)888 3927 y(teger)h(or)h(zer)o -(o,)e(then)i Fs(j)p Fx(n)p Fs(j)g FA(\256elds)f(ar)o(e)f(parsed,)h(and)g(the) -g(r)o(emainder)f(of)i(the)g(string)g(is)888 4026 y(r)o(eturned)g(in)i(the)g -(last)f(element)g(of)g(the)h(\256eld)f(list;)h(it)f(is)h(an)f(err)o(or)f(if)h -(fewer)g(than)g Fs(j)p Fx(n)p Fs(j)888 4126 y FA(\256elds)g(can)g(be)f -(parsed.)888 4263 y(The)d(\256eld)f(parser)f(pr)o(oduced)g(is)i(a)f(pr)o -(ocedur)o(e)e(that)j(can)f(be)g(employed)g(as)g(follows:)1071 -4413 y Fw(\()p Fz(parse)43 b(string)h([start])o Fw(\))f Fl(=)-14 -b Fs(\))44 b Fz(string-list)888 4562 y FA(The)18 b(optional)h -Fz(start)e FA(ar)o(gument)g(\(default)g(0\))g(speci\256es)h(wher)o(e)f(in)h -(the)g(string)h(to)f(be-)888 4661 y(gin)k(the)f(parse.)26 b(It)21 -b(is)g(an)g(err)o(or)e(if)i Fz(start)i Fx(>)f Fw(\(string-length)38 -b Fz(string)p Fw(\))p FA(.)888 4799 y(The)26 b(parsers)f(r)o(eturned)g(by)h -(the)g(four)f(parser)g(generators)h(implement)g(dif)o(fer)o(ent)888 -4898 y(kinds)c(of)e(\256eld)h(parsing:)681 5147 y(1)-5 b(10)p -1952 5071 323 4 v 1952 5173 4 102 v 1178 w FC(DRAFT)p 2271 -5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +110 115 bop 888 614 a FA(handle-newline)19 b FB(determines)f(what)h +Fx(read-line)c FB(does)j(with)h(the)g(newline)g(or)g(EOF)888 +714 y(that)29 b(terminates)g(the)g(line;)j(it)d(takes)g(the)g(general)f +(set)h(of)f(values)h(described)e(for)888 814 y(the)22 +b(general)e Fx(handle-delim)d FB(case)j(above,)h(and)f(defaults)h(to)g +Fx('trim)f FB(\(discar)o(d)f(the)888 913 y(newline\).)35 +b(Using)24 b(this)h(ar)o(gument)e(allows)i(one)f(to)g(tell)g(whether)g +(or)g(not)g(the)g(last)888 1013 y(line)d(of)g(input)g(in)h(a)e(\002le)h +(is)g(newline)g(terminated.)681 1305 y Fx(\(read-paragraph)37 +b FA([port)20 b(handle-delim])p Fx(\))85 b Ft(\000)-14 +b(!)87 b FA(string)21 b(or)f(eof)387 b FB(pr)o(ocedur)o(e)888 +1446 y(This)19 b(pr)o(ocedur)o(e)e(skips)i(blank)f(lines,)h(then)g(r)o +(eads)e(text)h(fr)o(om)g(a)g(port)h(until)g(a)f(blank)888 +1546 y(line)25 b(or)f(eof)g(is)h(found.)35 b(A)24 b(\223blank)g +(line\224)g(is)h(a)e(\(possibly)i(empty\))f(line)h(composed)888 +1645 y(only)e(of)e(white)h(space.)27 b(The)22 b FA(handle-delim)e +FB(parameter)g(determines)h(how)i(the)e(ter)o(-)888 1745 +y(minating)33 b(blank)f(line)g(is)g(handled.)58 b(It)31 +b(is)h(described)f(above,)j(and)d(defaults)g(to)888 1845 +y Fx('trim)p FB(.)24 b(The)c Fx('peek)f FB(option)j(is)f(not)h +(available.)805 2012 y(The)17 b(following)h(pr)o(ocedur)o(es)c(r)o(ead) +h(in)i(strings)h(fr)o(om)e(ports)g(delimited)h(by)f(characters)681 +2112 y(belonging)34 b(to)g(a)e(speci\002c)h(set.)62 b(See)33 +b(section)g(5.3)f(for)h(information)h(on)f(character)f(set)681 +2211 y(manipulation.)681 2361 y Fx(\(read-delimited)37 +b FA(char-set)20 b([port)g(handle-delim])p Fx(\))85 b +Ft(\000)-14 b(!)87 b FA(string)21 b(or)g(eof)101 b FB(pr)o(ocedur)o(e) +888 2503 y(Read)46 b(until)i(we)e(encounter)h(one)g(of)f(the)h(chars)f +(in)h FA(char-set)f FB(or)h(eof.)102 b(The)888 2602 y +FA(handle-delim)19 b FB(parameter)f(determines)i(how)h(the)g +(terminating)f(character)f(is)h(han-)888 2702 y(dled.)25 +b(It)c(is)g(described)f(above,)g(and)g(defaults)g(to)h +Fx('trim)p FB(.)888 2835 y(The)g FA(char-set)f FB(ar)o(gument)h(may)f +(be)h(a)f(charset,)g(a)h(string,)g(a)f(character)-6 b(,)19 +b(or)i(a)g(charac-)888 2935 y(ter)g(pr)o(edicate;)d(it)j(is)g(coer)o +(ced)f(to)h(a)f(charset.)681 3127 y Fx(\(read-delimited!)37 +b FA(char-set)15 b(buf)h([port)f(handle-delim)f(start)i(end])p +Fx(\))43 b Ft(\000)-15 b(!)44 b FA(nchars)16 b(or)g(eof)g(or)g(#f)86 +b FB(pr)o(ocedur)o(e)888 3268 y(A)21 b(side-ef)o(fecting)e(variant)h +(of)h Fx(read-delimited)p FB(.)888 3402 y(The)26 b(data)f(is)i(written) +f(into)h(the)f(string)h FA(buf)g FB(at)e(the)h(indices)h(in)f(the)g +(half-open)g(in-)888 3501 y(terval)h Fm([)p FA(start)o +Fy(;)14 b FA(end)p Fm(\))p FB(;)31 b(the)c(default)f(interval)h(is)g +(the)g(whole)h(string:)39 b FA(start)c Fm(=)f(0)26 b +FB(and)888 3601 y FA(end)k Fm(=)g Fx(\(string-length)38 +b FA(buf)p Fx(\))p FB(.)f(The)24 b(values)g(of)h FA(start)f +FB(and)g FA(end)g FB(must)h(specify)g(a)888 3700 y(well-de\002ned)c +(interval)f(in)h FA(str)p FB(,)g FA(i.e.)p FB(,)f Fm(0)j +Ft(\024)g FA(start)f Ft(\024)h FA(end)g Ft(\024)g Fx(\(string-length)37 +b FA(buf)q Fx(\))p FB(.)888 3834 y(It)21 b(r)o(eturns)e +FA(nbytes)q FB(,)h(the)g(number)g(of)h(bytes)f(r)o(ead.)k(If)19 +b(the)i(buf)o(fer)d(\002lled)j(up)f(without)888 3933 +y(a)32 b(delimiter)f(character)f(being)i(found,)i Fx(#f)d +FB(is)h(r)o(eturned.)57 b(If)32 b(the)f(port)h(is)g(at)f(eof)888 +4033 y(when)22 b(the)f(r)o(ead)e(starts,)h(the)h(eof)f(object)i(is)f(r) +o(eturned.)888 4166 y(If)h(an)f(integer)h(is)g(r)o(eturned)f(\()p +FA(i.e.)p FB(,)g(the)h(r)o(ead)f(is)h(successfully)g(terminated)f(by)h +(r)o(ead-)888 4266 y(ing)35 b(a)e(delimiter)h(character\),)h(then)f +(the)g FA(handle-delim)e FB(parameter)g(determines)888 +4365 y(how)24 b(the)e(terminating)h(character)e(is)i(handled.)30 +b(It)23 b(is)f(described)g(above,)g(and)g(de-)888 4465 +y(faults)f(to)g Fx('trim)p FB(.)681 4657 y Fx(\(\045read-delimited)o(!) +37 b FA(char-set)15 b(buf)i(gobble?)f([port)f(start)g(end])p +Fx(\))43 b Ft(\000)-14 b(!)43 b FA([char-or-eof-or-#f)14 +b(integer])87 b FB(pr)o(ocedur)o(e)888 4799 y(This)20 +b(low-level)f(delimited)g(r)o(eader)d(uses)k(an)e(alternate)g +(interface.)24 b(It)19 b(r)o(eturns)f(two)888 4898 y(values:)25 +b FA(terminator)c FB(and)f FA(num-r)o(ead)o FB(.)681 +5147 y(1)-5 b(10)p 1952 5071 323 4 v 1952 5173 4 102 +v 1178 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 +w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 111 117 -111 116 bop 573 614 a Fw(field-splitter)36 b FA(The)20 b(r)o(egular)g(expr)o -(ession)g(speci\256es)h(the)g(actual)f(\256eld.)573 759 y Fw(suffix-splitter) -35 b FA(Delimiters)d(ar)o(e)e(interpr)o(eted)g(as)h(element)h -Fz(terminators)p FA(.)59 b(If)756 859 y(vertical-bar)13 b(is)j(the)g(the)f -(delimiter)-6 b(,)16 b(then)g(the)g(string)g Fw("")f FA(is)h(the)g(empty)f(r) -o(ecor)o(d)756 958 y Fw(\(\))p FA(,)k Fw("foo|")g FA(pr)o(oduces)h(a)g -(one-\256eld)h(r)o(ecor)o(d)f Fw(\("foo"\))p FA(,)d(and)k Fw("foo")e -FA(is)i(an)g(er)o(-)756 1058 y(r)o(or)-6 b(.)756 1180 y(The)20 -b(syntax)h(of)g(suf)o(\256x-delimited)f(r)o(ecor)o(ds)f(is:)961 -1349 y Fx(<)p Fz(r)o(ecord)p Fx(>)98 b FA(::=)h Fw("")186 b -FA(\(Empty)21 b(r)o(ecor)o(d\))1431 1448 y Fs(j)134 b Fx(<)p -Fz(element)p Fx(>)21 b(<)p Fz(delim)p Fx(>)e(<)p Fz(r)o(ecord)p -Fx(>)756 1637 y FA(It)27 b(is)i(an)e(err)o(or)g(if)h(a)f(non-empty)i(r)o -(ecor)o(d)d(does)i(not)g(end)g(with)h(a)e(delimiter)-6 b(.)756 -1736 y(T)e(o)22 b(make)g(the)g(last)g(delimiter)g(optional,)h(make)f(sur)o(e) -g(the)g(delimiter)g(r)o(egexp)756 1836 y(matches)e(the)h(end-of-string)g(\(r) -o(egexp)e Fw("$)o(")p FA(\).)573 1981 y Fw(infix-splitter)36 -b FA(Delimiters)43 b(ar)o(e)f(interpr)o(eted)g(as)h(element)g -Fz(separators)p FA(.)95 b(If)756 2080 y(comma)21 b(is)g(the)g(delimiter)-6 -b(,)21 b(then)g(the)h(string)f Fw("foo,")e FA(pr)o(oduces)h(a)g(two-\256eld) -756 2180 y(r)o(ecor)o(d)f Fw(\("foo")41 b(""\))p FA(.)756 2302 -y(The)20 b(syntax)h(of)g(in\256x-delimited)g(r)o(ecor)o(ds)e(is:)961 -2471 y Fx(<)p Fz(r)o(ecord)p Fx(>)431 b FA(::=)99 b Fw("")186 -b FA(\(For)o(ced)20 b(to)h(be)f(empty)h(r)o(ecor)o(d\))1764 -2570 y Fs(j)134 b Fx(<)p Fz(r)o(eal-in\256x-r)o(ecord)p Fx(>)961 -2769 y(<)p Fz(r)o(eal-in\256x-r)o(ecord)p Fx(>)97 b FA(::=)i -Fx(<)p Fz(element)p Fx(>)21 b(<)p Fz(delim)p Fx(>)e(<)p Fz(r)o(eal-in\256x-r) -o(ecord)p Fx(>)1764 2869 y Fs(j)134 b Fx(<)p Fz(element)p Fx(>)756 -3057 y FA(Note)52 b(that)g(separator)g(semantics)g(doesn't)h(r)o(eally)e -(allow)i(for)f(empty)756 3157 y(r)o(ecor)o(ds\320the)k(straightforwar)o(d)h -(grammar)g(\()p Fz(i.e.)o FA(,)67 b Fx(<)p Fz(r)o(eal-in\256x-r)o(ecord)p -Fx(>)p FA(\))756 3257 y(parses)34 b(an)h(empty)g(string)h(as)f(a)g(singleton) -h(list)g(whose)g(one)g(\256eld)f(is)g(the)756 3356 y(empty)21 -b(string,)g Fw(\(""\))p FA(,)f(not)h(as)g(the)h(empty)f(r)o(ecor)o(d)e -Fw(\(\))p FA(.)28 b(This)21 b(is)h(unfortunate,)756 3456 y(since)c(it)g -(means)g(that)g(in\256x)h(string)g(parsing)f(doesn't)g(make)g -Fw(string-append)756 3555 y FA(and)i Fw(append)e FA(isomorphic.)29 -b(For)21 b(example,)911 3722 y Fw(\(\(infix-splitter)37 b(":"\))42 -b(\(string-append)37 b Fz(x)44 b Fw(":")e Fz(y)o Fw(\)\))756 -3889 y FA(doesn't)21 b(always)f(equal)911 4034 y Fw(\(append)40 -b(\(\(infix-splitter)d(":"\))42 b Fz(x)p Fw(\))1259 4133 y -(\(\(infix-splitter)37 b(":"\))42 b Fz(y)p Fw(\)\))756 4278 -y FA(It)23 b(fails)f(when)i Fz(x)f FA(or)g Fz(y)f FA(ar)o(e)g(the)h(empty)h -(string.)35 b(T)-8 b(erminator)23 b(semantics)h Fz(does)756 -4378 y FA(pr)o(eserve)19 b(a)h(similar)h(isomorphism.)756 4500 -y(However)-6 b(,)32 b(separator)d(semantics)i(is)g(fr)o(equently)g(what)f -(other)h(Unix)g(soft-)756 4599 y(war)o(e)21 b(uses,)i(so)g(to)g(parse)e -(their)i(strings,)h(we)e(need)g(to)h(use)g(it.)33 b(For)23 -b(example,)756 4699 y(Unix)g Fw($PATH)e FA(lists)j(have)f(separator)f -(semantics.)36 b(The)23 b(path)g(list)h Fw("/bin:")c FA(is)756 -4799 y(br)o(oken)h(up)g(into)h Fw(\("/bin")41 b(""\))p FA(,)20 -b(not)i Fw(\("/bin"\))p FA(.)k(Comma-separated)20 b(lists)756 -4898 y(should)h(also)g(be)f(parsed)g(this)i(way)-9 b(.)365 -5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p -1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 -V 1636 5176 323 4 v 1183 w FA(1)-5 b(1)g(1)p eop +111 116 bop 573 614 a Fz(terminator)40 b FB(A)20 b(value)g(describing)h +(why)g(the)g(r)o(ead)e(was)i(terminated:)805 842 y(Character)f(or)g +(eof-object)166 b Ft(\))g FB(Read)21 b(terminated)f(by)h(this)g(value.) +805 941 y Fx(#f)912 b Ft(\))166 b FB(Filled)21 b(buf)o(fer)e(without)j +(\002nding)g(a)e(delimiter)-6 b(.)573 1090 y Fz(num-read)39 +b FB(Number)21 b(of)g(characters)e(r)o(ead)g(into)j FA(buf)p +FB(.)573 1256 y(If)31 b(the)g(r)o(ead)f(is)i(successfully)g(terminated) +e(by)i(r)o(eading)e(a)h(delimiter)g(character)-6 b(,)573 +1356 y(then)27 b(the)g FA(gobble?)f FB(parameter)f(determines)i(what)f +(to)h(do)g(with)g(the)g(terminating)573 1456 y(character)-6 +b(.)23 b(If)c(tr)o(ue,)g(the)h(character)e(is)h(r)o(emoved)g(fr)o(om)g +(the)g(input)h(str)o(eam;)e(if)i(false,)573 1555 y(the)29 +b(character)e(is)i(left)g(in)g(the)g(input)g(str)o(eam)f(wher)o(e)h(a)f +(subsequent)h(r)o(ead)f(oper)o(-)573 1655 y(ation)h(will)g(r)o(etrieve) +e(it.)48 b(In)29 b(either)g(case,)g(the)g(character)d(is)j(also)g(the)f +(\002rst)h(value)573 1755 y(r)o(eturned)19 b(by)i(the)g(pr)o(ocedur)o +(e)e(call.)365 1945 y Fx(\(skip-char-set)38 b FA(skip-chars)20 +b([port])p Fx(\))85 b Ft(\000)-14 b(!)87 b FA(integer)697 +b FB(pr)o(ocedur)o(e)573 2087 y(Skip)20 b(characters)f(occurring)i(in)g +(the)g(set)f FA(skip-chars)o FB(;)h(r)o(eturn)e(the)i(number)f(of)h +(char)o(-)573 2186 y(acters)c(skipped.)24 b(The)17 b +FA(skip-chars)g FB(ar)o(gument)g(may)h(be)f(a)g(charset,)g(a)g(string,) +i(a)e(char)o(-)573 2286 y(acter)-6 b(,)19 b(or)i(a)f(character)g(pr)o +(edicate;)e(it)j(is)g(coer)o(ced)f(to)h(a)f(charset.)365 +5147 y FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1183 w FB(1)-5 b(1)g(1)p +eop %%Page: 112 118 -112 117 bop 681 535 2865 4 v 681 1403 4 868 v 835 657 a Fj(Recor)o(d)218 -b(:)24 b(suf)o(\256x)146 b Fi(:|$)19 b Fj(suf)o(\256x)288 b(:)25 -b(in\256x)417 b(non-:)25 b(\256eld)p 785 688 2656 4 v 835 752 -a Fi("")375 b(\(\))296 b(\(\))531 b(\(\))h(\(\))835 843 y(":")336 -b(\(""\))218 b(\(""\))453 b(\("")40 b(""\))336 b(\(\))835 934 -y("foo:")219 b(\("foo"\))101 b(\("foo"\))336 b(\("foo")41 b(""\))218 -b(\("foo"\))835 1026 y(":foo")h Fg(err)o(or)226 b Fi(\("")40 -b("foo"\))218 b(\("")40 b("foo"\))219 b(\("foo"\))835 1117 -y("foo:bar")102 b Fg(err)o(or)226 b Fi(\("foo")40 b("bar"\))101 -b(\("foo")41 b("bar"\))101 b(\("foo")41 b("bar"\))946 1379 -y FA(Figur)o(e)20 b(7.1:)26 b(Using)21 b(dif)o(fer)o(ent)e(grammars)h(to)h -(split)h(r)o(ecor)o(ds)d(into)i(\256elds.)p 3542 1403 4 868 -v 681 1406 2865 4 v 888 1636 a Fw(sloppy-suffix)36 b FA(The)23 -b(same)f(as)g(the)g Fw(suffix)e FA(case,)i(except)f(that)i(the)f(parser)f -(will)1071 1735 y(skip)26 b(an)f(initial)g(delimiter)g(string)h(if)f(the)g -(string)h(begins)g(with)g(one)f(instead)1071 1835 y(of)33 b(parsing)f(an)h -(initial)g(empty)g(\256eld.)63 b(This)33 b(can)f(be)h(used,)i(for)d(example,) -1071 1935 y(to)27 b(\256eld-split)g(a)f(sequence)i(of)e(English)i(text)f(at)f -(white-space)h(boundaries,)1071 2034 y(wher)o(e)19 b(the)h(string)h(may)e -(begin)h(or)g(end)g(with)g(white)h(space,)e(by)h(using)g(r)o(egex)1071 -2134 y Fw("[)43 b(\\t]+|$")p FA(.)25 b(\(But)c(you)g(would)h(be)f(better)f -(of)o(f)g(using)i Fw(field-splitter)16 b FA(in)1071 2234 y(this)21 -b(case.\))805 2440 y(Figur)o(e)28 b(7.1)e(shows)j(how)g(the)f(dif)o(fer)o -(ent)d(parser)i(grammars)h(split)g(apart)e(the)i(same)681 2540 -y(strings.)55 b(Having)19 b(to)h(choose)g(between)g(the)f(dif)o(fer)o(ent)f -(grammars)h(r)o(equir)o(es)f(you)i(to)g(de-)681 2639 y(cide)d(what)g(you)h -(want,)f(but)h(at)f(least)f(you)i(can)f(be)g(pr)o(ecise)f(about)h(what)h(you) -f(ar)o(e)f(parsing.)681 2739 y(T)-8 b(ake)20 b(\256fteen)g(seconds)h(and)f -(think)h(it)g(out.)28 b(Say)19 b(what)i(you)g(mean;)f(mean)g(what)h(you)g -(say)-9 b(.)681 2879 y Fw(\(join-strings)38 b Fz(string-list)20 -b([delimiter)h(grammar])p Fw(\))85 b Fs(\000)-14 b(!)87 b Fz(string)282 -b FA(pr)o(ocedur)o(e)888 3010 y(This)22 b(pr)o(ocedur)o(e)d(is)i(a)g(simple)g -(unparser)o(\320it)f(pastes)h(strings)h(together)f(using)h(the)888 -3110 y(delimiter)f(string.)888 3238 y(The)40 b Fz(grammar)f -FA(ar)o(gument)g(is)h(one)h(of)e(the)h(symbols)h Fw(infix)d -FA(\(the)i(default\))e(or)888 3338 y Fw(suffix)p FA(;)20 b(it)j(determines)e -(whether)i(the)f(delimiter)g(string)h(is)f(used)g(as)g(a)f(separator)888 -3437 y(or)g(as)g(a)f(terminator)-6 b(.)888 3565 y(The)20 b(delimiter)f(is)h -(the)g(string)g(used)g(to)g(delimit)g(elements;)g(it)f(defaults)g(to)h(a)f -(single)888 3665 y(space)h Fw(")43 b(")p FA(.)888 3793 y(Example:)1071 -3949 y Fw(\(join-strings)38 b('\("foo")j("bar")g("baz"\))h(":"\))1245 -4049 y Fl(=)-14 b Fs(\))87 b Fw("foo:bar:baz")681 4381 y Fy(7.1.3)81 -b(Field)19 b(readers)681 4579 y Fw(\(field-reader)38 b Fz([\256eld-parser)20 -b(r)o(ec-r)o(eader])p Fw(\))86 b Fs(\000)-14 b(!)87 b Fz(pr)o(ocedur)o(e)418 -b FA(pr)o(ocedur)o(e)888 4699 y(This)33 b(utility)f(r)o(eturns)g(a)f(pr)o -(ocedur)o(e)f(that)i(r)o(eads)e(r)o(ecor)o(ds)g(with)j(\256eld)f(str)o(uctur) -o(e)888 4799 y(fr)o(om)27 b(a)g(port.)46 b(The)27 b(r)o(eader)6 -b('s)25 b(interface)h(is)i(designed)f(to)g(make)g(it)g(useful)g(in)h(the)888 -4898 y Fw(awk)20 b FA(loop)h(macr)o(o)f(\(section)h(7.2\).)26 -b(The)21 b(r)o(eader)e(is)i(used)f(as)h(follows:)681 5147 y(1)-5 -b(12)p 1952 5071 323 4 v 1952 5173 4 102 v 1178 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +112 117 bop 681 1307 a Fw(Chapter)44 b(7)681 1792 y FC(A)-14 +b(wk,)51 b(record)h(I/O,)g(and)g(\002eld)681 2041 y(parsing)681 +2567 y FB(Unix)33 b(pr)o(ograms)g(fr)o(equently)g(pr)o(ocess)g(str)o +(eams)g(of)g(r)o(ecor)o(ds,)i(wher)o(e)e(each)g(r)o(ecor)o(d)f(is)681 +2667 y(delimited)27 b(by)h(a)g(newline,)i(and)d(r)o(ecor)o(ds)f(ar)o(e) +h(br)o(oken)g(into)i(\002elds)f(with)g(other)g(delim-)681 +2767 y(iters)f(\(for)f(example,)h(the)g(colon)h(character)e(in)h +Fx(/etc/passwd)p FB(\).)39 b(Scsh)27 b(has)g(pr)o(ocedur)o(es)681 +2866 y(that)i(allow)h(the)g(pr)o(ogrammer)f(to)h(easily)f(do)h(this)g +(kind)g(of)g(pr)o(ocessing.)52 b(Scsh's)30 b(\002eld)681 +2966 y(parsers)j(can)h(also)h(be)f(used)g(to)h(parse)e(other)i(kinds)g +(of)f(delimited)g(strings,)39 b(such)34 b(as)681 3066 +y(colon-separated)26 b Fx($PATH)e FB(lists.)45 b(These)27 +b(r)o(outines)g(can)f(be)h(used)f(with)i(scsh's)g Fx(awk)d +FB(loop)681 3165 y(constr)o(uct)f(to)g(conveniently)h(perform)e +(pattern-dir)o(ected)e(computation)j(over)g(str)o(eams)681 +3265 y(of)d(r)o(ecor)o(ds.)681 3658 y Fv(7.1)99 b(Record)25 +b(I/O)g(and)f(\002eld)h(parsing)681 3932 y FB(The)f(pr)o(ocedur)o(es)e +(in)i(this)h(section)g(ar)o(e)d(used)i(to)g(r)o(ead)f(r)o(ecor)o(ds)f +(fr)o(om)i(I/O)g(str)o(eams)f(and)681 4031 y(parse)16 +b(them)i(into)g(\002elds.)25 b(A)17 b(r)o(ecor)o(d)e(is)j(de\002ned)f +(as)g(text)g(terminated)g(by)g(some)h(delimiter)681 4131 +y(\(usually)25 b(a)f(newline\).)38 b(A)24 b(r)o(ecor)o(d)g(can)g(be)h +(split)g(into)h(\002elds)e(by)h(using)h(r)o(egular)e(expr)o(es-)681 +4230 y(sions)k(in)f(one)g(of)g(several)f(ways:)37 b(to)27 +b FA(match)e FB(\002elds,)j(to)f FA(separate)g FB(\002elds,)h(or)f(to)g +FA(terminate)681 4330 y FB(\002elds.)41 b(The)25 b(\002eld)h(parsers)f +(can)h(be)f(applied)g(to)h(arbitrary)f(strings)i(\(one)f(common)h(use) +681 4430 y(is)f(splitting)g(envir)o(onment)g(variables)f(such)g(as)h +Fx($PATH)d FB(at)i(colons)i(into)f(its)g(component)681 +4529 y(elements\).)805 4699 y(The)18 b(general)g(delimited-input)g(pr)o +(ocedur)o(es)e(described)h(in)h(chapter)f(6)h(ar)o(e)e(also)i(use-)681 +4799 y(ful)36 b(for)h(r)o(eading)e(simple)i(r)o(ecor)o(ds,)i(such)e(as) +g(single)g(lines,)k(paragraphs)35 b(of)i(text,)j(or)681 +4898 y(strings)21 b(terminated)g(by)f(speci\002c)h(characters.)681 +5147 y(1)-5 b(12)p 1952 5071 323 4 v 1952 5173 4 102 +v 1178 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 +w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 113 119 -113 118 bop 756 614 a Fw(\()p Fz(r)o(eader)43 b([port])n Fw(\))h -Fl(=)-14 b Fs(\))86 b Fz([raw-r)o(ecord)20 b(parsed-r)o(ecord])42 -b Fw(or)h Fz([eof)21 b(\(\)])573 793 y FA(When)27 b(the)h(r)o(eader)d(is)i -(applied)g(to)g(an)g(input)h(port)f(\(default:)39 b(the)28 -b(curr)o(ent)e(input)573 892 y(port\),)19 b(it)g(r)o(eads)e(a)i(r)o(ecor)o(d) -e(using)j Fz(r)o(ec-r)o(eader)o FA(.)27 b(If)19 b(this)g(r)o(ecor)o(d)e -(isn't)j(the)f(eof)g(object,)g(it)573 992 y(is)25 b(parsed)e(with)i -Fz(\256eld-parser)p FA(.)38 b(These)24 b(two)h(values\320the)f(r)o(ecor)o(d,) -f(and)h(its)h(parsed)573 1091 y(r)o(epr)o(esentation\320ar)o(e)18 -b(r)o(eturned)i(as)g(multiple)h(values)g(fr)o(om)f(the)h(r)o(eader)-6 -b(.)573 1226 y(When)21 b(called)f(at)g(eof,)h(the)f(r)o(eader)f(r)o(eturns)h -([eof-object)g Fw(\(\))p FA(].)573 1361 y(Although)e(the)g(r)o(ecor)o(d)e(r)o -(eader)f(typically)j(r)o(eturns)f(a)g(string,)h(and)f(the)h(\256eld-parser) -573 1461 y(typically)k(takes)g(a)g(string)h(ar)o(gument,)e(this)i(is)g(not)g -(r)o(equir)o(ed.)30 b(The)22 b(r)o(ecor)o(d)f(r)o(eader)573 -1560 y(can)c(pr)o(oduce,)g(and)h(the)g(\256eld-parser)e(consume,)j(values)e -(of)h(any)g(type.)26 b(However)-6 b(,)573 1660 y(the)24 b(empty)h(list)g(r)o -(eturned)e(as)i(the)f(parsed)g(value)f(on)j(eof)e(is)h(har)o(dwir)o(ed)d -(into)j(the)573 1759 y(\256eld)20 b(r)o(eader)-6 b(.)573 1894 -y(For)21 b(example,)f(if)g(port)h Fw(p)f FA(is)i(open)f(on)g -Fw(/etc/passwd)p FA(,)16 b(then)756 2037 y Fw(\(\(field-reader)37 -b(\(infix-splitter)h(":")k(7\)\))g(p\))573 2172 y FA(r)o(eturns)20 -b(two)i(values:)573 2299 y Fi("dalbertz:mx3Uaqq0:107:22:Davi)q(d)45 -b(Albertz:/users/dalbertz:/bin/)q(csh")573 2390 y(\("dalbertz")d("mx3Uaqq0")f -("107")f("22")h("David)f(Albertz")h("/users/dalbertz")1044 -2481 y("/bin/csh"\))595 2616 y FA(The)23 b Fz(\256eld-parser)f -FA(defaults)g(to)g(the)h(value)f(of)g Fw(\(field-splitter\))p -FA(,)16 b(a)22 b(parser)g(that)573 2716 y(picks)f(out)g(sequences)g(of)g -(non-white-space)g(strings.)573 2850 y(The)g Fz(r)o(ec-r)o(eader)f -FA(defaults)g(to)h Fw(read-line)p FA(.)573 2985 y(Figur)o(e)15 -b(7.2)f(shows)j Fw(field-reader)11 b FA(being)16 b(used)f(to)h(r)o(ead)e(dif) -o(fer)o(ent)f(kinds)j(of)g(Unix)573 3085 y(r)o(ecor)o(ds.)365 -3361 y Fy(7.1.4)81 b(Forward-progress)21 b(guarantees)d(and)i(empty-string)e -(matches)365 3548 y FA(A)j(loop)g(that)g(pulls)g(text)f(of)o(f)g(a)g(string)i -(by)e(r)o(epeatedly)f(matching)i(a)g(r)o(egexp)e(against)i(that)365 -3647 y(string)28 b(can)g(conceivably)f(get)g(stuck)h(in)g(an)f(in\256nite)i -(loop)f(if)f(the)h(r)o(egexp)e(matches)h(the)365 3747 y(empty)d(string.)37 -b(For)24 b(example,)g(the)g(r)o(egexps)e Fw(^)p FA(,)i Fw($)p -FA(,)g Fw(.*)p FA(,)f(and)h Fw(foo|[^f]*)c FA(can)j(all)g(match)365 -3846 y(the)e(empty)g(string.)490 3974 y(The)15 b(r)o(outines)h(in)f(this)h -(package)e(that)i(iterate)e(thr)o(ough)i(strings)g(with)g(r)o(egular)e(expr)o -(es-)365 4073 y(sions)i(ar)o(e)d(car)o(eful)g(to)i(handle)f(this)i -(empty-string)f(case.)24 b(If)15 b(a)f(r)o(egexp)f(matches)i(the)f(empty)365 -4173 y(string,)19 b(the)e(next)g(sear)o(ch)f(starts,)i(not)f(fr)o(om)g(the)g -(end)g(of)g(the)h(match)f(\(which)g(in)h(the)f(empty)365 4273 -y(string)25 b(case)e(is)h(also)g(the)g(beginning\320that's)i(the)e(pr)o -(oblem\),)g(but)g(fr)o(om)f(the)h(next)g(char)o(-)365 4372 -y(acter)h(over)-6 b(.)42 b(This)27 b(is)f(the)g(corr)o(ect)e(behaviour)-6 -b(.)43 b(Regexps)25 b(match)h(the)g(longest)h(possible)365 -4472 y(string)21 b(at)f(a)f(given)i(location,)f(so)h(if)f(the)g(r)o(egexp)f -(matched)g(the)h(empty)g(string)h(at)f(location)365 4572 y -Fx(i)p FA(,)e(then)h(it)f(is)h(guaranteed)e(it)h(could)g(not)h(have)f -(matched)f(a)h(longer)h(pattern)e(starting)i(with)365 4671 -y(character)h Fx(i)p FA(.)27 b(So)20 b(we)h(can)f(safely)h(begin)g(our)g -(sear)o(ch)e(for)i(the)g(next)g(match)f(at)h(char)f Fx(i)e -Fl(+)g(1)p FA(.)490 4799 y(W)-5 b(ith)24 b(this)h(pr)o(ovision,)f(every)f -(iteration)h(thr)o(ough)g(the)f(loop)h(makes)g(some)g(forwar)o(d)365 -4898 y(pr)o(ogr)o(ess,)c(and)g(the)h(loop)h(is)f(guaranteed)e(to)i -(terminate.)365 5147 y FD(November)d(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1179 w FA(1)-5 b(13)p eop +113 118 bop 365 614 a Fz(7.1.1)81 b(Reading)19 b(records)365 +821 y Fx(\(record-reader)38 b FA([delims)15 b(elide-delims?)g +(handle-delim])p Fx(\))42 b Ft(\000)-14 b(!)43 b FA(pr)o(ocedur)o(e)86 +b FB(pr)o(ocedur)o(e)573 946 y(Returns)32 b(a)f(pr)o(ocedur)o(e)e(that) +i(r)o(eads)f(r)o(ecor)o(ds)g(fr)o(om)h(a)f(port.)58 b(The)31 +b(pr)o(ocedur)o(e)e(is)573 1045 y(invoked)21 b(as)f(follows:)756 +1184 y Fx(\()p FA(r)o(eader)43 b([port])n Fx(\))h Ft(\000)-15 +b(!)44 b FA(string)21 b(or)g(eof)573 1322 y FB(A)i(r)o(ecor)o(d)f(is)i +(a)f(sequence)h(of)f(characters)g(terminated)g(by)h(one)g(of)f(the)h +(characters)573 1422 y(in)32 b FA(delims)g FB(or)f(eof.)58 +b(If)32 b FA(elide-delims?)f FB(is)h(tr)o(ue,)i(then)e(a)f(contiguous)j +(sequence)e(of)573 1522 y(delimiter)c(chars)h(ar)o(e)e(taken)h(as)h(a)f +(single)h(r)o(ecor)o(d)e(delimiter)-6 b(.)49 b(If)28 +b FA(elide-delims?)g FB(is)573 1621 y(false,)34 b(then)e(a)g(delimiter) +g(char)f(coming)j(immediately)e(after)f(a)g(delimiter)h(char)573 +1721 y(pr)o(oduces)c(an)i(empty-string)g(r)o(ecor)o(d.)50 +b(The)29 b(r)o(eader)e(consumes)k(the)f(delimiting)573 +1820 y(char\(s\))20 b(befor)o(e)f(r)o(eturning)i(fr)o(om)f(a)g(r)o +(ead.)573 1953 y(The)26 b FA(delims)g FB(set)g(defaults)f(to)i(the)f +(set)g Ft(f)p FB(newline)p Ft(g)p FB(.)41 b(It)26 b(may)g(be)g(a)f +(charset,)i(string,)573 2053 y(character)-6 b(,)49 b(or)44 +b(character)g(pr)o(edicate,)k(and)c(is)h(coer)o(ced)f(to)h(a)f +(charset.)97 b(The)573 2152 y FA(elide-delims?)20 b FB(\003ag)h +(defaults)f(to)h Fx(#f)p FB(.)573 2285 y(The)f FA(handle-delim)f +FB(ar)o(gument)g(contr)o(ols)i(what)f(is)h(done)f(with)h(the)f(r)o +(ecor)o(d's)f(termi-)573 2384 y(nating)i(delimiter)-6 +b(.)805 2525 y Fx('trim)185 b FB(Delimiters)19 b(ar)o(e)e(trimmed.)25 +b(\(The)18 b(default\))805 2624 y Fx('split)141 b FB(Reader)36 +b(r)o(eturns)g(delimiter)g(string)h(as)f(a)1210 2724 +y(second)29 b(ar)o(gument.)49 b(If)29 b(r)o(ecor)o(d)e(is)i(termi-)1210 +2824 y(nated)k(by)h(EOF)-8 b(,)34 b(then)g(the)f(eof)h(object)g(is)1210 +2923 y(r)o(eturned)20 b(as)g(this)i(second)f(ar)o(gument.)805 +3023 y Fx('concat)97 b FB(The)38 b(r)o(ecor)o(d)e(and)h(its)h +(delimiter)g(ar)o(e)e(r)o(e-)1210 3122 y(turned)21 b(as)f(a)g(single)i +(string.)573 3293 y(The)34 b(r)o(eader)e(pr)o(ocedur)o(e)g(r)o(eturned) +h(takes)g(one)i(optional)g(ar)o(gument,)h(the)e(port)573 +3392 y(fr)o(om)21 b(which)h(to)g(r)o(ead,)d(which)j(defaults)f(to)g +(the)h(curr)o(ent)e(input)i(port.)27 b(It)21 b(r)o(eturns)g(a)573 +3492 y(string)g(or)g(eof.)365 3759 y Fz(7.1.2)81 b(Parsing)20 +b(\002elds)365 3966 y Fx(\(field-splitter)38 b FA([r)o(egexp)19 +b(num-\002elds])p Fx(\))86 b Ft(\000)-14 b(!)87 b FA(pr)o(ocedur)o(e) +460 b FB(pr)o(ocedur)o(e)365 4066 y Fx(\(infix-splitter)38 +b FA([delim)17 b(num-\002elds)h(handle-delim])p Fx(\))65 +b Ft(\000)-14 b(!)66 b FA(pr)o(ocedur)o(e)87 b FB(pr)o(ocedur)o(e)365 +4165 y Fx(\(suffix-splitter)37 b FA([delim)16 b(num-\002elds)f +(handle-delim])p Fx(\))45 b Ft(\000)-14 b(!)47 b FA(pr)o(ocedur)o(e)87 +b FB(pr)o(ocedur)o(e)365 4265 y Fx(\(sloppy-suffix-sp)o(li)o(tte)o(r)37 +b FA([delim)15 b(num-\002elds)h(handle-delim])p Fx(\))41 +b Ft(\000)-14 b(!)43 b FA(pr)o(ocedur)o(e)87 b FB(pr)o(ocedur)o(e)573 +4389 y(These)21 b(functions)g(r)o(eturn)f(a)h(parser)e(function)j(that) +f(can)f(be)g(used)h(as)f(follows:)756 4528 y Fx(\()p +FA(parser)43 b(string)h([start])o Fx(\))f Ft(\000)-14 +b(!)43 b FA(string-list)573 4699 y FB(The)27 b(r)o(eturned)f(parsers)h +(split)g(strings)h(into)h(\002elds)e(de\002ned)g(by)g(r)o(egular)f +(expr)o(es-)573 4799 y(sions.)g(Y)-8 b(ou)19 b(can)e(parse)h(by)g +(specifying)g(a)g(pattern)f(that)h FA(separates)g FB(\002elds,)h(a)e +(pattern)573 4898 y(that)k FA(terminates)f FB(\002elds,)h(or)g(a)f +(pattern)g(that)h FA(matches)f FB(\002elds:)365 5147 +y FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1179 w FB(1)-5 b(13)p eop %%Page: 114 120 -114 119 bop 681 1310 2865 4 v 681 4120 4 2811 v 718 1426 a -Fw(;;;)42 b(/etc/passwd)e(reader)718 1525 y(\(field-reader)e -(\(infix-splitter)g(":")k(7\)\))892 1625 y(;)i(wandy:3xuncWdpK)o(hR.)o(:7)o -(3:2)o(2:)o(Wa)o(ndy)37 b(Saetan:/usr/wand)o(y:)o(/bi)o(n/)o(cs)o(h)718 -1824 y(;;;)42 b(Two)h(ls)g(-l)f(output)f(readers)718 1924 y(\(field-reader)d -(\(infix-splitter)g("[)k(\\t]+")g(8\)\))718 2024 y(\(field-reader)c -(\(infix-splitter)g("[)k(\\t]+")g(-7\)\))892 2123 y(;)i(-rw-r--r--)83 -b(1)43 b(shivers)171 b(22880)42 b(Sep)g(24)h(12:45)e(scsh.scm)718 -2322 y(;;;)h(Internet)f(hostname)f(reader)718 2422 y(\(field-reader)e -(\(field-splitter)g("[^.]+"\)\))892 2522 y(;)44 b(stat.sinica.edu)o(.tw)718 -2721 y(;;;)e(Internet)f(IP)i(address)d(reader)718 2821 y(\(field-reader)e -(\(field-splitter)g("[^.]+")i(4\)\))892 2920 y(;)k(18.24.0.241)718 -3119 y(;;;)e(Line)g(of)h(integers)718 3219 y(\(let)f(\(\(parser)e -(\(field-splitter)e("[+-]?[0-9]+"\)\)\))805 3319 y(\(field-reader)h(\()p -Fx(\025)f Fw(\(s\))43 b(\(map)f(string->number)37 b(\(parser)k(s\)\)\)\))892 -3418 y(;)j(18)e(24)h(0)g(241)718 3618 y(;;;)f(Same)g(as)h(above.)718 -3717 y(\(let)f(\(\(reader)e(\(field-reader)f(\(field-splitter)e -("[+-]?[0-9]+"\)\)\))o(\))805 3817 y(\()p Fx(\025)i Fw(maybe-port)h(\(map)h -(string->number)d(\(apply)j(reader)g(maybe-port\)\)\)\))892 -3917 y(;)j(Yale)e(beat)g(harvard)e(26)j(to)g(7.)1304 4096 y -FA(Figur)o(e)21 b(7.2:)26 b(Some)21 b(examples)f(of)h Fw(field-reader)p -3542 4120 V 681 4123 2865 4 v 681 5147 a FA(1)-5 b(14)p 1952 -5071 323 4 v 1952 5173 4 102 v 1178 w FC(DRAFT)p 2271 5173 -V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +114 119 bop 1121 601 a FB(Pr)o(ocedur)o(e)748 b(Pattern)p +1071 634 1835 4 v 1121 704 a Fx(field-splitter)509 b +FB(matches)21 b(\002elds)1121 804 y Fx(infix-splitter)509 +b FB(separates)19 b(\002elds)1121 903 y Fx(suffix-splitter)465 +b FB(terminates)20 b(\002elds)1121 1003 y Fx(sloppy-suffix-sp)o(li)o +(tte)o(r)160 b FB(terminates)20 b(\002elds)888 1189 y(These)i(parser)e +(generators)i(ar)o(e)e(contr)o(olled)h(by)h(a)f(range)g(of)h(options,)h +(so)f(that)f(you)888 1288 y(can)31 b(pr)o(ecisely)g(specify)g(what)g +(kind)g(of)h(parsing)f(you)h(want.)57 b(However)-6 b(,)33 +b(these)888 1388 y(options)22 b(default)e(to)h(r)o(easonable)f(values)g +(for)h(general)f(use.)888 1525 y(Defaults:)1121 1605 +y FA(delim)331 b FB(=)84 b Fx("[)43 b(\\t\\n]+|$")95 +b FB(\(suf)o(\002x)20 b(delimiter:)26 b(white)21 b(space)f(or)h(eos\)) +1771 1705 y Fx("[)43 b(\\t\\n]+")183 b FB(\(in\002x)21 +b(delimiter:)26 b(white)21 b(space\))1121 1805 y FA(r)o(e)453 +b FB(=)84 b Fx("[^)42 b(\\t\\n]+")140 b FB(\(non-white-space\))1121 +1904 y FA(num-\002elds)158 b FB(=)84 b Fx(#f)534 b FB(\(as)21 +b(many)g(\002elds)f(as)h(possible\))1121 2004 y FA(handle-delim)81 +b FB(=)j Fx('trim)402 b FB(\(discar)o(d)19 b(delimiter)i(chars\))888 +2102 y(.)12 b(.)g(.)g(which)33 b(means:)45 b(br)o(eak)29 +b(the)i(string)g(at)g(white)g(space,)h(discar)o(ding)e(the)g(white)888 +2202 y(space,)20 b(and)g(parse)g(as)h(many)g(\002elds)g(as)f(possible.) +888 2339 y(The)26 b(r)o(egular)e(expr)o(ession)h FA(delim)f +FB(is)i(used)f(to)h(match)f(\002eld)g(delimiters.)39 +b(It)25 b(can)g(be)888 2439 y(either)16 b(a)g(string)h(or)g(a)e +(compiled)i(r)o(egexp)e(str)o(uctur)o(e)h(\(see)f(the)i +Fx(make-regexp)11 b FB(pr)o(oce-)888 2539 y(dur)o(e\).)31 +b(In)23 b(the)g(separator)e(case,)i(it)g(defaults)f(to)h(a)f(r)o +(egular)g(expr)o(ession)g(matching)888 2638 y(white)j(space;)g(in)g +(the)f(terminator)h(case,)f(it)g(defaults)g(to)g(white)h(space)f(or)g +(end-of-)888 2738 y(string.)888 2875 y(The)f(r)o(egular)f(expr)o +(ession)h FA(r)o(e)h FB(is)f(a)g(r)o(egular)f(expr)o(ession)h(used)f +(to)i(match)f(\002elds.)33 b(It)888 2975 y(defaults)20 +b(to)h(non-white-space.)888 3112 y(The)g(boolean)g FA(handle-delim)f +FB(determines)g(what)h(to)g(do)g(with)h(delimiters.)1121 +3192 y Fx('trim)185 b FB(Delimiters)21 b(ar)o(e)e(thr)o(own)j(away)e +(after)f(parsing.)26 b(\(default\))1121 3292 y Fx('concat)97 +b FB(Delimiters)21 b(ar)o(e)e(appended)h(to)h(the)g(\002eld)f(pr)o +(eceding)g(them.)1121 3391 y Fx('split)141 b FB(Delimiters)21 +b(ar)o(e)e(r)o(eturned)h(as)g(separate)g(elements)h(in)g(the)g(\002eld) +f(list.)888 3528 y(The)31 b FA(num-\002elds)f FB(ar)o(gument)h(used)f +(to)h(cr)o(eate)f(the)g(parser)g(speci\002es)h(how)h(many)888 +3628 y(\002elds)20 b(to)h(parse.)j(If)c Fx(#f)f FB(\(the)h(default\),)e +(the)i(pr)o(ocedur)o(e)e(parses)h(them)i(all.)k(If)19 +b(a)h(pos-)888 3727 y(itive)25 b(integer)g Fy(n)p FB(,)h(exactly)e +(that)h(many)g(\002elds)g(ar)o(e)e(parsed;)i(it)h(is)f(an)f(err)o(or)g +(if)h(ther)o(e)888 3827 y(ar)o(e)g(mor)o(e)h(or)g(fewer)f(than)i +Fy(n)e FB(\002elds)i(in)f(the)g(r)o(ecor)o(d.)40 b(If)26 +b FA(num-\002elds)f FB(is)i(a)e(negative)888 3927 y(integer)20 +b(or)g(zer)o(o,)f(then)i Ft(j)p Fy(n)p Ft(j)f FB(\002elds)g(ar)o(e)e +(parsed,)h(and)h(the)g(r)o(emainder)e(of)i(the)g(string)888 +4026 y(is)k(r)o(eturned)e(in)i(the)g(last)f(element)h(of)f(the)h +(\002eld)f(list;)j(it)d(is)h(an)f(err)o(or)g(if)g(fewer)g(than)888 +4126 y Ft(j)p Fy(n)p Ft(j)e FB(\002elds)g(can)f(be)h(parsed.)888 +4263 y(The)c(\002eld)f(parser)f(pr)o(oduced)g(is)i(a)f(pr)o(ocedur)o(e) +e(that)j(can)f(be)g(employed)g(as)g(follows:)1071 4412 +y Fx(\()p FA(parse)43 b(string)h([start])o Fx(\))f Fm(=)-14 +b Ft(\))44 b FA(string-list)888 4562 y FB(The)30 b(optional)g +FA(start)g FB(ar)o(gument)f(\(default)f(0\))h(speci\002es)h(wher)o(e)f +(in)h(the)g(string)h(to)888 4661 y(begin)21 b(the)g(parse.)k(It)c(is)g +(an)f(err)o(or)g(if)h FA(start)i Fy(>)f Fx(\(string-length)38 +b FA(string)p Fx(\))p FB(.)888 4799 y(The)26 b(parsers)f(r)o(eturned)g +(by)h(the)g(four)f(parser)g(generators)h(implement)g(dif)o(fer)o(ent) +888 4898 y(kinds)c(of)e(\002eld)h(parsing:)681 5147 y(1)-5 +b(14)p 1952 5071 323 4 v 1952 5173 4 102 v 1178 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226) +f(21)13 b(:)f(47)p eop %%Page: 115 121 -115 120 bop 490 614 a FA(This)23 b(has)g(the)g(ef)o(fect)e(you)j(want)f(with) -g(\256eld)g(parsing.)34 b(For)23 b(example,)g(if)f(you)i(split)f(a)365 -714 y(string)28 b(with)f(the)g(empty)g(pattern,)h(you)f(will)g(explode)g(the) -f(string)i(into)f(its)h(individual)365 814 y(characters:)573 -961 y Fw(\(\(suffix-splitte)o(r)37 b(""\))43 b("foo"\))e Fl(=)-14 -b Fs(\))87 b Fw(\("")42 b("f")g("o")h("o"\))365 1107 y FA(However)-6 -b(,)27 b(even)e(though)i(this)f(boundary)g(case)f(is)g(handled)h(corr)o -(ectly)-9 b(,)25 b(we)h(don't)g(r)o(ec-)365 1207 y(ommend)c(using)f(it.)28 -b(Say)20 b(what)h(you)g(mean\320just)h(use)f(a)f(\256eld)g(splitter:)573 -1354 y Fw(\(\(field-splitter)37 b("."\))42 b("foo"\))f Fl(=)-14 -b Fs(\))87 b Fw(\("f")42 b("o")g("o"\))365 1501 y FA(Or)-6 -b(,)21 b(mor)o(e)f(ef)o(\256ciently)-9 b(,)573 1648 y Fw(\(\()p -Fx(\025)38 b Fw(\(s\))43 b(\(map)e(string)h(\(string->list)c(s\)\)\))k -("foo"\))365 1913 y Fy(7.1.5)81 b(Reader)20 b(limitations)365 -2102 y FA(Since)c(all)g(of)g(the)g(r)o(eaders)e(in)i(this)h(package)e(r)o -(equir)o(e)g(the)h(ability)g(to)g(peek)g(ahead)f(one)h(char)365 -2202 y(in)k(the)f(input)h(str)o(eam,)f(they)g(cannot)h(be)f(applied)f(to)i -(raw)f(integer)g(\256le)g(descriptors,)h(only)365 2302 y(Scheme)j(input)g -(ports.)35 b(This)23 b(is)h(because)e(Unix)h(doesn't)g(support)h(peeking)f -(ahead)f(into)365 2401 y(input)g(str)o(eams.)365 2692 y Fu(7.2)99 -b(A)-7 b(wk)365 2914 y FA(Scsh)25 b(pr)o(ovides)g(a)f(loop)i(macr)o(o)e(and)h -(a)f(set)h(of)g(\256eld)g(parsers)f(that)h(can)g(be)g(used)g(to)g(per)o(-)365 -3013 y(form)d(text)g(pr)o(ocessing)g(very)f(similar)h(to)h(the)f(A)-6 -b(wk)21 b(pr)o(ogramming)h(language.)31 b(The)21 b(ba-)365 -3113 y(sic)16 b(functionality)g(of)g(A)-6 b(wk)15 b(is)h(factor)o(ed)e(in)i -(scsh)g(into)h(its)f(component)h(parts.)25 b(The)15 b(contr)o(ol)365 -3212 y(str)o(uctur)o(e)22 b(is)h(pr)o(ovided)e(by)i(the)f Fw(awk)g -FA(loop)h(macr)o(o;)f(the)h(text)f(I/O)h(and)f(parsers)f(ar)o(e)g(pr)o(o-)365 -3312 y(vided)f(by)g(the)g(\256eld-r)o(eader)d(subr)o(outine)j(library)g -(\(section)g(7.1\).)26 b(This)20 b(factoring)g(allows)365 3412 -y(the)k(pr)o(ogrammer)e(to)h(compose)h(the)f(basic)g(loop)h(str)o(uctur)o(e)f -(with)h(any)f(parser)f(or)h(input)365 3511 y(mechanism)c(at)f(all.)26 -b(If)17 b(the)i(parsers)e(pr)o(ovided)g(by)h(the)g(\256eld-r)o(eader)d -(package)i(ar)o(e)g(insuf-)365 3611 y(\256cient,)27 b(the)f(pr)o(ogrammer)f -(can)g(write)h(a)f(custom)i(parser)d(in)j(Scheme)e(and)g(use)h(it)g(with)365 -3711 y(equal)21 b(ease)f(in)h(the)g(awk)g(framework.)490 3840 -y(A)-6 b(wk-in-scheme)20 b(is)i(given)f(by)f(a)h(loop)g(macr)o(o)f(called)g -Fw(awk)p FA(.)26 b(It)21 b(looks)h(like)f(this:)573 4040 y -Fw(\(awk)42 b Fx(<)p Fz(next-r)o(ecord)p Fx(>)f(<)p Fz(r)o -(ecord&\256eld-vars)p Fx(>)791 4140 y FA([)p Fx(<)p Fz(counter)p -Fx(>)p FA(])h Fx(<)p Fz(state-var-decls)p Fx(>)660 4239 y(<)p -Fz(clause)929 4251 y Ft(1)966 4239 y Fx(>)h(:)14 b(:)g(:)g -Fw(\))490 4470 y FA(The)23 b(body)h(of)f(the)g(loop)h(is)g(a)f(series)g(of)h -(clauses,)f(each)g(one)h(r)o(epr)o(esenting)e(a)h(kind)h(of)365 -4569 y(condition/action)k(pair)-6 b(.)40 b(The)26 b(loop)g(r)o(epeatedly)e(r) -o(eads)g(a)h(r)o(ecor)o(d,)f(and)h(then)h(executes)365 4669 -y(each)21 b(clause)f(whose)h(condition)h(is)g(satis\256ed)e(by)h(the)g(r)o -(ecor)o(d.)490 4799 y(Her)o(e's)i(an)h(example)f(that)h(r)o(eads)e(lines)i -(fr)o(om)g(port)g Fw(p)f FA(and)h(prints)g(the)g(line)g(number)365 -4898 y(and)d(line)g(of)f(every)h(line)g(containing)h(the)f(string)g(\252)p -Fw(Church-Rosser)p FA(\272:)365 5147 y FD(November)d(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1179 w FA(1)-5 b(15)p eop +115 120 bop 573 614 a Fx(field-splitter)36 b FB(The)20 +b(r)o(egular)g(expr)o(ession)g(speci\002es)h(the)g(actual)f(\002eld.) +573 759 y Fx(suffix-splitter)35 b FB(Delimiters)d(ar)o(e)f(interpr)o +(eted)f(as)h(element)h FA(terminators)p FB(.)58 b(If)756 +859 y(vertical-bar)36 b(is)i(the)g(the)g(delimiter)-6 +b(,)42 b(then)d(the)f(string)h Fx("")e FB(is)h(the)g(empty)756 +958 y(r)o(ecor)o(d)24 b Fx(\(\))p FB(,)k Fx("foo|")c +FB(pr)o(oduces)i(a)g(one-\002eld)g(r)o(ecor)o(d)f Fx(\("foo"\))p +FB(,)g(and)i Fx("foo")756 1058 y FB(is)21 b(an)f(err)o(or)-6 +b(.)756 1180 y(The)20 b(syntax)h(of)g(suf)o(\002x-delimited)f(r)o(ecor) +o(ds)f(is:)961 1349 y Fy(<)p FA(r)o(ecord)p Fy(>)98 b +FB(::=)h Fx("")186 b FB(\(Empty)21 b(r)o(ecor)o(d\))1431 +1448 y Ft(j)134 b Fy(<)p FA(element)p Fy(>)21 b(<)p FA(delim)p +Fy(>)e(<)p FA(r)o(ecord)p Fy(>)756 1637 y FB(It)27 b(is)i(an)e(err)o +(or)g(if)h(a)f(non-empty)i(r)o(ecor)o(d)d(does)i(not)g(end)g(with)h(a)e +(delimiter)-6 b(.)756 1736 y(T)e(o)22 b(make)g(the)g(last)g(delimiter)g +(optional,)h(make)f(sur)o(e)g(the)g(delimiter)g(r)o(egexp)756 +1836 y(matches)e(the)h(end-of-string)g(\(r)o(egexp)e +Fx("$")p FB(\).)573 1981 y Fx(infix-splitter)36 b FB(Delimiters)44 +b(ar)o(e)e(interpr)o(eted)g(as)h(element)g FA(separators)p +FB(.)94 b(If)756 2080 y(comma)21 b(is)g(the)g(delimiter)-6 +b(,)21 b(then)g(the)h(string)f Fx("foo,")e FB(pr)o(oduces)h(a)g +(two-\002eld)756 2180 y(r)o(ecor)o(d)f Fx(\("foo")41 +b(""\))p FB(.)756 2302 y(The)20 b(syntax)h(of)g(in\002x-delimited)g(r)o +(ecor)o(ds)e(is:)961 2471 y Fy(<)p FA(r)o(ecord)p Fy(>)431 +b FB(::=)99 b Fx("")186 b FB(\(For)o(ced)20 b(to)h(be)f(empty)h(r)o +(ecor)o(d\))1764 2570 y Ft(j)134 b Fy(<)p FA(r)o(eal-in\002x-r)o(ecord) +p Fy(>)961 2769 y(<)p FA(r)o(eal-in\002x-r)o(ecord)p +Fy(>)97 b FB(::=)i Fy(<)p FA(element)p Fy(>)21 b(<)p +FA(delim)p Fy(>)e(<)p FA(r)o(eal-in\002x-r)o(ecord)p +Fy(>)1764 2869 y Ft(j)134 b Fy(<)p FA(element)p Fy(>)756 +3057 y FB(Note)52 b(that)g(separator)g(semantics)g(doesn't)h(r)o(eally) +e(allow)i(for)f(empty)756 3157 y(r)o(ecor)o(ds\227the)k(straightforwar) +o(d)h(grammar)g(\()p FA(i.e.)o FB(,)67 b Fy(<)p FA(r)o(eal-in\002x-r)o +(ecord)p Fy(>)p FB(\))756 3257 y(parses)34 b(an)h(empty)g(string)h(as)f +(a)g(singleton)h(list)g(whose)g(one)g(\002eld)f(is)g(the)756 +3356 y(empty)21 b(string,)h Fx(\(""\))p FB(,)d(not)j(as)f(the)g(empty)h +(r)o(ecor)o(d)d Fx(\(\))p FB(.)26 b(This)c(is)g(unfortunate,)756 +3456 y(since)c(it)g(means)g(that)g(in\002x)h(string)g(parsing)f +(doesn't)g(make)g Fx(string-append)756 3555 y FB(and)i +Fx(append)e FB(isomorphic.)27 b(For)21 b(example,)911 +3722 y Fx(\(\(infix-splitter)37 b(":"\))42 b(\(string-append)37 +b FA(x)44 b Fx(":")e FA(y)o Fx(\)\))756 3889 y FB(doesn't)21 +b(always)f(equal)911 4034 y Fx(\(append)40 b(\(\(infix-splitter)d +(":"\))42 b FA(x)p Fx(\))1259 4133 y(\(\(infix-splitter)37 +b(":"\))42 b FA(y)p Fx(\)\))756 4278 y FB(It)23 b(fails)g(when)h +FA(x)e FB(or)i FA(y)e FB(ar)o(e)g(the)h(empty)h(string.)33 +b(T)-8 b(erminator)24 b(semantics)g FA(does)756 4378 +y FB(pr)o(eserve)19 b(a)h(similar)h(isomorphism.)756 +4500 y(However)-6 b(,)32 b(separator)d(semantics)i(is)g(fr)o(equently)g +(what)f(other)h(Unix)g(soft-)756 4599 y(war)o(e)21 b(uses,)i(so)g(to)g +(parse)f(their)h(strings,)h(we)e(need)h(to)g(use)f(it.)32 +b(For)23 b(example,)756 4699 y(Unix)g Fx($PATH)e FB(lists)k(have)e +(separator)f(semantics.)34 b(The)23 b(path)h(list)g Fx("/bin:")c +FB(is)756 4799 y(br)o(oken)h(up)g(into)i Fx(\("/bin")41 +b(""\))p FB(,)20 b(not)i Fx(\("/bin"\))p FB(.)j(Comma-separated)20 +b(lists)756 4898 y(should)h(also)g(be)f(parsed)g(this)i(way)-9 +b(.)365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1179 w FB(1)-5 +b(15)p eop %%Page: 116 122 -116 121 bop 888 614 a Fw(\(awk)42 b(\(read-line\))d(\(ln\))j(lineno)f(\(\)) -976 714 y(\("Church-Rosser)o(")c(\(format)k(#t)i("~d:)f(~s~\045")f(lineno)g -(ln\)\)\))681 932 y FA(This)18 b(example)e(has)h(just)i(one)e(clause)g(in)h -(the)f(loop)h(body)-9 b(,)18 b(the)f(one)h(that)f(tests)h(for)f(matches)681 -1032 y(against)j(the)h(r)o(egular)f(expr)o(ession)g(\252)p -Fw(Church-Rosser)p FA(\272.)805 1173 y(The)c Fx(<)p Fz(next-r)o(ecord)p -Fx(>)e FA(form)j(is)f(an)g(expr)o(ession)g(that)g(is)g(evaluated)f(each)g -(time)h(thr)o(ough)681 1273 y(the)27 b(loop)h(to)g(pr)o(oduce)e(a)g(r)o(ecor) -o(d)g(to)h(pr)o(ocess.)46 b(This)28 b(expr)o(ession)f(can)g(r)o(eturn)f -(multiple)681 1372 y(values;)18 b(these)g(values)g(ar)o(e)f(bound)h(to)h(the) -f(variables)f(given)i(in)f(the)g Fx(<)p Fz(r)o(ecord&\256eld-vars)p -Fx(>)681 1472 y FA(list)h(of)g(variables.)26 b(The)18 b(\256rst)h(value)g(r)o -(eturned)e(is)i(assumed)g(to)g(be)g(the)g(r)o(ecor)o(d;)e(when)j(it)f(is)681 -1572 y(the)i(end-of-\256le)f(object,)h(the)f(loop)i(terminates.)805 -1713 y(For)c(example,)f(let's)h(suppose)g(we)f(want)h(to)f(r)o(ead)f(items)i -(fr)o(om)f Fw(/etc/password)p FA(,)12 b(and)681 1812 y(we)20 -b(use)g(the)g Fw(field-reader)c FA(pr)o(ocedur)o(e)i(to)i(de\256ne)g(a)g(r)o -(ecor)o(d)f(parser)g(for)h Fw(/etc/passwd)681 1912 y FA(entries:)888 -2076 y Fw(\(define)41 b(read-passwd)e(\(field-reader)f(\(infix-splitter)g -(":")k(7\)\)\))681 2241 y FA(binds)22 b Fw(read-passwd)c FA(to)23 -b(a)f(pr)o(ocedur)o(e)e(that)i(r)o(eads)f(in)i(a)f(line)h(of)f(text)g(when)h -(it)f(is)h(called,)681 2340 y(and)39 b(splits)h(the)g(text)g(at)f(colons.)85 -b(It)40 b(r)o(eturns)f(two)h(values:)65 b(the)40 b(entir)o(e)f(line)h(r)o -(ead,)681 2440 y(and)30 b(a)g(seven-element)g(list)h(of)f(the)h(split-out)g -(\256elds.)56 b(\(See)30 b(section)h(7.1)e(for)h(mor)o(e)g(on)681 -2539 y Fw(field-reader)16 b FA(and)k Fw(infix-splitter)p FA(.\))805 -2680 y(So)27 b(if)g(the)g Fx(<)p Fz(next-r)o(ecord)p Fx(>)e -FA(form)i(in)g(an)g Fw(awk)f FA(expr)o(ession)g(is)i Fw(\(read-passwd\))p -FA(,)23 b(then)681 2780 y Fx(<)p Fz(r)o(ecord&\256eld-vars)p -Fx(>)18 b FA(must)k(be)e(a)g(list)i(of)e(two)i(variables,)d -Fz(e.g.)o FA(,)888 2944 y Fw(\(record)41 b(field-vec\))681 -3109 y FA(since)21 b Fw(read-passwd)16 b FA(r)o(eturns)k(two)i(values.)805 -3250 y(Note)16 b(that)g Fw(awk)f FA(allows)i(us)f(to)g(use)g -Fz(any)g FA(r)o(ecor)o(d)e(r)o(eader)g(we)i(want)g(in)h(the)f(loop,)h(r)o -(eturn-)681 3349 y(ing)f(whatever)f(number)h(of)f(values)g(we)h(like.)26 -b(These)15 b(values)g(don't)h(have)f(to)h(be)f(strings)i(or)681 -3449 y(string)k(lists.)28 b(The)20 b(only)h(r)o(equir)o(ement)e(is)i(that)f -(the)g(r)o(ecor)o(d)e(r)o(eader)g(r)o(eturn)i(the)g(eof)g(object)681 -3549 y(as)g(its)h(\256rst)g(value)g(when)g(the)g(loop)g(should)h(terminate.) -805 3690 y(The)g Fw(awk)f FA(loop)i(allows)f(the)h(pr)o(ogrammer)e(to)h(have) -g(loop)g(variables.)30 b(These)22 b(ar)o(e)f(de-)681 3789 y(clar)o(ed)e(and)h -(initialised)h(by)g(the)g Fx(<)p Fz(state-var-decls)p Fx(>)e -FA(form,)h(a)888 3954 y Fw(\(\()p Fz(var)43 b(init-exp)o Fw(\))g(\()p -Fz(var)g(init-exp)o Fw(\))g Fx(:)14 b(:)g(:)f Fw(\))681 4118 -y FA(list)26 b(rather)f(like)h(the)g Fw(let)f FA(form.)43 b(Whenever)25 -b(a)g(clause)h(in)g(the)g(loop)h(body)f(executes,)g(it)681 -4218 y(evaluates)19 b(to)j(as)e(many)h(values)g(as)f(ther)o(e)g(ar)o(e)f -(state)i(variables,)e(updating)i(them.)805 4359 y(The)31 b(optional)g -Fx(<)p Fz(counter)p Fx(>)f FA(variable)f(is)i(an)f(iteration)g(counter)-6 -b(.)57 b(It)30 b(is)h(bound)g(to)g(0)681 4458 y(when)c(the)f(loop)h(starts.) -43 b(The)26 b(counter)h(is)f(incr)o(emented)g(each)f(time)i(a)e(non-eof)i(r)o -(ecor)o(d)681 4558 y(is)21 b(r)o(ead.)805 4699 y(Ther)o(e)28 -b(ar)o(e)f(several)h(kinds)h(of)g(loop)g(clause.)51 b(When)29 -b(evaluating)f(the)h(body)f(of)h(the)681 4799 y(loop,)f Fw(awk)e -FA(evaluates)f Fz(all)i FA(the)f(clauses)h(sequentially)-9 -b(.)45 b(Unlike)27 b Fw(cond)p FA(,)f(it)h(does)f(not)i(stop)681 -4898 y(after)19 b(the)i(\256rst)g(clause)g(is)g(satis\256ed;)f(it)h(checks)g -(them)g(all.)681 5147 y(1)-5 b(16)p 1952 5071 323 4 v 1952 -5173 4 102 v 1178 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 -v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p +116 121 bop 681 535 2865 4 v 681 1403 4 868 v 835 657 +a Fk(Recor)o(d)218 b(:)22 b(suf)o(\002x)148 b Fh(:|$)19 +b Fk(suf)o(\002x)288 b(:)23 b(in\002x)419 b(non-:)23 +b(\002eld)p 785 688 2656 4 v 835 752 a Fh("")375 b(\(\))296 +b(\(\))531 b(\(\))h(\(\))835 843 y(":")336 b(\(""\))218 +b(\(""\))453 b(\("")40 b(""\))336 b(\(\))835 934 y("foo:")219 +b(\("foo"\))101 b(\("foo"\))336 b(\("foo")41 b(""\))218 +b(\("foo"\))835 1026 y(":foo")h Fi(err)o(or)226 b Fh(\("")40 +b("foo"\))218 b(\("")40 b("foo"\))219 b(\("foo"\))835 +1117 y("foo:bar")102 b Fi(err)o(or)226 b Fh(\("foo")40 +b("bar"\))101 b(\("foo")41 b("bar"\))101 b(\("foo")41 +b("bar"\))946 1379 y FB(Figur)o(e)21 b(7.1:)j(Using)d(dif)o(fer)o(ent)e +(grammars)h(to)h(split)h(r)o(ecor)o(ds)d(into)j(\002elds.)p +3542 1403 4 868 v 681 1406 2865 4 v 888 1654 a Fx(sloppy-suffix)36 +b FB(The)23 b(same)f(as)g(the)g Fx(suffix)e FB(case,)i(except)f(that)i +(the)f(parser)f(will)1071 1754 y(skip)26 b(an)f(initial)g(delimiter)g +(string)h(if)f(the)g(string)h(begins)g(with)g(one)f(instead)1071 +1853 y(of)33 b(parsing)g(an)f(initial)h(empty)g(\002eld.)62 +b(This)33 b(can)g(be)f(used,)j(for)e(example,)1071 1953 +y(to)27 b(\002eld-split)g(a)f(sequence)i(of)e(English)i(text)f(at)f +(white-space)h(boundaries,)1071 2053 y(wher)o(e)19 b(the)h(string)h +(may)e(begin)h(or)g(end)g(with)g(white)h(space,)e(by)h(using)g(r)o +(egex)1071 2152 y Fx("[)43 b(\\t]+|$")p FB(.)24 b(\(But)d(you)g(would)h +(be)f(better)g(of)o(f)f(using)i Fx(field-splitter)16 +b FB(in)1071 2252 y(this)21 b(case.\))805 2467 y(Figur)o(e)28 +b(7.1)e(shows)j(how)g(the)f(dif)o(fer)o(ent)d(parser)i(grammars)h +(split)g(apart)e(the)i(same)681 2567 y(strings.)103 b(Having)30 +b(to)f(choose)i(between)e(the)g(dif)o(fer)o(ent)e(grammars)i(r)o(equir) +o(es)g(you)h(to)681 2666 y(decide)i(what)h(you)h(want,)i(but)d(at)g +(least)g(you)h(can)e(be)h(pr)o(ecise)f(about)h(what)h(you)f(ar)o(e)681 +2766 y(parsing.)25 b(T)-8 b(ake)20 b(\002fteen)f(seconds)i(and)e(think) +i(it)f(out.)26 b(Say)19 b(what)h(you)g(mean;)g(mean)g(what)681 +2866 y(you)h(say)-9 b(.)681 3015 y Fx(\(join-strings)38 +b FA(string-list)20 b([delimiter)h(grammar])p Fx(\))85 +b Ft(\000)-14 b(!)87 b FA(string)282 b FB(pr)o(ocedur)o(e)888 +3155 y(This)22 b(pr)o(ocedur)o(e)d(is)i(a)g(simple)g(unparser)o(\227it) +f(pastes)h(strings)h(together)f(using)h(the)888 3255 +y(delimiter)f(string.)888 3388 y(The)40 b FA(grammar)f +FB(ar)o(gument)g(is)h(one)h(of)e(the)h(symbols)h Fx(infix)d +FB(\(the)i(default\))e(or)888 3487 y Fx(suffix)p FB(;)30 +b(it)f(determines)g(whether)g(the)g(delimiter)g(string)g(is)g(used)g +(as)f(a)h(separa-)888 3587 y(tor)21 b(or)g(as)g(a)f(terminator)-6 +b(.)888 3719 y(The)20 b(delimiter)f(is)h(the)g(string)g(used)g(to)g +(delimit)g(elements;)g(it)f(defaults)g(to)h(a)f(single)888 +3819 y(space)h Fx(")43 b(")p FB(.)888 3952 y(Example:)1071 +4117 y Fx(\(join-strings)38 b('\("foo")j("bar")g("baz"\))h(":"\))1245 +4217 y Fm(=)-14 b Ft(\))87 b Fx("foo:bar:baz")681 4567 +y Fz(7.1.3)81 b(Field)19 b(readers)681 4774 y Fx(\(field-reader)38 +b FA([\002eld-parser)20 b(r)o(ec-r)o(eader])p Fx(\))86 +b Ft(\000)-14 b(!)87 b FA(pr)o(ocedur)o(e)418 b FB(pr)o(ocedur)o(e)888 +4898 y(This)33 b(utility)f(r)o(eturns)g(a)f(pr)o(ocedur)o(e)f(that)i(r) +o(eads)e(r)o(ecor)o(ds)g(with)j(\002eld)f(str)o(uctur)o(e)681 +5147 y(1)-5 b(16)p 1952 5071 323 4 v 1952 5173 4 102 +v 1178 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 +w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 117 123 -117 122 bop 490 614 a Fs(\017)41 b Fw(\()p Fz(test)i(body)938 -641 y Ft(1)1019 614 y Fz(body)1177 641 y Ft(2)1258 614 y Fx(:)14 -b(:)g(:)g Fw(\))573 714 y FA(If)g Fz(test)g FA(is)g(tr)o(ue,)h(execute)f(the) -g(body)g(forms.)25 b(The)15 b(last)f(body)g(form)g(is)h(the)f(value)f(of)h -(the)573 814 y(clause.)33 b(The)22 b(test)h(and)f(body)h(forms)g(ar)o(e)e -(evaluated)g(in)i(the)g(scope)g(of)f(the)h(r)o(ecor)o(d)573 -913 y(and)d(state)h(variables.)573 1062 y(The)g Fz(test)f FA(form)h(can)f(be) -h(one)g(of:)805 1219 y(integer:)213 b(The)26 b(test)h(is)g(tr)o(ue)f(for)h -(that)f(iteration)h(of)g(the)f(loop.)46 b(The)1297 1319 y(\256rst)21 -b(iteration)g(is)g(#1.)805 1419 y(string:)258 b(The)23 b(string)i(is)f(a)f(r) -o(egular)f(expr)o(ession.)36 b(The)23 b(test)h(is)g(tr)o(ue)1297 -1518 y(if)c(the)h(r)o(egexp)f(matches)g(the)h(r)o(ecor)o(d.)805 -1618 y(expr)o(ession)100 b(If)38 b(not)i(an)e(integer)h(or)g(a)f(string,)44 -b(the)39 b(test)f(form)h(is)g(a)1297 1717 y(Scheme)20 b(expr)o(ession)h(that) -f(is)h(evaluated.)490 1952 y Fs(\017)91 b Fw(\(range)128 b -Fz(start-test)43 b(stop-test)f(body)1851 1979 y Ft(1)1931 1952 -y Fx(:)14 b(:)g(:)g Fw(\))623 2052 y(\(:range)84 b Fz(start-test)43 -b(stop-test)f(body)1851 2079 y Ft(1)1931 2052 y Fx(:)14 b(:)g(:)g -Fw(\))623 2151 y(\(range:)84 b Fz(start-test)43 b(stop-test)f(body)1851 -2178 y Ft(1)1931 2151 y Fx(:)14 b(:)g(:)g Fw(\))623 2251 y(\(:range:)40 -b Fz(start-test)j(stop-test)f(body)1851 2278 y Ft(1)1931 2251 -y Fx(:)14 b(:)g(:)g Fw(\))573 2350 y FA(These)k(clauses)g(become)h(activated) -e(when)i Fz(start-test)e FA(is)i(tr)o(ue;)g(they)g(stay)f(active)g(on)573 -2449 y(all)i(further)h(iterations)g(until)g Fz(stop-test)f -FA(is)h(tr)o(ue.)573 2598 y(So,)f(to)h(print)g(out)h(the)f(\256rst)g(ten)f -(lines)i(of)f(a)f(\256le,)g(we)h(use)g(the)g(clause:)756 2775 -y Fw(\(:range:)40 b(1)j(10)g(\(display)d(record\)\))573 3001 -y FA(The)24 b(colons)i(contr)o(ol)f(whether)g(or)g(not)g(the)g(start)f(and)g -(stop)h(lines)g(ar)o(e)f(pr)o(ocessed)573 3101 y(by)d(the)g(clause.)27 -b(For)21 b(example:)805 3280 y Fw(\(range)129 b(1)43 b(5)87 -b Fx(:)14 b(:)g(:)f Fw(\))166 b FA(Lines)83 b(2)20 b(3)h(4)805 -3379 y Fw(\(:range)85 b(1)43 b(5)87 b Fx(:)14 b(:)g(:)f Fw(\))166 -b FA(Lines)21 b(1)f(2)g(3)h(4)805 3479 y Fw(\(range:)85 b(1)43 -b(5)87 b Fx(:)14 b(:)g(:)f Fw(\))166 b FA(Lines)83 b(2)20 b(3)h(4)f(5)805 -3578 y Fw(\(:range:)41 b(1)i(5)87 b Fx(:)14 b(:)g(:)f Fw(\))166 -b FA(Lines)21 b(1)f(2)g(3)h(4)f(5)573 3804 y(A)g(line)g(can)g(trigger)h(both) -g(tests,)f(either)g(simultaneously)i(starting)f(and)f(stopping)573 -3903 y(an)f(active)g(r)o(egion,)h(or)g(simultaneously)h(stopping)g(one)f(and) -f(starting)h(a)f(new)h(one,)573 4003 y(so)h(ranges)g(can)f(abut)g(seamlessly) --9 b(.)490 4202 y Fs(\017)41 b Fw(\(else)g Fz(body)993 4229 -y Ft(1)1074 4202 y Fz(body)1232 4229 y Ft(2)1313 4202 y Fx(:)14 -b(:)g(:)f Fw(\))573 4301 y FA(If)22 b(no)h(other)f(clause)g(has)g(executed)f -(since)i(the)f(top)h(of)f(the)g(loop,)h(or)g(since)f(the)h(last)573 -4401 y Fw(else)c FA(clause,)h(this)i(clause)e(executes.)490 -4599 y Fs(\017)41 b Fw(\()p Fz(test)i Fw(=>)g Fz(exp)o Fw(\))573 -4699 y FA(If)19 b(evaluating)g Fw(test)f FA(pr)o(oduces)h(a)g(tr)o(ue)h -(value,)f(apply)g Fz(exp)g FA(to)h(that)g(value.)26 b(If)20 -b Fz(test)f FA(is)573 4799 y(a)c(r)o(egular)o(-expr)o(ession)e(string,)18 -b(then)e Fz(exp)f FA(is)h(applied)f(to)h(the)g(match)g(data)e(str)o(uctur)o -(e)573 4898 y(r)o(eturned)19 b(by)i(the)g(r)o(egexp)f(match)g(r)o(outine.)365 -5147 y FD(November)e(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 -5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V -1636 5176 323 4 v 1179 w FA(1)-5 b(17)p eop +117 122 bop 573 614 a FB(fr)o(om)27 b(a)f(port.)45 b(The)27 +b(r)o(eader)6 b('s)26 b(interface)g(is)i(designed)f(to)g(make)g(it)h +(useful)f(in)g(the)573 714 y Fx(awk)19 b FB(loop)j(macr)o(o)e +(\(section)h(7.2\).)j(The)d(r)o(eader)d(is)j(used)g(as)f(follows:)756 +865 y Fx(\()p FA(r)o(eader)43 b([port])n Fx(\))h Fm(=)-14 +b Ft(\))86 b FA([raw-r)o(ecord)20 b(parsed-r)o(ecord])42 +b Fx(or)h FA([eof)21 b(\(\)])573 1054 y FB(When)28 b(the)f(r)o(eader)e +(is)j(applied)f(to)g(an)g(input)h(port)g(\(default:)37 +b(the)28 b(curr)o(ent)e(input)573 1154 y(port\),)19 b(it)g(r)o(eads)f +(a)g(r)o(ecor)o(d)g(using)i FA(r)o(ec-r)o(eader)o FB(.)25 +b(If)19 b(this)h(r)o(ecor)o(d)d(isn't)j(the)f(eof)g(object,)g(it)573 +1254 y(is)25 b(parsed)e(with)i FA(\002eld-parser)p FB(.)37 +b(These)24 b(two)h(values\227the)f(r)o(ecor)o(d,)g(and)g(its)h(parsed) +573 1353 y(r)o(epr)o(esentation\227ar)o(e)18 b(r)o(eturned)i(as)g +(multiple)h(values)g(fr)o(om)f(the)h(r)o(eader)-6 b(.)573 +1491 y(When)21 b(called)f(at)g(eof,)h(the)f(r)o(eader)f(r)o(eturns)h +([eof-object)g Fx(\(\))p FB(].)573 1629 y(Although)e(the)g(r)o(ecor)o +(d)e(r)o(eader)f(typically)j(r)o(eturns)f(a)g(string,)h(and)f(the)h +(\002eld-parser)573 1729 y(typically)k(takes)g(a)g(string)h(ar)o +(gument,)f(this)h(is)g(not)g(r)o(equir)o(ed.)29 b(The)22 +b(r)o(ecor)o(d)f(r)o(eader)573 1829 y(can)d(pr)o(oduce,)f(and)g(the)h +(\002eld-parser)f(consume,)i(values)f(of)g(any)g(type.)24 +b(However)-6 b(,)573 1928 y(the)24 b(empty)h(list)g(r)o(eturned)e(as)i +(the)f(parsed)g(value)f(on)j(eof)e(is)h(har)o(dwir)o(ed)d(into)j(the) +573 2028 y(\002eld)20 b(r)o(eader)-6 b(.)573 2166 y(For)21 +b(example,)f(if)g(port)h Fx(p)f FB(is)i(open)f(on)g Fx(/etc/passwd)p +FB(,)16 b(then)756 2317 y Fx(\(\(field-reader)37 b(\(infix-splitter)h +(":")k(7\)\))g(p\))573 2459 y FB(r)o(eturns)20 b(two)i(values:)573 +2589 y Fh("dalbertz:mx3Uaqq0:107:22:Davi)q(d)45 b +(Albertz:/users/dalbertz:/bin/)q(csh")573 2681 y(\("dalbertz")d +("mx3Uaqq0")f("107")f("22")h("David)f(Albertz")h("/users/dalbertz")1044 +2772 y("/bin/csh"\))595 2910 y FB(The)23 b FA(\002eld-parser)f +FB(defaults)g(to)g(the)h(value)f(of)g Fx(\(field-splitter\))p +FB(,)16 b(a)22 b(parser)g(that)573 3010 y(picks)f(out)g(sequences)g(of) +g(non-white-space)g(strings.)573 3148 y(The)g FA(r)o(ec-r)o(eader)f +FB(defaults)g(to)h Fx(read-line)p FB(.)573 3286 y(Figur)o(e)35 +b(7.2)e(shows)k Fx(field-reader)30 b FB(being)35 b(used)g(to)h(r)o(ead) +d(dif)o(fer)o(ent)g(kinds)j(of)573 3385 y(Unix)21 b(r)o(ecor)o(ds.)365 +3676 y Fz(7.1.4)81 b(Forward-progress)21 b(guarantees)d(and)i +(empty-string)e(matches)365 3869 y FB(A)j(loop)g(that)g(pulls)g(text)f +(of)o(f)g(a)g(string)i(by)e(r)o(epeatedly)f(matching)i(a)g(r)o(egexp)e +(against)i(that)365 3969 y(string)28 b(can)g(conceivably)f(get)g(stuck) +h(in)g(an)f(in\002nite)i(loop)f(if)f(the)h(r)o(egexp)e(matches)h(the) +365 4068 y(empty)d(string.)36 b(For)24 b(example,)g(the)g(r)o(egexps)e +Fx(^)p FB(,)i Fx($)p FB(,)g Fx(.*)p FB(,)g(and)f Fx(foo|[^f]*)d +FB(can)k(all)f(match)365 4168 y(the)e(empty)g(string.)490 +4301 y(The)29 b(r)o(outines)h(in)g(this)g(package)e(that)i(iterate)e +(thr)o(ough)i(strings)h(with)f(r)o(egular)e(ex-)365 4400 +y(pr)o(essions)23 b(ar)o(e)f(car)o(eful)e(to)j(handle)g(this)g +(empty-string)g(case.)31 b(If)22 b(a)g(r)o(egexp)g(matches)g(the)365 +4500 y(empty)27 b(string,)h(the)f(next)f(sear)o(ch)g(starts,)h(not)h +(fr)o(om)e(the)g(end)g(of)h(the)g(match)f(\(which)h(in)365 +4599 y(the)d(empty)f(string)h(case)f(is)g(also)h(the)f +(beginning\227that's)i(the)e(pr)o(oblem\),)g(but)h(fr)o(om)e(the)365 +4699 y(next)j(character)e(over)-6 b(.)38 b(This)25 b(is)h(the)f(corr)o +(ect)e(behaviour)-6 b(.)38 b(Regexps)25 b(match)g(the)g(longest)365 +4799 y(possible)i(string)g(at)f(a)g(given)g(location,)i(so)f(if)f(the)g +(r)o(egexp)f(matched)h(the)g(empty)h(string)365 4898 +y(at)d(location)i Fy(i)p FB(,)e(then)h(it)g(is)g(guaranteed)e(it)i +(could)g(not)g(have)f(matched)g(a)g(longer)h(pattern)365 +5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1179 w FB(1)-5 b(17)p eop %%Page: 118 124 -118 123 bop 805 614 a Fs(\017)41 b Fw(\(after)g Fz(body)1352 -641 y Ft(1)1433 614 y Fx(:)14 b(:)g(:)f Fw(\))888 714 y FA(This)23 -b(clause)f(executes)f(when)i(the)f(loop)h(encounters)g(EOF)-8 -b(.)22 b(The)g(body)g(forms)h(ex-)888 814 y(ecute)h(in)h(the)f(scope)h(of)f -(the)g(state)g(vars)g(and)g(the)g(r)o(ecor)o(d-count)f(var)-6 -b(,)24 b(if)g(ther)o(e)f(ar)o(e)888 913 y(any)-9 b(.)28 b(The)20 -b(value)g(of)h(the)g(last)g(body)g(form)f(is)i(the)e(value)h(of)f(the)h -(entir)o(e)f(awk)h(form.)888 1042 y(If)f(ther)o(e)f(is)h(no)g -Fw(after)e FA(clause,)h Fw(awk)f FA(r)o(eturns)i(the)g(loop's)g(state)g -(variables)e(as)i(multi-)888 1142 y(ple)h(values.)681 1389 -y Fy(7.2.1)81 b(Examples)681 1572 y FA(Her)o(e)26 b(ar)o(e)g(some)i(examples) -f(of)g Fw(awk)f FA(being)i(used)f(to)h(pr)o(ocess)e(various)i(types)f(of)h -(input)681 1671 y(str)o(eam.)888 1858 y Fw(\(define)41 b($)i(nth\))347 -b(;)43 b(Saves)f(typing.)888 2058 y(;;;)h(Print)e(out)i(the)f(name)g(and)g -(home-directory)c(of)43 b(everyone)d(in)j(/etc/passwd:)888 -2157 y(\(let)f(\(\(read-passwd)c(\(field-reader)h(\(infix-splitter)e(":")42 -b(7\)\)\)\))976 2257 y(\(call-with-inpu)o(t-)o(fil)o(e)37 b("/etc/passwd") -1063 2357 y(\(lambda)j(\(port\))1150 2456 y(\(awk)i(\(read-passwd)c(port\))k -(\(record)f(fields\))f(\(\))1237 2556 y(\(#t)i(\(format)f(#t)i("~a's)e(home)h -(directory)e(is)j(~a~\045")1760 2655 y(\($)g(fields)e(0\))1760 -2755 y(\($)i(fields)e(5\)\)\)\)\)\)\))888 3005 y(;;;)i(Print)e(out)i(the)f -(user-name)e(and)i(home-directory)c(of)43 b(everyone)d(whose)888 -3104 y(;;;)j(name)f(begins)f(with)h("S")888 3204 y(\(let)g(\(\(read-passwd)c -(\(field-reader)h(\(infix-splitter)e(":")42 b(7\)\)\)\))976 -3303 y(\(call-with-inpu)o(t-)o(fil)o(e)37 b("/etc/passwd")1063 -3403 y(\(lambda)j(\(port\))1150 3503 y(\(awk)i(\(read-passwd)c(port\))k -(\(record)f(fields\))f(\(\))1237 3602 y(\("^S")i(\(format)e(#t)j("~a's)f -(home)f(directory)f(is)j(~a~\045")1847 3702 y(\($)g(fields)e(0\))1847 -3802 y(\($)i(fields)e(5\)\)\)\)\)\)\))888 4051 y(;;;)i(Read)f(a)h(series)e -(of)i(integers)d(from)i(stdin.)f(This)h(expression)d(evaluates)888 -4151 y(;;;)k(to)f(the)h(number)e(of)i(positive)d(numbers)h(that)h(were)f -(read.)h(Note)g(our)888 4250 y(;;;)h("record-reader")37 b(is)43 -b(the)f(standard)e(Scheme)i(READ)f(procedure.)888 4350 y(\(awk)h(\(read\))f -(\(i\))130 b(\(\(npos)41 b(0\)\))976 4450 y(\(\(>)h(i)h(0\))g(\(+)g(npos)e -(1\)\)\))888 4699 y(;;;)i(Filter)e(--)i(pass)e(only)h(lines)g(containing)d -(my)k(name.)888 4799 y(\(awk)f(\(read-line\))d(\(line\))i(\(\))976 -4898 y(\("Olin")f(\(display)g(line\))i(\(newline\)\)\))681 -5147 y FA(1)-5 b(18)p 1952 5071 323 4 v 1952 5173 4 102 v 1178 -w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 -b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p eop +118 123 bop 681 1310 2865 4 v 681 4120 4 2811 v 718 1426 +a Fx(;;;)42 b(/etc/passwd)e(reader)718 1525 y(\(field-reader)e +(\(infix-splitter)g(":")k(7\)\))892 1625 y(;)i(wandy:3xuncWdpK)o(hR.)o +(:7)o(3:2)o(2:)o(Wa)o(ndy)37 b(Saetan:/usr/wand)o(y:)o(/bi)o(n/)o(cs)o +(h)718 1824 y(;;;)42 b(Two)h(ls)g(-l)f(output)f(readers)718 +1924 y(\(field-reader)d(\(infix-splitter)g("[)k(\\t]+")g(8\)\))718 +2024 y(\(field-reader)c(\(infix-splitter)g("[)k(\\t]+")g(-7\)\))892 +2123 y(;)i(-rw-r--r--)83 b(1)43 b(shivers)171 b(22880)42 +b(Sep)g(24)h(12:45)e(scsh.scm)718 2322 y(;;;)h(Internet)f(hostname)f +(reader)718 2422 y(\(field-reader)e(\(field-splitter)g("[^.]+"\)\))892 +2522 y(;)44 b(stat.sinica.edu)o(.tw)718 2721 y(;;;)e(Internet)f(IP)i +(address)d(reader)718 2821 y(\(field-reader)e(\(field-splitter)g +("[^.]+")i(4\)\))892 2920 y(;)k(18.24.0.241)718 3119 +y(;;;)e(Line)g(of)h(integers)718 3219 y(\(let)f(\(\(parser)e +(\(field-splitter)e("[+-]?[0-9]+"\)\)\))805 3319 y(\(field-reader)h(\() +p Fy(\025)f Fx(\(s\))43 b(\(map)f(string->number)37 b(\(parser)k +(s\)\)\)\))892 3418 y(;)j(18)e(24)h(0)g(241)718 3618 +y(;;;)f(Same)g(as)h(above.)718 3717 y(\(let)f(\(\(reader)e +(\(field-reader)f(\(field-splitter)e("[+-]?[0-9]+"\)\)\))o(\))805 +3817 y(\()p Fy(\025)i Fx(maybe-port)h(\(map)h(string->number)d(\(apply) +j(reader)g(maybe-port\)\)\)\))892 3917 y(;)j(Yale)e(beat)g(harvard)e +(26)j(to)g(7.)1305 4096 y FB(Figur)o(e)21 b(7.2:)j(Some)d(examples)f +(of)h Fx(field-reader)p 3542 4120 V 681 4123 2865 4 v +681 5147 a FB(1)-5 b(18)p 1952 5071 323 4 v 1952 5173 +4 102 v 1178 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 +v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 119 125 -119 124 bop 573 614 a Fw(;;;)42 b(Count)g(the)g(number)f(of)i(non-comment)c -(lines)i(of)i(code)f(in)h(my)g(Scheme)e(source.)573 714 y(\(awk)h -(\(read-line\))d(\(line\))i(\(\(nlines)f(0\)\))660 814 y(\("^[)i(\\t]*;")f -(nlines\))651 b(;)43 b(A)g(comment)e(line.)660 913 y(\(else)303 -b(\(+)43 b(nlines)e(1\)\)\))347 b(;)43 b(Not)f(a)i(comment)c(line.)573 -1196 y(;;;)i(Read)g(numbers,)e(counting)h(the)h(evens)g(and)g(odds.)573 -1295 y(\(awk)g(\(read\))f(\(val\))g(\(\(evens)g(0\))i(\(odds)e(0\)\))660 -1395 y(\(\(>)h(val)h(0\))f(\(display)f("pos)h("\))86 b(\(values)41 -b(evens)g(odds\)\))g(;)j(Tell)d(me)i(about)660 1494 y(\(\(<)f(val)h(0\))f -(\(display)f("neg)h("\))86 b(\(values)41 b(evens)g(odds\)\))g(;)j(sign,)d -(too.)660 1594 y(\(else)259 b(\(display)41 b("zero)g("\))i(\(values)e(evens)g -(odds\)\))660 1793 y(\(\(even?)g(val\))h(\(values)e(\(+)j(evens)f(1\))g -(odds\)\))660 1893 y(\(else)347 b(\(values)40 b(evens)303 b(\(+)43 -b(odds)f(1\)\)\)\))573 2175 y(;;;)g(Determine)e(the)i(max)h(length)e(of)i -(all)f(the)g(lines)g(in)h(the)f(file.)573 2275 y(\(awk)g(\(read-line\))d -(\(line\))i(\(\(max-len)f(0\)\))660 2374 y(\(#t)i(\(max)g(max-len)f -(\(string-length)d(line\)\)\)\))573 2657 y(;;;)k(\(This)g(could)f(also)h(be)h -(done)f(with)g(REDUCE-PORT:\))573 2756 y(\(reduce-port)c(\(current-input-po)o -(rt\))f(read-line)1139 2856 y(\(lambda)k(\(line)h(maxlen\))e(\(max)i -(\(string-length)c(line\))k(maxlen\)\))1139 2956 y(0\))573 -3238 y(;;;)g(Print)g(every)f(line)h(longer)f(than)h(80)h(chars.)573 -3337 y(;;;)f(Prefix)f(each)h(line)g(with)g(its)g(line)g(#.)573 -3437 y(\(awk)g(\(read-line\))d(\(line\))i(lineno)g(\(\))660 -3537 y(\(\(>)h(\(string-length)c(line\))k(80\))704 3636 y(\(format)e(#t)j -("~d:)f(~s~\045")g(lineno)f(line\)\)\))573 3919 y(;;;)h(Strip)g(blank)f -(lines)h(from)g(input.)573 4018 y(\(awk)g(\(read-line\))d(\(line\))i(\(\))660 -4118 y(\(".")h(\(display)e(line\))i(\(newline\)\)\))573 4400 -y(;;;)g(Sort)g(the)g(entries)f(in)i(/etc/passwd)c(by)k(login)e(name.)573 -4500 y(\(for-each)f(\(lambda)g(\(entry\))h(\(display)f(\(cdr)i(entry\)\))f -(\(newline\)\))432 b(;)43 b(Out)1009 4599 y(\(sort)e(\(lambda)g(\(x)i(y\))f -(\(stringlist)c(s\)\)\))k("foo"\))365 2494 y Fz(7.1.5)81 +b(Reader)20 b(limitations)365 2697 y FB(Since)28 b(all)h(of)f(the)h(r)o +(eaders)e(in)i(this)g(package)e(r)o(equir)o(e)h(the)g(ability)h(to)g +(peek)f(ahead)f(one)365 2796 y(char)19 b(in)i(the)e(input)h(str)o(eam,) +f(they)h(cannot)g(be)g(applied)e(to)i(raw)g(integer)f(\002le)h +(descriptors,)365 2896 y(only)j(Scheme)e(input)h(ports.)29 +b(This)22 b(is)g(because)f(Unix)h(doesn't)g(support)g(peeking)g(ahead) +365 2996 y(into)g(input)f(str)o(eams.)365 3312 y Fv(7.2)99 +b(A)-7 b(wk)365 3546 y FB(Scsh)25 b(pr)o(ovides)g(a)f(loop)i(macr)o(o)e +(and)h(a)f(set)h(of)g(\002eld)g(parsers)f(that)h(can)g(be)g(used)g(to)g +(per)o(-)365 3646 y(form)34 b(text)f(pr)o(ocessing)h(very)f(similar)g +(to)h(the)g(A)-6 b(wk)33 b(pr)o(ogramming)g(language.)64 +b(The)365 3745 y(basic)30 b(functionality)h(of)f(A)-6 +b(wk)30 b(is)g(factor)o(ed)e(in)j(scsh)f(into)h(its)g(component)g +(parts.)53 b(The)365 3845 y(contr)o(ol)25 b(str)o(uctur)o(e)g(is)g(pr)o +(ovided)e(by)i(the)g Fx(awk)e FB(loop)j(macr)o(o;)g(the)e(text)h(I/O)g +(and)f(parsers)365 3944 y(ar)o(e)19 b(pr)o(ovided)g(by)h(the)h +(\002eld-r)o(eader)c(subr)o(outine)k(library)f(\(section)g(7.1\).)k +(This)d(factoring)365 4044 y(allows)g(the)f(pr)o(ogrammer)f(to)h +(compose)g(the)g(basic)g(loop)g(str)o(uctur)o(e)f(with)i(any)f(parser)e +(or)365 4144 y(input)i(mechanism)g(at)f(all.)25 b(If)19 +b(the)g(parsers)g(pr)o(ovided)f(by)i(the)f(\002eld-r)o(eader)e(package) +h(ar)o(e)365 4243 y(insuf)o(\002cient,)28 b(the)f(pr)o(ogrammer)f(can)g +(write)h(a)f(custom)h(parser)e(in)j(Scheme)e(and)g(use)g(it)365 +4343 y(with)c(equal)f(ease)f(in)h(the)g(awk)f(framework.)490 +4483 y(A)-6 b(wk-in-scheme)20 b(is)i(given)f(by)f(a)h(loop)g(macr)o(o)f +(called)g Fx(awk)p FB(.)k(It)d(looks)h(like)f(this:)573 +4699 y Fx(\(awk)42 b Fy(<)p FA(next-r)o(ecord)p Fy(>)f(<)p +FA(r)o(ecord&\002eld-vars)p Fy(>)791 4799 y FB([)p Fy(<)p +FA(counter)p Fy(>)p FB(])h Fy(<)p FA(state-var-decls)p +Fy(>)660 4898 y(<)p FA(clause)929 4910 y Fu(1)966 4898 +y Fy(>)h Fx(...\))365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1179 w FB(1)-5 +b(19)p eop %%Page: 120 126 -120 125 bop 888 614 a Fw(;;;)43 b(Prefix)e(line)h(numbers)e(to)j(the)g(input) -e(stream.)888 714 y(\(awk)h(\(read-line\))d(\(line\))i(lineno)h(\(\))976 -814 y(\(#t)g(\(format)f(#t)h("~d:\\t~a~\045")d(lineno)i(line\)\)\))681 -5147 y FA(120)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 w -FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 -b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p eop +120 125 bop 805 614 a FB(The)24 b(body)f(of)g(the)h(loop)g(is)g(a)f +(series)g(of)g(clauses,)h(each)e(one)i(r)o(epr)o(esenting)f(a)f(kind)i +(of)681 714 y(condition/action)j(pair)-6 b(.)40 b(The)25 +b(loop)i(r)o(epeatedly)c(r)o(eads)h(a)i(r)o(ecor)o(d,)e(and)i(then)g +(executes)681 814 y(each)20 b(clause)g(whose)i(condition)g(is)f +(satis\002ed)g(by)f(the)h(r)o(ecor)o(d.)805 939 y(Her)o(e's)i(an)h +(example)f(that)h(r)o(eads)e(lines)j(fr)o(om)e(port)h +Fx(p)g FB(and)f(prints)i(the)f(line)g(number)681 1038 +y(and)c(line)h(of)g(every)f(line)h(containing)h(the)f(string)h(\223)p +Fx(Church-Rosser)p FB(\224)o(:)888 1230 y Fx(\(awk)42 +b(\(read-line\))d(\(ln\))j(lineno)f(\(\))976 1329 y(\("Church-Rosser)o +(")c(\(format)k(#t)i("~d:)f(~s~\045")f(lineno)g(ln\)\)\))681 +1521 y FB(This)18 b(example)e(has)h(just)i(one)e(clause)g(in)h(the)f +(loop)h(body)-9 b(,)18 b(the)f(one)h(that)f(tests)h(for)f(matches)681 +1620 y(against)j(the)h(r)o(egular)f(expr)o(ession)g(\223)p +Fx(Church-Rosser)p FB(\224.)805 1745 y(The)c Fy(<)p FA(next-r)o(ecord)p +Fy(>)e FB(form)j(is)f(an)g(expr)o(ession)g(that)g(is)g(evaluated)f +(each)g(time)h(thr)o(ough)681 1845 y(the)27 b(loop)h(to)g(pr)o(oduce)e +(a)h(r)o(ecor)o(d)f(to)h(pr)o(ocess.)45 b(This)28 b(expr)o(ession)f +(can)g(r)o(eturn)f(multiple)681 1945 y(values;)18 b(these)g(values)g +(ar)o(e)f(bound)h(to)h(the)f(variables)f(given)i(in)f(the)g +Fy(<)p FA(r)o(ecord&\002eld-vars)p Fy(>)681 2044 y FB(list)24 +b(of)g(variables.)35 b(The)24 b(\002rst)g(value)g(r)o(eturned)f(is)h +(assumed)g(to)g(be)g(the)g(r)o(ecor)o(d;)g(when)h(it)681 +2144 y(is)c(the)g(end-of-\002le)f(object,)h(the)g(loop)g(terminates.) +805 2269 y(For)d(example,)f(let's)h(suppose)g(we)f(want)h(to)f(r)o(ead) +f(items)i(fr)o(om)f Fx(/etc/password)p FB(,)12 b(and)681 +2368 y(we)20 b(use)g(the)g Fx(field-reader)c FB(pr)o(ocedur)o(e)i(to)i +(de\002ne)g(a)g(r)o(ecor)o(d)f(parser)g(for)h Fx(/etc/passwd)681 +2468 y FB(entries:)888 2607 y Fx(\(define)41 b(read-passwd)e +(\(field-reader)f(\(infix-splitter)g(":")k(7\)\)\))681 +2746 y FB(binds)22 b Fx(read-passwd)c FB(to)23 b(a)f(pr)o(ocedur)o(e)e +(that)i(r)o(eads)f(in)i(a)f(line)h(of)f(text)g(when)h(it)f(is)h +(called,)681 2846 y(and)39 b(splits)i(the)f(text)f(at)h(colons.)84 +b(It)40 b(r)o(eturns)f(two)i(values:)63 b(the)40 b(entir)o(e)g(line)g +(r)o(ead,)681 2946 y(and)30 b(a)g(seven-element)g(list)h(of)g(the)g +(split-out)g(\002elds.)55 b(\(See)29 b(section)i(7.1)f(for)g(mor)o(e)g +(on)681 3045 y Fx(field-reader)16 b FB(and)k Fx(infix-splitter)p +FB(.\))805 3170 y(So)27 b(if)g(the)g Fy(<)p FA(next-r)o(ecord)p +Fy(>)e FB(form)i(in)g(an)g Fx(awk)f FB(expr)o(ession)g(is)i +Fx(\(read-passwd\))p FB(,)23 b(then)681 3270 y Fy(<)p +FA(r)o(ecord&\002eld-vars)p Fy(>)18 b FB(must)k(be)e(a)g(list)i(of)e +(two)i(variables,)d FA(e.g.)o FB(,)888 3409 y Fx(\(record)41 +b(field-vec\))681 3548 y FB(since)21 b Fx(read-passwd)16 +b FB(r)o(eturns)k(two)i(values.)805 3673 y(Note)27 b(that)f +Fx(awk)g FB(allows)h(us)g(to)f(use)h FA(any)f FB(r)o(ecor)o(d)f(r)o +(eader)f(we)j(want)f(in)h(the)g(loop,)h(r)o(e-)681 3772 +y(turning)k(whatever)e(number)h(of)g(values)f(we)h(like.)57 +b(These)31 b(values)f(don't)i(have)e(to)h(be)681 3872 +y(strings)21 b(or)f(string)h(lists.)26 b(The)21 b(only)g(r)o(equir)o +(ement)e(is)i(that)f(the)h(r)o(ecor)o(d)d(r)o(eader)g(r)o(eturn)i(the) +681 3972 y(eof)g(object)h(as)g(its)g(\002rst)g(value)f(when)i(the)f +(loop)g(should)h(terminate.)805 4097 y(The)33 b Fx(awk)f +FB(loop)i(allows)f(the)g(pr)o(ogrammer)f(to)i(have)e(loop)i(variables.) +61 b(These)32 b(ar)o(e)681 4196 y(declar)o(ed)18 b(and)j(initialised)g +(by)g(the)g Fy(<)p FA(state-var-decls)p Fy(>)d FB(form,)j(a)888 +4335 y Fx(\(\()p FA(var)43 b(init-exp)o Fx(\))g(\()p +FA(var)g(init-exp)o Fx(\))g(...\))681 4475 y FB(list)26 +b(rather)g(like)g(the)g Fx(let)f FB(form.)41 b(Whenever)25 +b(a)h(clause)f(in)i(the)f(loop)g(body)g(executes,)h(it)681 +4574 y(evaluates)19 b(to)j(as)e(many)h(values)g(as)f(ther)o(e)g(ar)o(e) +f(state)i(variables,)e(updating)i(them.)805 4699 y(The)31 +b(optional)g Fy(<)p FA(counter)p Fy(>)f FB(variable)f(is)i(an)g +(iteration)f(counter)-6 b(.)55 b(It)31 b(is)g(bound)g(to)g(0)681 +4799 y(when)21 b(the)g(loop)g(starts.)k(The)c(counter)f(is)h(incr)o +(emented)f(each)g(time)h(a)f(non-eof)h(r)o(ecor)o(d)e(is)681 +4898 y(r)o(ead.)681 5147 y(120)p 1952 5071 323 4 v 1952 +5173 4 102 v 1173 w FD(DRAFT)p 2271 5173 V 1952 5176 +323 4 v 538 w FE(Mar)o(ch)g(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 121 127 -121 126 bop 365 1262 a Fv(Chapter)45 b(8)365 1702 y FB(Miscellaneous)51 -b(routines)365 2175 y Fu(8.1)99 b(Integer)25 b(bitwise)g(ops)365 -2398 y Fw(\(arithmetic-shift)37 b Fz(i)21 b(j)p Fw(\))87 b -Fs(\000)-15 b(!)87 b Fz(integer)1052 b FA(pr)o(ocedur)o(e)365 -2498 y Fw(\(bitwise-and)39 b Fz(i)21 b(j)p Fw(\))87 b Fs(\000)-15 -b(!)88 b Fz(integer)1269 b FA(pr)o(ocedur)o(e)365 2598 y Fw(\(bitwise-ior)39 -b Fz(i)21 b(j)p Fw(\))87 b Fs(\000)-15 b(!)88 b Fz(integer)1269 -b FA(pr)o(ocedur)o(e)365 2697 y Fw(\(bitwise-not)39 b Fz(i)p -Fw(\))87 b Fs(\000)-15 b(!)88 b Fz(integer)1313 b FA(pr)o(ocedur)o(e)365 -2797 y Fw(\(bitwise-xor)39 b Fz(i)21 b(j)p Fw(\))87 b Fs(\000)-15 -b(!)88 b Fz(integer)1269 b FA(pr)o(ocedur)o(e)573 2913 y(These)53 -b(operations)g(operate)f(on)h(integers)h(r)o(epr)o(esenting)d -(semi-in\256nite)j(bit)573 3013 y(strings,)21 b(using)h(a)e(2's-complement)h -(encoding.)573 3138 y Fw(arithmetic-shift)e FA(shifts)26 b -Fz(i)g FA(by)g Fz(j)f FA(bits.)43 b(A)25 b(left)h(shift)g(is)g -Fx(j)44 b(>)39 b Fl(0)p FA(;)28 b(a)d(right)h(shift)g(is)573 -3238 y Fx(j)i(<)22 b Fl(0)p FA(.)365 3516 y Fu(8.2)99 b(List)26 -b(procedures)365 3739 y Fw(\(nth)42 b Fz(list)21 b(i)p Fw(\))87 -b Fs(\000)-14 b(!)87 b Fz(object)1578 b FA(pr)o(ocedur)o(e)573 -3856 y(Returns)22 b(the)g Fx(i)1049 3826 y Ft(t)p Fm(h)1140 -3856 y FA(element)g(of)f Fz(list)p FA(.)31 b(The)22 b(\256rst)g(element)g -(\(the)f(car\))g(is)h Fw(\(nth)42 b Fz(list)i Fw(0\))p FA(,)573 -3956 y(the)21 b(second)g(element)g(is)g Fw(\(nth)42 b Fz(list)h -Fw(1\))p FA(,)20 b(and)g(so)i(on.)573 4081 y(This)e(pr)o(ocedur)o(e)f(is)h -(pr)o(ovided)f(as)h(it)g(is)g(useful)g(for)g(accessing)g(elements)h(fr)o(om)e -(the)573 4180 y(lists)i(r)o(eturned)f(by)h(the)g(\256eld-r)o(eaders)d -(\(chapter)i(7\).)365 4459 y Fu(8.3)99 b(T)-11 b(op)26 b(level)365 -4682 y Fw(\(repl\))85 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)1590 -b FA(pr)o(ocedur)o(e)573 4799 y(This)23 b(r)o(uns)h(a)e(Scheme)h(48)f(r)o -(ead-eval-print)e(loop,)k(r)o(eading)e(forms)h(fr)o(om)g(the)g(cur)o(-)573 -4898 y(r)o(ent)d(input)h(port,)g(and)f(writing)i(their)f(values)f(to)h(the)g -(curr)o(ent)f(output)h(port.)365 5147 y FD(November)d(1,)h(1995)h(\261)f(15) -14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1174 w FA(121)p eop +121 126 bop 490 614 a FB(Ther)o(e)28 b(ar)o(e)f(several)h(kinds)h(of)g +(loop)g(clause.)49 b(When)30 b(evaluating)e(the)h(body)g(of)f(the)365 +714 y(loop,)h Fx(awk)c FB(evaluates)h FA(all)h FB(the)g(clauses)f +(sequentially)-9 b(.)44 b(Unlike)27 b Fx(cond)p FB(,)f(it)h(does)g(not) +g(stop)365 814 y(after)20 b(the)h(\002rst)g(clause)f(is)h(satis\002ed;) +g(it)g(checks)f(them)i(all.)490 1010 y Ft(\017)41 b Fx(\()p +FA(test)i(body)938 1037 y Fu(1)1019 1010 y FA(body)1177 +1037 y Fu(2)1258 1010 y Fx(...\))573 1110 y FB(If)28 +b FA(test)h FB(is)g(tr)o(ue,)i(execute)d(the)h(body)g(forms.)50 +b(The)28 b(last)h(body)g(form)g(is)g(the)g(value)573 +1209 y(of)24 b(the)h(clause.)35 b(The)25 b(test)f(and)g(body)g(forms)h +(ar)o(e)e(evaluated)g(in)h(the)h(scope)f(of)g(the)573 +1309 y(r)o(ecor)o(d)19 b(and)h(state)h(variables.)573 +1440 y(The)g FA(test)f FB(form)h(can)f(be)h(one)g(of:)805 +1558 y(integer:)213 b(The)26 b(test)h(is)g(tr)o(ue)g(for)g(that)f +(iteration)h(of)g(the)g(loop.)44 b(The)1297 1658 y(\002rst)21 +b(iteration)g(is)g(#1.)805 1758 y(string:)258 b(The)23 +b(string)i(is)f(a)f(r)o(egular)g(expr)o(ession.)34 b(The)24 +b(test)g(is)g(tr)o(ue)1297 1857 y(if)c(the)h(r)o(egexp)f(matches)g(the) +h(r)o(ecor)o(d.)805 1957 y(expr)o(ession)100 b(If)38 +b(not)i(an)e(integer)h(or)g(a)f(string,)44 b(the)39 b(test)f(form)h(is) +g(a)1297 2056 y(Scheme)20 b(expr)o(ession)h(that)f(is)h(evaluated.)490 +2234 y Ft(\017)91 b Fx(\(range)128 b FA(start-test)43 +b(stop-test)f(body)1851 2261 y Fu(1)1931 2234 y Fx(...\))623 +2334 y(\(:range)84 b FA(start-test)43 b(stop-test)f(body)1851 +2361 y Fu(1)1931 2334 y Fx(...\))623 2434 y(\(range:)84 +b FA(start-test)43 b(stop-test)f(body)1851 2461 y Fu(1)1931 +2434 y Fx(...\))623 2533 y(\(:range:)e FA(start-test)j(stop-test)f +(body)1851 2560 y Fu(1)1931 2533 y Fx(...\))573 2632 +y FB(These)18 b(clauses)g(become)h(activated)e(when)i +FA(start-test)e FB(is)i(tr)o(ue;)g(they)g(stay)f(active)g(on)573 +2731 y(all)i(further)h(iterations)g(until)g FA(stop-test)f +FB(is)h(tr)o(ue.)573 2862 y(So,)f(to)h(print)g(out)h(the)f(\002rst)g +(ten)f(lines)i(of)f(a)f(\002le,)g(we)h(use)g(the)g(clause:)756 +3001 y Fx(\(:range:)40 b(1)j(10)g(\(display)d(record\)\))573 +3170 y FB(The)24 b(colons)i(contr)o(ol)f(whether)g(or)g(not)g(the)g +(start)f(and)g(stop)h(lines)g(ar)o(e)f(pr)o(ocessed)573 +3270 y(by)d(the)g(clause.)k(For)c(example:)805 3410 y +Fx(\(range)129 b(1)43 b(5)87 b(...\))164 b FB(Lines)83 +b(2)20 b(3)h(4)805 3510 y Fx(\(:range)85 b(1)43 b(5)87 +b(...\))164 b FB(Lines)21 b(1)f(2)g(3)h(4)805 3609 y +Fx(\(range:)85 b(1)43 b(5)87 b(...\))164 b FB(Lines)83 +b(2)20 b(3)h(4)f(5)805 3709 y Fx(\(:range:)41 b(1)i(5)87 +b(...\))164 b FB(Lines)21 b(1)f(2)g(3)h(4)f(5)573 3878 +y(A)g(line)g(can)g(trigger)h(both)g(tests,)f(either)g(simultaneously)i +(starting)f(and)f(stopping)573 3977 y(an)f(active)g(r)o(egion,)h(or)g +(simultaneously)h(stopping)g(one)f(and)f(starting)h(a)f(new)h(one,)573 +4077 y(so)h(ranges)g(can)f(abut)g(seamlessly)-9 b(.)490 +4239 y Ft(\017)41 b Fx(\(else)g FA(body)993 4266 y Fu(1)1074 +4239 y FA(body)1232 4266 y Fu(2)1313 4239 y Fx(...\))573 +4338 y FB(If)22 b(no)h(other)f(clause)g(has)g(executed)f(since)i(the)f +(top)h(of)f(the)g(loop,)h(or)g(since)f(the)h(last)573 +4438 y Fx(else)c FB(clause,)h(this)i(clause)e(executes.)490 +4599 y Ft(\017)41 b Fx(\()p FA(test)i Fx(=>)g FA(exp)o +Fx(\))573 4699 y FB(If)25 b(evaluating)f Fx(test)g FB(pr)o(oduces)g(a)h +(tr)o(ue)g(value,)h(apply)e FA(exp)h FB(to)h(that)f(value.)38 +b(If)25 b FA(test)573 4799 y FB(is)20 b(a)f(r)o(egular)o(-expr)o +(ession)e(string,)j(then)g FA(exp)f FB(is)h(applied)f(to)h(the)g(match) +f(data)g(str)o(uc-)573 4898 y(tur)o(e)h(r)o(eturned)f(by)i(the)g(r)o +(egexp)f(match)g(r)o(outine.)365 5147 y FE(Mar)o(ch)f(10,)g(1997)h +(\226)f(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 +4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 +v 1174 w FB(121)p eop %%Page: 122 128 -122 127 bop 888 614 a FA(If)25 b(you)h(wish)f(to)h(try)f(something)i(danger)o -(ous,)e(and)f(want)h(to)h(be)f(able)f(to)h(r)o(ecover)888 714 -y(your)c(shell)h(state,)e(you)h(can)g(fork)f(of)o(f)g(a)g(subshell)i(with)g -(the)e(following)j(form:)1071 853 y Fw(\(run)42 b(\(begin)f(\(repl\)\)\))888 -991 y Fx(:)14 b(:)g(:)g FA(or)-6 b(,)21 b(r)o(ephrased)e(for)h(the)h(pr)o -(oceduralists:)1071 1130 y Fw(\(wait)42 b(\(fork)f(repl\)\))681 -5147 y FA(122)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 w -FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 -b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p eop +122 127 bop 805 614 a Ft(\017)41 b Fx(\(after)g FA(body)1352 +641 y Fu(1)1433 614 y Fx(...\))888 714 y FB(This)23 b(clause)f +(executes)f(when)i(the)f(loop)h(encounters)g(EOF)-8 b(.)22 +b(The)g(body)g(forms)h(ex-)888 814 y(ecute)h(in)h(the)f(scope)h(of)f +(the)g(state)g(vars)g(and)g(the)g(r)o(ecor)o(d-count)f(var)-6 +b(,)24 b(if)g(ther)o(e)f(ar)o(e)888 913 y(any)-9 b(.)26 +b(The)20 b(value)g(of)h(the)g(last)g(body)g(form)g(is)g(the)g(value)f +(of)g(the)h(entir)o(e)f(awk)h(form.)888 1042 y(If)f(ther)o(e)f(is)h(no) +g Fx(after)e FB(clause,)h Fx(awk)f FB(r)o(eturns)i(the)g(loop's)g +(state)g(variables)e(as)i(multi-)888 1142 y(ple)h(values.)681 +1389 y Fz(7.2.1)81 b(Examples)681 1572 y FB(Her)o(e)26 +b(ar)o(e)g(some)i(examples)f(of)g Fx(awk)f FB(being)i(used)f(to)h(pr)o +(ocess)e(various)i(types)f(of)h(input)681 1671 y(str)o(eam.)888 +1858 y Fx(\(define)41 b($)i(nth\))347 b(;)43 b(Saves)f(typing.)888 +2058 y(;;;)h(Print)e(out)i(the)f(name)g(and)g(home-directory)c(of)43 +b(everyone)d(in)j(/etc/passwd:)888 2157 y(\(let)f(\(\(read-passwd)c +(\(field-reader)h(\(infix-splitter)e(":")42 b(7\)\)\)\))976 +2257 y(\(call-with-inpu)o(t-)o(fil)o(e)37 b("/etc/passwd")1063 +2357 y(\(lambda)j(\(port\))1150 2456 y(\(awk)i(\(read-passwd)c(port\))k +(\(record)f(fields\))f(\(\))1237 2556 y(\(#t)i(\(format)f(#t)i("~a's)e +(home)h(directory)e(is)j(~a~\045")1760 2655 y(\($)g(fields)e(0\))1760 +2755 y(\($)i(fields)e(5\)\)\)\)\)\)\))888 3005 y(;;;)i(Print)e(out)i +(the)f(user-name)e(and)i(home-directory)c(of)43 b(everyone)d(whose)888 +3104 y(;;;)j(name)f(begins)f(with)h("S")888 3204 y(\(let)g +(\(\(read-passwd)c(\(field-reader)h(\(infix-splitter)e(":")42 +b(7\)\)\)\))976 3303 y(\(call-with-inpu)o(t-)o(fil)o(e)37 +b("/etc/passwd")1063 3403 y(\(lambda)j(\(port\))1150 +3503 y(\(awk)i(\(read-passwd)c(port\))k(\(record)f(fields\))f(\(\))1237 +3602 y(\("^S")i(\(format)e(#t)j("~a's)f(home)f(directory)f(is)j +(~a~\045")1847 3702 y(\($)g(fields)e(0\))1847 3802 y(\($)i(fields)e +(5\)\)\)\)\)\)\))888 4051 y(;;;)i(Read)f(a)h(series)e(of)i(integers)d +(from)i(stdin.)f(This)h(expression)d(evaluates)888 4151 +y(;;;)k(to)f(the)h(number)e(of)i(positive)d(numbers)h(that)h(were)f +(read.)h(Note)g(our)888 4250 y(;;;)h("record-reader")37 +b(is)43 b(the)f(standard)e(Scheme)i(READ)f(procedure.)888 +4350 y(\(awk)h(\(read\))f(\(i\))130 b(\(\(npos)41 b(0\)\))976 +4450 y(\(\(>)h(i)h(0\))g(\(+)g(npos)e(1\)\)\))888 4699 +y(;;;)i(Filter)e(--)i(pass)e(only)h(lines)g(containing)d(my)k(name.)888 +4799 y(\(awk)f(\(read-line\))d(\(line\))i(\(\))976 4898 +y(\("Olin")f(\(display)g(line\))i(\(newline\)\)\))681 +5147 y FB(122)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 123 129 -123 128 bop 365 1266 a Fv(Chapter)45 b(9)365 1710 y FB(Running)53 -b(scsh)365 2193 y FA(Scsh)23 b(is)g(curr)o(ently)f(implemented)h(on)h(top)f -(of)g(Scheme)f(48,)g(a)g(fr)o(eely-available)e(Scheme)365 2293 -y(implementation)c(written)e(by)g(Jonathan)h(Rees)f(and)g(Richar)o(d)f -(Kelsey)-9 b(.)26 b(Scheme)13 b(48)h(uses)g(a)365 2392 y(byte-code)k(interpr) -o(eter)e(for)i(good)h(code)f(density)-9 b(,)18 b(portability)h(and)e(medium)i -(ef)o(\256ciency)-9 b(.)365 2492 y(It)21 b(is)g(R4RS.)g(It)g(also)f(has)h(a)g -(module)g(system)g(designed)g(by)g(Jonathan)f(Rees.)490 2620 -y(Scsh's)25 b(design)h(is)g(not)f(Scheme)g(48)g(speci\256c,)h(although)g(the) -f(curr)o(ent)g(implementa-)365 2720 y(tion)j(is)g(necessarily)f(so.)47 -b(Scsh)27 b(is)h(intended)f(to)h(be)f(implementable)g(in)g(other)h(Scheme)365 -2820 y(implementations.)39 b(The)24 b(Scheme)f(48)g(virtual)h(machine)g(that) -g(scsh)h(uses)f(is)g(a)g(specially)365 2919 y(modi\256ed)k(version;)i -(standar)o(d)c(Scheme)g(48)g(virtual)h(machines)h(cannot)f(be)g(used)g(with) -365 3019 y(the)21 b(scsh)h(heap)e(image.)490 3147 y(Ther)o(e)37 -b(ar)o(e)f(several)h(dif)o(fer)o(ent)f(ways)i(to)g(invoke)g(scsh.)79 -b(Y)-8 b(ou)39 b(can)f(r)o(un)g(it)g(as)g(an)365 3247 y(interactive)30 -b(Scheme)g(system,)k(with)d(a)f(standar)o(d)f(r)o(ead-eval-print)e -(interaction)k(loop.)365 3347 y(Scsh)38 b(can)f(also)h(be)f(invoked)h(as)f -(the)g(interpr)o(eter)g(for)g(a)g(shell)h(script)f(by)h(putting)g(a)365 -3446 y(\252)p Fw(#!/usr/local/bin)o(/s)o(csh)f(-s)p FA(\272)19 -b(line)i(at)g(the)g(top)g(of)f(the)h(shell)h(script.)490 3574 -y(Descending)h(a)g(level,)f(it)i(is)f(also)g(possible)g(to)h(invoke)f(the)g -(underlying)h(virtual)e(ma-)365 3674 y(chine)k(byte-code)f(interpr)o(eter)f -(dir)o(ectly)h(on)h(dumped)f(heap)h(images.)42 b(Scsh)25 b(pr)o(ograms)365 -3774 y(can)j(be)f(pr)o(e-compiled)f(to)i(byte-codes)f(and)g(dumped)g(as)g -(raw)-8 b(,)29 b(binary)f(heap)f(images.)365 3873 y(W)-6 b(riting)28 -b(heap)e(images)h(strips)g(out)h(unused)f(portions)h(of)f(the)g(scsh)g(r)o -(untime)h(\(such)f(as)365 3973 y(the)19 b(compiler)-6 b(,)20 -b(the)f(debugger)-6 b(,)18 b(and)g(other)i(complex)f(subsystems\),)h(r)o -(educing)e(memory)365 4073 y(demands)25 b(and)g(saving)h(loading)f(and)g -(compilation)i(times.)41 b(The)26 b(heap)f(image)g(format)365 -4172 y(allows)k(for)f(an)h(initial)g Fw(#!/usr/local/li)o(b/s)o(cs)o(h/s)o -(cs)o(hvm)22 b FA(trigger)28 b(on)h(the)f(\256rst)h(line)365 -4272 y(of)23 b(the)f(image,)h(making)g(heap)f(images)g(dir)o(ectly)g -(executable)f(as)h(another)h(kind)g(of)f(shell)365 4371 y(script.)490 -4500 y(Finally)-9 b(,)24 b(scsh's)h(static)e(linker)h(system)h(allows)f -(dumped)f(heap)g(images)h(to)g(be)f(com-)365 4599 y(piled)c(to)h(a)f(raw)g -(Unix)g(a.out\(5\))e(format,)i(which)i(can)e(be)g(linked)g(into)h(the)g(text) -f(section)h(of)365 4699 y(the)h(vm)g(binary)-9 b(.)27 b(This)21 -b(pr)o(oduces)f(a)g(tr)o(ue)h(Unix)f(executable)g(binary)g(\256le.)28 -b(Since)20 b(the)h(byte)365 4799 y(codes)i(comprising)h(the)e(pr)o(ogram)g -(ar)o(e)g(in)h(the)f(\256le's)h(text)g(section,)g(they)g(ar)o(e)e(not)j -(traced)365 4898 y(or)f(copied)g(by)f(the)h(garbage)f(collector)-6 -b(,)23 b(do)g(not)g(occupy)g(space)f(in)h(the)g(vm's)h(heap,)e(and)365 -5147 y FD(November)c(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 -5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V -1636 5176 323 4 v 1174 w FA(123)p eop +123 128 bop 573 614 a Fx(;;;)42 b(Count)g(the)g(number)f(of)i +(non-comment)c(lines)i(of)i(code)f(in)h(my)g(Scheme)e(source.)573 +714 y(\(awk)h(\(read-line\))d(\(line\))i(\(\(nlines)f(0\)\))660 +814 y(\("^[)i(\\t]*;")f(nlines\))651 b(;)43 b(A)g(comment)e(line.)660 +913 y(\(else)303 b(\(+)43 b(nlines)e(1\)\)\))347 b(;)43 +b(Not)f(a)i(comment)c(line.)573 1196 y(;;;)i(Read)g(numbers,)e +(counting)h(the)h(evens)g(and)g(odds.)573 1295 y(\(awk)g(\(read\))f +(\(val\))g(\(\(evens)g(0\))i(\(odds)e(0\)\))660 1395 +y(\(\(>)h(val)h(0\))f(\(display)f("pos)h("\))86 b(\(values)41 +b(evens)g(odds\)\))g(;)j(Tell)d(me)i(about)660 1494 y(\(\(<)f(val)h +(0\))f(\(display)f("neg)h("\))86 b(\(values)41 b(evens)g(odds\)\))g(;)j +(sign,)d(too.)660 1594 y(\(else)259 b(\(display)41 b("zero)g("\))i +(\(values)e(evens)g(odds\)\))660 1793 y(\(\(even?)g(val\))h(\(values)e +(\(+)j(evens)f(1\))g(odds\)\))660 1893 y(\(else)347 b(\(values)40 +b(evens)303 b(\(+)43 b(odds)f(1\)\)\)\))573 2175 y(;;;)g(Determine)e +(the)i(max)h(length)e(of)i(all)f(the)g(lines)g(in)h(the)f(file.)573 +2275 y(\(awk)g(\(read-line\))d(\(line\))i(\(\(max-len)f(0\)\))660 +2374 y(\(#t)i(\(max)g(max-len)f(\(string-length)d(line\)\)\)\))573 +2657 y(;;;)k(\(This)g(could)f(also)h(be)h(done)f(with)g(REDUCE-PORT:\)) +573 2756 y(\(reduce-port)c(\(current-input-po)o(rt\))f(read-line)1139 +2856 y(\(lambda)k(\(line)h(maxlen\))e(\(max)i(\(string-length)c(line\)) +k(maxlen\)\))1139 2956 y(0\))573 3238 y(;;;)g(Print)g(every)f(line)h +(longer)f(than)h(80)h(chars.)573 3337 y(;;;)f(Prefix)f(each)h(line)g +(with)g(its)g(line)g(#.)573 3437 y(\(awk)g(\(read-line\))d(\(line\))i +(lineno)g(\(\))660 3537 y(\(\(>)h(\(string-length)c(line\))k(80\))704 +3636 y(\(format)e(#t)j("~d:)f(~s~\045")g(lineno)f(line\)\)\))573 +3919 y(;;;)h(Strip)g(blank)f(lines)h(from)g(input.)573 +4018 y(\(awk)g(\(read-line\))d(\(line\))i(\(\))660 4118 +y(\(".")h(\(display)e(line\))i(\(newline\)\)\))573 4400 +y(;;;)g(Sort)g(the)g(entries)f(in)i(/etc/passwd)c(by)k(login)e(name.) +573 4500 y(\(for-each)f(\(lambda)g(\(entry\))h(\(display)f(\(cdr)i +(entry\)\))f(\(newline\)\))432 b(;)43 b(Out)1009 4599 +y(\(sort)e(\(lambda)g(\(x)i(y\))f(\(string)c Fm(0)p FB(;)28 b(a)e(right)h(shift) +g(is)573 3238 y Fy(j)h(<)22 b Fm(0)p FB(.)365 3516 y +Fv(8.2)99 b(List)26 b(procedures)365 3739 y Fx(\(nth)42 +b FA(list)21 b(i)p Fx(\))87 b Ft(\000)-14 b(!)87 b FA(object)1578 +b FB(pr)o(ocedur)o(e)573 3856 y(Returns)22 b(the)h Fy(i)1050 +3826 y Fu(t)p Fn(h)1140 3856 y FB(element)f(of)g FA(list)p +FB(.)29 b(The)22 b(\002rst)g(element)g(\(the)g(car\))f(is)h +Fx(\(nth)42 b FA(list)i Fx(0\))p FB(,)573 3956 y(the)21 +b(second)g(element)g(is)g Fx(\(nth)42 b FA(list)h Fx(1\))p +FB(,)20 b(and)g(so)i(on.)573 4081 y(This)e(pr)o(ocedur)o(e)f(is)h(pr)o +(ovided)f(as)h(it)g(is)g(useful)g(for)g(accessing)g(elements)h(fr)o(om) +e(the)573 4180 y(lists)i(r)o(eturned)f(by)h(the)g(\002eld-r)o(eaders)d +(\(chapter)i(7\).)365 4459 y Fv(8.3)99 b(T)-11 b(op)26 +b(level)365 4682 y Fx(\(repl\))85 b Ft(\000)-14 b(!)87 +b FA(unde\002ned)1590 b FB(pr)o(ocedur)o(e)573 4799 y(This)23 +b(r)o(uns)h(a)e(Scheme)h(48)f(r)o(ead-eval-print)e(loop,)k(r)o(eading)e +(forms)h(fr)o(om)g(the)g(cur)o(-)573 4898 y(r)o(ent)d(input)h(port,)g +(and)f(writing)i(their)f(values)f(to)h(the)g(curr)o(ent)f(output)h +(port.)365 5147 y FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1174 w FB(125)p +eop %%Page: 126 132 -126 131 bop 805 614 a FA(It)20 b(may)g(take)f(you)h(a)f(little)h(while)g(to)g -(get)g(used)f(to)h(the)g(new)g(style)g(of)f(pr)o(ogram)g(devel-)681 -714 y(opment.)28 b(Although)21 b(scsh)g(can)f(be)g(used)g(without)i(r)o -(eferring)d(to)i(the)g(module)f(system)h(at)681 814 y(all,)d(we)h(r)o -(ecommend)g(taking)g(the)g(time)g(to)g(learn)f(and)g(use)h(it.)27 -b(The)19 b(ef)o(fort)e(will)i(pay)g(of)o(f)f(in)681 913 y(the)j(constr)o -(uction)h(of)f(modular)-6 b(,)20 b(factorable)f(pr)o(ograms.)681 -1181 y Fy(9.1.4)81 b(Switches)681 1373 y FA(The)21 b(scsh)g(top-level)f -(takes)h(command-line)g(switches)g(in)h(the)f(following)h(format:)888 -1522 y Fw(scsh)42 b([)p Fz(meta-ar)o(g)n Fw(])h([)p Fz(switch)1797 -1534 y Fm(i)1868 1522 y Fx(:)14 b(:)g(:)g Fw(])43 b([)p Fz(end-option)f(ar)o -(g)2622 1549 y Ft(1)2703 1522 y Fx(:)14 b(:)g(:)57 b Fz(ar)o(g)2967 -1549 y Fm(n)3012 1522 y Fw(])681 1671 y FA(wher)o(e)938 1898 -y Fz(meta-ar)o(g:)159 b Fw(\\)21 b Fz(script-\256le-name)938 -2097 y(switch:)240 b Fw(-e)20 b Fz(entry-point)405 b FA(Specify)20 -b(top-level)g(entry-point.)1418 2197 y Fw(-o)g Fz(structur)o(e)480 -b FA(Open)21 b(str)o(uctur)o(e)f(in)h(curr)o(ent)f(package.)1418 -2296 y Fw(-m)g Fz(structur)o(e)480 b FA(Switch)21 b(to)g(package.)1418 -2396 y Fw(-n)f Fz(new-package)362 b FA(Switch)21 b(to)g(new)g(package.)1418 -2595 y Fw(-lm)f Fz(module-\256le-name)165 b FA(Load)20 b(module)h(into)h -(con\256g)f(package.)1418 2695 y Fw(-l)f Fz(\256le-name)482 -b FA(Load)20 b(\256le)h(into)g(curr)o(ent)f(package.)1418 2794 -y Fw(-dm)765 b FA(Do)21 b(script)g(module.)1418 2894 y Fw(-ds)765 -b FA(Do)21 b(script.)938 3093 y Fz(end-option:)98 b Fw(-s)20 -b Fz(script)1418 3193 y Fw(-c)g Fz(exp)1418 3293 y Fw(--)681 -3440 y FA(These)29 b(command-line)g(switches)h(essentially)f(pr)o(ovide)f(a)h -(little)g(linker)h(language)e(for)681 3540 y(linking)34 b(a)f(shell)g(script) -g(or)g(a)f(pr)o(ogram)g(together)i(with)f(Scheme)g(48)f(modules.)64 -b(The)681 3640 y(command-line)23 b(pr)o(ocessor)f(serially)h(opens)g(str)o -(uctur)o(es)f(and)g(loads)h(code)f(into)i(a)e(given)681 3739 -y(package.)71 b(Switches)36 b(that)g(side-ef)o(fect)e(a)h(package)g(operate)g -(on)i(a)e(particular)g(\252cur)o(-)681 3839 y(r)o(ent\272)20 -b(package;)f(ther)o(e)h(ar)o(e)g(switches)h(to)h(change)e(this)i(package.)27 -b(\(These)20 b(switches)i(pr)o(o-)681 3939 y(vide)c(functionality)h -(equivalent)g(to)g(the)f(interactive)g Fw(,open)e(,load)h(,in)g -FA(and)h Fw(,new)f FA(com-)681 4038 y(mands.\))33 b(Except)21 -b(wher)o(e)h(indicated,)g(switches)i(specify)e(actions)h(that)g(ar)o(e)e -(executed)h(in)681 4138 y(a)j(left-to-right)g(or)o(der)-6 b(.)40 -b(The)25 b(initial)h(curr)o(ent)f(package)f(is)i(the)f(user)g(package,)g -(which)i(is)681 4237 y(completely)16 b(empty)g(and)g(opens)h(\(imports)f(the) -g(bindings)h(of\))f(the)g(R4RS)g(and)f(scsh)i(str)o(uc-)681 -4337 y(tur)o(es.)805 4468 y(If)k(the)g(Scheme)g(pr)o(ocess)g(is)g(started)g -(up)g(in)g(an)g(interactive)g(mode,)g(then)h(the)f(curr)o(ent)681 -4568 y(package)c(in)i(for)o(ce)e(at)g(the)i(end)f(of)g(switch)h(scanning)g -(is)g(the)f(one)h(inside)f(which)h(the)g(inter)o(-)681 4668 -y(active)h(r)o(ead-eval-print)e(loop)j(is)g(started.)805 4799 -y(The)f(command-line)h(switch)g(pr)o(ocessor)f(works)g(in)h(two)g(passes:)27 -b(it)20 b(\256rst)g(parses)g(the)681 4898 y(switches,)26 b(building)f(a)f -(list)g(of)h(actions)g(to)f(perform,)h(then)g(the)f(actions)h(ar)o(e)e -(performed)681 5147 y(126)p 1952 5071 323 4 v 1952 5173 4 102 -v 1173 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 -b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p eop +126 131 bop 888 614 a FB(If)25 b(you)h(wish)f(to)h(try)f(something)i +(danger)o(ous,)e(and)f(want)h(to)h(be)f(able)f(to)h(r)o(ecover)888 +714 y(your)c(shell)h(state,)e(you)h(can)g(fork)f(of)o(f)g(a)g(subshell) +i(with)g(the)e(following)j(form:)1071 853 y Fx(\(run)42 +b(\(begin)f(\(repl\)\)\))888 991 y FB(.)12 b(.)g(.)g(or)-6 +b(,)21 b(r)o(ephrased)e(for)i(the)g(pr)o(oceduralists:)1071 +1130 y Fx(\(wait)42 b(\(fork)f(repl\)\))681 5147 y FB(126)p +1952 5071 323 4 v 1952 5173 4 102 v 1173 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226) +f(21)13 b(:)f(47)p eop %%Page: 127 133 -127 132 bop 365 614 a FA(serially)-9 b(.)50 b(The)28 b(switch)h(list)g(is)f -(terminated)g(by)g(one)h(of)f(the)g Fz(end-option)f FA(switches.)51 -b(The)365 714 y Fz(ar)o(g)474 741 y Fm(i)520 714 y FA(ar)o(guments)17 -b(occurring)h(after)f(an)h(end-option)g(switch)h(ar)o(e)d(passed)h(to)h(the)g -(scsh)g(pr)o(o-)365 814 y(gram)j(as)g(the)g(value)g(of)g Fw(command-line-arg) -o(um)o(ent)o(s)15 b FA(and)20 b(the)i(tail)f(of)g(the)g(list)h(r)o(eturned) -365 913 y(by)h Fw(\(command-line\))p FA(.)29 b(That)23 b(is,)g(an)g -Fz(end-option)f FA(switch)i(separates)e(switches)h(that)g(con-)365 -1013 y(tr)o(ol)16 b(the)h(scsh)f(\252machine\272)g(fr)o(om)f(the)i(actual)e -(ar)o(guments)h(being)g(passed)g(to)g(the)h(scsh)f(pr)o(o-)365 -1112 y(gram)21 b(that)g(r)o(uns)g(on)g(that)g(machine.)490 -1247 y(The)g(following)h(switches)f(and)g(end)f(options)i(ar)o(e)e -(de\256ned:)490 1454 y Fs(\017)41 b Fw(-o)i Fz(struct)573 1553 -y FA(Open)21 b(the)g(str)o(uctur)o(e)f(in)h(the)g(curr)o(ent)f(package.)490 -1732 y Fs(\017)41 b Fw(-n)i Fz(package)573 1832 y FA(Make)20 -b(and)g(enter)h(a)g(new)g(package.)27 b(The)21 b(package)f(has)h(an)g -(associated)f(str)o(uctur)o(e)573 1932 y(named)g Fz(package)f -FA(with)i(an)f(empty)g(export)g(list.)28 b(If)19 b Fz(package)g -FA(is)i(the)f(string)h(\252)p Fw(#f)p FA(\272,)d(the)573 2031 -y(new)j(package)f(is)h(anonmyous,)h(with)f(no)h(associated)e(named)g(str)o -(uctur)o(e.)573 2171 y(The)25 b(new)g(package)f(initially)i(opens)g(no)g -(other)f(str)o(uctur)o(es,)h(not)f(even)g(the)h(R4RS)573 2270 -y(bindings.)h(Y)-8 b(ou)18 b(must)g(follow)g(a)e(\252)p Fw(-n)42 -b(foo)p FA(\272)16 b(switch)i(with)f(\252)p Fw(-o)43 b(scheme)p -FA(\272)14 b(to)j(access)573 2370 y(the)k(standar)o(d)e(identi\256ers)i(such) -g(as)f Fw(car)g FA(and)g Fw(define)p FA(.)490 2549 y Fs(\017)41 -b Fw(-m)i Fz(struct)573 2648 y FA(Change)27 b(the)f(curr)o(ent)g(package)g -(to)h(the)g(package)e(underlying)j(str)o(uctur)o(e)e Fz(struct)p -FA(.)573 2748 y(\(The)20 b Fw(-m)g FA(stands)h(for)f(\252module.\272\))490 -2927 y Fs(\017)41 b Fw(-lm)h Fz(module-\256le-name)573 3027 -y FA(Load)20 b(the)i(speci\256ed)f(\256le)g(into)h(scsh's)h(con\256g)f -(package)e(\320)h(the)h(\256le)f(must)h(contain)573 3126 y(sour)o(ce)17 -b(written)i(in)f(the)g(Scheme)g(48)e(module)j(language)e(\(\252load)g -(module\272\).)26 b(Does)573 3226 y(not)21 b(alter)f(the)h(curr)o(ent)f -(package.)490 3405 y Fs(\017)41 b Fw(-l)i Fz(\256le-name)573 -3504 y FA(Load)20 b(the)h(speci\256ed)f(\256le)h(into)h(the)f(curr)o(ent)f -(package.)490 3683 y Fs(\017)41 b Fw(-c)i Fz(exp)573 3783 y -FA(Evaluate)19 b(expr)o(ession)i Fz(exp)f FA(in)h(the)g(curr)o(ent)e(package) -h(and)g(exit.)27 b(This)22 b(is)f(called)e Fw(-c)573 3883 y -FA(after)f(a)g(common)j(shell)e(convention)i(\(see)d(sh)i(and)e(csh\).)27 -b(The)19 b(expr)o(ession)g(is)h(eval-)573 3982 y(uated)g(in)h(the)g(the)g -(curr)o(ent)f(package)f(\(and)h(hence)h(is)g(af)o(fected)d(by)j -Fw(-m)p FA('s)f(and)h Fw(-n)p FA('s.\))573 4122 y(When)g(the)g(scsh)h -(top-level)f(constr)o(ucts)h(the)f(scsh)h(command-line)f(in)g(this)h(case,)e -(it)573 4221 y(takes)j Fw("scsh")d FA(to)k(be)f(the)g(pr)o(ogram)f(name.)34 -b(This)24 b(switch)g(terminates)f(ar)o(gument)573 4321 y(scanning;)e -(following)h(ar)o(gs)e(become)h(the)g(tail)g(of)f(the)h(command-line)g(list.) -490 4500 y Fs(\017)41 b Fw(-e)i Fz(entry-point)573 4599 y FA(Specify)27 -b(an)h(entry)g(point)h(for)f(a)f(pr)o(ogram.)49 b(The)28 b -Fz(entry-point)f FA(is)h(a)g(variable)f(that)573 4699 y(is)i(taken)f(fr)o(om) -h(the)f(curr)o(ent)g(package)g(in)h(for)o(ce)e(at)i(the)f(end)h(of)f(switch)i -(evalua-)573 4799 y(tion.)45 b(The)26 b(entry)g(point)h(does)g(not)g(have)e -(to)i(be)f(exported)f(by)i(the)f(package)f(in)i(a)573 4898 -y(str)o(uctur)o(e;)18 b(it)g(can)g(be)f(internal)h(to)h(the)f(package.)25 -b(The)18 b(top)g(level)g(passes)g(contr)o(ol)g(to)365 5147 -y FD(November)g(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 -323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 -5176 323 4 v 1174 w FA(127)p eop +127 132 bop 365 1266 a Fw(Chapter)45 b(9)365 1709 y FC(Running)53 +b(scsh)365 2194 y FB(Scsh)23 b(is)g(curr)o(ently)f(implemented)h(on)h +(top)f(of)g(Scheme)f(48,)g(a)g(fr)o(eely-available)e(Scheme)365 +2293 y(implementation)i(written)f(by)f(Jonathan)g(Rees)h(and)f(Richar)o +(d)g(Kelsey)-9 b(.)25 b(Scheme)20 b(48)f(uses)365 2393 +y(a)33 b(byte-code)g(interpr)o(eter)f(for)h(good)h(code)g(density)-9 +b(,)36 b(portability)e(and)f(medium)h(ef)o(\002-)365 +2493 y(ciency)-9 b(.)26 b(It)20 b(is)i(R4RS.)e(It)h(also)g(has)g(a)f +(module)h(system)h(designed)e(by)h(Jonathan)g(Rees.)490 +2621 y(Scsh's)k(design)h(is)g(not)f(Scheme)g(48)g(speci\002c,)h +(although)g(the)f(curr)o(ent)g(implementa-)365 2720 y(tion)k(is)e +(necessarily)g(so.)46 b(Scsh)27 b(is)h(intended)f(to)h(be)f +(implementable)h(in)f(other)h(Scheme)365 2820 y(implementations.)37 +b(The)24 b(Scheme)g(48)f(virtual)h(machine)g(that)g(scsh)h(uses)g(is)f +(a)g(specially)365 2920 y(modi\002ed)k(version;)i(standar)o(d)c(Scheme) +g(48)g(virtual)h(machines)h(cannot)f(be)g(used)g(with)365 +3019 y(the)21 b(scsh)h(heap)e(image.)490 3147 y(Ther)o(e)37 +b(ar)o(e)f(several)h(dif)o(fer)o(ent)f(ways)i(to)h(invoke)f(scsh.)78 +b(Y)-8 b(ou)39 b(can)e(r)o(un)i(it)f(as)g(an)365 3247 +y(interactive)30 b(Scheme)g(system,)k(with)d(a)f(standar)o(d)f(r)o +(ead-eval-print)e(interaction)k(loop.)365 3347 y(Scsh)38 +b(can)f(also)h(be)f(invoked)h(as)f(the)g(interpr)o(eter)g(for)g(a)g +(shell)h(script)f(by)h(putting)g(a)365 3446 y(\223)p +Fx(#!/usr/local/bin)o(/s)o(csh)f(-s)p FB(\224)19 b(line)i(at)g(the)g +(top)g(of)f(the)h(shell)h(script.)490 3575 y(Descending)h(a)g(level,)f +(it)i(is)f(also)g(possible)g(to)h(invoke)f(the)g(underlying)h(virtual)e +(ma-)365 3674 y(chine)k(byte-code)f(interpr)o(eter)g(dir)o(ectly)g(on)h +(dumped)f(heap)h(images.)40 b(Scsh)26 b(pr)o(ograms)365 +3774 y(can)i(be)f(pr)o(e-compiled)f(to)i(byte-codes)f(and)g(dumped)g +(as)g(raw)-8 b(,)29 b(binary)f(heap)f(images.)365 3873 +y(W)-6 b(riting)28 b(heap)e(images)h(strips)g(out)h(unused)f(portions)h +(of)f(the)g(scsh)g(r)o(untime)h(\(such)f(as)365 3973 +y(the)19 b(compiler)-6 b(,)20 b(the)f(debugger)-6 b(,)18 +b(and)g(other)i(complex)f(subsystems\),)h(r)o(educing)e(memory)365 +4073 y(demands)25 b(and)g(saving)h(loading)g(and)f(compilation)i +(times.)40 b(The)25 b(heap)g(image)h(format)365 4172 +y(allows)j(for)f(an)h(initial)g Fx(#!/usr/local/li)o(b/s)o(cs)o(h/s)o +(cs)o(hvm)22 b FB(trigger)28 b(on)h(the)f(\002rst)h(line)365 +4272 y(of)23 b(the)f(image,)h(making)g(heap)f(images)g(dir)o(ectly)g +(executable)f(as)h(another)h(kind)g(of)f(shell)365 4372 +y(script.)490 4500 y(Finally)-9 b(,)24 b(scsh's)h(static)e(linker)h +(system)h(allows)f(dumped)f(heap)g(images)h(to)g(be)f(com-)365 +4599 y(piled)c(to)h(a)f(raw)g(Unix)g(a.out\(5\))e(format,)i(which)i +(can)e(be)g(linked)g(into)h(the)g(text)f(section)h(of)365 +4699 y(the)h(vm)g(binary)-9 b(.)26 b(This)21 b(pr)o(oduces)f(a)h(tr)o +(ue)g(Unix)g(executable)e(binary)i(\002le.)26 b(Since)21 +b(the)g(byte)365 4799 y(codes)i(comprising)h(the)e(pr)o(ogram)g(ar)o(e) +g(in)h(the)f(\002le's)h(text)g(section,)g(they)g(ar)o(e)e(not)j(traced) +365 4898 y(or)f(copied)g(by)f(the)h(garbage)f(collector)-6 +b(,)23 b(do)g(not)g(occupy)g(space)f(in)h(the)g(vm's)h(heap,)e(and)365 +5147 y FE(Mar)o(ch)d(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1174 w FB(127)p eop %%Page: 128 134 -128 133 bop 888 614 a FA(the)23 b(entry)g(point)h(by)f(applying)g(it)g(to)g -(the)g(command-line)g(list)h(\(so)e(pr)o(ograms)h(ex-)888 714 -y(ecuting)d(in)g(private)e(packages)g(can)h(r)o(efer)o(ence)e(their)i -(command-line)g(ar)o(guments)888 814 y(without)26 b(opening)f(the)f -Fw(scsh)f FA(package)g(to)i(access)e(the)i Fw(\(command-line\))18 -b FA(pr)o(oce-)888 913 y(dur)o(e\).)26 b(Note)19 b(that,)g(like)g(the)g(list) -g(r)o(eturned)f(by)h(the)g Fw(\(command-line\))13 b FA(pr)o(ocedur)o(e,)888 -1013 y(the)21 b(list)f(passed)g(to)g(the)h(entry)f(point)h(includes)f(the)h -(name)f(of)g(the)g(pr)o(ogram)g(being)888 1112 y(executed)15 -b(\(as)g(the)h(\256rst)h(element)f(of)g(the)g(list\),)h(not)f(just)h(the)f -(ar)o(guments)f(to)i(the)f(pr)o(o-)888 1212 y(gram.)888 1345 -y(A)21 b Fw(-e)g FA(switch)h(can)f(occur)g(anywher)o(e)g(in)g(the)h(switch)g -(list,)g(but)f(it)h(is)f(the)h Fz(last)f FA(action)888 1445 -y(performed)k(by)g(switch)i(scanning)f(if)f(it)h(occurs.)41 -b(\(W)-8 b(e)25 b(violate)h(or)o(dering)f(her)o(e)f(as)888 -1544 y(the)14 b(shell-script)h Fw(#!)e FA(mechanism)i(pr)o(events)e(you)h(fr) -o(om)g(putting)g(the)h Fz(-e)f FA(switch)g(last,)888 1644 y(wher)o(e)20 -b(it)h(belongs.\))805 1810 y Fs(\017)41 b Fw(-s)i Fz(script)888 -1910 y FA(Specify)20 b(a)h(\256le)g(to)g(load.)27 b(A)21 b -Fw(-ds)f FA(\(do-script\))f(or)i Fw(-dm)f FA(\(do-module\))g(switch)i(occur)o -(-)888 2009 y(ring)27 b(earlier)e(in)i(the)g(switch)g(list)g(gives)g(the)f -(place)g(wher)o(e)f(the)i(script)f(should)h(be)888 2109 y(loaded.)43 -b(If)25 b(ther)o(e)g(is)i(no)f Fw(-ds)f FA(or)h Fw(-dm)f FA(switch,)i(then)g -(the)f(script)g(is)g(loaded)f(at)h(the)888 2208 y(end)15 b(of)f(switch)i -(scanning,)g(into)g(the)e(module)h(that)g(is)g(curr)o(ent)e(at)i(the)f(end)h -(of)f(switch)888 2308 y(scanning.)888 2441 y(W)-8 b(e)17 b(use)f(the)h -Fw(-ds)e FA(switch)i(to)g(violate)f(left-to-right)h(switch)g(execution)f(or)o -(der)g(as)g(the)888 2540 y Fw(-s)h FA(switch)h(is)g Fz(r)o(equir)o(ed)g -FA(to)f(be)h(last)f(\(because)f(of)h(the)h Fw(#!)f FA(machinery\),)g -(independent)888 2640 y(of)k(when/wher)o(e)g(in)g(the)g(switch-pr)o(ocessing) -h(or)o(der)d(it)i(should)h(be)e(loaded.)888 2773 y(When)29 -b(the)f(scsh)h(top-level)f(constr)o(ucts)h(the)g(scsh)g(command-line)f(in)h -(this)g(case,)888 2873 y(it)j(takes)g Fz(script)f FA(to)h(be)g(the)g(pr)o -(ogram)f(name.)60 b(This)33 b(switch)f(terminates)g(switch)888 -2972 y(parsing;)19 b(following)i(ar)o(gs)c(ar)o(e)h(ignor)o(ed)g(by)h(the)f -(switch-scanner)h(and)g(ar)o(e)e(passed)888 3072 y(thr)o(ough)22 -b(to)f(the)g(pr)o(ogram)f(as)g(the)h(tail)g(of)f(the)h(command-line)h(list.) -805 3238 y Fs(\017)41 b Fw(--)888 3337 y FA(T)-8 b(erminate)39 -b(ar)o(gument)g(scanning)g(and)g(start)f(up)h(scsh)h(in)f(interactive)f -(mode.)888 3437 y(If)e(the)g(ar)o(gument)f(list)i(just)f(r)o(uns)h(out,)j -(without)d(either)f(a)f(terminating)i Fw(-s)e FA(or)888 3537 -y Fw(--)k FA(ar)o(g,)j(then)e(scsh)g(also)f(starts)g(up)h(in)f(interactive)g -(mode,)44 b(with)c(an)f(empty)888 3636 y Fw(command-line-argu)o(me)o(nts)28 -b FA(list)35 b(\(for)e(example,)k(simply)e(entering)g Fw(scsh)e -FA(at)h(a)888 3736 y(shell)22 b(pr)o(ompt)e(with)i(no)f(ar)o(gs)f(at)g -(all\).)888 3869 y(When)29 b(the)f(scsh)h(top-level)f(constr)o(ucts)h(the)g -(scsh)g(command-line)f(in)h(this)g(case,)888 3968 y(it)e(takes)f -Fw("scsh")e FA(to)j(be)f(the)g(pr)o(ogram)g(name.)44 b(This)27 -b(switch)g(terminates)f(switch)888 4068 y(parsing;)19 b(following)i(ar)o(gs)c -(ar)o(e)h(ignor)o(ed)g(by)h(the)f(switch-scanner)h(and)g(ar)o(e)e(passed)888 -4168 y(thr)o(ough)22 b(to)f(the)g(pr)o(ogram)f(as)g(the)h(tail)g(of)f(the)h -(command-line)h(list.)805 4334 y Fs(\017)41 b Fw(-ds)888 4433 -y FA(Specify)28 b(when)h(to)f(load)g(the)h(script)f(\(\252do-script\272\).)48 -b(If)28 b(this)h(switch)g(occurs,)h(the)888 4533 y(switch)23 -b(list)f Fz(must)g FA(be)g(terminated)f(by)h(a)f Fw(-s)43 b -Fz(script)21 b FA(switch.)32 b(The)22 b(script)g(is)g(loaded)888 -4633 y(into)g(the)f(package)e(that)i(is)g(curr)o(ent)f(at)h(the)f -Fw(-ds)g FA(switch.)805 4799 y Fs(\017)41 b Fw(-dm)888 4898 -y FA(As)18 b(above,)g(but)h(the)f(curr)o(ent)g(module)g(is)h(ignor)o(ed.)26 -b(The)18 b(script)h(is)f(loaded)g(into)h(the)681 5147 y(128)p -1952 5071 323 4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p 2271 -5173 V 1952 5176 323 4 v 435 w FD(November)f(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +128 133 bop 681 614 a FB(do)16 b(not)g(need)g(to)g(be)g(loaded)f(and)h +(linked)g(at)f(startup)h(time.)24 b(This)17 b(r)o(educes)d(the)i(pr)o +(ogram's)681 714 y(startup)k(time,)h(memory)g(r)o(equir)o(ements,)f +(and)h(paging)g(over)o(head.)805 854 y(This)h(chapter)e(will)h(cover)f +(these)h(various)g(ways)g(of)g(invoking)h(scsh)f(pr)o(ograms.)681 +1169 y Fv(9.1)99 b(Scsh)25 b(command-line)f(switches)681 +1403 y FB(When)f(the)g(scsh)g(top-level)f(starts)h(up,)g(it)g(scans)f +(the)h(command)g(line)g(for)g(switches)g(that)681 1503 +y(contr)o(ol)i(its)h(behaviour)-6 b(.)38 b(These)25 b(ar)o(guments)g +(ar)o(e)e(r)o(emoved)i(fr)o(om)f(the)h(command)h(line;)681 +1602 y(the)35 b(r)o(emaining)f(ar)o(guments)h(can)f(be)h(accessed)e(as) +i(the)f(value)g(of)h(the)g(scsh)g(variable)681 1702 y +Fx(command-line-arg)o(um)o(ent)o(s)p FB(.)681 1992 y +Fz(9.1.1)81 b(Scripts)19 b(and)h(programs)681 2194 y +FB(The)d(scsh)h(command-line)g(switches)g(pr)o(ovide)e(sophisticated)i +(support)f(for)g(the)h(authors)681 2294 y(of)28 b(shell)i(scripts)f +(and)f(pr)o(ograms;)k(they)d(also)g(allow)g(the)g(pr)o(ogrammer)f(to)h +(write)g(pr)o(o-)681 2393 y(grams)21 b(that)f(use)h(the)g(Scheme)f(48)g +(module)h(system.)805 2533 y(Ther)o(e)34 b(is)h(a)f(dif)o(fer)o(ence)e +(between)i(a)h FA(script)p FB(,)i(which)e(performs)g(its)g(action)g +FA(as)f(it)h(is)681 2633 y(loaded)p FB(,)d(and)f(a)g +FA(pr)o(ogram)p FB(,)h(which)g(is)g(loaded/linked,)h(and)e(then)g +(performs)g(its)h(action)681 2732 y(by)24 b(having)h(contr)o(ol)g +(transferr)o(ed)e(to)i(an)f(entry)h(point)h(\()p FA(e.g.)n +FB(,)g(the)f Fx(main\(\))d FB(function)j(in)g(C)681 2832 +y(pr)o(ograms\))20 b(that)g(was)h(de\002ned)f(by)h(the)g(load/link)h +(operation.)805 2971 y(A)g FA(script)p FB(,)f(by)g(the)h(above)f +(de\002nition,)i(cannot)f(be)f(compiled)h(by)g(the)g(simple)g(mecha-) +681 3071 y(nism)i(of)g(loading)f(it)h(into)g(a)f(scsh)h(pr)o(ocess)f +(and)g(dumping)h(out)g(a)f(heap)f(image\227it)i(exe-)681 +3171 y(cutes)c(as)h(it)g(loads.)k(It)c(does)g(not)g(have)g(a)f +(top-level)g Fx(main\(\))p FB(-type)e(entry)j(point.)805 +3310 y(It)g(is)g(mor)o(e)f(\003exible)h(and)f(useful)g(to)h(implement)h +(a)e(system)h(as)f(a)h(pr)o(ogram)e(than)i(as)g(a)681 +3410 y(script.)29 b(Pr)o(ograms)21 b(can)h(be)g(compiled)g +(straightforwar)o(dly;)f(they)h(can)g(also)g(export)g(pr)o(o-)681 +3509 y(cedural)g(interfaces)g(for)h(use)g(by)g(other)g(Scheme)g +(packages.)32 b(However)-6 b(,)23 b(scsh)h(supports)681 +3609 y(both)d(the)g(script)g(and)f(the)h(pr)o(ogram)f(style)h(of)g(pr)o +(ogramming.)681 3899 y Fz(9.1.2)81 b(Inserting)19 b(interpreter)g +(triggers)h(into)g(scsh)g(programs)681 4101 y FB(When)g(Unix)f(tries)h +(to)g(execute)e(an)i(executable)e(\002le)i(whose)g(\002rst)g(16)f(bits) +h(ar)o(e)e(the)i(charac-)681 4201 y(ter)d(pair)f(\223)p +Fx(#!)p FB(\224,)g(it)i(tr)o(eats)e(the)i(\002le)f(not)h(as)f +(machine-code)g(to)h(be)f(dir)o(ectly)f(executed)g(by)i(the)681 +4301 y(native)26 b(pr)o(ocessor)-6 b(,)28 b(but)f(as)g(sour)o(ce)f +(code)h(to)g(be)g(executed)f(by)h(some)g(interpr)o(eter)-6 +b(.)43 b(The)681 4400 y(interpr)o(eter)22 b(to)h(use)h(is)f +(speci\002ed)g(immediately)h(after)e(the)h(\223)p Fx(#!)p +FB(\224)f(sequence)h(on)h(the)g(\002rst)681 4500 y(line)k(of)g(the)h +(sour)o(ce)e(\002le)h(\(along)h(with)f(one)h(optional)g(initial)f(ar)o +(gument\).)47 b(The)28 b(kernel)681 4599 y(r)o(eads)20 +b(in)i(the)f(name)h(of)f(the)h(interpr)o(eter)-6 b(,)20 +b(and)h(executes)g(that)g(instead.)28 b(The)21 b(interpr)o(eter)681 +4699 y(is)e(passed)g(the)h(sour)o(ce)e(\002lename)i(as)f(its)g(\002rst) +h(ar)o(gument,)f(with)h(the)f(original)h(ar)o(guments)681 +4799 y(following.)29 b(Consult)22 b(the)g(Unix)g(man)f(page)g(for)g +(the)h Fx(exec)e FB(system)i(call)f(for)g(mor)o(e)h(infor)o(-)681 +4898 y(mation.)681 5147 y(128)p 1952 5071 323 4 v 1952 +5173 4 102 v 1173 w FD(DRAFT)p 2271 5173 V 1952 5176 +323 4 v 538 w FE(Mar)o(ch)d(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 129 135 -129 134 bop 573 614 a Fw(config)14 b FA(package)h(\(\252do-module\272\),)g -(and)h(hence)h(must)g(be)f(written)h(in)f(the)h(Scheme)573 -714 y(48)d(module)i(language.)25 b(This)16 b(switch)g(doesn't)f(af)o(fect)f -(the)h(curr)o(ent)f(module\320after)573 814 y(executing)21 -b(this)g(switch,)g(the)g(curr)o(ent)f(module)h(is)h(the)e(same)h(as)f(as)h -(it)g(was)g(befor)o(e.)573 946 y(This)16 b(switch)h(is)g(pr)o(ovided)e(to)h -(make)g(it)g(easy)g(to)g(write)g(shell)h(scripts)f(in)h(the)f(Scheme)573 -1045 y(48)k(module)h(language.)365 1295 y Fy(9.1.5)81 b(The)21 -b(meta)e(argument)365 1478 y FA(The)33 b(scsh)g(switch)h(parser)d(takes)h(a)h -(special)f(command-line)h(switch,)j(a)c(single)h(back-)365 -1578 y(slash)20 b(called)f(the)g(\252meta-ar)o(gument,\272)e(which)j(is)g -(useful)f(for)h(shell)f(scripts.)28 b(If)19 b(the)g(initial)365 -1678 y(command-line)24 b(ar)o(gument)f(is)g(a)g(\252)p Fw(\\)p -FA(\272)f(ar)o(gument,)h(followed)h(by)f(a)g(\256lename)g(ar)o(gument)365 -1777 y Fz(fname)p FA(,)g(scsh)g(will)g(open)g(the)g(\256le)f -Fz(fname)h FA(and)f(r)o(ead)e(mor)o(e)j(ar)o(guments)f(fr)o(om)g(the)g -(second)365 1877 y(line)g(of)f(this)h(\256le.)28 b(This)22 -b(list)g(of)f(ar)o(guments)g(will)g(then)h(r)o(eplace)d(the)j(\252)p -Fw(\\)p FA(\272)d(ar)o(gument\320)p Fz(i.e.)p FA(,)365 1976 -y(the)k(new)g(ar)o(guments)g(ar)o(e)e(inserted)h(in)i(fr)o(ont)e(of)h -Fz(fname)p FA(,)g(and)f(the)h(ar)o(gument)f(parser)g(r)o(e-)365 -2076 y(sumes)g(ar)o(gument)f(scanning.)30 b(This)22 b(is)g(used)f(to)h(over)o -(come)f(a)g(limitation)h(of)g(the)f Fw(#!)g FA(fea-)365 2176 -y(tur)o(e:)38 b(the)27 b Fw(#!)e FA(line)i(can)f(only)i(specify)e(a)g(single) -h(ar)o(gument)f(after)f(the)h(interpr)o(eter)-6 b(.)43 b(For)365 -2275 y(example,)27 b(we)f(might)i(hope)e(the)g(following)i(scsh)f(script,)g -Fw(ekko)p FA(,)f(would)h(implement)g(a)365 2375 y(simple-minded)21 -b(version)g(of)g(the)g(Unix)g Fw(echo)e FA(pr)o(ogram:)573 -2562 y Fw(#!/usr/local/bin)o(/s)o(csh)37 b(-e)43 b(main)e(-s)573 -2662 y(!#)573 2761 y(\(define)g(\(main)g(args\))660 2861 y(\(map)h(\()p -Fx(\025)d Fw(\(arg\))i(\(display)g(arg\))g(\(display)g(")i("\)\))878 -2961 y(\(cdr)f(args\)\))660 3060 y(\(newline\)\))365 3247 y -FA(The)21 b(idea)f(would)h(be)g(that)f(the)h(command)573 3386 -y Fw(ekko)42 b(Hi)h(there.)365 3525 y FA(would)22 b(by)e(expanded)g(by)h(the) -f Fw(exec\(2\))e FA(kernel)j(call)f(into)573 3712 y Fw(/usr/local/bin/s)o(cs) -o(h)38 b(-e)k(main)g(-s)h(ekko)f(Hi)h(there.)365 3899 y FA(In)18 -b(theory)-9 b(,)17 b(this)h(would)f(cause)g(scsh)g(to)g(start)g(up,)g(load)g -(in)g(\256le)g Fw(ekko)p FA(,)f(call)h(the)g(entry)g(point)365 -3999 y(on)22 b(the)f(command-line)g(list)573 4137 y Fw(\(main)41 -b('\("ekko")g("Hi")h("there."\)\))365 4276 y FA(and)21 b(exit.)490 -4400 y(Unfortunately)-9 b(,)15 b(the)f(Unix)g Fw(exec\(2\))e -FA(syscall's)j(support)f(for)g(scripts)h(is)g(not)g(very)f(gen-)365 -4500 y(eral)31 b(or)h(well-designed.)60 b(It)31 b(will)h(not)h(handle)e -(multiple)h(ar)o(guments;)37 b(the)31 b Fw(#!)g FA(line)h(is)365 -4599 y(usually)27 b(r)o(equir)o(ed)e(to)i(contain)g(no)g(mor)o(e)g(than)f(32) -g(characters;)i(it)e(is)h(not)g(r)o(ecursive.)44 b(If)365 4699 -y(these)21 b(r)o(estrictions)g(ar)o(e)e(violated,)h(most)h(Unix)f(systems)i -(will)f(not)g(pr)o(ovide)f(accurate)f(er)o(-)365 4799 y(r)o(or)27 -b(r)o(eporting,)h(but)f(either)g(fail)f(silently)-9 b(,)29 -b(or)e(simply)h(incorr)o(ectly)f(implement)g(the)g(de-)365 -4898 y(sir)o(ed)20 b(functionality)-9 b(.)28 b(These)21 b(ar)o(e)e(the)i -(facts)f(of)h(Unix)g(life.)365 5147 y FD(November)d(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1174 w FA(129)p eop +129 134 bop 490 614 a FB(Scsh)29 b(allows)h(Scheme)f(pr)o(ograms)g(to)g +(have)g(these)g(triggers)h(placed)e(on)i(their)f(\002rst)365 +714 y(line.)48 b(Scsh)28 b(tr)o(eats)f(the)h(character)f(sequence)h +(\223)p Fx(#!)p FB(\224)e(as)i(a)f(block-comment)i(sequence,)3192 +684 y Fu(1)365 814 y FB(and)41 b(skips)h(all)g(following)h(characters)d +(until)i(it)g(r)o(eads)e(the)h(comment-terminating)365 +913 y(sequence)34 b(newline/exclamation-point/sharp-sign/newline)i(\()p +FA(i.e.)p FB(,)g(the)d(sequence)365 1013 y(\223)p Fx(!#)p +FB(\224)19 b(occurring)i(on)h(its)f(own)h(line\).)490 +1142 y(In)f(this)g(way)-9 b(,)21 b(the)f(pr)o(ogrammer)g(can)h(arrange) +e(for)i(an)g(initial)573 1341 y Fx(#!/usr/local/bin)o(/s)o(csh)37 +b(-s)573 1441 y(!#)365 1640 y FB(header)31 b(appearing)f(in)i(a)f +(Scheme)g(pr)o(ogram)g(to)h(be)f(ignor)o(ed)g(when)h(the)f(pr)o(ogram)g +(is)365 1740 y(loaded)20 b(into)i(scsh.)365 2003 y Fz(9.1.3)81 +b(Module)20 b(system)365 2193 y FB(Scsh)e(uses)f(the)h(Scheme)f(48)f +(module)i(system,)g(which)h(de\002nes)e FA(packages)p +FB(,)g FA(structur)o(es)p FB(,)h(and)365 2292 y FA(interfaces)p +FB(.)365 2491 y Fz(Package)40 b FB(A)25 b(package)f(is)i(an)f(envir)o +(onment\227that)h(is,)h(a)e(set)g(of)h(variable/value)e(bind-)573 +2591 y(ings.)h(Y)-8 b(ou)17 b(can)f(evaluate)f(Scheme)h(forms)h(inside) +f(a)g(package,)g(or)h(load)f(a)f(\002le)i(into)g(a)573 +2691 y(package.)23 b(Packages)17 b(export)h(sets)g(of)g(bindings;)h +(these)f(sets)g(ar)o(e)e(called)h FA(structur)o(es)p +FB(.)365 2863 y Fz(Structure)40 b FB(A)20 b(str)o(uctur)o(e)g(is)h(a)f +(named)g(view)g(on)h(a)f(package\227a)f(set)i(of)f(bindings.)26 +b(Other)573 2963 y(packages)15 b(can)h FA(open)g FB(the)g(str)o(uctur)o +(e,)g(importing)h(its)g(bindings)g(into)g(their)f(envir)o(on-)573 +3062 y(ment.)28 b(Packages)21 b(can)g(pr)o(ovide)f(mor)o(e)i(than)f +(one)h(str)o(uctur)o(e,)f(r)o(evealing)g(dif)o(fer)o(ent)573 +3162 y(portions)h(of)e(the)h(package's)f(envir)o(onment.)365 +3335 y Fz(Interface)40 b FB(An)29 b(interface)e(is)i(the)f +(\223type\224)g(of)g(a)g(str)o(uctur)o(e.)48 b(An)28 +b(interface)g(is)h(the)f(set)h(of)573 3434 y(names)g(exported)g(by)g(a) +f(str)o(uctur)o(e.)51 b(These)29 b(names)g(can)g(also)g(be)g(marked)g +(with)573 3534 y(other)21 b(static)h(information)g(\()p +FA(e.g.)o FB(,)f(advisory)g(type)h(declarations,)e(or)i(syntax)f(infor) +o(-)573 3633 y(mation\).)365 3832 y(Mor)o(e)d(information)i(on)g(the)f +(the)g(Scheme)g(48)f(module)h(system)h(can)f(be)g(found)g(in)g(the)g +(\002le)365 3932 y Fx(module.ps)e FB(in)22 b(the)e Fx(doc)g +FB(dir)o(ectory)g(of)h(the)g(Scheme)f(48)g(and)g(scsh)h(r)o(eleases.) +490 4061 y(Pr)o(ogramming)33 b(Scheme)g(with)g(a)g(module)g(system)g +(is)g(dif)o(fer)o(ent)e(fr)o(om)i(pr)o(ogram-)365 4161 +y(ming)20 b(in)e(older)g(Scheme)g(implementations,)i(and)e(the)h +(associated)e(development)h(pr)o(ob-)365 4261 y(lems)36 +b(ar)o(e)d(consequently)j(dif)o(fer)o(ent.)66 b(In)35 +b(Schemes)g(that)g(lack)f(modular)h(abstraction)365 4360 +y(mechanisms,)26 b(everything)f(is)f(accessible;)h(the)f(major)h(pr)o +(oblem)f(is)g(pr)o(eventing)g(name-)365 4460 y(space)e(con\003icts.)32 +b(In)22 b(Scheme)h(48,)e(name-space)g(con\003icts)j(vanish;)g(the)e +(major)h(pr)o(oblem)365 4560 y(is)29 b(that)g(not)g(all)g(bindings)h +(ar)o(e)d(accessible)h(fr)o(om)g(every)h(place.)48 b(It)29 +b(takes)f(a)g(little)i(extra)365 4659 y(work)22 b(to)f(specify)f(what)h +(packages)f(export)g(which)i(values.)p 365 4742 1146 +4 v 450 4796 a Fp(1)485 4819 y Fs(Why)17 b(a)f(block-comment)h(instead) +f(of)h(an)g(end-of-line)f(delimited)g(comment?)k(See)d(the)e(section)j +(on)e(meta-)365 4898 y(ar)o(gs.)365 5147 y FE(Mar)o(ch)j(10,)g(1997)h +(\226)f(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 +4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 +v 1174 w FB(129)p eop %%Page: 130 136 -130 135 bop 805 614 a FA(In)25 b(the)g Fw(ekko)f FA(example)g(above,)h(our)g -Fw(#!)f FA(trigger)h(line)g(has)g(thr)o(ee)f(ar)o(guments)g(\(\252)p -Fw(-e)p FA(\272,)681 714 y(\252)p Fw(main)p FA(\272,)j(and)g(\252)p -Fw(-s)p FA(\272\),)g(so)i(it)f(will)h(not)f(work.)50 b(The)28 -b(meta-ar)o(gument)e(is)j(how)g(we)f(work)681 814 y(ar)o(ound)18 -b(this)h(pr)o(oblem.)26 b(W)-8 b(e)19 b(must)g(instead)f(invoke)i(the)e(scsh) -h(interpr)o(eter)f(with)h(the)g(sin-)681 913 y(gle)j Fw(\\)g -FA(ar)o(gument,)g(and)g(put)g(the)g(r)o(est)g(of)g(the)h(ar)o(guments)f(on)h -(line)f(two)h(of)g(the)f(pr)o(ogram.)681 1013 y(Her)o(e's)e(the)h(corr)o(ect) -e(pr)o(ogram:)888 1219 y Fw(#!/usr/local/bin/)o(sc)o(sh)37 -b(\\)888 1318 y(-e)43 b(main)f(-s)888 1418 y(!#)888 1517 y(\(define)f(\(main) -h(args\))976 1617 y(\(map)f(\()p Fx(\025)e Fw(\(arg\))j(\(display)e(arg\))i -(\(display)e(")j("\)\))1193 1717 y(\(cdr)f(args\)\))976 1816 -y(\(newline\)\))681 2022 y FA(Now)-8 b(,)21 b(the)g(invocation)h(starts)e(as) -888 2174 y Fw(ekko)42 b(Hi)h(there.)681 2327 y FA(and)20 b(is)h(expanded)f -(by)g(exec\(2\))f(into)888 2533 y Fw(/usr/local/bin/sc)o(sh)37 -b(\\)43 b(ekko)f(Hi)h(there.)681 2738 y FA(When)17 b(scsh)g(starts)g(up,)g -(it)g(expands)f(the)g(\252)p Fw(\\)p FA(\272)g(ar)o(gument)g(into)h(the)g(ar) -o(guments)f(r)o(ead)f(fr)o(om)681 2838 y(line)21 b(two)g(of)g -Fw(ekko)p FA(,)e(pr)o(oducing)h(this)i(ar)o(gument)e(list:)888 -3044 y Fw(-e)43 b(main)f(-s)h(ekko)p 888 3057 654 4 v 42 w(Hi)f(there.)1237 -3143 y Fs(")888 3243 y FA(Expanded)20 b(fr)o(om)43 b Fw(\\)g(ekko)681 -3449 y FA(W)-5 b(ith)22 b(this)f(ar)o(gument)f(list,)h(pr)o(ocessing)g(pr)o -(oceeds)f(as)g(we)h(intended.)681 3722 y Fy(Secondary)e(argument)g(syntax)681 -3917 y FA(Scsh)g(uses)h(a)f(very)h(simple)g(grammar)f(to)h(encode)f(the)h -(extra)e(ar)o(guments)i(on)g(the)g(second)681 4017 y(line)j(of)f(the)h(scsh)g -(script.)32 b(The)23 b(only)g(special)f(characters)f(ar)o(e)g(space,)h(tab,)g -(newline,)h(and)681 4116 y(backslash.)805 4322 y Fs(\017)41 -b FA(Each)15 b(space)f(character)g(terminates)g(an)h(ar)o(gument.)25 -b(This)16 b(means)f(that)g(two)h(spaces)888 4422 y(in)22 b(a)e(r)o(ow)g(intr) -o(oduce)h(an)f(empty-string)i(ar)o(gument.)805 4599 y Fs(\017)41 -b FA(The)19 b(tab)f(character)e(is)j(not)g(permitted)f(\(unless)h(you)g -(quote)g(it)g(with)g(the)f(backslash)888 4699 y(character)26 -b(described)h(below\).)47 b(This)28 b(is)g(to)f(pr)o(event)g(the)g(insidious) -i(bug)f(wher)o(e)888 4799 y(you)20 b(believe)e(you)i(have)f(six)g(space)f -(characters,)g(but)h(you)h(r)o(eally)e(have)g(a)h(tab)f(char)o(-)888 -4898 y(acter)-6 b(,)20 b(and)g Fz(vice-versa)p FA(.)681 5147 -y(130)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)e(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +130 135 bop 805 614 a FB(It)20 b(may)g(take)f(you)h(a)f(little)h(while) +g(to)g(get)g(used)f(to)h(the)g(new)g(style)g(of)f(pr)o(ogram)g(devel-) +681 714 y(opment.)26 b(Although)21 b(scsh)h(can)e(be)g(used)g(without)i +(r)o(eferring)e(to)h(the)f(module)h(system)g(at)681 814 +y(all,)k(we)f(r)o(ecommend)g(taking)h(the)g(time)g(to)g(learn)f(and)g +(use)g(it.)37 b(The)24 b(ef)o(fort)g(will)h(pay)f(of)o(f)681 +913 y(in)d(the)g(constr)o(uction)h(of)f(modular)-6 b(,)20 +b(factorable)g(pr)o(ograms.)681 1212 y Fz(9.1.4)81 b(Switches)681 +1419 y FB(The)21 b(scsh)g(top-level)f(takes)h(command-line)g(switches)g +(in)h(the)f(following)h(format:)888 1586 y Fx(scsh)42 +b([)p FA(meta-ar)o(g)n Fx(])h([)p FA(switch)1797 1598 +y Fn(i)1868 1586 y Fx(...])f([)p FA(end-option)g(ar)o(g)2642 +1613 y Fu(1)2723 1586 y Fx(...)g FA(ar)o(g)3007 1613 +y Fn(n)3052 1586 y Fx(])681 1753 y FB(wher)o(e)938 1999 +y FA(meta-ar)o(g:)159 b Fx(\\)21 b FA(script-\002le-name)938 +2198 y(switch:)240 b Fx(-e)20 b FA(entry-point)405 b +FB(Specify)20 b(top-level)g(entry-point.)1418 2298 y +Fx(-o)g FA(structur)o(e)480 b FB(Open)21 b(str)o(uctur)o(e)f(in)h(curr) +o(ent)f(package.)1418 2397 y Fx(-m)g FA(structur)o(e)480 +b FB(Switch)21 b(to)g(package.)1418 2497 y Fx(-n)f FA(new-package)362 +b FB(Switch)21 b(to)g(new)g(package.)1418 2696 y Fx(-lm)f +FA(module-\002le-name)165 b FB(Load)20 b(module)h(into)h(con\002g)f +(package.)1418 2796 y Fx(-l)f FA(\002le-name)482 b FB(Load)20 +b(\002le)h(into)g(curr)o(ent)f(package.)1418 2895 y Fx(-dm)765 +b FB(Do)21 b(script)g(module.)1418 2995 y Fx(-ds)765 +b FB(Do)21 b(script.)938 3194 y FA(end-option:)98 b Fx(-s)20 +b FA(script)1418 3294 y Fx(-sfd)f FA(num)1418 3393 y +Fx(-c)h FA(exp)1418 3493 y Fx(--)681 3659 y FB(These)29 +b(command-line)g(switches)h(essentially)f(pr)o(ovide)f(a)h(little)g +(linker)h(language)e(for)681 3759 y(linking)34 b(a)f(shell)g(script)g +(or)h(a)e(pr)o(ogram)g(together)i(with)g(Scheme)e(48)g(modules.)63 +b(The)681 3859 y(command-line)23 b(pr)o(ocessor)f(serially)h(opens)g +(str)o(uctur)o(es)f(and)g(loads)h(code)f(into)i(a)e(given)681 +3958 y(package.)30 b(Switches)22 b(that)h(side-ef)o(fect)d(a)i(package) +g(operate)f(on)i(a)f(particular)g(\223curr)o(ent\224)681 +4058 y(package;)29 b(ther)o(e)d(ar)o(e)f(switches)j(to)g(change)f(this) +g(package.)44 b(\(These)26 b(switches)i(pr)o(ovide)681 +4158 y(functionality)37 b(equivalent)g(to)g(the)f(interactive)g +Fx(,open)e(,load)h(,in)g FB(and)h Fx(,new)f FB(com-)681 +4257 y(mands.\))56 b(Except)31 b(wher)o(e)g(indicated,)h(switches)h +(specify)d(actions)i(that)f(ar)o(e)f(executed)681 4357 +y(in)25 b(a)f(left-to-right)g(or)o(der)-6 b(.)36 b(The)25 +b(initial)g(curr)o(ent)e(package)h(is)h(the)g(user)f(package,)g(which) +681 4456 y(is)29 b(completely)g(empty)f(and)g(opens)h(\(imports)g(the)g +(bindings)g(of\))f(the)h(R4RS)f(and)g(scsh)681 4556 y(str)o(uctur)o +(es.)805 4699 y(If)i(the)h(Scheme)e(pr)o(ocess)h(is)h(started)e(up)h +(in)h(an)f(interactive)g(mode,)i(then)f(the)f(cur)o(-)681 +4799 y(r)o(ent)21 b(package)f(in)j(for)o(ce)d(at)h(the)h(end)g(of)f +(switch)i(scanning)f(is)g(the)g(one)g(inside)g(which)h(the)681 +4898 y(interactive)d(r)o(ead-eval-print)e(loop)j(is)g(started.)681 +5147 y(130)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)e(10,)g +(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 131 137 -131 136 bop 490 614 a Fs(\017)41 b FA(The)30 b(newline)i(character)d -(terminates)h(the)h(sequence)g(of)f(ar)o(guments,)j(and)d(will)573 -714 y(also)20 b(terminate)f(a)g(\256nal)g(non-empty)i(ar)o(gument.)26 -b(\(However)-6 b(,)19 b(a)g(newline)h(follow-)573 814 y(ing)h(a)f(space)g -(does)g(not)h(intr)o(oduce)f(a)g(\256nal)h(empty-string)g(ar)o(gument;)f(it)g -(only)i(ter)o(-)573 913 y(minates)f(the)g(ar)o(gument)f(list.\))490 -1087 y Fs(\017)41 b FA(The)35 b(backslash)f(character)f(is)i(the)g(escape)f -(character)-6 b(.)67 b(It)35 b(escapes)f(backslash,)573 1186 -y(space,)20 b(tab,)h(and)g(newline,)i(turning)f(of)o(f)f(their)g(special)g -(functions,)h(and)g(allowing)573 1286 y(them)c(to)h(be)f(included)f(in)i(ar)o -(guments.)26 b(The)20 b(A)t Fr(N)t(S)t(I)h FA(C)d(escape)f(sequences,)h(such) -h(as)573 1386 y Fw(\\n)13 b FA(and)h Fw(\\t)f FA(ar)o(e)g(also)h(supported;)i -(these)e(also)g(pr)o(oduce)f(ar)o(gument-constituents\320)573 -1485 y Fw(\\n)22 b FA(doesn't)i(act)e(like)i(a)e(terminating)i(newline.)35 -b(The)23 b(escape)f(sequence)i Fw(\\)p Fz(nnn)f FA(for)573 -1585 y Fz(exactly)15 b FA(thr)o(ee)h(octal)h(digits)g(r)o(eads)e(as)i(the)g -(character)e(whose)20 b(A)t Fr(S)t(C)t(I)t(I)f FA(code)e(is)g -Fz(nnn)p FA(.)27 b(It)573 1685 y(is)17 b(an)f(err)o(or)g(if)g(backslash)g(is) -h(followed)g(by)f(just)i(one)f(or)f(two)h(octal)g(digits:)26 -b Fw(\\3Q)15 b FA(is)i(an)573 1784 y(err)o(or)-6 b(.)29 b(Octal)22 -b(escapes)f(ar)o(e)f(always)i(constituent)h(chars.)30 b(Backslash)21 -b(followed)h(by)573 1884 y(other)h(chars)g(is)g(not)g(allowed)g(\(so)g(we)g -(can)g(extend)f(the)h(escape-code)e(space)h(later)573 1983 -y(if)e(we)h(like\).)490 2184 y(Y)-8 b(ou)20 b(have)f(to)g(constr)o(uct)h -(these)f(line-two)h(ar)o(gument)f(lines)g(car)o(efully)-9 b(.)26 -b(In)19 b(particular)-6 b(,)365 2284 y(bewar)o(e)22 b(of)h(trailing)h(spaces) -f(at)g(the)g(end)g(of)h(the)f(line\320they'll)i(give)e(you)h(extra)e -(trailing)365 2383 y(empty-string)g(ar)o(guments.)27 b(Her)o(e's)20 -b(an)g(example:)573 2531 y Fw(#!/bin/interpret)o(er)37 b(\\)573 -2630 y(foo)42 b(bar)86 b(quux\\)42 b(yow)365 2778 y FA(would)22 -b(pr)o(oduce)d(the)i(ar)o(guments)573 2925 y Fw(\("foo")41 -b("bar")g("")i("quux)f(yow"\))365 3191 y Fy(9.1.6)81 b(Examples)490 -3381 y Fs(\017)41 b Fw(scsh)h(-dm)g(-m)h(myprog)e(-e)i(top)f(-s)h(myprog.scm) -573 3481 y FA(Load)18 b Fw(myprog.scm)d FA(into)20 b(the)g -Fw(config)c FA(package,)j(then)g(shift)h(to)f(the)h Fw(myprog)c -FA(pack-)573 3580 y(age)h(and)h(call)f Fw(\(top)42 b('\("myprog.scm"\)\))p -FA(,)12 b(then)18 b(exit.)27 b(This)18 b(sort)g(of)g(invocation)h(is)573 -3680 y(typically)i(used)f(in)h Fw(#!)f FA(script)h(lines)g(\(see)g(below\).) -490 3854 y Fs(\017)41 b Fw(scsh)h(-c)h('\(display)c("Hello,)i(world."\)')573 -3953 y FA(A)20 b(simple)h(pr)o(ogram.)490 4127 y Fs(\017)41 -b Fw(scsh)h(-o)h(bigscheme)573 4227 y FA(Start)52 b(up)h(interactively)g(in)h -(the)f(user)g(package)f(after)g(opening)i(str)o(uctur)o(e)573 -4326 y Fw(bigscheme)p FA(.)490 4500 y Fs(\017)41 b Fw(scsh)h(-o)h(bigscheme)c -(--)k(Three)f(args)g(passed)573 4599 y FA(Start)23 b(up)h(interactively)g(in) -h(the)f(user)g(package)f(after)g(opening)j Fw(bigscheme)p FA(.)34 -b(The)573 4699 y Fw(command-line-arg)o(s)d FA(variable)37 b(in)h(the)g(scsh)g -(package)e(is)i(bound)g(to)g(the)g(list)573 4799 y Fw(\("Three")i("args")h -("passed"\))p FA(,)h(and)d(the)i Fw(\(command-line\))34 b FA(pr)o(ocedur)o(e) -39 b(r)o(e-)573 4898 y(turns)21 b(the)g(list)g Fw(\("scsh")41 -b("Three")g("args")g("passed"\))p FA(.)365 5147 y FD(November)18 -b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 -5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v -1174 w FA(131)p eop +131 136 bop 490 614 a FB(The)20 b(command-line)h(switch)g(pr)o(ocessor) +f(works)h(in)g(two)g(passes:)k(it)20 b(\002rst)h(parses)e(the)365 +714 y(switches,)26 b(building)f(a)f(list)h(of)f(actions)h(to)g +(perform,)f(then)h(the)g(actions)g(ar)o(e)e(performed)365 +814 y(serially)-9 b(.)48 b(The)29 b(switch)g(list)g(is)g(terminated)f +(by)g(one)h(of)g(the)f FA(end-option)f FB(switches.)50 +b(The)365 913 y FA(ar)o(g)474 940 y Fn(i)520 913 y FB(ar)o(guments)17 +b(occurring)h(after)f(an)h(end-option)g(switch)h(ar)o(e)d(passed)h(to)h +(the)g(scsh)g(pr)o(o-)365 1013 y(gram)j(as)g(the)g(value)g(of)g +Fx(command-line-arg)o(um)o(ent)o(s)15 b FB(and)20 b(the)i(tail)f(of)g +(the)g(list)h(r)o(eturned)365 1112 y(by)i Fx(\(command-line\))p +FB(.)j(That)c(is,)g(an)g FA(end-option)f FB(switch)i(separates)e +(switches)i(that)f(con-)365 1212 y(tr)o(ol)30 b(the)h(scsh)g +(\223machine\224)f(fr)o(om)f(the)i(actual)e(ar)o(guments)h(being)h +(passed)f(to)g(the)h(scsh)365 1312 y(pr)o(ogram)20 b(that)h(r)o(uns)h +(on)f(that)g(machine.)490 1446 y(The)g(following)h(switches)f(and)g +(end)f(options)i(ar)o(e)e(de\002ned:)490 1653 y Ft(\017)41 +b Fx(-o)i FA(struct)573 1753 y FB(Open)21 b(the)g(str)o(uctur)o(e)f(in) +h(the)g(curr)o(ent)f(package.)490 1932 y Ft(\017)41 b +Fx(-n)i FA(package)573 2031 y FB(Make)20 b(and)h(enter)g(a)f(new)i +(package.)j(The)c(package)f(has)i(an)f(associated)f(str)o(uctur)o(e)573 +2131 y(named)g FA(package)f FB(with)i(an)f(empty)h(export)f(list.)26 +b(If)20 b FA(package)f FB(is)h(the)h(string)g(\223)p +Fx(#f)p FB(\224,)d(the)573 2231 y(new)j(package)f(is)h(anonmyous,)h +(with)f(no)h(associated)e(named)g(str)o(uctur)o(e.)573 +2370 y(The)25 b(new)g(package)f(initially)i(opens)g(no)g(other)f(str)o +(uctur)o(es,)h(not)f(even)g(the)h(R4RS)573 2469 y(bindings.)f(Y)-8 +b(ou)18 b(must)g(follow)g(a)f(\223)p Fx(-n)42 b(foo)p +FB(\224)16 b(switch)i(with)g(\223)p Fx(-o)42 b(scheme)p +FB(\224)15 b(to)i(access)573 2569 y(the)k(standar)o(d)e(identi\002ers)i +(such)g(as)f Fx(car)g FB(and)g Fx(define)p FB(.)490 2748 +y Ft(\017)41 b Fx(-m)i FA(struct)573 2848 y FB(Change)27 +b(the)f(curr)o(ent)g(package)g(to)h(the)g(package)e(underlying)j(str)o +(uctur)o(e)e FA(struct)p FB(.)573 2947 y(\(The)20 b Fx(-m)g +FB(stands)h(for)f(\223module.\224\))490 3126 y Ft(\017)41 +b Fx(-lm)h FA(module-\002le-name)573 3226 y FB(Load)20 +b(the)i(speci\002ed)f(\002le)g(into)h(scsh's)h(con\002g)f(package)e +(\227)h(the)h(\002le)f(must)h(contain)573 3325 y(sour)o(ce)17 +b(written)i(in)g(the)f(Scheme)g(48)f(module)h(language)g(\(\223load)f +(module\224\).)24 b(Does)573 3425 y(not)d(alter)f(the)h(curr)o(ent)f +(package.)490 3604 y Ft(\017)41 b Fx(-l)i FA(\002le-name)573 +3704 y FB(Load)20 b(the)h(speci\002ed)f(\002le)h(into)h(the)f(curr)o +(ent)f(package.)490 3883 y Ft(\017)41 b Fx(-c)i FA(exp)573 +3982 y FB(Evaluate)28 b(expr)o(ession)h FA(exp)f FB(in)i(the)f(curr)o +(ent)f(package)g(and)h(exit.)50 b(This)30 b(is)f(called)573 +4082 y Fx(-c)c FB(after)g(a)h(common)h(shell)g(convention)h(\(see)d(sh) +i(and)e(csh\).)42 b(The)26 b(expr)o(ession)g(is)573 4182 +y(evaluated)f(in)i(the)f(the)h(curr)o(ent)e(package)g(\(and)h(hence)g +(is)h(af)o(fected)d(by)i Fx(-m)p FB('s)g(and)573 4281 +y Fx(-n)p FB('s.\))573 4420 y(When)21 b(the)g(scsh)h(top-level)f +(constr)o(ucts)h(the)f(scsh)h(command-line)f(in)g(this)h(case,)e(it)573 +4520 y(takes)j Fx("scsh")e FB(to)i(be)g(the)h(pr)o(ogram)e(name.)33 +b(This)24 b(switch)g(terminates)f(ar)o(gument)573 4620 +y(scanning;)e(following)h(ar)o(gs)e(become)h(the)g(tail)g(of)f(the)h +(command-line)g(list.)490 4799 y Ft(\017)41 b Fx(-e)i +FA(entry-point)573 4898 y FB(Specify)27 b(an)h(entry)g(point)h(for)f(a) +g(pr)o(ogram.)47 b(The)28 b FA(entry-point)f FB(is)i(a)f(variable)f +(that)365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1174 w FB(131)p +eop %%Page: 132 138 -132 137 bop 805 614 a Fs(\017)41 b FA(Pr)o(ogram)21 b Fw(ekko)888 -714 y FA(This)g(shell)g(script,)f(called)f Fw(ekko)p FA(,)g(implements)i(a)e -(version)i(of)f(the)g(Unix)g Fw(echo)f FA(pr)o(o-)888 814 y(gram:)1071 -1008 y Fw(#!/usr/local/bin)o(/sc)o(sh)37 b(-s)1071 1107 y(!#)1071 -1207 y(\(for-each)j(\()p Fx(\025)f Fw(\(arg\))i(\(display)f(arg\))i -(\(display)f(")i("\)\))1507 1307 y(command-line-arg)o(s\))888 -1548 y FA(Note)22 b(this)g(short)f(pr)o(ogram)g(is)g(an)g(example)g(of)g(a)g -Fz(script)p FA(\320it)g(executes)f(as)h(it)g(loads.)888 1648 -y(The)g(Unix)g(r)o(ule)g(for)f(executing)h Fw(#!)f FA(shell)h(scripts)g -(causes)1071 1819 y Fw(ekko)42 b(Hello,)f(world.)888 1991 y -FA(to)21 b(expand)f(as)1071 2162 y Fw(/usr/local/bin/s)o(csh)37 -b(-s)42 b(ekko)g(Hello,)g(world.)805 2381 y Fs(\017)f FA(Pr)o(ogram)21 -b Fw(ekko)888 2480 y FA(This)d(is)g(the)f(same)g(pr)o(ogram,)g -Fz(not)g FA(as)g(a)g(script.)27 b(W)-6 b(riting)17 b(it)h(this)g(way)f(makes) -g(it)h(pos-)888 2580 y(sible)d(to)h(compile)f(the)g(pr)o(ogram)f(\(and)g -(then,)j(for)d(instance,)i(dump)f(it)g(out)h(as)e(a)h(heap)888 -2680 y(image\).)1071 2874 y Fw(#!/usr/local/bin)o(/sc)o(sh)37 -b(\\)1071 2974 y(-e)43 b(top)f(-s)1071 3073 y(!#)1071 3173 -y(\(define)f(\(top)h(args\))1158 3272 y(\(for-each)e(\()p Fx(\025)f -Fw(\(arg\))i(\(display)g(arg\))h(\(display)e(")j("\)\))1594 -3372 y(\(cdr)f(args\)\)\))888 3566 y FA(The)28 b Fw(exec\(2\))d -FA(expansion)j(of)f(the)h Fw(#!)f FA(line)h(together)g(with)h(the)e(scsh)i -(expansion)888 3666 y(of)34 b(the)g(\252)p Fw(\\)42 b(ekko)p -FA(\272)32 b(meta-ar)o(gument)g(\(see)h(section)i(9.1.5\))c(gives)j(the)g -(following)888 3765 y(command-line)22 b(expansion:)1071 3960 -y Fw(ekko)42 b(Hello,)f(world.)1245 4059 y Fl(=)-14 b Fs(\))87 -b Fw(/usr/local/bin/sc)o(sh)37 b(\\)43 b(ekko)391 b(Hello,)41 -b(world.)1245 4159 y Fl(=)-14 b Fs(\))87 b Fw(/usr/local/bin/sc)o(sh)37 -b(-e)43 b(top)f(-s)h(ekko)f(Hello,)f(world.)805 4400 y Fs(\017)g -FA(Pr)o(ogram)21 b Fw(sort)888 4500 y FA(This)c(is)g(a)e(pr)o(ogram)h(to)h(r) -o(eplace)d(the)i(Unix)g Fw(sort)f FA(utility\320sorting)j(lines)f(r)o(ead)d -(fr)o(om)888 4599 y(stdin,)28 b(and)e(printing)h(the)f(r)o(esults)g(on)g -(stdout.)44 b(Note)26 b(that)g(the)h(sour)o(ce)e(code)h(de-)888 -4699 y(\256nes)f(a)f(general)g(sorting)i(package,)e(which)h(is)g(useful)f -(\(1\))f(as)i(a)f(Scheme)g(module)888 4799 y(exporting)f(sort)h(pr)o(ocedur)o -(es)d(to)i(other)g(Scheme)f(code,)h(and)g(\(2\))e(as)i(a)f(standalone)888 -4898 y(pr)o(ogram)e(invoked)i(fr)o(om)e(the)h Fw(top)e FA(pr)o(ocedur)o(e.) -681 5147 y(132)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 w -FC(DRAFT)p 2271 5173 V 1952 5176 323 4 v 435 w FD(November)f(1,)h(1995)h -(\261)f(15)13 b(:)f(58)p eop +132 137 bop 888 614 a FB(is)29 b(taken)g(fr)o(om)f(the)h(curr)o(ent)f +(package)f(in)i(for)o(ce)f(at)g(the)h(end)f(of)h(switch)g(evalua-)888 +714 y(tion.)44 b(The)26 b(entry)g(point)i(does)e(not)h(have)f(to)h(be)f +(exported)f(by)i(the)f(package)g(in)h(a)888 814 y(str)o(uctur)o(e;)19 +b(it)f(can)g(be)g(internal)g(to)g(the)g(package.)24 b(The)18 +b(top)g(level)g(passes)g(contr)o(ol)h(to)888 913 y(the)k(entry)g(point) +h(by)f(applying)g(it)g(to)g(the)g(command-line)g(list)h(\(so)e(pr)o +(ograms)h(ex-)888 1013 y(ecuting)d(in)g(private)e(packages)g(can)h(r)o +(efer)o(ence)e(their)i(command-line)g(ar)o(guments)888 +1112 y(without)26 b(opening)f(the)f Fx(scsh)f FB(package)g(to)i(access) +e(the)i Fx(\(command-line\))18 b FB(pr)o(oce-)888 1212 +y(dur)o(e\).)24 b(Note)19 b(that,)g(like)h(the)f(list)h(r)o(eturned)d +(by)j(the)f Fx(\(command-line\))13 b FB(pr)o(ocedur)o(e,)888 +1312 y(the)21 b(list)f(passed)g(to)g(the)h(entry)f(point)h(includes)f +(the)h(name)f(of)g(the)g(pr)o(ogram)g(being)888 1411 +y(executed)28 b(\(as)g(the)h(\002rst)h(element)f(of)g(the)g(list\),)i +(not)e(just)h(the)f(ar)o(guments)g(to)g(the)888 1511 +y(pr)o(ogram.)888 1650 y(A)21 b Fx(-e)g FB(switch)h(can)f(occur)g +(anywher)o(e)g(in)g(the)h(switch)g(list,)g(but)f(it)h(is)f(the)h +FA(last)f FB(action)888 1750 y(performed)k(by)h(switch)g(scanning)g(if) +g(it)g(occurs.)40 b(\(W)-8 b(e)25 b(violate)g(or)o(dering)h(her)o(e)e +(as)888 1850 y(the)31 b(shell-script)f Fx(#!)g FB(mechanism)h(pr)o +(events)e(you)i(fr)o(om)f(putting)h(the)f FA(-e)g FB(switch)888 +1949 y(last,)21 b(wher)o(e)f(it)h(belongs.\))805 2129 +y Ft(\017)41 b Fx(-s)i FA(script)888 2228 y FB(Specify)29 +b(a)g(\002le)g(to)h(load.)52 b(A)29 b Fx(-ds)f FB(\(do-script\))g(or)i +Fx(-dm)e FB(\(do-module\))h(switch)h(oc-)888 2328 y(curring)c(earlier)f +(in)h(the)g(switch)h(list)f(gives)g(the)g(place)f(wher)o(e)g(the)h +(script)f(should)888 2428 y(be)j(loaded.)46 b(If)27 b(ther)o(e)g(is)h +(no)g Fx(-ds)f FB(or)h Fx(-dm)e FB(switch,)k(then)f(the)f(script)f(is)h +(loaded)f(at)888 2527 y(the)d(end)f(of)h(switch)g(scanning,)h(into)g +(the)f(module)g(that)f(is)h(curr)o(ent)f(at)g(the)h(end)f(of)888 +2627 y(switch)f(scanning.)888 2766 y(W)-8 b(e)17 b(use)f(the)h +Fx(-ds)e FB(switch)i(to)g(violate)f(left-to-right)h(switch)g(execution) +f(or)o(der)g(as)g(the)888 2866 y Fx(-s)h FB(switch)h(is)g +FA(r)o(equir)o(ed)g FB(to)f(be)h(last)f(\(because)f(of)h(the)h +Fx(#!)f FB(machinery\),)g(independent)888 2966 y(of)k(when/wher)o(e)g +(in)g(the)g(switch-pr)o(ocessing)h(or)o(der)d(it)i(should)h(be)e +(loaded.)888 3105 y(When)29 b(the)f(scsh)h(top-level)f(constr)o(ucts)h +(the)g(scsh)g(command-line)f(in)h(this)g(case,)888 3205 +y(it)k(takes)e FA(script)h FB(to)g(be)g(the)g(pr)o(ogram)f(name.)59 +b(This)33 b(switch)f(terminates)g(switch)888 3304 y(parsing;)19 +b(following)i(ar)o(gs)c(ar)o(e)h(ignor)o(ed)g(by)h(the)f +(switch-scanner)h(and)g(ar)o(e)e(passed)888 3404 y(thr)o(ough)22 +b(to)f(the)g(pr)o(ogram)f(as)g(the)h(tail)g(of)f(the)h(command-line)h +(list.)805 3583 y Ft(\017)41 b Fx(-sfd)h FA(num)888 3683 +y FB(Loads)36 b(the)h(script)f(fr)o(om)g(\002le)h(descriptor)f +FA(num)o FB(.)73 b(This)37 b(switch)g(is)g(like)f(the)h +Fx(-s)888 3782 y FB(switch,)25 b(except)d(that)i(the)f(script)g(is)h +(loaded)e(fr)o(om)h(one)h(of)f(the)g(pr)o(ocess')g(open)h(in-)888 +3882 y(put)18 b(\002le)g(descriptors.)24 b(For)18 b(example,)g(to)g +(have)f(the)h(script)f(loaded)g(fr)o(om)h(standar)o(d)888 +3982 y(input,)j(specify)g Fx(-sfd)42 b(0)p FB(.)805 4161 +y Ft(\017)f Fx(--)888 4261 y FB(T)-8 b(erminate)39 b(ar)o(gument)g +(scanning)g(and)g(start)f(up)h(scsh)h(in)f(interactive)f(mode.)888 +4360 y(If)e(the)g(ar)o(gument)f(list)i(just)f(r)o(uns)h(out,)j(without) +d(either)f(a)f(terminating)i Fx(-s)e FB(or)888 4460 y +Fx(--)k FB(ar)o(g,)j(then)e(scsh)g(also)f(starts)g(up)h(in)f +(interactive)g(mode,)44 b(with)c(an)f(empty)888 4560 +y Fx(command-line-argu)o(me)o(nts)28 b FB(list)35 b(\(for)e(example,)k +(simply)e(entering)g Fx(scsh)e FB(at)h(a)888 4659 y(shell)22 +b(pr)o(ompt)e(with)i(no)f(ar)o(gs)f(at)g(all\).)888 4799 +y(When)29 b(the)f(scsh)h(top-level)f(constr)o(ucts)h(the)g(scsh)g +(command-line)f(in)h(this)g(case,)888 4898 y(it)e(takes)f +Fx("scsh")e FB(to)j(be)f(the)h(pr)o(ogram)f(name.)42 +b(This)27 b(switch)h(terminates)e(switch)681 5147 y(132)p +1952 5071 323 4 v 1952 5173 4 102 v 1173 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226) +f(21)13 b(:)f(47)p eop %%Page: 133 139 -133 138 bop 756 614 a Fw(#!/usr/local/bi)o(n/)o(scs)o(h)37 -b(\\)756 714 y(-dm)42 b(-m)h(sort-toplevel)38 b(-e)43 b(top)f(-s)756 -814 y(!#)756 1013 y(;;;)g(This)g(is)h(a)g(sorting)d(module.)h(TOP)h -(procedure)e(exports)756 1112 y(;;;)i(the)g(functionality)c(as)43 -b(a)g(Unix)f(program)f(akin)h(to)h(sort\(1\).)756 1212 y(\(define-structu)o -(re)o(s)38 b(\(\(sort-struct)g(\(export)j(sort-list)2543 1312 -y(sort-vector!\)\))1627 1411 y(\(sort-toplevel)d(\(export)j(top\)\)\))843 -1511 y(\(open)g(scheme\))843 1710 y(\(begin)g(\(define)f(\(sort-list)g(elts)i -(<=\))g Fx(:)14 b(:)g(:)g Fw(\))1148 1810 y(\(define)40 b(\(sort-vec!)g(vec)i -(<=\))86 b Fx(:)14 b(:)g(:)g Fw(\))1148 2009 y(;;)43 b(Parse)e(the)h(command) -f(line)h(and)1148 2109 y(;;)h(sort)e(stdin)h(to)h(stdout.)1148 -2208 y(\(define)d(\(top)i(args\))1279 2308 y Fx(:)14 b(:)g(:)f -Fw(\)\)\))573 2532 y FA(The)18 b(expansion)g(below)h(shows)h(how)f(the)f -(command-line)g(scanner)g(\(1\))f(loads)h(the)573 2623 y(con\256g)i(\256le)f -Fw(sort)f FA(\(written)h(in)h(the)f(Scheme)g(48)f(module)h(language\),)g -(\(2\))f(switches)573 2715 y(to)32 b(the)h(package)e(underlying)h(the)g -Fw(sort-toplevel)27 b FA(str)o(uctur)o(e,)34 b(\(3\))d(calls)h -Fw(\(top)573 2806 y('\("sort")40 b("foo")i("bar"\)\))18 b FA(in)j(the)g -(package,)e(and)h(\256nally)i(\(4\))d(exits.)573 3073 y Fi(sort)40 -b(foo)g(bar)573 3164 y Fc(=)-13 b Fb(\))78 b Fi(/usr/local/bin/scsh)44 -b(\\)39 b(sort)1178 b(foo)40 b(bar)573 3255 y Fc(=)-13 b Fb(\))78 -b Fi(/usr/local/bin/scsh)44 b(-dm)39 b(-m)h(sort-toplevel)i(-e)e(top)g(-s)g -(sort)g(foo)g(bar)573 3462 y FA(An)17 b(alternate)g(method)h(would)g(have)f -(used)g(a)g Fw(-n)42 b(-o)h(sort-toplevel)12 b FA(sequence)573 -3562 y(of)21 b(switches)g(to)g(specify)g(a)f(top-level)g(package.)490 -3803 y(Note)e(that)g(the)g(sort)g(example)f(can)h(be)f(compiled)h(into)h(a)e -(Unix)h(pr)o(ogram)f(by)h(loading)365 3902 y(the)25 b(\256le)g(into)h(an)f -(scsh)g(pr)o(ocess,)g(and)g(dumping)g(a)f(heap)h(with)g(top-level)g -Fw(top)p FA(.)38 b(Even)25 b(if)365 4002 y(we)19 b(don't)g(want)g(to)g -(export)f(the)g(sort's)i(functionality)f(as)f(a)g(subr)o(outine)h(library)-9 -b(,)18 b(it)h(is)g(still)365 4101 y(useful)f(to)h(write)f(the)g(sort)h(pr)o -(ogram)e(with)i(the)f(module)g(language.)27 b(The)18 b(command)g(line)365 -4201 y(design)23 b(allows)g(us)g(to)g(r)o(un)g(this)h(pr)o(ogram)e(as)g -(either)h(an)f(interpr)o(eted)f(script)i(\(given)f(the)365 -4301 y Fw(#!)e FA(ar)o(gs)g(in)h(the)g(header\))f(or)g(as)h(a)f(compiled)h -(heap)f(image.)365 4594 y Fy(9.1.7)81 b(Process)20 b(exit)f(values)365 -4799 y FA(Scsh)j(ignor)o(es)g(the)g(value)f(pr)o(oduced)f(by)i(its)g -(top-level)f(computation)i(when)f(determin-)365 4898 y(ing)g(its)g(exit)f -(status)h(code.)29 b(If)20 b(the)i(top-level)f(computation)h(completed)f -(with)i(no)f(err)o(ors,)365 5147 y FD(November)c(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1174 w FA(133)p eop +133 138 bop 573 614 a FB(parsing;)19 b(following)h(ar)o(gs)e(ar)o(e)f +(ignor)o(ed)i(by)f(the)h(switch-scanner)g(and)f(ar)o(e)f(passed)573 +714 y(thr)o(ough)k(to)g(the)g(pr)o(ogram)f(as)h(the)g(tail)f(of)h(the)g +(command-line)g(list.)490 893 y Ft(\017)41 b Fx(-ds)573 +992 y FB(Specify)27 b(when)i(to)g(load)f(the)h(script)f +(\(\223do-script\224\).)47 b(If)28 b(this)h(switch)g(occurs,)h(the)573 +1092 y(switch)23 b(list)f FA(must)g FB(be)g(terminated)f(by)h(a)g +Fx(-s)42 b FA(script)22 b FB(switch.)30 b(The)22 b(script)g(is)g +(loaded)573 1191 y(into)f(the)g(package)f(that)h(is)g(curr)o(ent)f(at)g +(the)h Fx(-ds)f FB(switch.)490 1370 y Ft(\017)41 b Fx(-dm)573 +1470 y FB(As)18 b(above,)g(but)h(the)f(curr)o(ent)g(module)h(is)f +(ignor)o(ed.)25 b(The)18 b(script)h(is)f(loaded)g(into)h(the)573 +1569 y Fx(config)14 b FB(package)h(\(\223do-module\224\),)g(and)h +(hence)h(must)g(be)f(written)h(in)f(the)h(Scheme)573 +1669 y(48)31 b(module)h(language.)59 b(This)33 b(switch)g(doesn't)g(af) +o(fect)d(the)i(curr)o(ent)f(module\227)573 1768 y(after)26 +b(executing)h(this)h(switch,)i(the)d(curr)o(ent)g(module)h(is)f(the)h +(same)f(as)g(as)g(it)h(was)573 1868 y(befor)o(e.)573 +2007 y(This)16 b(switch)h(is)g(pr)o(ovided)e(to)h(make)g(it)g(easy)g +(to)g(write)g(shell)h(scripts)f(in)h(the)f(Scheme)573 +2107 y(48)k(module)h(language.)365 2382 y Fz(9.1.5)81 +b(The)21 b(meta)e(argument)365 2577 y FB(The)33 b(scsh)g(switch)h +(parser)d(takes)h(a)h(special)f(command-line)h(switch,)j(a)c(single)h +(back-)365 2677 y(slash)20 b(called)f(the)h(\223meta-ar)o(gument,\224)d +(which)j(is)g(useful)g(for)f(shell)h(scripts.)25 b(If)19 +b(the)h(initial)365 2777 y(command-line)k(ar)o(gument)f(is)g(a)g(\223)p +Fx(\\)p FB(\224)f(ar)o(gument,)h(followed)h(by)f(a)g(\002lename)g(ar)o +(gument)365 2876 y FA(fname)p FB(,)g(scsh)g(will)g(open)g(the)g(\002le) +f FA(fname)h FB(and)f(r)o(ead)e(mor)o(e)j(ar)o(guments)f(fr)o(om)g(the) +g(second)365 2976 y(line)30 b(of)f(this)h(\002le.)50 +b(This)30 b(list)g(of)f(ar)o(guments)f(will)i(then)g(r)o(eplace)d(the)i +(\223)p Fx(\\)p FB(\224)f(ar)o(gument\227)365 3075 y +FA(i.e.)p FB(,)21 b(the)h(new)f(ar)o(guments)g(ar)o(e)f(inserted)h(in)h +(fr)o(ont)f(of)g FA(fname)p FB(,)h(and)e(the)i(ar)o(gument)f(parser)365 +3175 y(r)o(esumes)28 b(ar)o(gument)f(scanning.)47 b(This)28 +b(is)h(used)e(to)h(over)o(come)g(a)f(limitation)i(of)e(the)h +Fx(#!)365 3275 y FB(featur)o(e:)23 b(the)d Fx(#!)f FB(line)h(can)f +(only)h(specify)f(a)g(single)i(ar)o(gument)e(after)f(the)i(interpr)o +(eter)-6 b(.)23 b(For)365 3374 y(example,)k(we)f(might)i(hope)e(the)g +(following)i(scsh)f(script,)g Fx(ekko)p FB(,)f(would)h(implement)g(a) +365 3474 y(simple-minded)21 b(version)g(of)g(the)g(Unix)g +Fx(echo)e FB(pr)o(ogram:)573 3680 y Fx(#!/usr/local/bin)o(/s)o(csh)37 +b(-e)43 b(main)e(-s)573 3780 y(!#)573 3880 y(\(define)g(\(main)g +(args\))660 3979 y(\(map)h(\()p Fy(\025)d Fx(\(arg\))i(\(display)g +(arg\))g(\(display)g(")i("\)\))878 4079 y(\(cdr)f(args\)\))660 +4179 y(\(newline\)\))365 4385 y FB(The)21 b(idea)f(would)h(be)g(that)f +(the)h(command)573 4538 y Fx(ekko)42 b(Hi)h(there.)365 +4692 y FB(would)22 b(by)e(expanded)g(by)h(the)f Fx(exec\(2\))e +FB(kernel)j(call)f(into)573 4898 y Fx(/usr/local/bin/s)o(cs)o(h)38 +b(-e)k(main)g(-s)h(ekko)f(Hi)h(there.)365 5147 y FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p 1636 5071 323 +4 v 1636 5173 4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 +5176 323 4 v 1174 w FB(133)p eop %%Page: 134 140 -134 139 bop 681 614 a FA(scsh)20 b(dies)g(with)g(exit)f(code)h(0.)26 -b(For)20 b(example,)f(a)g(scsh)i(pr)o(ocess)e(whose)h(top-level)g(is)g(spec-) -681 714 y(i\256ed)g(by)h(a)f Fw(-c)42 b Fz(exp)20 b FA(or)h(a)f -Fw(-e)42 b Fz(entry)21 b FA(entry)f(point)h(ignor)o(es)g(the)g(value)e(pr)o -(oduced)h(by)g(eval-)681 814 y(uating)f Fz(exp)g FA(and)g(calling)g -Fz(entry)p FA(,)g(r)o(espectively)-9 b(.)26 b(If)19 b(these)g(computations)h -(terminate)f(with)681 913 y(no)i(err)o(ors,)f(the)h(scsh)g(pr)o(ocess)f -(exits)h(with)h(an)e(exit)h(code)f(of)h(0.)805 1066 y(T)-8 -b(o)22 b(r)o(eturn)e(a)g(speci\256c)h(exit)f(status,)h(use)g(the)g -Fw(exit)e FA(pr)o(ocedur)o(e)f(explicitly)-9 b(,)21 b Fz(e.g.)o -FA(,)888 1250 y Fw(scsh)42 b(-c)h("\(exit)e(\(run)h(\(|)h(\(fmt\))e(\(mail)h -(shivers@lcs.mit.)o(ed)o(u\)\))o(\)\))o(")681 1600 y Fu(9.2)99 -b(The)25 b(scsh)g(virtual)h(machine)681 1852 y FA(T)-8 b(o)14 -b(r)o(un)h(the)f(Scheme)f(48)g(implementation)i(of)f(scsh,)i(you)e(r)o(un)g -(a)g(specially)g(modi\256ed)g(copy)681 1952 y(of)j(the)g(Scheme)f(48)g -(virtual)h(machine)g(with)g(a)g(scsh)g(heap)g(image.)26 b(The)17 -b(scsh)g(binary)g(is)g(ac-)681 2051 y(tually)f(nothing)j(but)d(a)g(small)h -(cover)f(pr)o(ogram)g(that)h(invokes)g(the)g(byte-code)e(interpr)o(eter)681 -2151 y(on)22 b(the)g(scsh)g(heap)f(image)g(for)g(you.)31 b(This)22 -b(allows)g(you)g(to)g(simply)g(start)f(up)h(an)f(interac-)681 -2250 y(tive)d(scsh)h(fr)o(om)f(a)g(command)h(line,)g(as)f(well)h(as)f(write)g -(shell)h(scripts)g(that)f(begin)h(with)g(the)681 2350 y(simple)i(trigger)888 -2533 y Fw(#!/usr/local/bin/)o(sc)o(sh)37 b(-s)805 2770 y FA(Y)-8 -b(ou)19 b(can)f(also)g(dir)o(ectly)f(execute)g(the)g(virtual)h(machine,)g -(which)h(takes)e(its)i(own)f(set)g(of)681 2870 y(command-line)23 -b(switches..)36 b(For)24 b(example,)f(this)h(command)f(starts)g(the)h(vm)f -(up)g(with)i(a)681 2969 y(1Mwor)o(d)19 b(heap)h(\(split)h(into)h(two)f -(semispaces\):)888 3153 y Fw(scshvm)41 b(-o)i(scshvm)e(-h)i(1000000)e(-i)i -(scsh.image)c(arg1)j(arg2)g Fx(:)14 b(:)g(:)681 3336 y FA(The)g(vm)h(peels)g -(of)o(f)f(initial)h(vm)g(ar)o(guments)f(up)h(to)g(the)f Fw(-i)g -FA(heap)g(image)h(ar)o(gument,)g(which)681 3435 y(terminates)24 -b(vm)h(ar)o(gument)f(parsing.)39 b(The)25 b(r)o(est)e(of)i(the)g(ar)o -(guments)f(ar)o(e)f(passed)h(of)o(f)g(to)681 3535 y(the)g(scsh)g(top-level.) -36 b(Scsh's)24 b(top-level)g(r)o(emoves)f(scsh)h(switches,)h(as)f(discussed)g -(in)g(the)681 3635 y(pr)o(evious)c(section;)h(the)g(r)o(est)f(show)i(up)f(as) -f(the)h(value)f(of)h Fw(command-line-argu)o(me)o(nt)o(s)p FA(.)805 -3788 y(Dir)o(ectly)k(executing)g(the)h(vm)f(can)g(be)g(useful)g(to)g(specify) -g(non-standar)o(d)f(switches,)681 3887 y(or)f(invoke)h(the)g(virtual)f -(machine)h(on)g(special)f(heap)g(images,)h(which)g(can)f(contain)h(pr)o(e-) -681 3987 y(compiled)d(scsh)g(pr)o(ograms)f(with)i(their)f(own)g(top-level)g -(pr)o(ocedur)o(es.)681 4311 y Fy(9.2.1)81 b(VM)20 b(arguments)681 -4532 y FA(The)h(vm)f(takes)h(ar)o(guments)f(in)i(the)f(following)h(form:)888 -4715 y Fw(scshvm)41 b([)p Fz(meta-ar)o(g)n Fw(])i([)p Fz(vm-options)2044 -4685 y Ft(+)2099 4715 y Fw(])g([)p Fz(end-option)f(scheme-ar)o(gs)o -Fw(])681 4898 y FA(wher)o(e)681 5147 y(134)p 1952 5071 323 -4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p 2271 5173 V 1952 5176 -323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +134 139 bop 681 614 a FB(In)17 b(theory)-9 b(,)18 b(this)f(would)h +(cause)e(scsh)i(to)f(start)f(up,)i(load)e(in)i(\002le)f +Fx(ekko)p FB(,)f(call)g(the)h(entry)g(point)681 714 y(on)k(the)g +(command-line)g(list)888 890 y Fx(\(main)42 b('\("ekko")e("Hi")i +("there."\)\))681 1067 y FB(and)20 b(exit.)805 1216 y(Unfortunately)-9 +b(,)34 b(the)e(Unix)g Fx(exec\(2\))d FB(syscall's)j(support)g(for)g +(scripts)g(is)g(not)g(very)681 1315 y(general)c(or)g(well-designed.)49 +b(It)29 b(will)g(not)g(handle)f(multiple)h(ar)o(guments;)j(the)d +Fx(#!)f FB(line)681 1415 y(is)g(usually)g(r)o(equir)o(ed)e(to)i +(contain)g(no)g(mor)o(e)g(than)f(32)g(characters;)i(it)f(is)g(not)g(r)o +(ecursive.)681 1514 y(If)c(these)g(r)o(estrictions)h(ar)o(e)e +(violated,)h(most)i(Unix)e(systems)h(will)g(not)g(pr)o(ovide)f +(accurate)681 1614 y(err)o(or)19 b(r)o(eporting,)i(but)f(either)h(fail) +f(silently)-9 b(,)21 b(or)g(simply)g(incorr)o(ectly)g(implement)g(the)g +(de-)681 1714 y(sir)o(ed)f(functionality)-9 b(.)26 b(These)20 +b(ar)o(e)g(the)h(facts)f(of)g(Unix)h(life.)805 1862 y(In)k(the)g +Fx(ekko)f FB(example)g(above,)h(our)g Fx(#!)f FB(trigger)h(line)g(has)g +(thr)o(ee)f(ar)o(guments)g(\(\223)p Fx(-e)p FB(\224,)681 +1962 y(\223)p Fx(main)p FB(\224,)j(and)g(\223)p Fx(-s)p +FB(\224\),)h(so)g(it)h(will)g(not)f(work.)48 b(The)28 +b(meta-ar)o(gument)f(is)i(how)f(we)h(work)681 2062 y(ar)o(ound)18 +b(this)h(pr)o(oblem.)25 b(W)-8 b(e)19 b(must)g(instead)f(invoke)i(the)f +(scsh)g(interpr)o(eter)e(with)j(the)f(sin-)681 2161 y(gle)j +Fx(\\)g FB(ar)o(gument,)g(and)g(put)g(the)g(r)o(est)g(of)g(the)h(ar)o +(guments)f(on)h(line)f(two)h(of)g(the)f(pr)o(ogram.)681 +2261 y(Her)o(e's)e(the)h(corr)o(ect)e(pr)o(ogram:)888 +2492 y Fx(#!/usr/local/bin/)o(sc)o(sh)37 b(\\)888 2592 +y(-e)43 b(main)f(-s)888 2692 y(!#)888 2791 y(\(define)f(\(main)h +(args\))976 2891 y(\(map)f(\()p Fy(\025)e Fx(\(arg\))j(\(display)e +(arg\))i(\(display)e(")j("\)\))1193 2990 y(\(cdr)f(args\)\))976 +3090 y(\(newline\)\))681 3321 y FB(Now)-8 b(,)21 b(the)g(invocation)h +(starts)e(as)888 3498 y Fx(ekko)42 b(Hi)h(there.)681 +3674 y FB(and)20 b(is)h(expanded)f(by)g(exec\(2\))f(into)888 +3905 y Fx(/usr/local/bin/sc)o(sh)37 b(\\)43 b(ekko)f(Hi)h(there.)681 +4137 y FB(When)17 b(scsh)g(starts)g(up,)g(it)g(expands)f(the)g(\223)p +Fx(\\)p FB(\224)g(ar)o(gument)g(into)h(the)g(ar)o(guments)f(r)o(ead)f +(fr)o(om)681 4236 y(line)21 b(two)g(of)g Fx(ekko)p FB(,)e(pr)o(oducing) +h(this)i(ar)o(gument)e(list:)888 4468 y Fx(-e)43 b(main)f(-s)h(ekko)p +888 4481 654 4 v 42 w(Hi)f(there.)1237 4567 y Ft(")888 +4667 y FB(Expanded)20 b(fr)o(om)43 b Fx(\\)g(ekko)681 +4898 y FB(W)-5 b(ith)22 b(this)f(ar)o(gument)f(list,)h(pr)o(ocessing)g +(pr)o(oceeds)f(as)g(we)h(intended.)681 5147 y(134)p 1952 +5071 323 4 v 1952 5173 4 102 v 1173 w FD(DRAFT)p 2271 +5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 135 141 -135 140 bop 623 601 a Fz(meta-ar)o(g:)159 b Fw(\\)43 b Fz(\256lename)623 -800 y(vm-option)n FA(:)113 b Fw(-h)43 b Fz(heap-size-in-words)1103 -900 y Fw(-s)g Fz(stack-size-in-words)1103 1000 y Fw(-o)g Fz -(object-\256le-name)623 1199 y(end-option:)98 b Fw(-i)43 b -Fz(image-\256le-name)1103 1298 y Fw(--)490 1471 y FA(The)35 -b(vm's)h(meta-switch)g(\252)p Fw(\\)43 b Fz(\256lename)p FA(\272)35 -b(is)h(handled)f(the)g(same)h(as)f(scsh's)h(meta-)365 1571 -y(switch,)22 b(and)e(serves)g(the)h(same)g(purpose.)365 1832 -y Fy(VM)g(options)365 2020 y FA(The)e Fw(-o)43 b Fz(object-\256le-name)18 -b FA(switch)i(tells)g(the)f(vm)g(wher)o(e)f(to)i(\256nd)f(r)o(elocation)g -(information)365 2120 y(for)28 b(its)g(for)o(eign-function)g(calls.)48 -b(Scsh)28 b(will)h(use)e(a)h(pr)o(e-compiled)e(default)h(if)h(it)g(is)g(not) -365 2220 y(speci\256ed.)f(Scsh)18 b Fz(must)h FA(have)f(this)i(information)f -(to)g(r)o(un,)h(since)f(scsh's)g(syscall)g(interfaces)365 2319 -y(ar)o(e)h(done)h(with)g(for)o(eign-function)g(calls.)490 2448 -y(The)h Fw(-h)f FA(and)h Fw(-s)f FA(options)j(tell)e(the)g(vm)h(how)g(much)f -(space)g(to)g(allocate)g(for)g(the)g(heap)365 2547 y(and)j(stack.)40 -b(The)26 b(heap)e(size)h(value)g(is)g(the)g(total)h(number)f(of)g(wor)o(ds)g -(allocated)f(for)h(the)365 2647 y(heap;)31 b(this)d(space)f(is)h(then)g -(split)g(into)h(two)f(semi-spaces)f(for)h(Scheme)f(48's)g(stop-and-)365 -2747 y(copy)21 b(collector)-6 b(.)365 3008 y Fy(End)20 b(options)365 -3196 y FA(End)31 b(options)h(terminate)f(ar)o(gument)g(parsing.)58 -b(The)31 b Fw(-i)g FA(switch)g(is)h(followed)f(by)g(the)365 -3295 y(name)24 b(of)f(a)g(heap)g(image)g(for)h(the)f(vm)h(to)g(execute.)35 -b(The)23 b Fz(image-\256le-name)f FA(string)j(is)e(also)365 -3395 y(taken)f(to)g(be)g(the)g(name)g(of)g(the)g(pr)o(ogram)f(being)h -(executed)f(by)h(the)g(VM;)f(this)h(name)g(be-)365 3495 y(comes)f(the)f(head) -f(of)h(the)h(ar)o(gument)e(list)i(passed)e(to)i(the)f(heap)f(image's)i -(top-level)e(entry)365 3594 y(point.)27 b(The)17 b(tail)g(of)g(the)g(ar)o -(gument)f(list)i(is)f(constr)o(ucted)g(fr)o(om)g(all)g(following)h(ar)o -(guments.)490 3723 y(The)23 b Fw(--)e FA(switch)j(terminates)f(ar)o(gument)f -(parsing)h(without)h(giving)f(a)f(speci\256c)h(heap)365 3822 -y(image;)k(the)f(vm)f(will)h(start)f(up)g(using)h(a)f(default)f(heap)h -(\(whose)h(location)g(is)f(compiled)365 3922 y(into)h(the)f(vm\).)40 -b(All)25 b(the)g(following)i(ar)o(guments)d(comprise)i(the)f(tail)g(of)g(the) -g(list)g(passed)365 4022 y(of)o(f)20 b(to)h(the)g(heap)f(image's)h(top-level) -g(pr)o(ocedur)o(e.)490 4150 y(Notice)f(that)f(you)i(ar)o(e)d(not)j(allowed)e -(to)h(pass)g(ar)o(guments)f(to)i(the)e(heap)h(image's)g(top-)365 -4250 y(level)h(pr)o(ocedur)o(e)e(\()p Fz(e.g.)o FA(,)h(scsh\))h(without)h -(delimiting)g(them)f(with)h Fw(-i)d FA(or)i Fw(--)f FA(\257ags.)365 -4511 y Fy(9.2.2)81 b(Inserting)20 b(interpreter)f(triggers)h(into)g(heap)f -(images)365 4699 y FA(Scheme)j(48's)g(heap)g(image)h(format)f(allows)h(for)f -(an)g(informational)i(header:)29 b(when)23 b(the)365 4799 y(vm)f(loads)g(in)h -(a)e(heap)g(image,)h(it)g(ignor)o(es)g(all)g(data)f(occurring)h(befor)o(e)e -(the)i(\256rst)h(contr)o(ol-)365 4898 y(L)d(character)e(\()r(A)t -Fr(S)t(C)t(I)t(I)23 b FA(12\).)i(This)c(means)f(that)g(you)g(can)g(insert)g -(a)f(\252)p Fw(#!)p FA(\272)f(trigger)i(line)g(into)h(a)365 -5147 y FD(November)d(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 -5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V -1636 5176 323 4 v 1174 w FA(135)p eop +135 140 bop 365 614 a Fz(Secondary)20 b(argument)f(syntax)365 +797 y FB(Scsh)h(uses)g(a)f(very)g(simple)h(grammar)f(to)h(encode)g(the) +f(extra)g(ar)o(guments)g(on)i(the)e(second)365 897 y(line)k(of)g(the)g +(scsh)g(script.)31 b(The)22 b(only)i(special)e(characters)f(ar)o(e)g +(space,)h(tab,)g(newline,)i(and)365 997 y(backslash.)490 +1182 y Ft(\017)41 b FB(Each)e(space)g(character)f(terminates)h(an)h(ar) +o(gument.)81 b(This)41 b(means)e(that)h(two)573 1282 +y(spaces)20 b(in)h(a)g(r)o(ow)f(intr)o(oduce)h(an)f(empty-string)h(ar)o +(gument.)490 1445 y Ft(\017)41 b FB(The)18 b(tab)g(character)f(is)i +(not)g(permitted)f(\(unless)g(you)h(quote)g(it)g(with)g(the)g +(backslash)573 1545 y(character)26 b(described)g(below\).)46 +b(This)28 b(is)g(to)g(pr)o(event)f(the)h(insidious)g(bug)g(wher)o(e)573 +1644 y(you)19 b(believe)g(you)h(have)e(six)h(space)g(characters,)e(but) +j(you)f(r)o(eally)f(have)h(a)f(tab)h(char)o(-)573 1744 +y(acter)-6 b(,)19 b(and)i FA(vice-versa)p FB(.)490 1908 +y Ft(\017)41 b FB(The)25 b(newline)g(character)f(terminates)g(an)h(ar)o +(gument,)g(like)g(the)g(space)f(character)-6 b(,)573 +2007 y(and)26 b(also)h(terminates)g(the)g(ar)o(gument)f(sequence.)44 +b(This)27 b(means)g(that)g(an)f(empty)573 2107 y(line)j(parses)e(to)i +(the)g(singleton)h(list)f(whose)g(one)g(element)f(is)h(the)g(empty)f +(string:)573 2206 y Fx(\(""\))p FB(.)c(The)c(grammar)h(doesn't)g(admit) +f(the)h(empty)g(list.)490 2370 y Ft(\017)41 b FB(The)35 +b(backslash)f(character)g(is)h(the)g(escape)f(character)-6 +b(.)66 b(It)35 b(escapes)f(backslash,)573 2469 y(space,)d(tab,)g(and)e +(newline,)k(turning)d(of)o(f)f(their)h(special)f(functions,)k(and)d +(allow-)573 2569 y(ing)i(them)g(to)g(be)g(included)f(in)h(ar)o +(guments.)58 b(The)34 b(A)t Fs(N)t(S)t(I)g FB(C)d(escape)g(sequences) +573 2669 y(\()p Fx(\\b)p FB(,)36 b Fx(\\n)p FB(,)g Fx(\\r)c +FB(and)i Fx(\\t)p FB(\))e(ar)o(e)h(also)h(supported;)40 +b(these)34 b(also)g(pr)o(oduce)e(ar)o(gument-)573 2768 +y(constituents\227)p Fx(\\n)27 b FB(doesn't)h(act)e(like)h(a)g +(terminating)g(newline.)45 b(The)27 b(escape)f(se-)573 +2868 y(quence)31 b Fx(\\)p FA(nnn)f FB(for)h FA(exactly)e +FB(thr)o(ee)h(octal)g(digits)h(r)o(eads)f(as)g(the)h(character)e(whose) +575 2968 y(A)t Fs(S)t(C)t(I)t(I)21 b FB(code)d(is)g FA(nnn)p +FB(.)26 b(It)18 b(is)g(an)g(err)o(or)g(if)g(backslash)g(is)g(followed)h +(by)f(just)h(one)g(or)f(two)573 3067 y(octal)26 b(digits:)36 +b Fx(\\3Q)24 b FB(is)i(an)g(err)o(or)-6 b(.)39 b(Octal)26 +b(escapes)f(ar)o(e)g(always)g(constituent)i(chars.)573 +3167 y(Backslash)e(followed)h(by)g(other)g(chars)f(is)h(not)h(allowed)e +(\(so)h(we)g(can)f(extend)g(the)573 3266 y(escape-code)19 +b(space)h(later)g(if)h(we)f(like\).)490 3452 y(Y)-8 b(ou)20 +b(have)f(to)h(constr)o(uct)g(these)f(line-two)h(ar)o(gument)f(lines)h +(car)o(efully)-9 b(.)24 b(In)19 b(particular)-6 b(,)365 +3552 y(bewar)o(e)22 b(of)h(trailing)h(spaces)f(at)g(the)g(end)g(of)h +(the)f(line\227they'll)i(give)e(you)h(extra)e(trailing)365 +3651 y(empty-string)g(ar)o(guments.)j(Her)o(e's)20 b(an)g(example:)573 +3790 y Fx(#!/bin/interpret)o(er)37 b(\\)573 3890 y(foo)42 +b(bar)86 b(quux\\)42 b(yow)365 4028 y FB(would)22 b(pr)o(oduce)d(the)i +(ar)o(guments)573 4167 y Fx(\("foo")41 b("bar")g("")i("quux)f(yow"\)) +365 4416 y Fz(9.1.6)81 b(Examples)490 4599 y Ft(\017)41 +b Fx(scsh)h(-dm)g(-m)h(myprog)e(-e)i(top)f(-s)h(myprog.scm)573 +4699 y FB(Load)18 b Fx(myprog.scm)d FB(into)20 b(the)g +Fx(config)c FB(package,)j(then)g(shift)h(to)f(the)h Fx(myprog)c +FB(pack-)573 4799 y(age)25 b(and)g(call)h Fx(\(top)42 +b('\("myprog.scm"\)\))o FB(,)21 b(then)26 b(exit.)40 +b(This)27 b(sort)f(of)g(invocation)573 4898 y(is)21 b(typically)g(used) +f(in)i Fx(#!)e FB(script)g(lines)i(\(see)e(below\).)365 +5147 y FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1174 w FB(135)p eop %%Page: 136 142 -136 141 bop 681 614 a FA(heap)15 b(image,)i(making)g(it)f(a)f(form)i(of)f -(executable)e(\252shell)i(script.\272)26 b(Since)16 b(the)g(vm)g(r)o(equir)o -(es)681 714 y(multiple)22 b(ar)o(guments)g(to)g(be)f(given)h(on)h(the)f -(command)g(line,)g(you)h(must)f(use)g(the)g(meta-)681 814 y(switch.)28 -b(Her)o(e's)20 b(an)h(example)f(heap-image)f(header:)888 995 -y Fw(#!/usr/local/lib/)o(sc)o(sh/)o(sc)o(shv)o(m)37 b(\\)888 -1094 y(-o)43 b(/usr/local/lib/s)o(csh)o(/s)o(csh)o(vm)37 b(-i)888 -1194 y Fx(:)14 b(:)g(:)58 b Fz(Y)-9 b(our)21 b(heap)f(image)g(goes)h(her)o(e) -43 b Fx(:)14 b(:)g(:)681 1499 y Fy(9.2.3)81 b(Inserting)19 -b(a)i(double-level)c(trigger)k(into)f(Scheme)e(programs)681 -1682 y FA(If)d(you'r)o(e)f(a)h(ner)o(d,)g(you)h(may)f(enjoy)h(doing)g(a)f -(double-level)f(machine)i(shift)f(in)h(the)f(trigger)681 1782 -y(line)21 b(of)g(your)g(Scheme)f(pr)o(ograms)g(with)i(the)f(following)h -(magic:)888 1955 y Fi(#!/usr/local/lib/scsh/scshvm)46 b(\\)888 -2046 y(-o)40 b(/usr/local/lib/scsh/scshvm)45 b(-i)40 b -(/usr/local/lib/scsh/scsh.image)46 b(-s)888 2137 y(!#)888 2229 -y Fe(:)13 b(:)h(:)52 b Fg(Y)-8 b(our)18 b(Scheme)h(pr)o(ogram)h(goes)f(her)o -(e)40 b Fe(:)13 b(:)g(:)681 2561 y Fu(9.3)99 b(Compiling)25 -b(scsh)h(programs)681 2775 y FA(Scsh)k(allows)g(you)g(to)h(cr)o(eate)d(a)h -(heap)g(image)h(with)h(your)f(own)h(top-level)e(pr)o(ocedur)o(e.)681 -2874 y(Adding)20 b(the)h(pair)f(of)h(lines)888 3055 y Fw(#!/usr/local/lib/)o -(sc)o(sh/)o(sc)o(shv)o(m)37 b(\\)888 3155 y(-o)43 b(/usr/local/lib/s)o(csh)o -(/s)o(csh)o(vm)37 b(-i)681 3336 y FA(to)21 b(the)g(top)g(of)g(the)g(heap)f -(image)g(will)i(turn)f(it)g(into)g(an)g(executable)f(Unix)g(\256le.)805 -3461 y(Y)-8 b(ou)22 b(can)f(cr)o(eate)e(heap)h(images)h(with)g(the)g -(following)h(two)g(pr)o(ocedur)o(es.)681 3605 y Fw(\(dump-scsh-progr)o(am)37 -b Fz(main)20 b(fname)p Fw(\))87 b Fs(\000)-14 b(!)87 b Fz(unde\256ned)585 -b FA(pr)o(ocedur)o(e)888 3741 y(This)29 b(pr)o(ocedur)o(e)c(writes)j(out)g(a) -f(scsh)h(heap)f(image.)48 b(When)28 b(the)g(heap)f(image)h(is)888 -3841 y(executed)21 b(by)h(the)g(Scheme)f(48)g(vm,)h(it)g(will)h(call)e(the)h -Fz(main)g FA(pr)o(ocedur)o(e,)e(passing)i(it)888 3941 y(the)f(vm's)g(ar)o -(gument)e(list.)28 b(When)21 b Fw(main)d FA(r)o(eturns)i(an)g(integer)h -(value)e Fx(i)p FA(,)h(the)g(vm)h(ex-)888 4040 y(its)j(with)h(exit)e(status)h -Fx(i)p FA(.)35 b(The)23 b(Scheme)h(vm)f(will)i(parse)d(command-line)i -(switches)888 4140 y(as)30 b(described)g(in)h(section)g(9.2.1;)i(r)o -(emaining)d(ar)o(guments)g(form)h(the)f(tail)h(of)f(the)888 -4240 y(command-line)19 b(list)g(that)g(is)f(passed)g(to)h Fw(main)p -FA(.)25 b(\(The)18 b(head)g(of)g(the)h(list)g(is)g(the)f(name)888 -4339 y(of)i(the)g(pr)o(ogram)f(being)h(executed)e(by)i(the)g(vm.\))27 -b(Further)20 b(ar)o(gument)f(parsing)h(\(as)888 4439 y(described)g(for)h -(scsh)g(in)g(section)h(9.1.4\))c(is)j(not)h(performed.)888 -4569 y(The)14 b(heap)g(image)g(cr)o(eated)e(by)i Fw(dump-scsh-progra)o(m)8 -b FA(has)14 b(unused)g(code)g(and)f(data)888 4669 y(pr)o(uned)21 -b(out,)g(so)g(small)g(pr)o(ograms)g(compile)g(to)g(much)g(smaller)g(heap)f -(images.)681 4852 y Fw(\(dump-scsh)39 b Fz(fname)p Fw(\))87 -b Fs(\000)-14 b(!)87 b Fz(unde\256ned)1125 b FA(pr)o(ocedur)o(e)681 -5147 y(136)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +136 141 bop 805 614 a Ft(\017)41 b Fx(scsh)h(-c)h('\(display)d("Hello,) +h(world."\)')888 714 y FB(A)21 b(simple)g(pr)o(ogram.)805 +897 y Ft(\017)41 b Fx(scsh)h(-o)h(bigscheme)888 996 y +FB(Start)53 b(up)g(interactively)f(in)i(the)f(user)g(package)f(after)g +(opening)j(str)o(uctur)o(e)888 1096 y Fx(bigscheme)p +FB(.)805 1278 y Ft(\017)41 b Fx(scsh)h(-o)h(bigscheme)d(--)j(Three)e +(args)h(passed)888 1378 y FB(Start)24 b(up)g(interactively)g(in)h(the)g +(user)f(package)f(after)g(opening)i Fx(bigscheme)p FB(.)33 +b(The)888 1478 y Fx(command-line-args)e FB(variable)36 +b(in)i(the)g(scsh)g(package)f(is)h(bound)g(to)g(the)f(list)888 +1577 y Fx(\("Three")k("args")g("passed"\))p FB(,)g(and)f(the)g +Fx(\(command-line\))35 b FB(pr)o(ocedur)o(e)j(r)o(e-)888 +1677 y(turns)22 b(the)e(list)i Fx(\("scsh")40 b("Three")h("args")g +("passed"\))p FB(.)805 1859 y Ft(\017)g FB(Pr)o(ogram)21 +b Fx(ekko)888 1959 y FB(This)g(shell)g(script,)f(called)f +Fx(ekko)p FB(,)g(implements)i(a)e(version)i(of)f(the)g(Unix)g +Fx(echo)f FB(pr)o(o-)888 2059 y(gram:)1071 2241 y Fx(#!/usr/local/bin)o +(/sc)o(sh)37 b(-s)1071 2341 y(!#)1071 2440 y(\(for-each)j(\()p +Fy(\025)f Fx(\(arg\))i(\(display)f(arg\))i(\(display)f(")i("\)\))1507 +2540 y(command-line-arg)o(s\))888 2764 y FB(Note)22 b(this)g(short)f +(pr)o(ogram)g(is)g(an)g(example)g(of)g(a)g FA(script)p +FB(\227it)g(executes)f(as)h(it)g(loads.)888 2864 y(The)g(Unix)g(r)o +(ule)g(for)f(executing)h Fx(#!)f FB(shell)h(scripts)g(causes)1071 +3022 y Fx(ekko)42 b(Hello,)f(world.)888 3180 y FB(to)21 +b(expand)f(as)1071 3338 y Fx(/usr/local/bin/s)o(csh)37 +b(-s)42 b(ekko)g(Hello,)g(world.)805 3537 y Ft(\017)f +FB(Pr)o(ogram)21 b Fx(ekko)888 3637 y FB(This)30 b(is)f(the)g(same)g +(pr)o(ogram,)h FA(not)e FB(as)h(a)f(script.)50 b(W)-6 +b(riting)29 b(it)h(this)f(way)g(makes)g(it)888 3736 y(possible)21 +b(to)f(compile)h(the)f(pr)o(ogram)f(\(and)g(then,)i(for)e(instance,)h +(dump)g(it)g(out)h(as)f(a)888 3836 y(heap)h(image\).)1071 +4018 y Fx(#!/usr/local/bin)o(/sc)o(sh)37 b(\\)1071 4118 +y(-e)43 b(top)f(-s)1071 4218 y(!#)1071 4317 y(\(define)f(\(top)h +(args\))1158 4417 y(\(for-each)e(\()p Fy(\025)f Fx(\(arg\))i(\(display) +g(arg\))h(\(display)e(")j("\)\))1594 4516 y(\(cdr)f(args\)\)\))888 +4699 y FB(The)28 b Fx(exec\(2\))d FB(expansion)j(of)f(the)h +Fx(#!)f FB(line)h(together)g(with)h(the)e(scsh)i(expansion)888 +4799 y(of)34 b(the)g(\223)p Fx(\\)42 b(ekko)p FB(\224)32 +b(meta-ar)o(gument)g(\(see)h(section)i(9.1.5\))c(gives)j(the)g +(following)888 4898 y(command-line)22 b(expansion:)681 +5147 y(136)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)d(10,)g +(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 137 143 -137 142 bop 573 614 a FA(This)20 b(pr)o(ocedur)o(e)e(writes)h(out)h(a)f(heap) -h(image)f(with)h(the)g(standar)o(d)e(scsh)i(top-level.)573 -714 y(When)31 b(the)g(image)g(is)h(r)o(esumed)e(by)h(the)g(vm,)i(it)f(will)f -(parse)f(and)h(execute)f(scsh)573 814 y(command-line)21 b(switches)h(as)e -(described)g(in)h(section)g(9.1.4.)573 942 y(Y)-8 b(ou)15 b(can)e(use)h(this) -h(pr)o(ocedur)o(e)d(to)i(write)g(out)h(custom)f(scsh)h(heap)e(images)h(that)g -(have)573 1041 y(speci\256c)21 b(packages)e(pr)o(eloaded)g(and)i(start)f(up)h -(in)g(speci\256c)g(packages.)490 1203 y(Unfortunately)-9 b(,)17 -b(Scheme)g(48)f(does)i(not)g(support)f(separate)f(compilation)j(of)e(Scheme) -365 1302 y(\256les)25 b(or)f(Scheme)g(modules.)39 b(The)24 -b(only)h(way)g(to)f(compile)h(is)g(to)f(load)g(sour)o(ce)g(and)g(then)365 -1402 y(dump)c(out)h(a)f(heap)f(image.)28 b(One)20 b(occasionally)h(hears)f(r) -o(umours)h(that)f(this)h(is)f(being)h(ad-)365 1502 y(dr)o(essed)f(by)h(the)f -(Scheme)h(48)f(development)g(team.)365 1775 y Fu(9.4)99 b(Statically)26 -b(linking)g(heap)e(images)365 1989 y FA(Brian)29 b(Carlstr)o(om)f(has)i -(written)f(code)g(to)g(pr)o(ocess)g(Scheme)g(48)f(heap)g(images)h(into)h -Fw(.o)365 2088 y FA(\256les)24 b(that)e(can)h(be)g(linked)g(with)g(a)g -(virtual)f(machine)h(binary)g(to)g(pr)o(oduce)f(a)h(standalone)365 -2188 y(machine-code)e(executable.)490 2313 y(The)f(sour)o(ce)f(code)h(comes)g -(with)h(the)f(curr)o(ent)f(distribution,)i(but)f(it)g(has)g(not)h(been)e(in-) -365 2412 y(tegrated)h(into)i(the)e(system)i(or)f(documented)f(in)i(time)f -(for)f(this)i(r)o(elease.)365 2685 y Fu(9.5)99 b(Standard)24 -b(\256le)h(locations)365 2899 y FA(Because)20 b(the)i(scshvm)g(binary)f(is)g -(intended)g(to)h(be)f(used)g(for)g(writing)h(shell)g(scripts,)f(it)g(is)365 -2999 y(important)j(that)g(the)f(binary)h(be)f(installed)g(in)h(a)f(standar)o -(d)f(place,)h(so)h(that)f(shell)h(scripts)365 3099 y(can)g(dependably)g(r)o -(efer)e(to)j(it.)39 b(The)24 b(standar)o(d)f(dir)o(ectory)h(for)g(the)g(scsh) -h(tr)o(ee)f(should)h(be)365 3198 y Fw(/usr/local/lib/sc)o(sh)o(/)p -FA(.)c(Whenever)g(possible,)g(the)g(vm)g(should)g(be)g(located)f(in)573 -3337 y Fw(/usr/local/lib/s)o(cs)o(h/s)o(cs)o(hvm)365 3475 y -FA(and)h(a)f(scsh)h(heap)f(image)h(should)h(be)e(located)g(in)573 -3614 y Fw(/usr/local/lib/s)o(cs)o(h/s)o(cs)o(h.i)o(ma)o(ge)365 -3752 y FA(The)h(top-level)f(scsh)i(pr)o(ogram)e(should)h(be)g(located)f(in) -573 3891 y Fw(/usr/local/lib/s)o(cs)o(h/s)o(cs)o(h)365 4030 -y FA(with)i(a)e(symbolic)i(link)f(to)h(it)f(fr)o(om)573 4168 -y Fw(/usr/local/bin/s)o(cs)o(h)490 4332 y FA(The)30 b(Scheme)g(48)f(image)h -(format)f(allows)i(heap)e(images)i(to)f(have)g Fw(#!)f FA(triggers,)j(so)365 -4431 y Fw(scsh.image)17 b FA(should)k(have)g(a)f Fw(#!)g FA(trigger)h(of)f -(the)h(following)h(form:)573 4603 y Fw(#!/usr/local/lib)o(/s)o(csh)o(/s)o -(csh)o(vm)37 b(\\)573 4703 y(-o)43 b(/usr/local/lib/)o(scs)o(h/)o(scs)o(hv)o -(m)37 b(-i)573 4803 y Fx(:)14 b(:)g(:)57 b Fz(heap)20 b(image)g(goes)h(her)o -(e)43 b Fx(:)14 b(:)g(:)365 5147 y FD(November)k(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1174 w FA(137)p eop +137 142 bop 756 614 a Fx(ekko)41 b(Hello,)h(world.)930 +714 y Fm(=)-14 b Ft(\))87 b Fx(/usr/local/bin/s)o(cs)o(h)37 +b(\\)44 b(ekko)390 b(Hello,)41 b(world.)930 814 y Fm(=)-14 +b Ft(\))87 b Fx(/usr/local/bin/s)o(cs)o(h)37 b(-e)43 +b(top)g(-s)f(ekko)g(Hello,)f(world.)490 1035 y Ft(\017)g +FB(Pr)o(ogram)20 b Fx(sort)573 1135 y FB(This)d(is)f(a)g(pr)o(ogram)f +(to)i(r)o(eplace)e(the)h(Unix)g Fx(sort)f FB(utility\227sorting)j +(lines)e(r)o(ead)f(fr)o(om)573 1234 y(stdin,)28 b(and)d(printing)i(the) +g(r)o(esults)f(on)h(stdout.)42 b(Note)26 b(that)g(the)h(sour)o(ce)f +(code)f(de-)573 1334 y(\002nes)g(a)f(general)g(sorting)h(package,)f +(which)i(is)e(useful)h(\(1\))e(as)h(a)g(Scheme)g(module)573 +1434 y(exporting)f(sort)g(pr)o(ocedur)o(es)e(to)i(other)h(Scheme)e +(code,)h(and)f(\(2\))g(as)g(a)h(standalone)573 1533 y(pr)o(ogram)d +(invoked)h(fr)o(om)f(the)h Fx(top)f FB(pr)o(ocedur)o(e.)756 +1714 y Fx(#!/usr/local/bi)o(n/)o(scs)o(h)37 b(\\)756 +1814 y(-dm)42 b(-m)h(sort-toplevel)38 b(-e)43 b(top)f(-s)756 +1913 y(!#)756 2112 y(;;;)g(This)g(is)h(a)g(sorting)d(module.)h(TOP)h +(procedure)e(exports)756 2212 y(;;;)i(the)g(functionality)c(as)43 +b(a)g(Unix)f(program)f(akin)h(to)h(sort\(1\).)756 2312 +y(\(define-structu)o(re)o(s)38 b(\(\(sort-struct)g(\(export)j +(sort-list)2543 2411 y(sort-vector!\)\))1627 2511 y(\(sort-toplevel)d +(\(export)j(top\)\)\))843 2611 y(\(open)g(scheme\))843 +2810 y(\(begin)g(\(define)f(\(sort-list)g(elts)i(<=\))g(...\))1148 +2909 y(\(define)e(\(sort-vec!)g(vec)i(<=\))86 b(...\))1148 +3109 y(;;)43 b(Parse)e(the)h(command)f(line)h(and)1148 +3208 y(;;)h(sort)e(stdin)h(to)h(stdout.)1148 3308 y(\(define)d(\(top)i +(args\))1279 3408 y(...\)\)\))573 3621 y FB(The)18 b(expansion)g(below) +h(shows)h(how)f(the)f(command-line)g(scanner)g(\(1\))f(loads)h(the)573 +3712 y(con\002g)i(\002le)f Fx(sort)f FB(\(written)h(in)h(the)f(Scheme)g +(48)f(module)h(language\),)g(\(2\))f(switches)573 3803 +y(to)32 b(the)h(package)e(underlying)h(the)g Fx(sort-toplevel)27 +b FB(str)o(uctur)o(e,)34 b(\(3\))d(calls)h Fx(\(top)573 +3895 y('\("sort")40 b("foo")i("bar"\)\))18 b FB(in)j(the)g(package,)e +(and)h(\002nally)i(\(4\))d(exits.)573 4154 y Fh(sort)40 +b(foo)g(bar)573 4246 y Fc(=)-13 b Fb(\))78 b Fh(/usr/local/bin/scsh)44 +b(\\)39 b(sort)1178 b(foo)40 b(bar)573 4337 y Fc(=)-13 +b Fb(\))78 b Fh(/usr/local/bin/scsh)44 b(-dm)39 b(-m)h(sort-toplevel)i +(-e)e(top)g(-s)g(sort)g(foo)g(bar)573 4537 y FB(An)21 +b(alternate)e(method)i(would)h(have)e(used)h(a)756 4718 +y Fx(-n)42 b(#f)h(-o)g(sort-toplevel)573 4898 y FB(sequence)21 +b(of)g(switches)g(to)g(specify)g(a)f(top-level)g(package.)365 +5147 y FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1174 w FB(137)p eop %%Page: 138 144 -138 143 bop 681 1263 a Fv(Chapter)44 b(10)681 1704 y FB(Changes)52 -b(from)g(the)g(previous)681 1953 y(release)681 2411 y FA(This)20 -b(section)h(details)f(changes)g(that)g(have)g(been)g(made)f(in)i(scsh)g -(since)f(the)h(pr)o(evious)e(r)o(e-)681 2511 y(lease.)805 2636 -y(Scsh)29 b(is)g(now)g(much)g(mor)o(e)f(r)o(obust.)51 b(All)29 -b(known)g(bugs)g(have)f(been)h(\256xed.)50 b(Ther)o(e)681 2736 -y(have)14 b(been)g(many)g(impr)o(ovements)h(and)f(extensions)h(made.)25 -b(W)-8 b(e)15 b(have)e(also)i(made)f(made)681 2835 y(some)21 -b(incompatible)g(changes.)805 2961 y(The)e(sections)g(below)g(brie\257y)g -(describe)f(these)g(new)h(featur)o(es)e(and)h(changes;)h(the)g(r)o(el-)681 -3061 y(evant)h(sections)i(of)e(the)h(manual)g(give)g(the)g(full)f(details.) -681 3341 y Fu(10.1)99 b(New)24 b(features)681 3556 y FA(This)d(r)o(elease)e -(incorporates)i(several)f(new)h(featur)o(es)e(into)j(scsh.)805 -3766 y Fs(\017)41 b FA(Contr)o(ol)21 b(of)g(buf)o(fer)o(ed)d(I/O)888 -3866 y(Scsh)25 b(now)g(allows)h(you)f(to)g(contr)o(ol)g(the)g(buf)o(fering)e -(policy)i(used)g(for)f(doing)h(I/O)888 3966 y(on)d(a)e(Scheme)g(port.)805 -4133 y Fs(\017)41 b FA(Her)o(e-strings)888 4233 y(Scsh)21 b(now)g(has)g(a)f -(new)h(lexical)f(featur)o(e,)e Fw(#<<)p FA(,)i(that)g(pr)o(ovides)g(the)h -(ability)f(to)h(enter)888 4332 y(long,)h(multi-line)f(string)h(constants)g -(in)f(scsh)g(pr)o(ograms.)27 b(Such)21 b(a)f(string)i(is)f(called)888 -4432 y(a)16 b(\252her)o(e)f(string,\272)i(by)g(analogy)f(to)h(the)g(common)h -(shell)f(\252her)o(e)e(document\272)h Fw(<<)f FA(r)o(edi-)888 -4532 y(r)o(ection.)805 4699 y Fs(\017)41 b FA(Delimited)21 -b(r)o(eaders)e(and)i(r)o(ead-line)888 4799 y(Scsh)31 b(now)i(has)e(a)f -(powerful)h(set)h(of)f(delimited)g(r)o(eaders.)56 b(These)32 -b(can)e(be)h(used)888 4898 y(to)23 b(r)o(ead)f(input)h(delimited)f(by)h(a)f -(newline)i(character)d(\()p Fw(read-line)p FA(\),)e(a)j(blank)h(line)681 -5147 y(138)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +138 143 bop 805 614 a FB(Note)18 b(that)g(the)g(sort)g(example)g(can)f +(be)h(compiled)g(into)g(a)g(Unix)g(pr)o(ogram)f(by)h(loading)681 +714 y(the)25 b(\002le)g(into)h(an)f(scsh)g(pr)o(ocess,)g(and)g(dumping) +g(a)g(heap)f(with)i(top-level)f Fx(top)p FB(.)37 b(Even)24 +b(if)681 814 y(we)18 b(don't)h(want)g(to)g(export)f(the)h(sort's)g +(functionality)h(as)e(a)g(subr)o(outine)h(library)-9 +b(,)18 b(it)g(is)h(still)681 913 y(useful)f(to)h(write)f(the)g(sort)h +(pr)o(ogram)e(with)i(the)g(module)f(language.)25 b(The)18 +b(command)h(line)681 1013 y(design)k(allows)g(us)g(to)g(r)o(un)g(this)g +(pr)o(ogram)f(as)h(either)f(an)g(interpr)o(eted)g(script)g(\(given)h +(the)681 1112 y Fx(#!)d FB(ar)o(gs)g(in)h(the)g(header\))e(or)i(as)f(a) +h(compiled)g(heap)f(image.)681 1370 y Fz(9.1.7)81 b(Process)20 +b(exit)f(values)681 1556 y FB(Scsh)i(ignor)o(es)h(the)g(value)f(pr)o +(oduced)f(by)i(its)g(top-level)g(computation)g(when)g(determin-)681 +1655 y(ing)g(its)g(exit)f(status)h(code.)27 b(If)21 b(the)h(top-level)f +(computation)h(completed)g(with)g(no)g(err)o(ors,)681 +1755 y(scsh)e(dies)g(with)g(exit)g(code)g(0.)k(For)c(example,)f(a)h +(scsh)g(pr)o(ocess)f(whose)i(top-level)f(is)g(spec-)681 +1854 y(i\002ed)g(by)h(a)f Fx(-c)42 b FA(exp)20 b FB(or)h(a)f +Fx(-e)42 b FA(entry)21 b FB(entry)f(point)h(ignor)o(es)g(the)g(value)e +(pr)o(oduced)h(by)g(eval-)681 1954 y(uating)f FA(exp)g +FB(and)g(calling)h FA(entry)p FB(,)f(r)o(espectively)-9 +b(.)24 b(If)19 b(these)h(computations)g(terminate)f(with)681 +2054 y(no)i(err)o(ors,)f(the)h(scsh)g(pr)o(ocess)f(exits)h(with)h(an)e +(exit)h(code)f(of)h(0.)805 2181 y(T)-8 b(o)22 b(r)o(eturn)e(a)g +(speci\002c)h(exit)f(status,)h(use)g(the)g Fx(exit)e +FB(pr)o(ocedur)o(e)f(explicitly)-9 b(,)21 b FA(e.g.)o +FB(,)888 2280 y Fx(scsh)42 b(-c)h(\\)976 2380 y("\(exit)e +(\(status:exit-va)o(l)d(\(run)k(\(|)g(\(fmt\))g(\(mail)f +(shivers\)\)\)\)\)")681 2663 y Fv(9.2)99 b(The)25 b(scsh)g(virtual)h +(machine)681 2880 y FB(T)-8 b(o)30 b(r)o(un)h(the)f(Scheme)f(48)g +(implementation)i(of)f(scsh,)i(you)e(r)o(un)h(a)e(specially)h +(modi\002ed)681 2980 y(copy)d(of)f(the)h(Scheme)g(48)e(virtual)i +(machine)g(with)g(a)f(scsh)i(heap)e(image.)43 b(The)27 +b(scsh)g(bi-)681 3080 y(nary)22 b(is)h(actually)e(nothing)j(but)f(a)f +(small)g(cover)g(pr)o(ogram)g(that)g(invokes)h(the)g(byte-code)681 +3179 y(interpr)o(eter)28 b(on)i(the)g(scsh)g(heap)f(image)g(for)h(you.) +52 b(This)30 b(allows)g(you)g(to)g(simply)g(start)681 +3279 y(up)23 b(an)g(interactive)f(scsh)i(fr)o(om)f(a)f(command)i(line,) +g(as)f(well)g(as)g(write)g(shell)h(scripts)f(that)681 +3378 y(begin)e(with)g(the)g(simple)h(trigger)888 3521 +y Fx(#!/usr/local/bin/)o(sc)o(sh)37 b(-s)805 3690 y FB(Y)-8 +b(ou)27 b(can)e(also)g(dir)o(ectly)g(execute)f(the)i(virtual)f +(machine,)h(which)g(takes)f(its)h(own)g(set)681 3790 +y(of)21 b(command-line)g(switches..)27 b(For)22 b(example,)e(this)h +(command)h(starts)f(the)g(vm)g(up)g(with)681 3889 y(a)f(1Mwor)o(d)f +(heap)i(\(split)g(into)g(two)h(semispaces\):)888 4031 +y Fx(scshvm)41 b(-o)i(scshvm)e(-h)i(1000000)e(-i)i(scsh.image)c(arg1)j +(arg2)g(...)681 4174 y FB(The)33 b(vm)h(peels)f(of)o(f)f(initial)i(vm)g +(ar)o(guments)f(up)g(to)h(the)f Fx(-i)g FB(heap)g(image)g(ar)o(gument,) +681 4273 y(which)46 b(terminates)f(vm)h(ar)o(gument)e(parsing.)99 +b(The)45 b(r)o(est)g(of)g(the)h(ar)o(guments)e(ar)o(e)681 +4373 y(passed)e(of)o(f)f(to)i(the)g(scsh)g(top-level.)90 +b(Scsh's)43 b(top-level)f(r)o(emoves)g(scsh)h(switches,)681 +4473 y(as)k(discussed)g(in)h(the)f(pr)o(evious)g(section;)61 +b(the)48 b(r)o(est)e(show)j(up)e(as)g(the)g(value)g(of)681 +4572 y Fx(command-line-arg)o(um)o(ent)o(s)p FB(.)805 +4699 y(Dir)o(ectly)25 b(executing)g(the)h(vm)f(can)g(be)g(useful)g(to)g +(specify)g(non-standar)o(d)f(switches,)681 4799 y(or)f(invoke)h(the)g +(virtual)f(machine)h(on)g(special)f(heap)g(images,)h(which)g(can)f +(contain)h(pr)o(e-)681 4898 y(compiled)d(scsh)g(pr)o(ograms)f(with)i +(their)f(own)g(top-level)g(pr)o(ocedur)o(es.)681 5147 +y(138)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p eop %%Page: 139 145 -139 144 bop 573 614 a FA(\()p Fw(read-paragraph)p FA(\))o(,)19 -b(or)25 b(the)f(occurr)o(ence)f(of)i(any)f(character)f(in)h(an)h(arbitrary)e -(set)573 714 y(\()p Fw(read-delimited)p FA(\))o(.)573 860 y(While)k(these)f -(pr)o(ocedur)o(es)f(can)h(be)g(applied)g(to)h(any)f(Scheme)h(input)g(port,)g -(ther)o(e)573 960 y(is)37 b(native-code)e(support)i(for)f(performing)h -(delimited)f(r)o(eads)f(on)i(Unix)f(input)573 1060 y(sour)o(ces,)i(so)d -(doing)h(block)f(input)g(with)h(these)f(pr)o(ocedur)o(es)e(should)i(be)g -(much)573 1159 y(faster)20 b(than)h(the)f(equivalent)h(character)o -(-at-a-time)c(Scheme)k(code.)490 1352 y Fs(\017)41 b FA(New)21 -b(system)g(calls)573 1452 y(W)-5 b(ith)17 b(the)f(sole)h(exception)f(of)g -(signal)h(handlers,)g(scsh)f(now)h(has)g(all)e(of)k(P)t Fr(O)t(S)t(I)t(X)r -FA(.)27 b(This)573 1552 y(r)o(elease)19 b(intr)o(oduces)672 -1745 y Fy(\261)42 b Fw(select)p FA(,)672 1891 y Fy(\261)g FA(full)20 -b(terminal)h(device)f(contr)o(ol,)672 2038 y Fy(\261)42 b FA(support)20 -b(for)h(pseudo-terminal)f(\252pty\272)g(devices,)672 2184 y -Fy(\261)42 b FA(\256le)20 b(locking,)672 2330 y Fy(\261)42 -b FA(pr)o(ocess)20 b(timing,)672 2477 y Fy(\261)42 b Fw(set-file-times)p -FA(,)672 2623 y Fy(\261)g Fw(seek)19 b FA(and)h Fw(tell)p FA(.)573 -2816 y(Note)d(that)g(having)g Fw(select)p FA(,)e(pseudo-terminals,)i(and)f -(tty)h(device)f(contr)o(ol)h(means)573 2916 y(that)23 b(it)h(is)g(now)g -(possible)h(to)e(implement)i(inter)o(esting)e(network)i(pr)o(otocols,)f(such) -573 3015 y(as)c(telnet)h(servers)f(and)h(clients,)g(dir)o(ectly)f(in)h -(Scheme.)490 3209 y Fs(\017)41 b FA(New)21 b(command-line)g(switches)573 -3308 y(Ther)o(e)15 b(is)h(a)f(new)h(set)f(of)h(command-line)g(switches)g -(that)g(make)f(it)h(possible)h(to)f(write)573 3408 y(shell)j(scripts)f(using) -h(the)f(Scheme)g(48)f(module)h(system.)27 b(Scripts)18 b(can)g(use)g(the)g -(new)573 3507 y(command-line)g(switches)h(to)f(open)g(dependent)f(modules)h -(and)g(load)f(dependent)573 3607 y(sour)o(ce)28 b(code.)52 -b(Scripts)29 b(can)f(also)h(be)g(written)g(in)h(the)f(Scheme)g(48)f(module)h -(lan-)573 3707 y(guage,)18 b(which)h(allows)f(you)h(to)f(use)g(it)h(both)f -(as)g(a)f(standalone)h(shell)h(script,)f(and)g(as)573 3806 -y(a)i(code)h(module)g(that)f(can)h(be)f(loaded)g(and)h(used)f(by)h(other)g -(Scheme)f(pr)o(ograms.)490 3999 y Fs(\017)41 b FA(Static)20 -b(heap)g(linking)573 4099 y(Ther)o(e)d(is)h(a)f(new)h(facility)g(that)g -(allows)g(you)g(to)g(compile)h(a)e(heap)g(image)h(to)g(a)f -Fw(.o)g FA(\256le)573 4199 y(that)26 b(can)f(be)h(linked)g(with)h(the)f(scsh) -h(virtual)e(machine.)44 b(This)26 b(pr)o(oduces)f(a)h(stan-)573 -4298 y(dalone)33 b(executable)g(binary)-9 b(,)36 b(makes)e(startup)g(time)g -(near)o(-instantaneous,)i(and)573 4398 y(gr)o(eatly)19 b(impr)o(oves)g -(memory)i(performance\320the)e(initial)h(heap)f(image)h(is)g(placed)573 -4498 y(in)k(the)g(pr)o(ocess')f(text)h(pages,)f(wher)o(e)g(it)h(is)g(shar)o -(ed)f(by)g(dif)o(fer)o(ent)f(scsh)i(pr)o(ocesses,)573 4597 -y(and)c(does)h(not)g(occupy)g(space)f(in)i(the)e(r)o(un-time)i(heap.)756 -4805 y FD(Oops:)81 b Fj(The)26 b(static)g(heap)g(linker)e(was)i(not)g -(documented)g(and)g(installed)f(in)756 4897 y(time)18 b(for)g(this)h(r)o -(elease.)365 5147 y FD(November)f(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1174 w FA(139)p eop +139 144 bop 365 614 a Fz(9.2.1)81 b(VM)21 b(arguments)365 +805 y FB(The)g(vm)g(takes)f(ar)o(guments)h(in)g(the)g(following)h +(form:)573 952 y Fx(scshvm)41 b([)p FA(meta-ar)o(g)n +Fx(])i([)p FA(vm-options)1729 922 y Fu(+)1784 952 y Fx(])g([)p +FA(end-option)f(scheme-ar)o(gs)o Fx(])365 1099 y FB(wher)o(e)623 +1227 y FA(meta-ar)o(g:)159 b Fx(\\)43 b FA(\002lename)623 +1426 y(vm-option)n FB(:)113 b Fx(-h)43 b FA(heap-size-in-words)1103 +1526 y Fx(-s)g FA(stack-size-in-words)1103 1626 y Fx(-o)g +FA(object-\002le-name)623 1825 y(end-option:)98 b Fx(-i)43 +b FA(image-\002le-name)1103 1924 y Fx(--)490 2102 y FB(The)35 +b(vm's)h(meta-switch)g(\223)p Fx(\\)43 b FA(\002lename)p +FB(\224)35 b(is)h(handled)f(the)g(same)h(as)f(scsh's)h(meta-)365 +2201 y(switch,)22 b(and)e(serves)g(the)h(same)g(purpose.)365 +2467 y Fz(VM)g(options)365 2657 y FB(The)e Fx(-o)43 b +FA(object-\002le-name)18 b FB(switch)i(tells)g(the)f(vm)g(wher)o(e)f +(to)i(\002nd)f(r)o(elocation)g(information)365 2757 y(for)28 +b(its)g(for)o(eign-function)g(calls.)47 b(Scsh)28 b(will)h(use)f(a)f +(pr)o(e-compiled)g(default)g(if)g(it)i(is)f(not)365 2856 +y(speci\002ed.)d(Scsh)19 b FA(must)f FB(have)h(this)g(information)h(to) +g(r)o(un,)f(since)g(scsh's)h(syscall)f(interfaces)365 +2956 y(ar)o(e)h(done)h(with)g(for)o(eign-function)g(calls.)490 +3086 y(The)h Fx(-h)f FB(and)h Fx(-s)f FB(options)j(tell)e(the)g(vm)h +(how)g(much)f(space)g(to)g(allocate)g(for)g(the)g(heap)365 +3186 y(and)j(stack.)39 b(The)25 b(heap)g(size)g(value)g(is)g(the)h +(total)f(number)h(of)f(wor)o(ds)g(allocated)f(for)h(the)365 +3285 y(heap;)31 b(this)d(space)f(is)h(then)g(split)g(into)h(two)f +(semi-spaces)f(for)h(Scheme)f(48's)g(stop-and-)365 3385 +y(copy)21 b(collector)-6 b(.)365 3651 y Fz(End)20 b(options)365 +3841 y FB(End)31 b(options)i(terminate)e(ar)o(gument)f(parsing.)57 +b(The)32 b Fx(-i)e FB(switch)i(is)g(followed)f(by)g(the)365 +3941 y(name)24 b(of)f(a)g(heap)h(image)f(for)g(the)h(vm)g(to)g +(execute.)33 b(The)24 b FA(image-\002le-name)e FB(string)i(is)g(also) +365 4040 y(taken)e(to)g(be)g(the)g(name)g(of)g(the)g(pr)o(ogram)f +(being)h(executed)f(by)h(the)g(VM;)f(this)h(name)g(be-)365 +4140 y(comes)f(the)f(head)f(of)h(the)h(ar)o(gument)e(list)i(passed)e +(to)i(the)f(heap)f(image's)i(top-level)e(entry)365 4239 +y(point.)25 b(The)17 b(tail)g(of)g(the)h(ar)o(gument)e(list)i(is)f +(constr)o(ucted)h(fr)o(om)f(all)g(following)h(ar)o(guments.)490 +4370 y(The)23 b Fx(--)e FB(switch)j(terminates)f(ar)o(gument)f(parsing) +h(without)h(giving)f(a)f(speci\002c)h(heap)365 4469 y(image;)k(the)f +(vm)f(will)h(start)f(up)g(using)h(a)f(default)f(heap)h(\(whose)h +(location)g(is)f(compiled)365 4569 y(into)h(the)g(vm\).)38 +b(All)25 b(the)g(following)i(ar)o(guments)e(comprise)g(the)g(tail)g(of) +g(the)h(list)f(passed)365 4669 y(of)o(f)20 b(to)h(the)g(heap)f(image's) +h(top-level)g(pr)o(ocedur)o(e.)490 4799 y(Notice)f(that)f(you)i(ar)o(e) +d(not)j(allowed)e(to)h(pass)g(ar)o(guments)f(to)i(the)e(heap)h(image's) +g(top-)365 4898 y(level)h(pr)o(ocedur)o(e)e(\()p FA(e.g.)o +FB(,)h(scsh\))h(without)h(delimiting)g(them)f(with)h +Fx(-i)d FB(or)i Fx(--)f FB(\003ags.)365 5147 y FE(Mar)o(ch)f(10,)g +(1997)h(\226)f(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 +5173 4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 +4 v 1174 w FB(139)p eop %%Page: 140 146 -140 145 bop 681 614 a Fu(10.2)99 b(Incompatible)24 b(improvements)681 -830 y FA(Some)30 b(featur)o(es)e(of)j(scsh)f(have)g(been)g(impr)o(oved)f(in)i -(ways)f(that)g(ar)o(e)f(not)i(backwar)o(ds-)681 929 y(compatible)19 -b(with)h(pr)o(evious)f(r)o(eleases.)25 b(These)19 b(changes)h(should)g(not)f -(af)o(fect)f(most)i(code;)681 1029 y(however)-6 b(,)20 b(please)g(note)i(the) -e(changes)h(and)g(modify)g(your)g(code)f(accor)o(dingly)-9 -b(.)805 1239 y Fs(\017)41 b FA(New)21 b(pr)o(ocess-object)f(data-type)g(r)o -(eturned)f(by)i Fw(fork)888 1338 y FA(Pr)o(evious)h(r)o(eleases)e(wer)o(e)g -(pr)o(one)h(to)h(\256ll)g(up)f(the)h(kernel's)f(pr)o(ocess)g(table)g(if)g(a)g -(pr)o(o-)888 1438 y(gram)26 b(forked)f(lar)o(ge)f(numbers)i(of)g(pr)o -(ocesses)f(and)g(subsequently)i(failed)e(to)h(use)888 1538 -y Fw(wait)e FA(to)h(r)o(eclaim)f(the)h(entries)g(in)h(the)f(kernel's)g(pr)o -(ocess)g(table.)39 b(\(This)25 b(is)g(a)g(pr)o(ob-)888 1637 -y(lem)c(in)h(standar)o(d)d(C)h(envir)o(onments,)i(as)e(well.\))888 -1771 y(Scsh)27 b(0.4)f(intr)o(oduces)h(a)g(new)g(mechanism)h(for)f -(automatically)g(managing)g(sub-)888 1871 y(pr)o(ocesses.)37 -b(Pr)o(ocesses)24 b(ar)o(e)f(no)h(longer)h(r)o(epr)o(esented)d(by)i(an)g -(integer)g(pr)o(ocess)f(id,)888 1970 y(which)31 b(is)f(impossible)g(to)g -(garbage-collect,)g(but)g(by)f(an)h(abstract)e(pr)o(ocess)h(data)888 -2070 y(type)18 b(that)f(encapsulates)g(the)h(pr)o(ocess)f(id.)27 -b(All)17 b(pr)o(ocesses)g(ar)o(e)g(r)o(epr)o(esented)e(using)888 -2169 y(the)k(new)g(data)e(str)o(uctur)o(es;)h(see)h(the)f(r)o(elevant)f -(section)i(of)g(the)f(manual)g(for)h(further)888 2269 y(details.)805 -2437 y Fs(\017)41 b FA(Better)20 b(stdio/curr)o(ent-port)h(synchr)o -(onisation)888 2536 y(The)k Fw(\(begin)41 b Fx(:)14 b(:)g(:)g -Fw(\))24 b FA(pr)o(ocess)g(form)g(now)h(does)g(a)f Fw(stdio->stdports)18 -b FA(call)24 b(befor)o(e)888 2636 y(executing)g(its)g(body)-9 -b(.)36 b(This)24 b(means)g(that)g(the)g(Scheme)f(code)g(in)h(the)g(body)g -(\252sees\272)888 2735 y(any)15 b(external)f(r)o(edir)o(ections.)24 -b(For)15 b(example,)g(it)g(means)f(that)h(if)f(a)h Fw(begin)d -FA(form)j(in)g(the)888 2835 y(middle)k(of)f(a)h(pipeline)f(performs)h(I/O)g -(on)g(the)g(curr)o(ent)f(input)h(and)f(output)h(ports,)888 -2935 y(it)j(will)g(be)f(communicating)i(with)f(its)g(upstr)o(eam)f(and)g -(downstr)o(eam)g(pipes.)30 b Fz(E.g.)n FA(,)888 3034 y(this)16 -b(code)f(works)g(as)g(intended)g(without)h(the)f(need)f(for)h(explicit)g -(synchr)o(onisation:)888 3235 y Fw(\(run)42 b(\(|)h(\(gunzip\))1237 -3335 y(;;)g(Kill)f(line)g(1)h(and)f(insert)f(doubled-sided)1237 -3434 y(;;)i(code)f(at)g(head)g(of)h(Postscript.)1237 3534 y(\(begin)e -(\(read-line\))e(;)k(Eat)g(first)e(line.)1542 3633 y(\(display)f -("\045!PS-Adobe-2.0\\\\)o(n"\))1542 3733 y(\(display)g("statusdict)f -(/setduplexmode)f(known)k("\))1542 3833 y(\(display)e("{statusdict)f(begin)j -(true)f("\))1542 3932 y(\(display)f("setduplexmode)e(end})k(if\\n"\))1542 -4032 y(\(exec-epf)e(\(cat\)\)\))1237 4132 y(\(lpr\)\))1106 -4231 y(\(<)j(paper.ps\)\))888 4432 y FA(Arranging)14 b(for)g(the)g -Fw(begin)e FA(pr)o(ocess)i(form)g(to)g(synchr)o(onise)h(the)f(curr)o(ent)f -(I/O)i(ports)888 4532 y(with)22 b(stdio)f(means)g(that)g(all)f(pr)o(ocess)h -(forms)g(now)g(see)g(their)g(epf)5 b('s)20 b(r)o(edir)o(ections.)805 -4699 y Fs(\017)41 b Fw(file-match)17 b FA(mor)o(e)j(r)o(obust)888 -4799 y(The)15 b Fw(file-match)10 b FA(pr)o(ocedur)o(e)i(now)j(catches)f(any)g -(err)o(or)f(condition)j(signalled)e(by)h(a)888 4898 y(match)i(pr)o(ocedur)o -(e,)e(and)h(tr)o(eats)g(it)h(as)f(if)h(the)f(pr)o(ocedur)o(e)f(had)h(simply)i -(r)o(eturned)d Fw(#f)p FA(,)681 5147 y(140)p 1952 5071 323 -4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p 2271 5173 V 1952 5176 -323 4 v 435 w FD(November)j(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +140 145 bop 681 614 a Fz(9.2.2)81 b(Inserting)19 b(interpreter)g +(triggers)h(into)g(heap)g(images)681 804 y FB(Scheme)i(48's)g(heap)g +(image)h(format)f(allows)h(for)g(an)f(informational)h(header:)29 +b(when)23 b(the)681 904 y(vm)18 b(loads)g(in)h(a)f(heap)g(image,)g(it)g +(ignor)o(es)h(all)f(data)f(occurring)h(befor)o(e)f(the)i(\002rst)f +(contr)o(ol-L)681 1004 y(character)23 b(\()r(A)t Fs(S)t(C)t(I)t(I)k +FB(12\).)35 b(This)26 b(means)e(that)h(you)g(can)f(insert)h(a)f(\223)p +Fx(#!)p FB(\224)f(trigger)h(line)h(into)h(a)681 1103 +y(heap)15 b(image,)i(making)g(it)f(a)g(form)g(of)h(executable)e +(\223shell)h(script.\224)23 b(Since)16 b(the)h(vm)f(r)o(equir)o(es)681 +1203 y(multiple)22 b(ar)o(guments)g(to)g(be)f(given)h(on)h(the)f +(command)g(line,)g(you)h(must)f(use)g(the)g(meta-)681 +1302 y(switch.)k(Her)o(e's)20 b(an)h(example)f(heap-image)f(header:)888 +1502 y Fx(#!/usr/local/lib/)o(sc)o(sh/)o(sc)o(shv)o(m)37 +b(\\)888 1602 y(-o)43 b(/usr/local/lib/s)o(csh)o(/s)o(csh)o(vm)37 +b(-i)888 1702 y(...)43 b FA(Y)-9 b(our)21 b(heap)f(image)g(goes)h(her)o +(e)43 b Fx(...)681 2036 y Fz(9.2.3)81 b(Inserting)19 +b(a)i(double-level)c(trigger)k(into)f(Scheme)e(programs)681 +2226 y FB(If)j(you'r)o(e)h(a)f(ner)o(d,)g(you)h(may)g(enjoy)g(doing)h +(a)e(double-level)g(machine)h(shift)g(in)g(the)g(trig-)681 +2326 y(ger)e(line)h(of)g(your)g(Scheme)g(pr)o(ograms)f(with)h(the)g +(following)i(magic:)888 2517 y Fh(#!/usr/local/lib/scsh/scshvm)46 +b(\\)888 2609 y(-o)40 b(/usr/local/lib/scsh/scshvm)45 +b(-i)40 b(/usr/local/lib/scsh/scsh.image)46 b(-s)888 +2700 y(!#)888 2791 y(...)40 b Fi(Y)-8 b(our)18 b(Scheme)i(pr)o(ogram)f +(goes)h(her)o(e)39 b Fh(...)681 3153 y Fv(9.3)99 b(Compiling)25 +b(scsh)h(programs)681 3374 y FB(Scsh)k(allows)g(you)g(to)h(cr)o(eate)d +(a)h(heap)g(image)h(with)h(your)f(own)h(top-level)e(pr)o(ocedur)o(e.) +681 3473 y(Adding)20 b(the)h(pair)f(of)h(lines)888 3673 +y Fx(#!/usr/local/lib/)o(sc)o(sh/)o(sc)o(shv)o(m)37 b(\\)888 +3773 y(-o)43 b(/usr/local/lib/s)o(csh)o(/s)o(csh)o(vm)37 +b(-i)681 3973 y FB(to)21 b(the)g(top)g(of)g(the)g(heap)f(image)g(will)i +(turn)f(it)g(into)g(an)g(executable)f(Unix)g(\002le.)805 +4102 y(Y)-8 b(ou)22 b(can)f(cr)o(eate)e(heap)h(images)h(with)g(the)g +(following)h(two)g(pr)o(ocedur)o(es.)681 4255 y Fx(\(dump-scsh-progr)o +(am)37 b FA(main)20 b(fname)p Fx(\))87 b Ft(\000)-14 +b(!)87 b FA(unde\002ned)585 b FB(pr)o(ocedur)o(e)888 +4400 y(This)29 b(pr)o(ocedur)o(e)c(writes)j(out)h(a)e(scsh)h(heap)f +(image.)47 b(When)28 b(the)g(heap)f(image)h(is)888 4500 +y(executed)f(by)h(the)f(Scheme)h(48)e(vm,)k(it)e(will)g(call)f(the)h +FA(main)f FB(pr)o(ocedur)o(e,)h(passing)888 4599 y(it)d(the)f(vm's)h +(ar)o(gument)f(list.)37 b(When)25 b Fx(main)d FB(r)o(eturns)i(an)h +(integer)f(value)g Fy(i)p FB(,)g(the)h(vm)888 4699 y(exits)17 +b(with)g(exit)f(status)h Fy(i)p FB(.)23 b(The)17 b(Scheme)f(vm)h(will)g +(parse)e(command-line)i(switches)888 4799 y(as)30 b(described)g(in)h +(section)g(9.2.1;)i(r)o(emaining)d(ar)o(guments)g(form)h(the)f(tail)h +(of)f(the)888 4898 y(command-line)19 b(list)g(that)g(is)g(passed)f(to)h +Fx(main)p FB(.)k(\(The)18 b(head)g(of)h(the)f(list)h(is)g(the)g(name) +681 5147 y(140)p 1952 5071 323 4 v 1952 5173 4 102 v +1173 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w +FE(Mar)o(ch)g(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 141 147 -141 146 bop 573 614 a Fz(i.e.)p FA(,)16 b(match)g(failur)o(e.)24 -b(This)16 b(means)g Fw(file-match)11 b FA(no)16 b(longer)h(gets)e(blown)i -(out)f(of)f(the)573 714 y(water)23 b(by)h(trying)h(to)g(apply)e(a)h(function) -h(like)f Fw(file-directory?)18 b FA(to)24 b(a)g(dangling)573 -814 y(symlink,)e(and)e(other)h(r)o(elated)e(OS)i(err)o(ors.)490 -981 y Fs(\017)41 b FA(Standar)o(d)18 b(input)k(now)f(unbuf)o(fer)o(ed)573 -1080 y(Scsh's)d(startup)g(code)f(now)i(makes)f(the)g(initial)g(curr)o(ent)f -(input)i(port)f(\(corr)o(espond-)573 1180 y(ing)24 b(to)g(\256le)g -(descriptor)g(0\))f(unbuf)o(fer)o(ed.)34 b(This)24 b(keeps)g(the)f(shell)i -(fr)o(om)e(\252stealing\272)573 1280 y(input)e(meant)g(for)f(subpr)o -(ocesses.)28 b(However)-6 b(,)20 b(it)h(does)g(slow)g(down)h(character)o -(-at-)573 1379 y(a-time)i(input)g(pr)o(ocessing.)38 b(If)24 -b(you)h(ar)o(e)e(writing)i(a)f(pr)o(ogram)f(that)i(is)f(tolerant)h(of)573 -1479 y(buf)o(fer)o(ed)18 b(input,)j(and)g(wish)h(the)f(ef)o(\256ciency)f -(gains,)h(you)h(can)e(r)o(eset)g(the)i(buf)o(fering)573 1578 -y(policy)f(yourself.)490 1746 y Fs(\017)41 b FA(\252writeable\272)19 -b(now)j(spelled)e(\252writable\272)573 1845 y(W)-8 b(e)27 b(inconsistently)h -(spelled)f Fw(file-writable?)21 b FA(and)26 b Fw(file-not-writabl)o(e?)20 -b FA(in)573 1945 y(the)25 b(manual)f(and)g(the)h(implementation.)40 -b(W)-8 b(e)25 b(have)f(now)h(standar)o(dised)e(on)i(the)573 -2044 y(common)f(spelling)g(\252writable\272)e(in)i(both.)34 -b(The)24 b(older)e(bindings)i(still)g(exist)f(in)h(r)o(e-)573 -2144 y(lease)c(0.4,)f(but)i(will)h(go)f(away)f(in)h(futur)o(e)f(r)o(eleases.) -490 2311 y Fs(\017)41 b Fw(char-set-member?)14 b FA(r)o(eplaced)573 -2411 y(W)-8 b(e)21 b(have)f(de-r)o(eleased)e(the)i Fw(char-set-member?)14 -b FA(pr)o(ocedur)o(e.)26 b(The)20 b(scsh)i(0.3)d(ver)o(-)573 -2510 y(sion)j(of)e(this)i(pr)o(ocedur)o(e)d(took)i(ar)o(guments)g(in)g(the)g -(following)h(or)o(der:)756 2650 y Fw(\(char-set-membe)o(r?)37 -b Fz(char)43 b(char-set)o Fw(\))573 2790 y FA(This)29 b(ar)o(gument)e(or)o -(der)g(is)i(in)f(accor)o(dance)f(with)i(standar)o(d)d(mathematical)i(use-)573 -2890 y(age)h(\()p Fz(i.e.)p FA(,)j Fx(x)55 b Fs(2)f Fx(S)5 -b FA(\),)32 b(and)d(also)i(consistent)g(with)g(the)f(R4RS)g -Fw(member)p FA(,)g Fw(memq)e FA(and)573 2989 y Fw(memv)22 b -FA(pr)o(ocedur)o(es.)34 b(It)24 b(is,)g(however)-6 b(,)24 b(exactly)f -(opposite)h(fr)o(om)f(the)h(ar)o(gument)f(or)o(-)573 3089 y(der)17 -b(used)g(by)h(the)g Fw(char-set-member)o(?)12 b FA(in)18 b(MIT)f(Scheme's)g -(character)o(-set)f(library)-9 b(.)573 3189 y(If)20 b(we)h(left)g(things)h -(as)e(they)h(wer)o(e,)f(we)h(risked)g(pr)o(oblems)f(with)i(code)e(ported)h -(over)573 3288 y(fr)o(om)30 b(MIT)f(Scheme.)56 b(On)31 b(the)f(other)h(hand,) -h(changing)f(to)f(conformance)h(with)573 3388 y(MIT)c(Scheme)h(meant)f -(inconsistency)j(with)f(common)g(mathematical)e(notation)573 -3487 y(and)f(other)h(long-standing)h(Scheme)e(pr)o(ocedur)o(es.)43 -b(Either)27 b(way)g(was)f(bound)h(to)573 3587 y(intr)o(oduce)20 -b(confusion.)573 3720 y(W)-8 b(e've)34 b(taken)g(the)h(appr)o(oach)e(of)i -(simply)g(r)o(emoving)g(the)f Fw(char-set-member?)573 3820 -y FA(pr)o(ocedur)o(e)19 b(altogether)-6 b(,)20 b(and)g(r)o(eplacing)g(it)h -(with)h(a)e(new)h(pr)o(ocedur)o(e:)756 3960 y Fw(\(char-set-conta)o(in)o(s?) -37 b Fz(cset)44 b(char)o Fw(\))573 4100 y FA(Note)21 b(that)f(the)h(ar)o -(gument)g(or)o(der)e(is)i(consistent)h(with)g(the)f(name.)490 -4267 y Fs(\017)41 b Fw(file-attributes)14 b FA(now)22 b Fw(file-info)573 -4366 y FA(In)33 b(keeping)g(with)g(the)g(general)f(convention)i(in)f(scsh)g -(of)g(naming)g(pr)o(ocedur)o(es)573 4466 y(that)15 b(r)o(etrieve)e -(information)j(about)f(system)g(r)o(esour)o(ces)f Fx(:)g(:)g(:)g -Fw(-info)e FA(\()p Fz(e.g.)o FA(,)k Fw(tty-info)p FA(,)573 -4566 y Fw(user-info)p FA(,)g Fw(group-info)p FA(\),)f(the)20 -b Fw(file-attributes)14 b FA(pr)o(ocedur)o(e)k(is)i(now)h(named)573 -4665 y Fw(file-info)p FA(.)573 4799 y(W)-8 b(e)17 b(continue)h(to)f(export)g -(a)f Fw(file-attributes)11 b FA(binding)17 b(for)g(the)g(curr)o(ent)f(r)o -(elease,)573 4898 y(but)21 b(it)g(will)g(go)g(away)g(in)g(futur)o(e)e(r)o -(eleases.)365 5147 y FD(November)f(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1174 w FA(141)p eop +141 146 bop 573 614 a FB(of)20 b(the)g(pr)o(ogram)f(being)h(executed)f +(by)h(the)g(vm.\))25 b(Further)20 b(ar)o(gument)f(parsing)h(\(as)573 +714 y(described)g(for)g(scsh)h(in)h(section)f(9.1.4\))e(is)i(not)g +(performed.)573 849 y(The)33 b(heap)g(image)h(cr)o(eated)d(by)i +Fx(dump-scsh-program)27 b FB(has)33 b(unused)h(code)f(and)573 +949 y(data)26 b(pr)o(uned)g(out,)j(so)e(small)h(pr)o(ograms)e(compile)h +(to)h(much)f(smaller)g(heap)f(im-)573 1048 y(ages.)365 +1246 y Fx(\(dump-scsh)40 b FA(fname)p Fx(\))86 b Ft(\000)-14 +b(!)87 b FA(unde\002ned)1126 b FB(pr)o(ocedur)o(e)573 +1390 y(This)20 b(pr)o(ocedur)o(e)e(writes)h(out)h(a)f(heap)h(image)f +(with)h(the)g(standar)o(d)e(scsh)i(top-level.)573 1490 +y(When)31 b(the)g(image)g(is)h(r)o(esumed)e(by)h(the)g(vm,)i(it)f(will) +f(parse)f(and)h(execute)f(scsh)573 1589 y(command-line)21 +b(switches)h(as)e(described)g(in)h(section)g(9.1.4.)573 +1724 y(Y)-8 b(ou)31 b(can)e(use)h(this)h(pr)o(ocedur)o(e)c(to)j(write)g +(out)h(custom)f(scsh)g(heap)g(images)g(that)573 1824 +y(have)20 b(speci\002c)h(packages)f(pr)o(eloaded)f(and)h(start)g(up)h +(in)g(speci\002c)g(packages.)490 1998 y(Unfortunately)-9 +b(,)17 b(Scheme)g(48)f(does)i(not)g(support)f(separate)f(compilation)j +(of)e(Scheme)365 2098 y(\002les)25 b(or)g(Scheme)f(modules.)37 +b(The)24 b(only)h(way)g(to)g(compile)f(is)h(to)g(load)f(sour)o(ce)g +(and)g(then)365 2198 y(dump)31 b(out)g(a)f(heap)f(image.)55 +b(One)31 b(occasionally)g(hears)f(r)o(umours)h(that)f(this)h(is)g +(being)365 2297 y(addr)o(essed)19 b(by)i(the)g(Scheme)f(48)g +(development)h(team.)365 2584 y Fv(9.4)99 b(Statically)26 +b(linking)g(heap)e(images)365 2803 y FB(Brian)29 b(Carlstr)o(om)f(has)i +(written)f(code)g(to)g(pr)o(ocess)g(Scheme)g(48)f(heap)g(images)h(into) +h Fx(.o)365 2902 y FB(\002les)24 b(that)e(can)h(be)g(linked)g(with)g(a) +g(virtual)f(machine)h(binary)g(to)g(pr)o(oduce)f(a)h(standalone)365 +3002 y(machine-code)e(executable.)490 3130 y(The)30 b(sour)o(ce)f(code) +g(comes)i(with)f(the)g(curr)o(ent)f(distribution,)k(but)d(it)g(has)f +(not)i(been)365 3229 y(integrated)20 b(into)i(the)f(system)g(or)g +(documented)g(in)g(time)g(for)g(this)g(r)o(elease.)365 +3516 y Fv(9.5)99 b(Standard)24 b(\002le)h(locations)365 +3735 y FB(Because)20 b(the)i(scshvm)g(binary)f(is)g(intended)g(to)h(be) +f(used)g(for)g(writing)h(shell)g(scripts,)f(it)g(is)365 +3834 y(important)j(that)g(the)f(binary)h(be)f(installed)g(in)h(a)f +(standar)o(d)f(place,)h(so)h(that)f(shell)h(scripts)365 +3934 y(can)h(dependably)e(r)o(efer)g(to)i(it.)37 b(The)24 +b(standar)o(d)f(dir)o(ectory)h(for)g(the)h(scsh)g(tr)o(ee)f(should)h +(be)365 4034 y Fx(/usr/local/lib/sc)o(sh)o(/)p FB(.)20 +b(Whenever)g(possible,)h(the)g(vm)g(should)g(be)g(located)f(in)573 +4178 y Fx(/usr/local/lib/s)o(cs)o(h/s)o(cs)o(hvm)365 +4322 y FB(and)h(a)f(scsh)h(heap)f(image)h(should)h(be)e(located)g(in) +573 4466 y Fx(/usr/local/lib/s)o(cs)o(h/s)o(cs)o(h.i)o(ma)o(ge)365 +4610 y FB(The)h(top-level)f(scsh)i(pr)o(ogram)e(should)h(be)g(located)f +(in)573 4754 y Fx(/usr/local/lib/s)o(cs)o(h/s)o(cs)o(h)365 +4898 y FB(with)i(a)e(symbolic)i(link)f(to)h(it)f(fr)o(om)365 +5147 y FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1174 w FB(141)p eop %%Page: 142 148 -142 147 bop 805 614 a Fs(\017)41 b FA(Renaming)22 b(of)f(I/O)g(synchr)o -(onisation)h(pr)o(ocedur)o(es)888 714 y(The)108 b Fw(\(stdio->stdport)o(s)38 -b Fz(thunk)o Fw(\))107 b FA(pr)o(ocedur)o(e)e(has)i(been)g(r)o(enamed)888 -814 y Fw(with-stdio-ports*)o FA(;)35 b(ther)o(e)f(is)h(now)g(a)f(corr)o -(esponding)h Fw(with-stdio-port)o(s)888 913 y FA(special)28 -b(form.)50 b(The)28 b Fw(stdio->stdports)22 b FA(pr)o(ocedur)o(e)k(is)j(now)g -(a)f(nullary)g(pr)o(oce-)888 1013 y(dur)o(e)20 b(that)h(side-ef)o(fects)d -(the)j(curr)o(ent)f(set)h(of)g(curr)o(ent)f(I/O)h(port)g(bindings.)805 -1174 y Fs(\017)41 b FA(New)21 b(meta-ar)o(g)e(line-two)j(syntax)888 -1273 y(Scsh)g(now)h(uses)e(a)h(simpli\256ed)g(grammar)f(for)h(describing)f -(command-line)h(ar)o(gu-)888 1373 y(ments)29 b(r)o(ead)d(by)j(the)f -(\252meta-ar)o(g\272)d(switch)k(fr)o(om)f(line)g(two)h(of)f(a)f(shell)i -(script.)49 b(If)888 1472 y(you)26 b(wer)o(e)f(using)h(this)g(featur)o(e)e -(in)h(pr)o(evious)g(r)o(eleases,)g(the)h(thr)o(ee)f(incompatible)888 -1572 y(changes)19 b(of)g(which)g(to)g(be)f(awar)o(e)f(ar)o(e:)25 -b(\(1\))18 b(tab)g(is)h(no)g(longer)g(allowed)g(as)f(an)g(ar)o(gu-)888 -1672 y(ment)24 b(delimiter)-6 b(,)23 b(\(2\))f(a)g(r)o(un)i(of)f(space)f -(characters)g(is)h(not)h(equivalent)f(to)h(a)e(single)888 1771 -y(space,)e(\(3\))g(empty)h(ar)o(guments)f(ar)o(e)f(written)j(a)e(dif)o(fer)o -(ent)e(way)-9 b(.)681 2046 y Fu(10.3)99 b(Backwards-compatible)25 -b(improvements)681 2260 y FA(Some)c(existing)h(featur)o(es)d(in)j(scsh)f -(have)g(been)g(impr)o(oved)f(in)i(ways)f(that)g(will)h(not)g(ef)o(fect)681 -2360 y(existing)f(code.)805 2554 y Fs(\017)41 b FA(Impr)o(oved)20 -b(err)o(or)g(r)o(eporting)888 2654 y(Exception)d(handlers)f(that)g(print)g -(out)h(err)o(or)e(messages)i(and)f(warnings)h(now)g(print)888 -2753 y(their)e(messages)g(on)g(the)g(err)o(or)e(output)i(port,)h(instead)e -(of)h(the)f(curr)o(ent)g(output)h(port.)888 2853 y(Pr)o(evious)20 -b(r)o(eleases)f(used)h(the)g(curr)o(ent)f(output)i(port,)f(a)g(pr)o(oblem)f -(inherited)h(fr)o(om)888 2952 y(Scheme)h(48.)888 3083 y(Pr)o(evious)e(scsh)g -(r)o(eleases)e(\257ushed)i(the)g(Scheme)f(48)f(debugging)i(tables)f(when)h -(cr)o(e-)888 3182 y(ating)28 b(the)f(standar)o(d)e(scsh)j(heap)e(image.)47 -b(This)27 b(trimmed)g(the)h(size)e(of)h(the)h(heap)888 3282 -y(image,)23 b(but)f(made)f(err)o(or)g(messages)i(much)g(less)f(compr)o -(ehensible.)32 b(W)-8 b(e)22 b(now)h(r)o(e-)888 3381 y(tain)c(the)g -(debugging)g(tables.)26 b(This)19 b(bloats)g(the)g(heap)f(image)h(up)f(by)h -(about)g(600kb.)888 3481 y(And)i(worth)g(it,)g(too.)888 3611 -y(\(W)-8 b(e)17 b(also)g(have)g(some)g(new)g(techniques)h(for)f(eliminating)h -(the)f(r)o(un-time)g(memory)888 3711 y(penalty)g(imposed)g(by)g(these)g(lar)o -(ge)f(heap)g(images.)26 b(Scsh's)17 b(new)h(static-heap)d(tech-)888 -3810 y(nology)21 b(allows)g(for)e(this)i(data)d(to)i(be)g(linked)g(into)g -(the)g(text)f(pages)h(of)f(the)h(vm's)g(bi-)888 3910 y(nary)-9 -b(,)18 b(wher)o(e)g(it)g(will)h(not)f(be)g(touched)g(by)g(the)h(GC)f(or)g -(otherwise)h(af)o(fect)d(the)i(mem-)888 4010 y(ory)j(system)h(until)f(it)g -(is)g(r)o(efer)o(enced.\))888 4140 y(Finally)-9 b(,)26 b(scsh)g(now)f -(generates)f(mor)o(e)h(informative)g(err)o(or)e(messages)i(for)g(syscall)888 -4240 y(err)o(ors.)49 b(For)28 b(example,)h(a)f(\256le-open)g(err)o(or)f(pr)o -(eviously)h(told)g(you)h(what)f(the)g(er)o(-)888 4339 y(r)o(or)17 -b(was)g(\()p Fz(e.g.)o FA(,)g(\252Permission)h(denied,\272)f(or)g(\252No)g -(such)h(\256le)f(or)g(dir)o(ectory\272\),)f(but)h(not)888 4439 -y(which)22 b(\256le)f(you)g(had)g(tried)f(to)h(open.)28 b(W)-8 -b(e've)20 b(impr)o(oved)g(this.)805 4599 y Fs(\017)41 b FA(Closing)22 -b(a)f(port)f(twice)h(allowed)888 4699 y(Scsh)26 b(used)f(to)g(generate)g(an)g -(err)o(or)f(if)h(you)h(attempted)e(to)i(close)f(a)g(port)g(that)g(had)888 -4799 y(alr)o(eady)20 b(been)i(closed.)30 b(This)23 b(is)f(now)g(allowed.)31 -b(The)21 b(close)h(pr)o(ocedur)o(e)e(r)o(eturns)i(a)888 4898 -y(boolean)f(to)h(indicate)e(whether)h(the)g(port)g(had)f(alr)o(eady)f(been)h -(closed)h(or)g(not.)681 5147 y(142)p 1952 5071 323 4 v 1952 -5173 4 102 v 1173 w FC(DRAFT)p 2271 5173 V 1952 5176 323 4 -v 435 w FD(November)d(1,)h(1995)h(\261)f(15)13 b(:)f(58)p eop +142 147 bop 888 614 a Fx(/usr/local/bin/sc)o(sh)805 778 +y FB(The)30 b(Scheme)g(48)f(image)h(format)g(allows)g(heap)g(images)g +(to)h(have)e Fx(#!)g FB(triggers,)k(so)681 877 y Fx(scsh.image)16 +b FB(should)22 b(have)e(a)g Fx(#!)g FB(trigger)h(of)g(the)g(following)h +(form:)888 1068 y Fx(#!/usr/local/lib/)o(sc)o(sh/)o(sc)o(shv)o(m)37 +b(\\)888 1168 y(-o)43 b(/usr/local/lib/s)o(csh)o(/s)o(csh)o(vm)37 +b(-i)888 1268 y(...)43 b FA(heap)20 b(image)g(goes)g(her)o(e)44 +b Fx(...)681 5147 y FB(142)p 1952 5071 323 4 v 1952 5173 +4 102 v 1173 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 +v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 143 149 -143 148 bop 490 614 a Fs(\017)41 b FA(Better)20 b(time)h(pr)o(ecision)573 -714 y(The)33 b Fw(time+ticks)d FA(pr)o(ocedur)o(e)h(now)k(r)o(eturns)e -(sub-second)h(pr)o(ecision)f(on)h(OS's)573 814 y(that)21 b(support)g(it.)490 -980 y Fs(\017)41 b FA(Nicer)20 b(print-methods)i(for)e(basic)g(data-types)573 -1079 y(Scsh's)e(standar)o(d)e(r)o(ecor)o(d)h(types)h(now)h(print)f(mor)o(e)g -(informatively)-9 b(.)26 b(For)19 b(example,)573 1179 y(a)j(pr)o(ocess)g -(object)h(includes)g(the)g(pr)o(ocess)f(id)h(in)g(its)g(printed)f(r)o(epr)o -(esentation:)30 b(the)573 1279 y(pr)o(ocess)20 b(object)h(for)g(pr)o(ocess)f -(id)h(2653)e(prints)i(as)f Fw(#{proc)41 b(2653})p FA(.)365 -5147 y FD(November)18 b(1,)h(1995)h(\261)f(15)14 b(:)e(58)p -1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 -V 1636 5176 323 4 v 1174 w FA(143)p eop +143 148 bop 365 1263 a Fw(Chapter)45 b(10)365 1704 y +FC(Changes)53 b(from)e(the)h(previous)365 1953 y(release)365 +2411 y FB(This)31 b(section)g(details)e(changes)h(that)g(have)g(been)g +(made)f(in)i(scsh)f(since)h(the)f(pr)o(evious)365 2511 +y(r)o(elease.)490 2636 y(Scsh)f(is)g(now)g(much)h(mor)o(e)e(r)o(obust.) +50 b(All)28 b(known)i(bugs)g(have)e(been)g(\002xed.)50 +b(Ther)o(e)365 2736 y(have)34 b(been)g(many)h(impr)o(ovements)f(and)g +(extensions)h(made.)66 b(W)-8 b(e)34 b(have)g(also)g(made)365 +2835 y(made)20 b(some)i(incompatible)f(changes.)490 2961 +y(The)32 b(sections)h(below)g(brie\003y)f(describe)g(these)g(new)g +(featur)o(es)f(and)h(changes;)37 b(the)365 3061 y(r)o(elevant)20 +b(sections)i(of)e(the)h(manual)g(give)g(the)f(full)h(details.)365 +3341 y Fv(10.1)99 b(New)25 b(features)365 3556 y FB(This)d(r)o(elease)d +(incorporates)i(several)e(new)j(featur)o(es)d(into)i(scsh.)490 +3766 y Ft(\017)41 b FB(Contr)o(ol)21 b(of)g(buf)o(fer)o(ed)d(I/O)573 +3866 y(Scsh)24 b(now)i(allows)f(you)g(to)g(contr)o(ol)g(the)g(buf)o +(fering)f(policy)h(used)f(for)h(doing)g(I/O)573 3966 +y(on)c(a)g(Scheme)f(port.)490 4133 y Ft(\017)41 b FB(Her)o(e-strings) +573 4233 y(Scsh)26 b(now)h(has)e(a)h(new)g(lexical)g(featur)o(e,)f +Fx(#<<)p FB(,)g(that)h(pr)o(ovides)f(the)h(ability)h(to)f(en-)573 +4332 y(ter)j(long,)k(multi-line)e(string)f(constants)h(in)f(scsh)h(pr)o +(ograms.)52 b(Such)29 b(a)h(string)g(is)573 4432 y(called)21 +b(a)g(\223her)o(e)g(string,\224)h(by)g(analogy)g(to)g(the)g(common)i +(shell)e(\223her)o(e)f(document\224)573 4532 y Fx(<<)f +FB(r)o(edir)o(ection.)490 4699 y Ft(\017)41 b FB(Delimited)21 +b(r)o(eaders)e(and)h(r)o(ead-line)573 4799 y(Scsh)31 +b(now)h(has)g(a)e(powerful)i(set)f(of)g(delimited)g(r)o(eaders.)56 +b(These)31 b(can)g(be)g(used)573 4898 y(to)23 b(r)o(ead)e(input)i +(delimited)g(by)g(a)f(newline)h(character)f(\()p Fx(read-line)p +FB(\),)c(a)k(blank)h(line)365 5147 y FE(Mar)o(ch)c(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v +540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1174 w +FB(143)p eop %%Page: 144 150 -144 149 bop 805 614 a FA(\277)681 5147 y(144)p 1952 5071 323 -4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p 2271 5173 V 1952 5176 -323 4 v 435 w FD(November)18 b(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +144 149 bop 888 614 a FB(\()p Fx(read-paragraph)p FB(\),)19 +b(or)24 b(the)h(occurr)o(ence)e(of)h(any)g(character)f(in)i(an)f +(arbitrary)f(set)888 714 y(\()p Fx(read-delimited)p FB(\).)888 +855 y(While)k(these)g(pr)o(ocedur)o(es)e(can)h(be)g(applied)g(to)g(any) +h(Scheme)f(input)h(port,)h(ther)o(e)888 955 y(is)37 b(native-code)f +(support)g(for)g(performing)h(delimited)f(r)o(eads)f(on)i(Unix)g(input) +888 1055 y(sour)o(ces,)h(so)e(doing)f(block)g(input)h(with)f(these)g +(pr)o(ocedur)o(es)e(should)j(be)e(much)888 1154 y(faster)20 +b(than)h(the)g(equivalent)g(character)o(-at-a-time)c(Scheme)j(code.)805 +1337 y Ft(\017)41 b FB(New)21 b(system)h(calls)888 1437 +y(W)-5 b(ith)33 b(the)e(sole)h(exception)g(of)f(signal)h(handlers,)h +(scsh)f(now)h(has)e(all)g(of)j(P)t Fs(O)t(S)t(I)t(X)r +FB(.)888 1536 y(This)22 b(r)o(elease)d(intr)o(oduces)988 +1719 y Fz(\226)41 b Fx(select)p FB(,)988 1860 y Fz(\226)g +FB(full)21 b(terminal)g(device)f(contr)o(ol,)988 2002 +y Fz(\226)41 b FB(support)21 b(for)g(pseudo-terminal)f(\223pty\224)g +(devices,)988 2143 y Fz(\226)41 b FB(\002le)21 b(locking,)988 +2284 y Fz(\226)41 b FB(pr)o(ocess)20 b(timing,)988 2426 +y Fz(\226)41 b Fx(set-file-times)p FB(,)988 2567 y Fz(\226)g +Fx(seek)19 b FB(and)h Fx(tell)p FB(.)888 2750 y(Note)d(that)g(having)g +Fx(select)p FB(,)e(pseudo-terminals,)i(and)g(tty)g(device)f(contr)o(ol) +h(means)888 2849 y(that)24 b(it)g(is)f(now)i(possible)f(to)g(implement) +g(inter)o(esting)g(network)g(pr)o(otocols,)h(such)888 +2949 y(as)c(telnet)g(servers)f(and)g(clients,)h(dir)o(ectly)f(in)h +(Scheme.)805 3132 y Ft(\017)41 b FB(New)21 b(command-line)g(switches) +888 3232 y(Ther)o(e)32 b(is)i(a)e(new)i(set)f(of)g(command-line)g +(switches)h(that)f(make)g(it)g(possible)h(to)888 3331 +y(write)27 b(shell)g(scripts)f(using)h(the)g(Scheme)e(48)h(module)g +(system.)43 b(Scripts)26 b(can)g(use)888 3431 y(the)k(new)g +(command-line)f(switches)h(to)g(open)g(dependent)f(modules)g(and)g +(load)888 3530 y(dependent)16 b(sour)o(ce)g(code.)24 +b(Scripts)16 b(can)g(also)g(be)g(written)h(in)g(the)g(Scheme)f(48)f +(mod-)888 3630 y(ule)k(language,)f(which)i(allows)f(you)g(to)g(use)g +(it)g(both)g(as)f(a)h(standalone)f(shell)h(script,)888 +3730 y(and)i(as)g(a)g(code)f(module)i(that)f(can)g(be)g(loaded)f(and)h +(used)g(by)g(other)g(Scheme)g(pr)o(o-)888 3829 y(grams.)805 +4012 y Ft(\017)41 b FB(Static)20 b(heap)h(linking)888 +4112 y(Ther)o(e)c(is)h(a)g(new)g(facility)f(that)h(allows)g(you)h(to)f +(compile)g(a)f(heap)h(image)f(to)i(a)e Fx(.o)g FB(\002le)888 +4211 y(that)26 b(can)g(be)g(linked)g(with)h(the)g(scsh)f(virtual)g +(machine.)42 b(This)26 b(pr)o(oduces)g(a)f(stan-)888 +4311 y(dalone)34 b(executable)e(binary)-9 b(,)37 b(makes)d(startup)f +(time)h(near)o(-instantaneous,)i(and)888 4411 y(gr)o(eatly)19 +b(impr)o(oves)h(memory)g(performance\227the)f(initial)h(heap)f(image)h +(is)g(placed)888 4510 y(in)k(the)g(pr)o(ocess')g(text)f(pages,)h(wher)o +(e)f(it)h(is)g(shar)o(ed)e(by)i(dif)o(fer)o(ent)e(scsh)i(pr)o(ocesses,) +888 4610 y(and)d(does)f(not)i(occupy)f(space)f(in)h(the)g(r)o(un-time)g +(heap.)1071 4805 y FE(Oops:)79 b Fk(The)26 b(static)h(heap)f(linker)e +(was)j(not)f(documented)g(and)g(installed)f(in)1071 4897 +y(time)19 b(for)e(this)i(r)o(elease.)681 5147 y FB(144)p +1952 5071 323 4 v 1952 5173 4 102 v 1173 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)g(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p eop %%Page: 145 151 -145 150 bop 365 1262 a Fv(Chapter)45 b(1)-6 b(1)365 1702 y -FB(T)-23 b(odo)365 2159 y FA(W)-8 b(e'd)18 b(love)f(to)h(have)f(have)g -(people)h(implement)g(these)g(subsystems)g(and)f(fold)h(them)g(into)365 -2258 y(the)j(scsh)h(r)o(elease:)490 2447 y Fs(\017)41 b FA(Mor)o(e)20 -b(network)h(pr)o(otocols.)28 b(T)-8 b(elnet)21 b(and)f(ftp)h(would)g(be)f -(the)h(most)h(important.)490 2612 y Fs(\017)41 b FA(An)21 b(ILU)f(interface.) -490 2776 y Fs(\017)41 b FA(An)21 b(RPC)g(system,)g(with)g(\252tail-r)o -(ecursion.\272)490 2941 y Fs(\017)41 b FA(Interfaces)20 b(to)h(r)o(elational) -f(db's.)27 b(This)21 b(would)h(be)e(quite)h(useful)g(for)g(W)-8 -b(eb)20 b(servers.)365 3130 y(Manual)g(hacking:)490 3319 y -Fs(\017)41 b FA(The)17 b(L)750 3301 y Fa(A)783 3319 y FA(T)820 -3338 y(E)860 3319 y(X)h(hackery)f(needs)g(yet)g(another)h(serious)g(pass.)26 -b(Most)17 b(importantly)-9 b(,)19 b(long)573 3418 y(pr)o(ocedur)o(e)g -(\252declarations\272)g(need)h(to)h(be)g(br)o(oken)f(acr)o(oss)g(two)i -(lines.)490 3583 y Fs(\017)41 b FA(Fix)21 b(up)f(0-or)o(-mor)o(e)f(and)i -(1-or)o(-mor)o(e)e(parameter)g(typesetting,)i(with)g(subscripts.)490 -3748 y Fs(\017)41 b FA(Parameter)19 b(subscripts)i(need)g(to)g(be)f(made)g(r) -o(eal)g(subscripts.)490 3913 y Fs(\017)41 b FA(Soup)26 b(up)h(the)g(markup)f -(pr)o(ocessor)-6 b(,)28 b(and)e(r)o(edo)g(manual)g(in)h(markup.)45 -b(Generate)573 4012 y(LaT)-8 b(eX,)17 b(HTML,)f(and)h(info)g(versions.)27 -b(Alternatively)-9 b(,)17 b(persuade)f(some)i(kind)g(soul)573 -4112 y(to)j(hand-port)f(manual)h(to)g(HTML)f(or)h(info.)365 -4301 y(Job)g(contr)o(ol,)g(after)e Fw(jcontrol.scm)365 4425 -y FA(Static)h(heaps;)h(fast)f(startup.)365 4550 y(Gnu)i(r)o(eadline)d(lib.) -365 4674 y(Interr)o(upt)i(system.)365 4799 y(Make)h(it)g(all)h(coexist)g -(with)g(S48)e(thr)o(eads)g(as)h(well)h(as)f(can)h(be)f(done)g(for)h(Unix.)32 -b(The)23 b(DEC)365 4898 y(SRC)e(tech)g(r)o(eport)f(gives)h(a)f(good)h -(discussion)h(of)f(the)g(issues.)365 5147 y FD(November)d(1,)h(1995)h(\261)f -(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w -FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1174 w FA(145)p eop +145 150 bop 365 614 a Fv(10.2)99 b(Incompatible)25 b(improvements)365 +828 y FB(Some)30 b(featur)o(es)f(of)h(scsh)h(have)e(been)h(impr)o(oved) +g(in)h(ways)f(that)g(ar)o(e)f(not)h(backwar)o(ds-)365 +928 y(compatible)20 b(with)g(pr)o(evious)f(r)o(eleases.)k(These)d +(changes)f(should)h(not)g(af)o(fect)e(most)i(code;)365 +1028 y(however)-6 b(,)21 b(please)f(note)h(the)g(changes)g(and)f +(modify)h(your)g(code)g(accor)o(dingly)-9 b(.)490 1213 +y Ft(\017)41 b FB(New)21 b(pr)o(ocess-object)f(data-type)f(r)o(eturned) +h(by)g Fx(fork)573 1312 y FB(Pr)o(evious)h(r)o(eleases)f(wer)o(e)h(pr)o +(one)g(to)g(\002ll)h(up)g(the)f(kernel's)h(pr)o(ocess)f(table)f(if)i(a) +e(pr)o(o-)573 1412 y(gram)25 b(forked)g(lar)o(ge)g(numbers)h(of)g(pr)o +(ocesses)f(and)g(subsequently)i(failed)d(to)j(use)573 +1512 y Fx(wait)15 b FB(to)j(r)o(eclaim)e(the)h(entries)h(in)f(the)h +(kernel's)f(pr)o(ocess)g(table.)23 b(\(This)18 b(is)f(a)g(pr)o(oblem) +573 1611 y(in)k(standar)o(d)e(C)i(envir)o(onments,)g(as)g(well.\))573 +1740 y(Scsh)27 b(0.4)f(intr)o(oduces)h(a)f(new)i(mechanism)f(for)g +(automatically)g(managing)h(sub-)573 1839 y(pr)o(ocesses.)35 +b(Pr)o(ocesses)24 b(ar)o(e)f(no)i(longer)g(r)o(epr)o(esented)d(by)i(an) +g(integer)g(pr)o(ocess)g(id,)573 1939 y(which)30 b(is)g(impossible)h +(to)f(garbage-collect,)g(but)f(by)h(an)f(abstract)g(pr)o(ocess)g(data) +573 2039 y(type)d(that)g(encapsulates)f(the)h(pr)o(ocess)g(id.)41 +b(All)26 b(pr)o(ocesses)g(ar)o(e)f(r)o(epr)o(esented)f(us-)573 +2138 y(ing)30 b(the)g(new)g(data)f(str)o(uctur)o(es;)k(see)d(the)g(r)o +(elevant)e(section)j(of)e(the)h(manual)g(for)573 2238 +y(further)20 b(details.)490 2395 y Ft(\017)41 b FB(Better)20 +b(stdio/curr)o(ent-port)g(synchr)o(onisation)573 2495 +y(The)i Fx(\(begin)41 b(...\))21 b FB(pr)o(ocess)h(form)g(now)h(does)f +(a)g Fx(stdio->stdports)16 b FB(call)22 b(befor)o(e)573 +2594 y(executing)i(its)g(body)-9 b(.)34 b(This)25 b(means)f(that)g(the) +f(Scheme)h(code)f(in)i(the)f(body)g(\223sees\224)573 +2694 y(any)h(external)f(r)o(edir)o(ections.)38 b(For)26 +b(example,)f(it)g(means)h(that)f(if)g(a)g Fx(begin)e +FB(form)i(in)573 2793 y(the)i(middle)f(of)h(a)f(pipeline)h(performs)f +(I/O)h(on)g(the)g(curr)o(ent)f(input)h(and)f(output)573 +2893 y(ports,)17 b(it)g(will)g(be)g(communicating)h(with)f(its)g(upstr) +o(eam)e(and)i(downstr)o(eam)f(pipes.)573 2993 y FA(E.g.)o +FB(,)j(this)g(code)g(works)h(as)f(intended)f(without)j(the)e(need)f +(for)h(explicit)g(synchr)o(oni-)573 3092 y(sation:)573 +3269 y Fx(\(run)42 b(\(|)h(\(gunzip\))922 3369 y(;;)f(Kill)g(line)g(1)h +(and)g(insert)e(doubled-sided)922 3468 y(;;)h(code)g(at)h(head)f(of)h +(Postscript.)922 3568 y(\(begin)e(\(read-line\))e(;)k(Eat)f(first)g +(line.)1227 3668 y(\(display)e("\045!PS-Adobe-2.0\\)o(\\n)o("\))1227 +3767 y(\(display)g("statusdict)f(/setduplexmode)f(known)j("\))1227 +3867 y(\(display)f("{statusdict)f(begin)i(true)h("\))1227 +3967 y(\(display)e("setduplexmode)e(end})k(if\\n"\))1227 +4066 y(\(exec-epf)e(\(cat\)\)\))922 4166 y(\(lpr\)\))791 +4265 y(\(<)j(paper.ps\)\))573 4442 y FB(Arranging)34 +b(for)g(the)h Fx(begin)d FB(pr)o(ocess)i(form)h(to)f(synchr)o(onise)i +(the)e(curr)o(ent)g(I/O)573 4542 y(ports)29 b(with)i(stdio)e(means)h +(that)f(all)g(pr)o(ocess)g(forms)h(now)g(see)f(their)g(epf)5 +b('s)29 b(r)o(edi-)573 4642 y(r)o(ections.)490 4799 y +Ft(\017)41 b Fx(file-match)16 b FB(mor)o(e)21 b(r)o(obust)573 +4898 y(The)f Fx(file-match)d FB(pr)o(ocedur)o(e)h(now)j(catches)f(any)h +(err)o(or)e(condition)j(signalled)e(by)365 5147 y FE(Mar)o(ch)f(10,)g +(1997)h(\226)f(21)13 b(:)f(47)p 1636 5071 323 4 v 1636 +5173 4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 5176 323 +4 v 1174 w FB(145)p eop %%Page: 146 152 -146 151 bop 681 614 a FA(T)-8 b(esting)21 b(br)o(oken)g(symlinks\320new)i -(value)d(for)g Fz(chase?)g FA(\257ag?)681 739 y(Rename)h(and)f(r)o(elease)f -Fw(ensure-file-name-)o(is)o(-)p Fs(f)o Fw(non)o(,)p Fs(g)o -Fw(di)o(rec)o(to)o(ry)p FA(.)681 863 y(Mor)o(e)g(informative)i(errno)g -(exception)g(packets)f(&)g(documentation)i(for)e(them.)681 -988 y(Other)i(things)h(should)g(be)e(available:)28 b(hash)22 -b(tables,)g(sort,)g(list)h(utils,)f(pattern)f(matchers.)681 -1088 y(But)g(things)h(start)f(to)h(overload.)28 b(The)21 b(module)g(system)h -(is)g(the)f(appr)o(opriate)e(way)i(to)h(use)681 1187 y(these.)681 -1312 y(Need)c(to)h(do)f(\256le-contr)o(ol)h(\()p Fz(i.e.)p -FA(,)g Fw(fcntl\(\))p FA(\).)k Fw(fcntl)17 b FA(is)i(ugly)-9 -b(.)27 b(Better)18 b(to)h(have)f(a)g(pr)o(ocedur)o(e)681 1411 -y(for)i(each)h(dif)o(fer)o(ent)d(operation.)681 5147 y(146)p -1952 5071 323 4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p 2271 -5173 V 1952 5176 323 4 v 435 w FD(November)g(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +146 151 bop 888 614 a FB(a)22 b(match)g(pr)o(ocedur)o(e,)f(and)g(tr)o +(eats)h(it)g(as)g(if)g(the)g(pr)o(ocedur)o(e)e(had)i(simply)h(r)o +(eturned)888 714 y Fx(#f)p FB(,)h FA(i.e.)p FB(,)h(match)f(failur)o(e.) +34 b(This)25 b(means)f Fx(file-match)c FB(no)25 b(longer)f(gets)h +(blown)g(out)888 814 y(of)19 b(the)f(water)g(by)g(trying)h(to)g(apply)f +(a)g(function)h(like)f Fx(file-directory?)12 b FB(to)19 +b(a)f(dan-)888 913 y(gling)k(symlink,)g(and)e(other)h(r)o(elated)e(OS)i +(err)o(ors.)805 1095 y Ft(\017)41 b FB(Standar)o(d)19 +b(input)i(now)h(unbuf)o(fer)o(ed)888 1194 y(Scsh's)c(startup)g(code)g +(now)g(makes)g(the)g(initial)h(curr)o(ent)e(input)h(port)g(\(corr)o +(espond-)888 1294 y(ing)25 b(to)f(\002le)g(descriptor)g(0\))f(unbuf)o +(fer)o(ed.)32 b(This)25 b(keeps)f(the)g(shell)g(fr)o(om)g +(\223stealing\224)888 1394 y(input)e(meant)f(for)f(subpr)o(ocesses.)26 +b(However)-6 b(,)21 b(it)g(does)g(slow)h(down)f(character)o(-at-)888 +1493 y(a-time)j(input)h(pr)o(ocessing.)37 b(If)24 b(you)h(ar)o(e)e +(writing)i(a)f(pr)o(ogram)g(that)g(is)h(tolerant)f(of)888 +1593 y(buf)o(fer)o(ed)19 b(input,)i(and)f(wish)i(the)f(ef)o(\002ciency) +g(gains,)g(you)g(can)g(r)o(eset)f(the)h(buf)o(fering)888 +1693 y(policy)h(yourself.)805 1874 y Ft(\017)41 b FB(\223writeable\224) +19 b(now)j(spelled)f(\223writable\224)888 1974 y(W)-8 +b(e)27 b(inconsistently)i(spelled)d Fx(file-writable?)21 +b FB(and)26 b Fx(file-not-writable)o(?)21 b FB(in)888 +2073 y(the)k(manual)g(and)f(the)h(implementation.)39 +b(W)-8 b(e)25 b(have)f(now)i(standar)o(dised)c(on)k(the)888 +2173 y(common)f(spelling)f(\223writable\224)e(in)i(both.)33 +b(The)23 b(older)g(bindings)h(still)g(exist)g(in)f(r)o(e-)888 +2273 y(lease)d(0.4,)g(but)h(will)g(go)g(away)f(in)i(futur)o(e)d(r)o +(eleases.)805 2454 y Ft(\017)41 b Fx(char-set-member?)14 +b FB(r)o(eplaced)888 2554 y(W)-8 b(e)21 b(have)g(de-r)o(eleased)d(the)j +Fx(char-set-member?)14 b FB(pr)o(ocedur)o(e.)24 b(The)c(scsh)i(0.3)d +(ver)o(-)888 2654 y(sion)j(of)f(this)g(pr)o(ocedur)o(e)e(took)j(ar)o +(guments)e(in)h(the)g(following)i(or)o(der:)1071 2810 +y Fx(\(char-set-member)o(?)38 b FA(char)43 b(char-set)o +Fx(\))888 2967 y FB(This)18 b(ar)o(gument)f(or)o(der)f(is)h(in)h(accor) +o(dance)d(with)j(standar)o(d)d(mathematical)i(useage)888 +3067 y(\()p FA(i.e.)p FB(,)30 b Fy(x)39 b Ft(2)f Fy(S)5 +b FB(\),)30 b(and)f(also)g(consistent)h(with)f(the)g(R4RS)g +Fx(member)p FB(,)f Fx(memq)f FB(and)i Fx(memv)888 3167 +y FB(pr)o(ocedur)o(es.)60 b(It)32 b(is,)k(however)-6 +b(,)36 b(exactly)c(opposite)h(fr)o(om)f(the)h(ar)o(gument)f(or)o(der) +888 3266 y(used)24 b(by)g(the)g Fx(char-set-member?)17 +b FB(in)25 b(MIT)e(Scheme's)h(character)o(-set)d(library)-9 +b(.)34 b(If)888 3366 y(we)27 b(left)g(things)h(as)f(they)h(wer)o(e,)f +(we)g(risked)g(pr)o(oblems)g(with)h(code)f(ported)f(over)888 +3465 y(fr)o(om)k(MIT)g(Scheme.)54 b(On)31 b(the)g(other)f(hand,)j +(changing)e(to)g(conformance)f(with)888 3565 y(MIT)e(Scheme)f(meant)h +(inconsistency)i(with)e(common)i(mathematical)d(notation)888 +3665 y(and)g(other)g(long-standing)h(Scheme)e(pr)o(ocedur)o(es.)42 +b(Either)27 b(way)g(was)f(bound)i(to)888 3764 y(intr)o(oduce)21 +b(confusion.)888 3905 y(W)-8 b(e've)35 b(taken)f(the)h(appr)o(oach)e +(of)h(simply)h(r)o(emoving)g(the)g Fx(char-set-member)o(?)888 +4005 y FB(pr)o(ocedur)o(e)19 b(altogether)-6 b(,)20 b(and)h(r)o +(eplacing)f(it)h(with)g(a)f(new)h(pr)o(ocedur)o(e:)1071 +4161 y Fx(\(char-set-contai)o(ns?)37 b FA(cset)43 b(char)p +Fx(\))888 4318 y FB(Note)21 b(that)g(the)g(ar)o(gument)f(or)o(der)g(is) +h(consistent)h(with)f(the)g(name.)805 4500 y Ft(\017)41 +b Fx(file-attributes)15 b FB(now)22 b Fx(file-info)888 +4599 y FB(In)17 b(keeping)g(with)g(the)g(general)f(convention)i(in)f +(scsh)g(of)g(naming)g(pr)o(ocedur)o(es)e(that)888 4699 +y(r)o(etrieve)33 b(information)j(about)e(system)h(r)o(esour)o(ces)e +Fx(...-info)e FB(\()p FA(e.g.)o FB(,)38 b Fx(tty-info)p +FB(,)888 4799 y Fx(user-info)p FB(,)16 b Fx(group-info)p +FB(\),)g(the)k Fx(file-attributes)13 b FB(pr)o(ocedur)o(e)18 +b(is)j(now)f(named)888 4898 y Fx(file-info)p FB(.)681 +5147 y(146)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 +w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)f(10,)g +(1997)h(\226)f(21)13 b(:)f(47)p eop %%Page: 147 153 -147 152 bop 365 1096 a FB(Index)365 1514 y Fw(\045read-delimited!)p -FA(,)14 b(106)365 1614 y(*temp-\256le-template*,)20 b(48)365 -1714 y Fw(->uid)p FA(,)f(60)365 1814 y Fw(->username)p FA(,)e(60)365 -1914 y Fw(\045exec)p FA(,)i(50)365 2014 y Fw(\045exit)p FA(,)g(51)365 -2114 y Fw(\045fork)p FA(,)g(52)365 2214 y Fw(\045fork/pipe)p -FA(,)e(52)365 2314 y Fw(\045fork/pipe+)p FA(,)f(53)365 2414 -y(&,)k(13)365 2515 y Fw(&)p FA(,)g(13)365 2615 y Fw(&&)p FA(,)g(20)365 -2806 y Fw(accept-connection)o FA(,)15 b(89)365 2906 y Fw(add-after)p -FA(,)i(70)365 3006 y Fw(add-before)p FA(,)g(70)365 3106 y Fw(alist->env)p -FA(,)g(69)365 3206 y Fw(alist-compress)p FA(,)e(69)365 3306 -y Fw(alist-delete)p FA(,)h(69)365 3406 y Fw(alist-update)p -FA(,)g(69)365 3506 y Fw(arg)p FA(,)k(60)365 3606 y Fw(arg*)p -FA(,)f(60)365 3706 y Fw(argv)p FA(,)g(60)365 3807 y Fw(arithmetic-shift)p -FA(,)14 b(121)365 3907 y Fw(ascii->char)p FA(,)i(102)365 4007 -y Fw(ascii-range->char)o(-s)o(et)p FA(,)e(103)365 4107 y Fw(autoreap-policy)p -FA(,)h(54)365 4207 y(awk,)21 b(1)-5 b(15)365 4398 y Fw(become-session-le)o -(ad)o(er)p FA(,)14 b(76)365 4498 y Fw(bind-listen-accep)o(t-)o(loo)o(p)p -FA(,)g(86)365 4598 y Fw(bind-socket)p FA(,)i(89)365 4698 y -Fw(bitwise-and)p FA(,)g(121)365 4798 y Fw(bitwise-ior)p FA(,)g(121)365 -4898 y Fw(bitwise-not)p FA(,)g(121)1943 1514 y Fw(bitwise-xor)p -FA(,)g(121)1943 1701 y Fw(call-terminally)p FA(,)e(51)1943 -1801 y Fw(call-with-string)o(-o)o(ut)o(put)o(-p)o(ort)o FA(,)2275 -1901 y(26)1943 2001 y Fw(call/fdes)p FA(,)j(30)1943 2101 y -Fw(char->ascii)p FA(,)f(102)1943 2201 y Fw(char-alphabetic?)o -FA(,)f(104)1943 2301 y Fw(char-alphanumeri)o(c?)o FA(,)g(104)1943 -2400 y Fw(char-filter)p FA(,)h(20)1943 2500 y Fw(char-graphic?)p -FA(,)f(104)1943 2600 y Fw(char-lower-case?)o FA(,)g(104)1943 -2700 y Fw(char-numeric?)82 b FA(,)20 b(104)1943 2800 y Fw(char-set)p -FA(,)d(103)1943 2900 y Fw(char-set-contain)o(s?)o FA(,)e(103)1943 -3000 y Fw(char-set-differe)o(nc)o(e)p FA(,)f(104)1943 3100 -y Fw(char-set-interse)o(ct)o(io)o(n)p FA(,)h(104)1943 3200 -y Fw(char-set-invert)p FA(,)f(104)1943 3300 y Fw(char-set-members)o -FA(,)h(103)1943 3400 y Fw(char-set-union)p FA(,)f(104)1943 -3499 y(char)o(-set:alphabetic,)k(104)1943 3599 y(char)o(-set:alphanumeric,)g -(104)1943 3699 y(char)o(-set:graphic,)g(104)1943 3799 y(char)o(-set:lower)o -(-case,)f(104)1943 3899 y(char)o(-set:not-whitespace,)i(104)1943 -3999 y(char)o(-set:numeric,)g(104)1943 4099 y(char)o(-set:upper)o(-case,)e -(104)1943 4199 y(char)o(-set:whitespace,)h(104)1943 4299 y -Fw(char-set?)p FA(,)f(103)1943 4399 y Fw(char-upper-case?)o -FA(,)e(104)1943 4499 y Fw(char-whitespace?)o FA(,)g(104)1943 -4599 y Fw(chars->char-set)p FA(,)f(103)1943 4698 y Fw(chdir)p -FA(,)k(58)1943 4798 y Fw(close)p FA(,)g(25)1943 4898 y Fw(close-after)p -FA(,)e(24)365 5147 y FD(November)i(1,)h(1995)h(\261)f(15)14 -b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p -1955 5173 V 1636 5176 323 4 v 1174 w FA(147)p eop +147 152 bop 573 614 a FB(W)-8 b(e)17 b(continue)h(to)f(export)g(a)f +Fx(file-attributes)11 b FB(binding)17 b(for)g(the)g(curr)o(ent)f(r)o +(elease,)573 714 y(but)21 b(it)g(will)g(go)g(away)g(in)g(futur)o(e)e(r) +o(eleases.)490 901 y Ft(\017)41 b FB(Renaming)22 b(of)e(I/O)i(synchr)o +(onisation)g(pr)o(ocedur)o(es)573 1000 y(The)107 b Fx +(\(stdio->stdports)37 b FA(thunk)o Fx(\))107 b FB(pr)o(ocedur)o(e)f +(has)h(been)g(r)o(enamed)573 1100 y Fx(with-stdio-ports)o(*)p +FB(;)35 b(ther)o(e)f(is)g(now)i(a)e(corr)o(esponding)g +Fx(with-stdio-ports)573 1200 y FB(special)54 b(form.)126 +b(The)54 b Fx(stdio->stdports)48 b FB(pr)o(ocedur)o(e)53 +b(is)h(now)i(a)d(nullary)573 1299 y(pr)o(ocedur)o(e)19 +b(that)h(side-ef)o(fects)f(the)i(curr)o(ent)f(set)h(of)f(curr)o(ent)g +(I/O)i(port)e(bindings.)490 1486 y Ft(\017)41 b FB(New)21 +b(meta-ar)o(g)e(line-two)i(syntax)573 1586 y(Scsh)h(now)g(uses)g(a)f +(simpli\002ed)i(grammar)e(for)g(describing)h(command-line)g(ar)o(gu-) +573 1685 y(ments)29 b(r)o(ead)d(by)i(the)h(\223meta-ar)o(g\224)c +(switch)k(fr)o(om)f(line)h(two)f(of)h(a)e(shell)i(script.)48 +b(If)573 1785 y(you)26 b(wer)o(e)e(using)j(this)f(featur)o(e)d(in)j(pr) +o(evious)f(r)o(eleases,)g(the)h(thr)o(ee)e(incompatible)573 +1885 y(changes)19 b(of)f(which)i(to)f(be)g(awar)o(e)e(ar)o(e:)23 +b(\(1\))17 b(tab)h(is)i(no)f(longer)g(allowed)g(as)f(an)h(ar)o(gu-)573 +1984 y(ment)k(delimiter)-6 b(,)23 b(\(2\))f(a)h(r)o(un)g(of)g(space)g +(characters)e(is)j(not)g(equivalent)f(to)g(a)g(single)573 +2084 y(space,)d(\(3\))f(empty)i(ar)o(guments)g(ar)o(e)e(written)i(a)f +(dif)o(fer)o(ent)f(way)-9 b(.)365 2401 y Fv(10.3)99 b +(Backwards-compatible)25 b(improvements)365 2636 y FB(Some)c(existing)h +(featur)o(es)e(in)h(scsh)h(have)e(been)h(impr)o(oved)g(in)g(ways)h +(that)f(will)g(not)h(ef)o(fect)365 2735 y(existing)g(code.)490 +2974 y Ft(\017)41 b FB(Impr)o(oved)20 b(err)o(or)g(r)o(eporting)573 +3074 y(Exception)c(handlers)g(that)g(print)h(out)g(err)o(or)e(messages) +h(and)g(warnings)h(now)g(print)573 3173 y(their)32 b(messages)g(on)g +(the)g(err)o(or)f(output)h(port,)i(instead)e(of)f(the)h(curr)o(ent)f +(output)573 3273 y(port.)25 b(Pr)o(evious)20 b(r)o(eleases)e(used)h +(the)h(curr)o(ent)f(output)h(port,)g(a)f(pr)o(oblem)g(inherited)573 +3373 y(fr)o(om)h(Scheme)h(48.)573 3516 y(Pr)o(evious)d(scsh)h(r)o +(eleases)e(\003ushed)j(the)e(Scheme)g(48)g(debugging)h(tables)f(when)h +(cr)o(e-)573 3616 y(ating)27 b(the)h(standar)o(d)d(scsh)j(heap)f +(image.)44 b(This)28 b(trimmed)f(the)h(size)f(of)g(the)g(heap)573 +3715 y(image,)22 b(but)h(made)e(err)o(or)h(messages)g(much)h(less)g +(compr)o(ehensible.)30 b(W)-8 b(e)23 b(now)g(r)o(e-)573 +3815 y(tain)c(the)g(debugging)g(tables.)24 b(This)c(bloats)f(the)g +(heap)f(image)h(up)g(by)f(about)h(600kb.)573 3914 y(And)h(worth)i(it,)e +(too.)573 4058 y(\(W)-8 b(e)26 b(also)h(have)f(some)h(new)g(techniques) +h(for)e(eliminating)i(the)e(r)o(un-time)i(mem-)573 4157 +y(ory)23 b(penalty)f(imposed)h(by)f(these)h(lar)o(ge)e(heap)h(images.) +31 b(Scsh's)23 b(new)g(static-heap)573 4257 y(technology)34 +b(allows)e(for)h(this)g(data)e(to)h(be)g(linked)h(into)g(the)f(text)g +(pages)g(of)g(the)573 4357 y(vm's)26 b(binary)-9 b(,)26 +b(wher)o(e)f(it)h(will)g(not)g(be)g(touched)f(by)h(the)g(GC)g(or)f +(otherwise)i(af)o(fect)573 4456 y(the)21 b(memory)g(system)h(until)f +(it)g(is)g(r)o(efer)o(enced.\))573 4599 y(Finally)-9 +b(,)26 b(scsh)f(now)h(generates)e(mor)o(e)g(informative)h(err)o(or)f +(messages)h(for)f(syscall)573 4699 y(err)o(ors.)k(For)22 +b(example,)f(a)h(\002le-open)g(err)o(or)f(pr)o(eviously)h(told)g(you)g +(what)g(the)h(err)o(or)573 4799 y(was)28 b(\()p FA(e.g.)o +FB(,)i(\223Permission)f(denied,\224)g(or)g(\223No)f(such)g(\002le)h(or) +f(dir)o(ectory\224\),)h(but)f(not)573 4898 y(which)22 +b(\002le)e(you)i(had)e(tried)g(to)h(open.)26 b(W)-8 b(e've)21 +b(impr)o(oved)f(this.)365 5147 y FE(Mar)o(ch)f(10,)g(1997)h(\226)f(21) +13 b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 +w FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1174 w FB(147)p +eop %%Page: 148 154 -148 153 bop 681 614 a Fw(close-socket)p FA(,)15 b(86)681 714 -y Fw(command-line)p FA(,)g(60)681 815 y(command-line-ar)o(guments,)20 -b(60)681 915 y Fw(connect-socket)p FA(,)14 b(89)681 1015 y -Fw(copy-tty-info)p FA(,)h(74)681 1115 y Fw(cpu-ticks/sec)p -FA(,)g(59)681 1215 y Fw(create-directory)o FA(,)g(39)681 1315 -y Fw(create-fifo)p FA(,)h(39)681 1415 y Fw(create-hard-link)o -FA(,)f(39)681 1515 y Fw(create-socket)p FA(,)g(86)681 1615 -y Fw(create-socket-pa)o(ir)o FA(,)g(86)681 1715 y Fw(create-symlink)p -FA(,)f(39)681 1815 y Fw(create-temp-file)o FA(,)h(47)681 1915 -y Fw(cwd)p FA(,)k(58)681 2106 y(date,)g(63)681 2206 y Fw(date)p -FA(,)g(65)681 2306 y Fw(date->string)p FA(,)c(66)681 2406 y -Fw(define-record)p FA(,)g(7)681 2506 y Fw(delete-directory)o -FA(,)g(39)681 2606 y Fw(delete-file)p FA(,)h(39)681 2706 y -Fw(delete-filesys-o)o(bj)o(ect)o FA(,)f(39)681 2806 y Fw(directory-as-fil)o -(e-)o(nam)o(e)p FA(,)f(99)681 2906 y Fw(directory-files)p FA(,)g(43)681 -3007 y Fw(disable-tty-char)o FA(,)h(73)681 3107 y Fw(drain-tty)p -FA(,)i(75)681 3207 y Fw(dump-scsh)p FA(,)g(136)681 3307 y Fw -(dump-scsh-progra)o(m)p FA(,)d(136)681 3407 y Fw(dup)p FA(,)19 -b(31)681 3507 y Fw(dup->fdes)p FA(,)e(31)681 3607 y Fw(dup->inport)p -FA(,)f(31)681 3707 y Fw(dup->outport)p FA(,)f(31)681 3898 y -Fw(env->alist)p FA(,)h(68)681 3998 y Fw(errno-error)p FA(,)g(21)681 -4098 y Fw(error-output-por)o(t)p FA(,)e(24)681 4198 y Fw(exec)p -FA(,)19 b(50)681 4298 y(exec-epf,)f(13)681 4398 y Fw(exec-epf)p -FA(,)f(13)681 4498 y Fw(exec-path)p FA(,)g(50)681 4598 y(exec-path-list,)i -(71)681 4698 y Fw(exec-path-search)o FA(,)c(50)681 4798 y Fw(exec-path/env)p -FA(,)g(50)681 4898 y Fw(exec/env)p FA(,)i(50)2258 614 y Fw(exit)p -FA(,)i(51)2258 714 y Fw(expand-file-name)p FA(,)14 b(102)2258 -902 y Fw(fdes->inport)p FA(,)i(30)2258 1002 y Fw(fdes->outport)p -FA(,)f(30)2258 1102 y Fw(field-reader)p FA(,)h(1)-5 b(12)2258 -1202 y Fw(field-splitter)p FA(,)15 b(109)2258 1302 y Fw(file-directory?)p -FA(,)g(42)2258 1401 y Fw(file-executable?)p FA(,)f(43)2258 -1501 y Fw(file-exists?)p FA(,)i(43)2258 1601 y Fw(file-fifo?)p -FA(,)h(42)2258 1701 y Fw(file-group)p FA(,)g(41)2258 1801 y -Fw(file-info)p FA(,)g(40)2258 1901 y(\256le-info:atime,)k(41)2258 -2001 y(\256le-info:ctime,)g(41)2258 2101 y(\256le-info:device,)f(41)2258 -2201 y(\256le-info:gid,)h(41)2258 2301 y(\256le-info:inode,)g(41)2258 -2401 y(\256le-info:mode,)g(41)2258 2500 y(\256le-info:mtime,)g(41)2258 -2600 y(\256le-info:nlinks,)h(41)2258 2700 y(\256le-info:size,)e(41)2258 -2800 y(\256le-info:type,)h(41)2258 2900 y(\256le-info:uid,)g(41)2258 -3000 y Fw(file-inode)p FA(,)c(41)2258 3100 y Fw(file-last-access)p -FA(,)d(41)2258 3200 y Fw(file-last-mod)p FA(,)h(41)2258 3300 -y Fw(file-last-status-)o(ch)o(ang)o(e)p FA(,)f(41)2258 3400 -y Fw(file-match)p FA(,)j(45)2258 3500 y Fw(file-mode)p FA(,)g(41)2258 -3599 y Fw(file-name-absolut)o(e?)o FA(,)e(99)2258 3699 y Fw -(file-name-as-dire)o(ct)o(ory)o FA(,)g(98)2258 3799 y Fw(file-name-directo)o -(ry)o FA(,)g(99)2258 3899 y Fw(file-name-directo)o(ry)o(?)p -FA(,)f(98)2258 3999 y Fw(file-name-extensi)o(on)o FA(,)h(100)2258 -4099 y Fw(file-name-non-dir)o(ec)o(tor)o(y?)o FA(,)g(98)2258 -4199 y Fw(file-name-nondire)o(ct)o(ory)o FA(,)g(99)2258 4299 -y Fw(file-name-sans-ex)o(te)o(nsi)o(on)o FA(,)g(101)2258 4399 -y Fw(file-nlinks)p FA(,)h(41)2258 4499 y Fw(file-not-executab)o(le)o(?)p -FA(,)e(42)2258 4599 y Fw(file-not-exists?)p FA(,)g(43)2258 -4698 y Fw(file-not-readable)o(?)p FA(,)g(42)2258 4798 y Fw(file-not-writable) -o(?)p FA(,)g(42)2258 4898 y Fw(file-owner)p FA(,)j(41)681 5147 -y(148)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p -2271 5173 V 1952 5176 323 4 v 435 w FD(November)h(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +148 153 bop 805 614 a Ft(\017)41 b FB(Closing)22 b(a)f(port)f(twice)h +(allowed)888 714 y(Scsh)26 b(used)f(to)g(generate)g(an)g(err)o(or)f(if) +h(you)h(attempted)e(to)i(close)f(a)g(port)g(that)g(had)888 +814 y(alr)o(eady)20 b(been)i(closed.)30 b(This)22 b(is)h(now)f +(allowed.)30 b(The)22 b(close)g(pr)o(ocedur)o(e)e(r)o(eturns)i(a)888 +913 y(boolean)f(to)h(indicate)e(whether)h(the)g(port)g(had)f(alr)o +(eady)f(been)h(closed)h(or)g(not.)805 1079 y Ft(\017)41 +b FB(Better)20 b(time)h(pr)o(ecision)888 1179 y(The)34 +b Fx(time+ticks)29 b FB(pr)o(ocedur)o(e)j(now)i(r)o(eturns)g +(sub-second)f(pr)o(ecision)h(on)g(OS's)888 1279 y(that)21 +b(support)g(it.)805 1445 y Ft(\017)41 b FB(Nicer)21 b(print-methods)g +(for)g(basic)f(data-types)888 1544 y(Scsh's)f(standar)o(d)d(r)o(ecor)o +(d)h(types)h(now)h(print)g(mor)o(e)f(informatively)-9 +b(.)25 b(For)18 b(example,)888 1644 y(a)23 b(pr)o(ocess)f(object)h +(includes)g(the)g(pr)o(ocess)g(id)f(in)i(its)f(printed)f(r)o(epr)o +(esentation:)29 b(the)888 1743 y(pr)o(ocess)21 b(object)g(for)f(pr)o +(ocess)h(id)f(2653)f(prints)i(as)g Fx(#{proc)41 b(2653})p +FB(.)681 5147 y(148)p 1952 5071 323 4 v 1952 5173 4 102 +v 1173 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 v 538 +w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 149 155 -149 154 bop 365 614 a Fw(file-readable?)p FA(,)15 b(43)365 -714 y Fw(file-regular?)p FA(,)g(42)365 814 y Fw(file-size)p -FA(,)i(41)365 913 y Fw(file-socket?)p FA(,)f(42)365 1013 y -Fw(file-special?)p FA(,)f(42)365 1112 y Fw(file-symlink?)p -FA(,)g(42)365 1212 y Fw(file-type)p FA(,)i(41)365 1312 y Fw(file-writable?)p -FA(,)e(43)365 1411 y Fw(fill-in-date!)p FA(,)g(66)365 1511 -y Fw(flush-all-ports)p FA(,)g(36)365 1611 y Fw(flush-tty/both)p -FA(,)g(75)365 1710 y Fw(flush-tty/input)p FA(,)g(75)365 1810 -y Fw(flush-tty/output)p FA(,)f(75)365 1910 y Fw(force-output)p -FA(,)i(36)365 2009 y Fw(fork)p FA(,)j(52)365 2109 y Fw(fork-pty-session)p -FA(,)14 b(77)365 2208 y Fw(fork/pipe)p FA(,)j(52)365 2308 y -Fw(fork/pipe+)p FA(,)g(53)365 2408 y Fw(format-date)p FA(,)f(66)365 -2587 y Fw(get-lock-region)p FA(,)f(38)365 2687 y Fw(getenv)p -FA(,)j(68)365 2786 y Fw(glob)p FA(,)h(44)365 2886 y Fw(glob-quote)p -FA(,)e(45)365 2985 y(gr)o(oup-info,)k(60)365 3085 y Fw(group-info)p -FA(,)c(60)365 3185 y(gr)o(oup-info:gid,)j(60)365 3284 y(gr)o -(oup-info:members,)g(60)365 3384 y(gr)o(oup-info:name,)g(60)365 -3563 y Fw(home-dir)p FA(,)d(102)365 3663 y(home-dir)o(ectory)-9 -b(,)20 b(71)365 3763 y Fw(home-file)p FA(,)d(102)365 3862 y -Fw(host-info)p FA(,)g(92)365 4042 y Fw(index)p FA(,)i(96)365 -4141 y Fw(infix-splitter)p FA(,)c(109)365 4241 y Fw(internet-address-)o(>s)o -(ock)o(et)o(-ad)o(dr)o(es)o(s)p FA(,)697 4340 y(88)365 4440 -y Fw(itimer)p FA(,)j(62)365 4619 y Fw(join-strings)p FA(,)e(1)-5 -b(12)365 4799 y Fw(listen-socket)p FA(,)15 b(89)365 4898 y -Fw(lock-region)p FA(,)h(38)1943 614 y Fw(lock-region/no-b)o(lo)o(ck)o -FA(,)f(38)1943 715 y(lock-r)o(egion:end,)20 b(37)1943 815 y(lock-r)o -(egion:exclusive?,)g(37)1943 915 y(lock-r)o(egion:len,)g(37)1943 -1015 y(lock-r)o(egion:pid,)g(37)1943 1116 y(lock-r)o(egion:start,)g(37)1943 -1216 y(lock-r)o(egion:whence,)g(37)1943 1316 y(lock-r)o(egion?,)g(37)1943 -1510 y Fw(make-date)p FA(,)d(64)1943 1610 y Fw(make-lock-region)o -FA(,)e(38)1943 1710 y Fw(make-pty-generat)o(or)o FA(,)g(78)1943 -1811 y Fw(make-regexp)p FA(,)h(95)1943 1911 y Fw(make-string-inpu)o(t-)o(po)o -(rt)p FA(,)e(26)1943 2011 y Fw(make-string-outp)o(ut)o(-p)o(ort)o -FA(,)h(26)1943 2111 y Fw(make-tty-info)p FA(,)g(74)1943 2212 -y Fw(match:end)p FA(,)i(95)1943 2312 y Fw(match:start)p FA(,)f(95)1943 -2412 y Fw(match:substring)p FA(,)e(95)1943 2512 y Fw(move->fdes)p -FA(,)i(30)1943 2706 y Fw(network-info)p FA(,)f(92)1943 2806 -y Fw(nice)p FA(,)k(58)1943 2907 y Fw(nth)p FA(,)g(121)1943 -3100 y Fw(open-control-tty)o FA(,)c(76)1943 3201 y Fw(open-fdes)p -FA(,)i(32)1943 3301 y Fw(open-file)p FA(,)g(32)1943 3401 y -Fw(open-input-file)p FA(,)d(32)1943 3501 y Fw(open-output-file)o -FA(,)h(32)1943 3602 y Fw(open-pty)p FA(,)i(77)1943 3795 y Fw(parent-pid)p -FA(,)f(58)1943 3896 y Fw(parse-file-name)p FA(,)e(101)1943 -3996 y Fw(path-list->file-)o(na)o(me)o FA(,)h(100)1943 4096 -y Fw(pause-until-inte)o(rr)o(up)o(t)p FA(,)g(62)1943 4197 y -Fw(pid)p FA(,)k(58)1943 4297 y Fw(pid->proc)p FA(,)e(53)1943 -4397 y Fw(pipe)p FA(,)i(32)1943 4497 y Fw(port->fdes)p FA(,)d(30)1943 -4598 y Fw(port->list)p FA(,)g(15)1943 4698 y Fw(port->sexp-list)p -FA(,)e(15)1943 4798 y Fw(port->string)p FA(,)h(15)1943 4898 -y Fw(port->string-lis)o(t)p FA(,)f(15)365 5147 y FD(November)k(1,)h(1995)h -(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 -v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1174 w FA(149)p -eop +149 154 bop 490 614 a FB(\277)365 5147 y FE(Mar)o(ch)19 +b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p 1636 5071 323 +4 v 1636 5173 4 102 v 540 w FD(DRAFT)p 1955 5173 V 1636 +5176 323 4 v 1174 w FB(149)p eop %%Page: 150 156 -150 155 bop 681 614 a Fw(port-revealed)p FA(,)15 b(30)681 714 -y Fw(predicate->char-)o(se)o(t)p FA(,)f(103)681 814 y Fw(priority)p -FA(,)j(58)681 914 y(pr)o(oc,)j(53)681 1014 y(pr)o(oc:pid,)f(53)681 -1114 y(pr)o(oc?,)h(53)681 1214 y Fw(process-group)p FA(,)15 -b(58)681 1314 y Fw(process-times)p FA(,)g(59)681 1414 y Fw(protocol-info)p -FA(,)g(92)681 1514 y Fw(pty-name->tty-na)o(me)o FA(,)g(77)681 -1701 y Fw(read-delimited)p FA(,)f(106)681 1801 y Fw(read-delimited!)p -FA(,)g(106)681 1901 y Fw(read-line)p FA(,)j(105)681 2001 y -Fw(read-paragraph)p FA(,)d(106)681 2101 y Fw(read-string)p -FA(,)i(33)681 2201 y Fw(read-string!)p FA(,)f(33)681 2301 y -Fw(read-string!/par)o(ti)o(al)p FA(,)f(33)681 2401 y Fw(read-string/part)o -(ia)o(l)p FA(,)g(33)681 2500 y Fw(read-symlink)p FA(,)h(39)681 -2600 y Fw(reap-zombies)p FA(,)g(55)681 2700 y Fw(receive-message)p -FA(,)f(90)681 2800 y Fw(receive-message!)o FA(,)h(90)681 2900 -y Fw(receive-message!)o(/p)o(art)o(ia)o(l)p FA(,)f(90)681 3000 -y Fw(receive-message/)o(pa)o(rti)o(al)o FA(,)h(90)681 3100 -y Fw(record-reader)p FA(,)g(108)681 3200 y Fw(reduce-port)p -FA(,)h(16)681 3300 y Fw(regexp-exec)p FA(,)g(95)681 3400 y -Fw(regexp-match?)p FA(,)f(94)681 3500 y Fw(regexp-quote)p FA(,)g(96)681 -3599 y Fw(regexp?)p FA(,)i(95)681 3699 y Fw(release-port-han)o(dl)o(e)p -FA(,)d(30)681 3799 y Fw(rename-file)p FA(,)i(39)681 3899 y -Fw(repl)p FA(,)j(121)681 3999 y Fw(replace-extensio)o(n)p FA(,)14 -b(101)681 4099 y Fw(resolve-file-nam)o(e)p FA(,)g(102)681 4199 -y Fw(rindex)p FA(,)k(96)681 4299 y(r)o(un,)j(13)681 4399 y -Fw(run)p FA(,)e(13)681 4499 y Fw(run/collecting)p FA(,)14 b(17)681 -4599 y Fw(run/collecting*)p FA(,)g(17)681 4698 y Fw(run/file)p -FA(,)j(14)681 4798 y Fw(run/file*)p FA(,)g(15)681 4898 y Fw(run/port)p -FA(,)g(14)2258 614 y Fw(run/port*)p FA(,)g(15)2258 714 y Fw(run/port+proc)p -FA(,)e(17)2258 814 y Fw(run/port+proc*)p FA(,)g(17)2258 914 -y Fw(run/sexp)p FA(,)i(14)2258 1014 y Fw(run/sexp*)p FA(,)g(15)2258 -1114 y Fw(run/sexps)p FA(,)g(14)2258 1214 y Fw(run/sexps*)p -FA(,)g(15)2258 1314 y Fw(run/string)p FA(,)g(14)2258 1414 y -Fw(run/string*)p FA(,)f(15)2258 1514 y Fw(run/strings)p FA(,)g(14)2258 -1614 y Fw(run/strings*)p FA(,)g(15)2258 1801 y Fw(seek)p FA(,)j(31)2258 -1901 y Fw(select)41 b FA(,)21 b(34)2258 2001 y Fw(send-message)p -FA(,)16 b(90)2258 2101 y Fw(send-message/part)o(ia)o(l)p FA(,)e(90)2258 -2201 y Fw(send-tty-break)p FA(,)h(75)2258 2301 y Fw(service-info)p -FA(,)h(92)2258 2401 y Fw(set-file-group)p FA(,)f(40)2258 2501 -y Fw(set-file-mode)p FA(,)g(40)2258 2601 y Fw(set-file-owner)p -FA(,)g(40)2258 2701 y Fw(set-file-times)p FA(,)g(40)2258 2801 -y Fw(set-gid)p FA(,)j(59)2258 2900 y Fw(set-port-bufferin)o(g)p -FA(,)c(36)2258 3000 y Fw(set-priority)p FA(,)i(58)2258 3100 -y Fw(set-process-group)o FA(,)f(58)2258 3200 y Fw(set-socket-option)o -FA(,)g(91)2258 3300 y Fw(set-tty-info/drai)o(n)p FA(,)f(74)2258 -3400 y Fw(set-tty-info/flus)o(h)p FA(,)g(74)2258 3500 y Fw(set-tty-info/now)p -FA(,)g(74)2258 3600 y Fw(set-tty-process-g)o(ro)o(up)p FA(,)g(76)2258 -3700 y Fw(set-uid)p FA(,)k(59)2258 3800 y Fw(set-umask)p FA(,)f(58)2258 -3900 y Fw(setenv)p FA(,)h(68)2258 4000 y Fw(shutdown-socket)p -FA(,)d(90)2258 4100 y Fw(signal-process)p FA(,)g(62)2258 4199 -y Fw(signal-process-gr)o(ou)o(p)p FA(,)f(62)2258 4299 y Fw(simplify-file-nam) -o(e)p FA(,)g(102)2258 4399 y Fw(sleep)p FA(,)19 b(62)2258 4499 -y Fw(sloppy-suffix-spl)o(it)o(ter)o FA(,)c(109)2258 4599 y -Fw(socket-address->i)o(nt)o(ern)o(et)o(-a)o(ddr)o(es)o(s)p -FA(,)2590 4699 y(88)2258 4799 y Fw(socket-address->u)o(ni)o(x-a)o(dd)o(re)o -(ss)p FA(,)2590 4898 y(88)681 5147 y(150)p 1952 5071 323 4 -v 1952 5173 4 102 v 1173 w FC(DRAFT)p 2271 5173 V 1952 5176 -323 4 v 435 w FD(November)j(1,)h(1995)h(\261)f(15)13 b(:)f(58)p -eop +150 155 bop 681 1262 a Fw(Chapter)44 b(1)-6 b(1)681 1702 +y FC(T)-23 b(odo)681 2159 y FB(W)-8 b(e'd)17 b(love)h(to)g(have)f(have) +g(people)g(implement)h(these)g(subsystems)h(and)e(fold)g(them)h(into) +681 2258 y(the)j(scsh)g(r)o(elease:)805 2447 y Ft(\017)41 +b FB(Mor)o(e)20 b(network)h(pr)o(otocols.)26 b(T)-8 b(elnet)21 +b(and)g(ftp)f(would)h(be)g(the)g(most)g(important.)805 +2612 y Ft(\017)41 b FB(An)21 b(ILU)f(interface.)805 2776 +y Ft(\017)41 b FB(An)21 b(RPC)g(system,)g(with)h(\223tail-r)o +(ecursion.\224)805 2941 y Ft(\017)41 b FB(Interfaces)20 +b(to)h(r)o(elational)f(db's.)26 b(This)21 b(would)g(be)g(quite)g +(useful)g(for)f(W)-8 b(eb)21 b(servers.)681 3130 y(Manual)f(hacking:) +805 3319 y Ft(\017)41 b FB(The)18 b(L)1066 3301 y Fa(A)1099 +3319 y FB(T)1136 3338 y(E)1176 3319 y(X)g(hackery)f(needs)g(yet)h +(another)g(serious)g(pass.)24 b(Most)18 b(importantly)-9 +b(,)18 b(long)888 3418 y(pr)o(ocedur)o(e)h(\223declarations\224)g(need) +i(to)g(be)f(br)o(oken)h(acr)o(oss)f(two)h(lines.)805 +3583 y Ft(\017)41 b FB(Fix)21 b(up)g(0-or)o(-mor)o(e)e(and)h(1-or)o +(-mor)o(e)f(parameter)g(typesetting,)i(with)h(subscripts.)805 +3748 y Ft(\017)41 b FB(Parameter)20 b(subscripts)h(need)f(to)h(be)g +(made)f(r)o(eal)f(subscripts.)805 3913 y Ft(\017)41 b +FB(Soup)27 b(up)g(the)g(markup)f(pr)o(ocessor)-6 b(,)28 +b(and)e(r)o(edo)g(manual)h(in)g(markup.)44 b(Generate)888 +4012 y(LaT)-8 b(eX,)17 b(HTML,)g(and)g(info)h(versions.)25 +b(Alternatively)-9 b(,)17 b(persuade)f(some)i(kind)g(soul)888 +4112 y(to)j(hand-port)g(manual)f(to)i(HTML)e(or)g(info.)681 +4301 y(Job)g(contr)o(ol,)h(after)f Fx(jcontrol.scm)681 +4425 y FB(Static)g(heaps;)g(fast)g(startup.)681 4550 +y(Gnu)h(r)o(eadline)f(lib.)681 4674 y(Interr)o(upt)h(system.)681 +4799 y(Make)g(it)i(all)g(coexist)f(with)i(S48)d(thr)o(eads)g(as)i(well) +g(as)f(can)g(be)h(done)f(for)h(Unix.)31 b(The)22 b(DEC)681 +4898 y(SRC)e(tech)h(r)o(eport)f(gives)h(a)f(good)i(discussion)g(of)e +(the)h(issues.)681 5147 y(150)p 1952 5071 323 4 v 1952 +5173 4 102 v 1173 w FD(DRAFT)p 2271 5173 V 1952 5176 +323 4 v 538 w FE(Mar)o(ch)e(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p eop %%Page: 151 157 -151 156 bop 365 614 a Fw(socket-connect)p FA(,)15 b(85)365 -714 y Fw(socket-local-addr)o(es)o(s)p FA(,)g(89)365 814 y Fw(socket-option)p -FA(,)g(91)365 914 y Fw(socket-remote-add)o(re)o(ss)p FA(,)f(89)365 -1014 y Fw(split-file-name)p FA(,)h(100)365 1114 y Fw(start-tty-input)p -FA(,)g(75)365 1214 y Fw(start-tty-output)p FA(,)f(75)365 1314 -y Fw(status:exit-val)p FA(,)h(57)365 1414 y Fw(status:stop-sig)p -FA(,)g(57)365 1514 y Fw(status:term-sig)p FA(,)g(57)365 1613 -y Fw(stdio->stdports)p FA(,)g(25)365 1713 y Fw(stdports->stdio)p -FA(,)g(25)365 1813 y Fw(stop-tty-input)p FA(,)g(75)365 1913 -y Fw(stop-tty-output)p FA(,)g(75)365 2013 y Fw(string->char-set)p -FA(,)f(103)365 2113 y Fw(string-filter)p FA(,)h(20)365 2213 -y Fw(string-match)p FA(,)h(94)365 2313 y Fw(string-output-por)o(t-)o(out)o -(pu)o(t)p FA(,)e(26)365 2413 y Fw(substitute-env-va)o(rs)o -FA(,)h(96)365 2513 y Fw(suffix-splitter)p FA(,)g(109)365 2613 -y Fw(suspend)p FA(,)j(51)365 2712 y Fw(sync-file)p FA(,)f(40)365 -2812 y Fw(sync-file-system)p FA(,)d(40)365 2912 y Fw(system-name)p -FA(,)i(62)365 3100 y Fw(tell)p FA(,)j(31)365 3200 y Fw(temp-file-channel)o -FA(,)c(49)365 3300 y Fw(temp-file-iterate)o FA(,)g(48)365 3400 -y Fw(ticks/sec)p FA(,)i(64)365 3500 y(time,)k(63)365 3599 y -Fw(time)p FA(,)e(65)365 3699 y Fw(time+ticks)p FA(,)e(64)365 -3799 y Fw(truncate-file)p FA(,)e(40)365 3899 y Fw(tty-info)p -FA(,)i(74)365 3999 y(tty-info)k(r)o(ecor)o(d)e(type,)i(72)365 -4099 y Fw(tty-info:control-)o(ch)o(ars)o FA(,)15 b(72)365 4199 -y Fw(tty-info:control-)o(fl)o(ags)o FA(,)g(72)365 4299 y Fw -(tty-info:input-fl)o(ag)o(s)p FA(,)g(72)365 4399 y Fw(tty-info:input-sp)o(ee) -o(d)p FA(,)g(72)365 4499 y Fw(tty-info:local-fl)o(ag)o(s)p -FA(,)g(72)365 4599 y Fw(tty-info:min)p FA(,)h(72)365 4698 y -Fw(tty-info:output-f)o(la)o(gs)p FA(,)e(72)365 4798 y Fw(tty-info:output-s)o -(pe)o(ed)p FA(,)g(72)365 4898 y Fw(tty-info:time)p FA(,)h(72)1943 -614 y Fw(tty-info?)p FA(,)i(72)1943 714 y Fw(tty-name->pty-na)o(me)o -FA(,)e(77)1943 814 y Fw(tty-process-grou)o(p)p FA(,)f(76)1943 -913 y Fw(ttyc/2-stop-bits)o FA(,)h(83)1943 1013 y Fw(ttyc/carrier-flo)o(w-)o -(ct)o(l)p FA(,)g(83)1943 1112 y Fw(ttyc/char-size)p FA(,)f(83)1943 -1212 y Fw(ttyc/char-size5)p FA(,)g(83)1943 1312 y Fw(ttyc/char-size6)p -FA(,)g(83)1943 1411 y Fw(ttyc/char-size7)p FA(,)g(83)1943 1511 -y Fw(ttyc/char-size8)p FA(,)g(83)1943 1611 y Fw(ttyc/CTS-output-)o(fl)o(ow)o -(-ct)o(l)p FA(,)g(83)1943 1710 y Fw(ttyc/enable-pari)o(ty)o -FA(,)h(83)1943 1810 y Fw(ttyc/enable-read)o FA(,)g(83)1943 -1910 y Fw(ttyc/hup-on-clos)o(e)p FA(,)f(83)1943 2009 y Fw(ttyc/ignore-flag)o -(s)p FA(,)g(83)1943 2109 y Fw(ttyc/no-modem-sy)o(nc)o FA(,)h(83)1943 -2208 y Fw(ttyc/odd-parity)p FA(,)f(83)1943 2308 y Fw(ttyc/RTS-input-f)o(lo)o -(w-)o(ctl)o FA(,)h(83)1943 2408 y Fw(ttychar/delayed-)o(su)o(sp)o(end)o -FA(,)g(79)1943 2507 y Fw(ttychar/delete-c)o(ha)o(r)p FA(,)f(79)1943 -2607 y Fw(ttychar/delete-l)o(in)o(e)p FA(,)g(79)1943 2707 y -Fw(ttychar/delete-w)o(or)o(d)p FA(,)g(79)1943 2806 y Fw(ttychar/discard)p -FA(,)g(79)1943 2906 y Fw(ttychar/eof)p FA(,)i(79)1943 3005 -y Fw(ttychar/eol)p FA(,)g(79)1943 3105 y Fw(ttychar/eol2)p -FA(,)f(79)1943 3205 y Fw(ttychar/interrup)o(t)p FA(,)f(79)1943 -3304 y Fw(ttychar/literal-)o(ne)o(xt)o FA(,)h(79)1943 3404 -y Fw(ttychar/quit)p FA(,)g(79)1943 3504 y Fw(ttychar/reprint)p -FA(,)f(79)1943 3603 y Fw(ttychar/start)p FA(,)h(79)1943 3703 -y Fw(ttychar/status)p FA(,)f(79)1943 3802 y Fw(ttychar/stop)p -FA(,)h(79)1943 3902 y Fw(ttychar/suspend)p FA(,)f(79)1943 4002 -y Fw(ttyin/7bits)p FA(,)i(80)1943 4101 y Fw(ttyin/beep-on-ov)o(er)o(fl)o(ow)p -FA(,)e(80)1943 4201 y Fw(ttyin/check-pari)o(ty)o FA(,)h(80)1943 -4301 y Fw(ttyin/cr->nl)p FA(,)g(80)1943 4400 y Fw(ttyin/ignore-bad)o(-p)o(ar) -o(ity)o(-c)o(har)o(s)p FA(,)2275 4500 y(80)1943 4599 y Fw(ttyin/ignore-bre)o -(ak)o FA(,)g(80)1943 4699 y Fw(ttyin/ignore-cr)p FA(,)f(80)1943 -4799 y Fw(ttyin/input-flow)o(-c)o(tl)o FA(,)h(80)1943 4898 -y Fw(ttyin/interrupt-)o(on)o(-b)o(rea)o(k)p FA(,)f(80)365 5147 -y FD(November)k(1,)h(1995)h(\261)f(15)14 b(:)e(58)p 1636 5071 -323 4 v 1636 5173 4 102 v 436 w FC(DRAFT)p 1955 5173 V 1636 -5176 323 4 v 1174 w FA(151)p eop +151 156 bop 365 614 a FB(T)-8 b(esting)22 b(br)o(oken)f +(symlinks\227new)h(value)e(for)h FA(chase?)f FB(\003ag?)365 +739 y(Rename)h(and)f(r)o(elease)g Fx(ensure-file-name)o(-i)o(s-)o +Ft(f)p Fx(no)o(n,)o Ft(g)p Fx(d)o(ire)o(ct)o(or)o(y)p +FB(.)365 863 y(Mor)o(e)g(informative)h(errno)f(exception)h(packets)f(&) +h(documentation)g(for)g(them.)365 988 y(Other)h(things)i(should)f(be)e +(available:)27 b(hash)22 b(tables,)g(sort,)g(list)h(utils,)g(pattern)e +(matchers.)365 1088 y(But)g(things)i(start)e(to)h(overload.)k(The)21 +b(module)h(system)g(is)g(the)f(appr)o(opriate)f(way)h(to)h(use)365 +1187 y(these.)365 1312 y(Need)d(to)g(do)g(\002le-contr)o(ol)g(\()p +FA(i.e.)p FB(,)g Fx(fcntl\(\))p FB(\).)i Fx(fcntl)c FB(is)j(ugly)-9 +b(.)25 b(Better)18 b(to)i(have)e(a)h(pr)o(ocedur)o(e)365 +1411 y(for)i(each)f(dif)o(fer)o(ent)f(operation.)365 +5147 y FE(Mar)o(ch)g(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1174 w FB(151)p eop %%Page: 152 158 -152 157 bop 681 614 a Fw(ttyin/lowercase)p FA(,)14 b(80)681 -714 y Fw(ttyin/mark-parit)o(y-)o(err)o(or)o(s)p FA(,)g(80)681 -814 y Fw(ttyin/nl->cr)p FA(,)h(80)681 913 y Fw(ttyin/output-flo)o(w-)o(ctl)o -FA(,)g(80)681 1013 y Fw(ttyin/xon-any)p FA(,)g(80)681 1112 -y Fw(ttyl/alt-delete-)o(wo)o(rd)p FA(,)f(84)681 1212 y Fw(ttyl/canonical)p -FA(,)g(84)681 1312 y Fw(ttyl/case-map)p FA(,)h(84)681 1411 -y Fw(ttyl/echo)p FA(,)i(84)681 1511 y Fw(ttyl/echo-ctl)p FA(,)e(84)681 -1611 y Fw(ttyl/echo-delete)o(-l)o(ine)o FA(,)g(84)681 1710 -y Fw(ttyl/echo-nl)p FA(,)g(84)681 1810 y Fw(ttyl/enable-sign)o(al)o(s)p -FA(,)f(84)681 1910 y Fw(ttyl/extended)p FA(,)h(84)681 2009 -y Fw(ttyl/flush-outpu)o(t)p FA(,)f(84)681 2109 y Fw(ttyl/hardcopy-de)o(le)o -(te)p FA(,)g(84)681 2208 y Fw(ttyl/no-flush-on)o(-i)o(nte)o(rr)o(up)o(t)p -FA(,)h(84)681 2308 y Fw(ttyl/no-kernel-s)o(ta)o(tus)o FA(,)g(84)681 -2408 y Fw(ttyl/reprint-unr)o(ea)o(d-c)o(ha)o(rs)o FA(,)g(84)681 -2507 y Fw(ttyl/ttou-signal)o FA(,)g(84)681 2607 y Fw(ttyl/visual-dele)o(te)o -FA(,)g(84)681 2707 y Fw(ttyl/visual-dele)o(te)o(-li)o(ne)o -FA(,)g(84)681 2806 y Fw(ttyout/all-delay)o FA(,)g(82)681 2906 -y Fw(ttyout/bs-delay)p FA(,)f(82)681 3005 y Fw(ttyout/bs-delay0)o -FA(,)h(82)681 3105 y Fw(ttyout/bs-delay1)o FA(,)g(82)681 3205 -y Fw(ttyout/cr->nl)p FA(,)g(81)681 3304 y Fw(ttyout/cr-delay)p -FA(,)f(82)681 3404 y Fw(ttyout/cr-delay0)o FA(,)h(82)681 3504 -y Fw(ttyout/cr-delay1)o FA(,)g(82)681 3603 y Fw(ttyout/cr-delay2)o -FA(,)g(82)681 3703 y Fw(ttyout/cr-delay3)o FA(,)g(82)681 3802 -y Fw(ttyout/delay-w/f)o(il)o(l-c)o(ha)o(r)p FA(,)f(81)681 3902 -y Fw(ttyout/discard-e)o(ot)o FA(,)h(81)681 4002 y Fw(ttyout/enable)p -FA(,)g(81)681 4101 y Fw(ttyout/expand-ta)o(bs)o FA(,)g(81)681 -4201 y Fw(ttyout/ff-delay)p FA(,)f(82)681 4301 y Fw(ttyout/ff-delay0)o -FA(,)h(82)681 4400 y Fw(ttyout/ff-delay1)o FA(,)g(82)681 4500 -y Fw(ttyout/fill-w/de)o(l)p FA(,)f(81)681 4599 y Fw(ttyout/nl->crnl)p -FA(,)g(81)681 4699 y Fw(ttyout/nl-delay)p FA(,)g(82)681 4799 -y Fw(ttyout/nl-delay0)o FA(,)h(82)681 4898 y Fw(ttyout/nl-delay1)o -FA(,)g(82)2258 614 y Fw(ttyout/nl-does-cr)o FA(,)g(81)2258 -714 y Fw(ttyout/no-col0-cr)o FA(,)g(81)2258 815 y Fw(ttyout/tab-delay)p -FA(,)f(82)2258 915 y Fw(ttyout/tab-delay0)o FA(,)h(82)2258 -1015 y Fw(ttyout/tab-delay1)o FA(,)g(82)2258 1115 y Fw(ttyout/tab-delay2)o -FA(,)g(82)2258 1215 y Fw(ttyout/tab-delayx)o FA(,)g(82)2258 -1315 y Fw(ttyout/uppercase)p FA(,)f(81)2258 1415 y Fw(ttyout/vtab-delay)o -FA(,)h(82)2258 1515 y Fw(ttyout/vtab-delay)o(0)p FA(,)f(82)2258 -1615 y Fw(ttyout/vtab-delay)o(1)p FA(,)g(82)2258 1806 y Fw(umask)p -FA(,)19 b(58)2258 1906 y Fw(unix-address->soc)o(ke)o(t-a)o(dd)o(re)o(ss)p -FA(,)2590 2006 y(88)2258 2106 y Fw(unlock-region)p FA(,)c(38)2258 -2206 y Fw(user-effective-gi)o(d)p FA(,)f(59)2258 2306 y Fw(user-effective-ui) -o(d)p FA(,)g(59)2258 2406 y Fw(user-gid)p FA(,)j(59)2258 2506 -y(user)o(-info,)j(59)2258 2606 y Fw(user-info)p FA(,)d(59)2258 -2706 y(user)o(-info:gid,)j(59)2258 2806 y(user)o(-info:home-dir)-6 -b(,)20 b(59)2258 2906 y(user)o(-info:name,)g(59)2258 3006 y(user)o -(-info:shell,)g(59)2258 3106 y(user)o(-info:uid,)g(59)2258 -3206 y Fw(user-login-name)p FA(,)15 b(59)2258 3307 y Fw(user-supplementar)o -(y-)o(gid)o(s)p FA(,)f(59)2258 3407 y Fw(user-uid)p FA(,)j(59)2258 -3597 y Fw(wait)p FA(,)i(56)2258 3697 y Fw(wait-any)p FA(,)e(56)2258 -3797 y Fw(wait-process-grou)o(p)p FA(,)d(57)2258 3898 y Fw(with-current-inpu) -o(t-)o(por)o(t)p FA(,)g(24)2258 3998 y Fw(with-current-inpu)o(t-)o(por)o(t*)o -FA(,)h(24)2258 4098 y Fw(with-current-outp)o(ut)o(-po)o(rt)o -FA(,)g(24)2258 4198 y Fw(with-current-outp)o(ut)o(-po)o(rt)o(*)p -FA(,)f(24)2258 4298 y Fw(with-cwd)p FA(,)j(58)2258 4398 y Fw(with-cwd*)p -FA(,)g(58)2258 4498 y Fw(with-env)p FA(,)g(69)2258 4598 y Fw(with-env*)p -FA(,)g(69)2258 4698 y Fw(with-errno-handle)o(r)p FA(,)d(22)2258 -4798 y Fw(with-errno-handle)o(r*)o FA(,)h(22)2258 4898 y Fw -(with-error-output)o(-p)o(ort)o FA(,)g(24)681 5147 y(152)p -1952 5071 323 4 v 1952 5173 4 102 v 1173 w FC(DRAFT)p 2271 -5173 V 1952 5176 323 4 v 435 w FD(November)j(1,)h(1995)h(\261)f(15)13 -b(:)f(58)p eop +152 157 bop 681 1095 a FC(Index)681 1513 y Fx(\045read-delimited!)o +FB(,)15 b(1)-5 b(10)681 1706 y(*temp-\002le-template*,)20 +b(49)681 1899 y Fx(->uid)p FB(,)e(61)681 2000 y Fx(->username)p +FB(,)e(61)681 2193 y Fx(\045exec)p FB(,)i(52)681 2293 +y Fx(\045exit)p FB(,)g(52)681 2393 y Fx(\045fork)p FB(,)g(53)681 +2493 y Fx(\045fork/pipe)p FB(,)e(53)681 2593 y Fx(\045fork/pipe+)p +FB(,)g(54)681 2694 y Fx(&)p FB(,)k(13)681 2794 y Fx(&&)p +FB(,)f(20)681 2894 y Fx(interrupt/alarm)p FB(,)14 b(64)681 +2994 y Fx(interrupt/alrm)p FB(,)g(64)681 3094 y Fx(interrupt/chld)p +FB(,)g(64)681 3195 y Fx(interrupt/cont)p FB(,)g(64)681 +3295 y Fx(interrupt/hup)p FB(,)h(64)681 3395 y Fx(interrupt/info)p +FB(,)f(64)681 3495 y Fx(interrupt/int)p FB(,)h(64)681 +3596 y Fx(interrupt/io)p FB(,)g(64)681 3696 y Fx(interrupt/keyboa)o(rd) +o FB(,)g(64)681 3796 y Fx(interrupt/memory)o(-s)o(hor)o(ta)o(ge)o +FB(,)g(64)681 3896 y Fx(interrupt/poll)p FB(,)f(64)681 +3996 y Fx(interrupt/prof)p FB(,)g(64)681 4097 y Fx(interrupt/pwr)p +FB(,)h(64)681 4197 y Fx(interrupt/quit)p FB(,)f(64)681 +4297 y Fx(interrupt/term)p FB(,)g(64)681 4397 y Fx(interrupt/tstp)p +FB(,)g(64)681 4497 y Fx(interrupt/urg)p FB(,)h(64)681 +4598 y Fx(interrupt/usr1)p FB(,)f(64)681 4698 y Fx(interrupt/usr2)p +FB(,)g(64)681 4798 y Fx(interrupt/vtalrm)o FB(,)h(64)681 +4898 y Fx(interrupt/winch)p FB(,)f(64)2258 1513 y Fx(interrupt/xcpu)p +FB(,)h(64)2258 1616 y Fx(interrupt/xfsz)p FB(,)g(64)2258 +1718 y Fx(signal/abrt)p FB(,)h(65)2258 1821 y Fx(signal/alrm)p +FB(,)g(64)2258 1924 y Fx(signal/bus)p FB(,)h(65)2258 +2026 y Fx(signal/chld)p FB(,)f(64)2258 2129 y Fx(signal/cont)p +FB(,)g(64)2258 2231 y Fx(signal/emt)p FB(,)h(65)2258 +2334 y Fx(signal/fpe)p FB(,)g(65)2258 2436 y Fx(signal/hup)p +FB(,)g(64)2258 2539 y Fx(signal/ill)p FB(,)g(65)2258 +2642 y Fx(signal/info)p FB(,)f(64)2258 2744 y Fx(signal/int)p +FB(,)h(64)2258 2847 y Fx(signal/iot)p FB(,)g(65)2258 +2949 y Fx(signal/io)p FB(,)g(64)2258 3052 y Fx(signal/kill)p +FB(,)f(65)2258 3154 y Fx(signal/pipe)p FB(,)g(65)2258 +3257 y Fx(signal/poll)p FB(,)g(64)2258 3360 y Fx(signal/prof)p +FB(,)g(64)2258 3462 y Fx(signal/pwr)p FB(,)h(64)2258 +3565 y Fx(signal/quit)p FB(,)f(64)2258 3667 y Fx(signal/segv)p +FB(,)g(65)2258 3770 y Fx(signal/stop)p FB(,)g(65)2258 +3873 y Fx(signal/sys)p FB(,)h(65)2258 3975 y Fx(signal/term)p +FB(,)f(64)2258 4078 y Fx(signal/trap)p FB(,)g(65)2258 +4180 y Fx(signal/tstp)p FB(,)g(64)2258 4283 y Fx(signal/ttin)p +FB(,)g(65)2258 4385 y Fx(signal/ttou)p FB(,)g(65)2258 +4488 y Fx(signal/urg)p FB(,)h(64)2258 4591 y Fx(signal/usr1)p +FB(,)f(64)2258 4693 y Fx(signal/usr2)p FB(,)g(64)2258 +4796 y Fx(signal/vtalrm)p FB(,)f(64)2258 4898 y Fx(signal/winch)p +FB(,)h(64)681 5147 y(152)p 1952 5071 323 4 v 1952 5173 +4 102 v 1173 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 +v 538 w FE(Mar)o(ch)j(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop %%Page: 153 159 -153 158 bop 365 614 a Fw(with-error-output)o(-p)o(ort)o(*)p -FA(,)14 b(24)365 714 y Fw(with-region-lock)p FA(,)g(38)365 -814 y Fw(with-region-lock*)o FA(,)h(38)365 913 y Fw(with-stdio-ports)p -FA(,)f(26)365 1013 y Fw(with-stdio-ports*)o FA(,)h(26)365 1112 -y Fw(with-total-env)p FA(,)g(69)365 1212 y Fw(with-total-env*)p -FA(,)g(69)365 1312 y Fw(with-umask)p FA(,)i(58)365 1411 y Fw(with-umask*)p -FA(,)f(58)365 1511 y Fw(write-string)p FA(,)g(34)365 1611 y -Fw(write-string/part)o(ia)o(l)p FA(,)f(35)365 5147 y FD(November)j(1,)h(1995) -h(\261)f(15)14 b(:)e(58)p 1636 5071 323 4 v 1636 5173 4 102 -v 436 w FC(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1174 w FA(153)p +153 158 bop 365 614 a Fx(signal/xcpu)p FB(,)16 b(64)365 +715 y Fx(signal/xfsz)p FB(,)g(64)365 907 y Fx(accept-connection)o +FB(,)f(93)365 1007 y Fx(add-after)p FB(,)i(75)365 1107 +y Fx(add-before)p FB(,)g(75)365 1208 y Fx(alist->env)p +FB(,)g(73)365 1308 y Fx(alist-compress)p FB(,)e(74)365 +1408 y Fx(alist-delete)p FB(,)h(74)365 1508 y Fx(alist-update)p +FB(,)g(74)365 1608 y Fx(arg)p FB(,)k(62)365 1709 y Fx(arg*)p +FB(,)f(62)365 1809 y Fx(argv)p FB(,)g(62)365 1909 y Fx +(arithmetic-shift)p FB(,)14 b(125)365 2009 y Fx(ascii->char)p +FB(,)i(106)365 2109 y Fx(ascii-range->char)o(-s)o(et)p +FB(,)e(107)365 2210 y Fx(autoreap-policy)p FB(,)h(56)365 +2310 y(awk,)21 b(1)-5 b(19)365 2502 y Fx(become-session-le)o(ad)o(er)p +FB(,)14 b(81)365 2602 y Fx(bind-listen-accep)o(t-)o(loo)o(p)p +FB(,)g(90)365 2703 y Fx(bind-socket)p FB(,)i(93)365 2803 +y Fx(bitwise-and)p FB(,)g(125)365 2903 y Fx(bitwise-ior)p +FB(,)g(125)365 3003 y Fx(bitwise-not)p FB(,)g(125)365 +3103 y Fx(bitwise-xor)p FB(,)g(125)365 3296 y Fx(call-terminally)p +FB(,)f(52)365 3396 y Fx(call-with-string-)o(ou)o(tpu)o(t-)o(por)o(t)p +FB(,)697 3496 y(26)365 3596 y Fx(call/fdes)p FB(,)i(30)365 +3696 y Fx(char->ascii)p FB(,)f(106)365 3796 y Fx(char-alphabetic?)p +FB(,)e(108)365 3896 y Fx(char-alphanumeric)o(?)p FB(,)g(108)365 +3997 y Fx(char-filter)p FB(,)i(20)365 4097 y Fx(char-graphic?)p +FB(,)f(108)365 4197 y Fx(char-lower-case?)p FB(,)f(108)365 +4297 y Fx(char-numeric?)82 b FB(,)21 b(108)365 4397 y +Fx(char-set)p FB(,)c(107)365 4498 y Fx(char-set-contains)o(?)p +FB(,)d(107)365 4598 y Fx(char-set-differen)o(ce)o FB(,)h(108)365 +4698 y Fx(char-set-intersec)o(ti)o(on)p FB(,)f(108)365 +4798 y Fx(char-set-invert)p FB(,)h(108)365 4898 y Fx(char-set-members)p +FB(,)f(107)1943 614 y Fx(char-set-union)p FB(,)g(108)1943 +714 y(char)o(-set:alphabetic,)k(108)1943 814 y(char)o +(-set:alphanumeric,)g(108)1943 914 y(char)o(-set:graphic,)g(108)1943 +1014 y(char)o(-set:lower)o(-case,)f(108)1943 1114 y(char)o +(-set:not-whitespace,)i(108)1943 1214 y(char)o(-set:numeric,)g(108)1943 +1314 y(char)o(-set:upper)o(-case,)e(108)1943 1414 y(char)o +(-set:whitespace,)h(108)1943 1514 y Fx(char-set?)p FB(,)f(107)1943 +1613 y Fx(char-upper-case?)o FB(,)e(108)1943 1713 y Fx +(char-whitespace?)o FB(,)g(108)1943 1813 y Fx(chars->char-set)p +FB(,)f(107)1943 1913 y Fx(chdir)p FB(,)k(59)1943 2013 +y Fx(close)p FB(,)g(25)1943 2113 y Fx(close-after)p FB(,)e(24)1943 +2213 y Fx(close-socket)p FB(,)f(90)1943 2313 y Fx(command-line)p +FB(,)g(61)1943 2413 y(command-line-ar)o(guments,)20 b(61)1943 +2513 y Fx(connect-socket)p FB(,)14 b(93)1943 2613 y Fx +(control-tty-file)o(-n)o(am)o(e)p FB(,)h(81)1943 2712 +y Fx(copy-tty-info)p FB(,)g(79)1943 2812 y Fx(cpu-ticks/sec)p +FB(,)g(60)1943 2912 y Fx(create-directory)o FB(,)g(40)1943 +3012 y Fx(create-fifo)p FB(,)h(40)1943 3112 y Fx(create-hard-link)o +FB(,)f(40)1943 3212 y Fx(create-socket)p FB(,)g(90)1943 +3312 y Fx(create-socket-pa)o(ir)o FB(,)g(90)1943 3412 +y Fx(create-symlink)p FB(,)f(40)1943 3512 y Fx(create-temp-file)o +FB(,)h(48)1943 3612 y Fx(cwd)p FB(,)k(59)1943 3799 y(date,)g(68,)h(70) +1943 3899 y Fx(date->string)p FB(,)15 b(71)1943 3999 +y Fx(define-record)p FB(,)g(7)1943 4099 y Fx(delete-directory)o +FB(,)g(40)1943 4199 y Fx(delete-file)p FB(,)h(40)1943 +4299 y Fx(delete-filesys-o)o(bj)o(ec)o(t)p FB(,)f(40)1943 +4399 y Fx(directory-as-fil)o(e-)o(na)o(me)p FB(,)f(102)1943 +4499 y Fx(directory-files)p FB(,)g(44)1943 4599 y Fx(disable-tty-char)o +FB(,)h(78)1943 4698 y Fx(drain-tty)p FB(,)i(80)1943 4798 +y Fx(dump-scsh)p FB(,)g(141)1943 4898 y Fx(dump-scsh-progra)o(m)p +FB(,)d(140)365 5147 y FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 +b(:)f(47)p 1636 5071 323 4 v 1636 5173 4 102 v 540 w +FD(DRAFT)p 1955 5173 V 1636 5176 323 4 v 1174 w FB(153)p +eop +%%Page: 154 160 +154 159 bop 681 614 a Fx(dup)p FB(,)19 b(31)681 714 y +Fx(dup->fdes)p FB(,)e(31)681 815 y Fx(dup->inport)p FB(,)f(31)681 +915 y Fx(dup->outport)p FB(,)f(31)681 1105 y Fx(enabled-interrup)o(ts)o +FB(,)g(66)681 1205 y Fx(env->alist)p FB(,)h(73)681 1305 +y Fx(errno-error)p FB(,)g(21)681 1405 y Fx(error-output-por)o(t)p +FB(,)e(24)681 1505 y Fx(exec)p FB(,)19 b(51)681 1605 +y(exec-epf,)f(13)681 1706 y Fx(exec-path)p FB(,)f(51)681 +1806 y(exec-path-list,)i(76)681 1906 y Fx(exec-path-search)o +FB(,)c(52)681 2006 y Fx(exec-path/env)p FB(,)g(51)681 +2106 y Fx(exec/env)p FB(,)i(51)681 2206 y Fx(exit)p FB(,)i(52)681 +2306 y Fx(expand-file-name)o FB(,)c(106)681 2497 y Fx(fdes->inport)p +FB(,)g(30)681 2597 y Fx(fdes->outport)p FB(,)g(30)681 +2697 y Fx(fdes-flags)p FB(,)h(32)681 2797 y Fx(fdes-status)p +FB(,)g(33)681 2897 y Fx(field-reader)p FB(,)f(1)-5 b(16)681 +2997 y Fx(field-splitter)p FB(,)14 b(1)-5 b(13)681 3097 +y Fx(file-directory?)p FB(,)14 b(43)681 3197 y Fx(file-executable?)o +FB(,)h(44)681 3297 y Fx(file-exists?)p FB(,)g(44)681 +3397 y Fx(file-fifo?)p FB(,)h(43)681 3497 y Fx(file-group)p +FB(,)g(42)681 3597 y Fx(file-info)p FB(,)h(41)681 3697 +y(\002le-info:atime,)j(42)681 3797 y(\002le-info:ctime,)g(42)681 +3898 y(\002le-info:device,)f(42)681 3998 y(\002le-info:gid,)h(42)681 +4098 y(\002le-info:inode,)h(42)681 4198 y(\002le-info:mode,)f(42)681 +4298 y(\002le-info:mtime,)h(42)681 4398 y(\002le-info:nlinks,)h(42)681 +4498 y(\002le-info:size,)e(42)681 4598 y(\002le-info:type,)g(42)681 +4698 y(\002le-info:uid,)g(42)681 4798 y Fx(file-inode)p +FB(,)c(42)681 4898 y Fx(file-last-access)o FB(,)f(42)2258 +614 y Fx(file-last-mod)p FB(,)g(42)2258 714 y Fx(file-last-status-)o +(ch)o(ang)o(e)p FB(,)f(42)2258 814 y Fx(file-match)p +FB(,)j(46)2258 914 y Fx(file-mode)p FB(,)g(42)2258 1014 +y Fx(file-name-absolut)o(e?)o FB(,)e(103)2258 1114 y +Fx(file-name-as-dire)o(ct)o(ory)o FB(,)g(102)2258 1214 +y Fx(file-name-directo)o(ry)o FB(,)g(103)2258 1314 y +Fx(file-name-directo)o(ry)o(?)p FB(,)f(102)2258 1414 +y Fx(file-name-extensi)o(on)o FB(,)h(104)2258 1514 y +Fx(file-name-non-dir)o(ec)o(tor)o(y?)o FB(,)g(102)2258 +1613 y Fx(file-name-nondire)o(ct)o(ory)o FB(,)g(103)2258 +1713 y Fx(file-name-sans-ex)o(te)o(nsi)o(on)o FB(,)g(104)2258 +1813 y Fx(file-nlinks)p FB(,)h(42)2258 1913 y Fx(file-not-executab)o +(le)o(?)p FB(,)e(43)2258 2013 y Fx(file-not-exists?)p +FB(,)g(44)2258 2113 y Fx(file-not-readable)o(?)p FB(,)g(43)2258 +2213 y Fx(file-not-writable)o(?)p FB(,)g(43)2258 2313 +y Fx(file-owner)p FB(,)j(42)2258 2413 y Fx(file-readable?)p +FB(,)e(44)2258 2513 y Fx(file-regular?)p FB(,)g(43)2258 +2613 y Fx(file-size)p FB(,)i(42)2258 2712 y Fx(file-socket?)p +FB(,)f(43)2258 2812 y Fx(file-special?)p FB(,)f(43)2258 +2912 y Fx(file-symlink?)p FB(,)g(43)2258 3012 y Fx(file-type)p +FB(,)i(42)2258 3112 y Fx(file-writable?)p FB(,)e(44)2258 +3212 y Fx(fill-in-date!)p FB(,)g(71)2258 3312 y Fx(flush-all-ports)p +FB(,)g(37)2258 3412 y Fx(flush-tty/both)p FB(,)g(80)2258 +3512 y Fx(flush-tty/input)p FB(,)g(80)2258 3612 y Fx(flush-tty/output)p +FB(,)f(80)2258 3712 y Fx(force-output)p FB(,)i(37)2258 +3811 y Fx(fork)p FB(,)j(53)2258 3911 y Fx(fork-pty-session)p +FB(,)14 b(82)2258 4011 y Fx(fork/pipe)p FB(,)j(53)2258 +4111 y Fx(fork/pipe+)p FB(,)g(54)2258 4211 y Fx(format-date)p +FB(,)f(71)2258 4399 y Fx(get-lock-region)p FB(,)f(39)2258 +4499 y Fx(getenv)p FB(,)j(73)2258 4599 y Fx(glob)p FB(,)h(45)2258 +4698 y Fx(glob-quote)p FB(,)e(46)2258 4798 y Fx(group-info)p +FB(,)g(61)2258 4898 y(gr)o(oup-info:gid,)j(61)681 5147 +y(154)p 1952 5071 323 4 v 1952 5173 4 102 v 1173 w FD(DRAFT)p +2271 5173 V 1952 5176 323 4 v 538 w FE(Mar)o(ch)f(10,)g(1997)h(\226)f +(21)13 b(:)f(47)p eop +%%Page: 155 161 +155 160 bop 365 614 a FB(gr)o(oup-info:members,)20 b(61)365 +715 y(gr)o(oup-info:name,)g(61)365 910 y Fx(home-dir)p +FB(,)d(106)365 1011 y(home-dir)o(ectory)-9 b(,)20 b(76)365 +1111 y Fx(home-file)p FB(,)d(106)365 1211 y Fx(host-info)p +FB(,)g(96)365 1407 y Fx(index)p FB(,)i(100)365 1507 y +Fx(infix-splitter)p FB(,)c(1)-5 b(13)365 1608 y Fx(internet-address-)o +(>s)o(ock)o(et)o(-ad)o(dr)o(es)o(s)p FB(,)697 1707 y(92)365 +1808 y Fx(interrupt-handler)o FB(,)15 b(67)365 1908 y +Fx(interrupt-set)p FB(,)g(66)365 2008 y Fx(itimer)p FB(,)j(63)365 +2204 y Fx(join-strings)p FB(,)e(1)-5 b(16)365 2400 y +Fx(listen-socket)p FB(,)15 b(93)365 2500 y Fx(lock-region)p +FB(,)h(39)365 2600 y Fx(lock-region/no-bl)o(oc)o(k)p +FB(,)f(39)365 2701 y(lock-r)o(egion:end,)21 b(38)365 +2801 y(lock-r)o(egion:exclusive?,)f(38)365 2901 y(lock-r)o(egion:len,)h +(38)365 3002 y(lock-r)o(egion:pr)o(oc,)f(38)365 3102 +y(lock-r)o(egion:start,)g(38)365 3202 y(lock-r)o(egion:whence,)h(38)365 +3303 y(lock-r)o(egion?,)g(38)365 3498 y Fx(make-date)p +FB(,)c(69)365 3599 y Fx(make-lock-region)p FB(,)d(39)365 +3699 y Fx(make-pty-generato)o(r)p FB(,)g(82)365 3799 +y Fx(make-regexp)p FB(,)i(99)365 3900 y Fx(make-string-input)o(-p)o +(ort)o FB(,)f(26)365 4000 y Fx(make-string-outpu)o(t-)o(por)o(t)p +FB(,)f(26)365 4101 y Fx(make-tty-info)p FB(,)h(79)365 +4201 y Fx(match:end)p FB(,)i(99)365 4301 y Fx(match:start)p +FB(,)f(99)365 4402 y Fx(match:substring)p FB(,)f(99)365 +4502 y Fx(move->fdes)p FB(,)i(30)365 4698 y Fx(network-info)p +FB(,)f(96)365 4798 y Fx(nice)p FB(,)j(60)365 4898 y Fx(nth)p +FB(,)h(125)1943 614 y Fx(open-control-tty)o FB(,)15 b(81)1943 +714 y Fx(open-fdes)p FB(,)i(32)1943 815 y Fx(open-file)p +FB(,)g(32)1943 915 y Fx(open-input-file)p FB(,)d(32)1943 +1015 y Fx(open-output-file)o FB(,)h(32)1943 1115 y Fx(open-pty)p +FB(,)i(82)1943 1305 y Fx(parent-pid)p FB(,)f(60)1943 +1405 y Fx(parse-file-name)p FB(,)e(105)1943 1505 y Fx(path-list->file-) +o(na)o(me)o FB(,)h(104)1943 1605 y Fx(pause-until-inte)o(rr)o(up)o(t)p +FB(,)g(63)1943 1706 y Fx(pid)p FB(,)k(60)1943 1806 y +Fx(pid->proc)p FB(,)e(55)1943 1906 y Fx(pipe)p FB(,)i(33)1943 +2006 y Fx(port->fdes)p FB(,)d(30)1943 2106 y Fx(port->list)p +FB(,)g(15)1943 2206 y Fx(port->sexp-list)p FB(,)e(15)1943 +2306 y Fx(port->string)p FB(,)h(15)1943 2406 y Fx(port->string-lis)o(t) +p FB(,)f(15)1943 2506 y Fx(port-revealed)p FB(,)h(30)1943 +2606 y Fx(predicate->char-)o(se)o(t)p FB(,)f(107)1943 +2706 y Fx(priority)p FB(,)j(60)1943 2806 y(pr)o(oc,)j(55)1943 +2906 y(pr)o(oc:pid,)f(55)1943 3007 y(pr)o(oc?,)g(55)1943 +3107 y Fx(process-group)p FB(,)c(60)1943 3207 y Fx(process-times)p +FB(,)g(60)1943 3307 y Fx(protocol-info)p FB(,)g(96)1943 +3407 y Fx(pty-name->tty-na)o(me)o FB(,)g(82)1943 3597 +y Fx(read-delimited)p FB(,)f(1)-5 b(10)1943 3697 y Fx(read-delimited!)p +FB(,)14 b(1)-5 b(10)1943 3797 y Fx(read-line)p FB(,)17 +b(109)1943 3898 y Fx(read-paragraph)p FB(,)d(1)-5 b(10)1943 +3998 y Fx(read-string)p FB(,)16 b(33)1943 4098 y Fx(read-string!)p +FB(,)f(33)1943 4198 y Fx(read-string!/par)o(ti)o(al)o +FB(,)g(34)1943 4298 y Fx(read-string/part)o(ia)o(l)p +FB(,)f(34)1943 4398 y Fx(read-symlink)p FB(,)h(40)1943 +4498 y Fx(reap-zombies)p FB(,)g(56)1943 4598 y Fx(receive-message)p +FB(,)f(94)1943 4698 y Fx(receive-message!)o FB(,)h(94)1943 +4798 y Fx(receive-message!)o(/p)o(ar)o(tia)o(l)p FB(,)f(94)1943 +4898 y Fx(receive-message/)o(pa)o(rt)o(ial)o FB(,)h(94)365 +5147 y FE(Mar)o(ch)k(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1174 w FB(155)p eop +%%Page: 156 162 +156 161 bop 681 614 a Fx(record-reader)p FB(,)15 b(1)-5 +b(13)681 714 y Fx(reduce-port)p FB(,)16 b(16)681 814 +y Fx(regexp-exec)p FB(,)g(99)681 914 y Fx(regexp-match?)p +FB(,)f(98)681 1014 y Fx(regexp-quote)p FB(,)g(99)681 +1114 y Fx(regexp?)p FB(,)i(99)681 1214 y Fx(release-port-han)o(dl)o(e)p +FB(,)d(30)681 1314 y Fx(rename-file)p FB(,)i(40)681 1414 +y Fx(repl)p FB(,)j(125)681 1514 y Fx(replace-extensio)o(n)p +FB(,)14 b(105)681 1613 y Fx(resolve-file-nam)o(e)p FB(,)g(106)681 +1713 y Fx(rindex)p FB(,)k(100)681 1813 y(r)o(un,)j(13)681 +1913 y Fx(run/collecting)p FB(,)14 b(17)681 2013 y Fx(run/collecting*)p +FB(,)g(17)681 2113 y Fx(run/file)p FB(,)j(14)681 2213 +y Fx(run/file*)p FB(,)g(15)681 2313 y Fx(run/port)p FB(,)g(14)681 +2413 y Fx(run/port*)p FB(,)g(15)681 2513 y Fx(run/port+proc)p +FB(,)e(17)681 2613 y Fx(run/port+proc*)p FB(,)f(17)681 +2712 y Fx(run/sexp)p FB(,)j(14)681 2812 y Fx(run/sexp*)p +FB(,)g(15)681 2912 y Fx(run/sexps)p FB(,)g(14)681 3012 +y Fx(run/sexps*)p FB(,)f(15)681 3112 y Fx(run/string)p +FB(,)g(14)681 3212 y Fx(run/string*)p FB(,)g(15)681 3312 +y Fx(run/strings)p FB(,)g(14)681 3412 y Fx(run/strings*)p +FB(,)f(15)681 3599 y Fx(seek)p FB(,)k(31)681 3699 y Fx(select)41 +b FB(,)20 b(34)681 3799 y Fx(send-message)p FB(,)15 b(94)681 +3899 y Fx(send-message/par)o(ti)o(al)p FB(,)f(94)681 +3999 y Fx(send-tty-break)p FB(,)g(80)681 4099 y Fx(service-info)p +FB(,)h(96)681 4199 y Fx(set-enabled-inte)o(rr)o(upt)o(s)p +FB(,)f(66)681 4299 y Fx(set-fdes-flags)p FB(,)g(32)681 +4399 y Fx(set-fdes-status)p FB(,)g(33)681 4499 y Fx(set-file-group)p +FB(,)g(41)681 4599 y Fx(set-file-mode)p FB(,)h(41)681 +4698 y Fx(set-file-owner)p FB(,)f(41)681 4798 y Fx(set-file-times)p +FB(,)g(41)681 4898 y Fx(set-gid)p FB(,)j(60)2258 614 +y Fx(set-interrupt-han)o(dl)o(er)p FB(,)d(66)2258 714 +y Fx(set-port-bufferin)o(g)p FB(,)g(37)2258 814 y Fx(set-priority)p +FB(,)i(60)2258 913 y Fx(set-process-group)o FB(,)f(60)2258 +1013 y Fx(set-socket-option)o FB(,)g(95)2258 1112 y Fx +(set-tty-info/drai)o(n)p FB(,)f(79)2258 1212 y Fx(set-tty-info/flus)o +(h)p FB(,)g(79)2258 1312 y Fx(set-tty-info/now)p FB(,)g(79)2258 +1411 y Fx(set-tty-process-g)o(ro)o(up)p FB(,)g(81)2258 +1511 y Fx(set-uid)p FB(,)k(60)2258 1611 y Fx(set-umask)p +FB(,)f(59)2258 1710 y Fx(setenv)p FB(,)h(73)2258 1810 +y Fx(shutdown-socket)p FB(,)d(94)2258 1910 y Fx(signal->interrupt)o +FB(,)g(66)2258 2009 y Fx(signal-process)p FB(,)g(63)2258 +2109 y Fx(signal-process-gr)o(ou)o(p)p FB(,)f(63)2258 +2208 y Fx(simplify-file-nam)o(e)p FB(,)g(105)2258 2308 +y Fx(skip-char-set)p FB(,)h(1)-5 b(1)g(1)2258 2408 y +Fx(sleep)p FB(,)19 b(63)2258 2507 y Fx(sleep-until)p +FB(,)d(63)2258 2607 y Fx(sloppy-suffix-spl)o(it)o(ter)o +FB(,)f(1)-5 b(13)2258 2707 y Fx(socket-address->i)o(nt)o(ern)o(et)o(-a) +o(ddr)o(es)o(s)p FB(,)2590 2806 y(92)2258 2906 y Fx(socket-address->u)o +(ni)o(x-a)o(dd)o(re)o(ss)p FB(,)2590 3005 y(92)2258 3105 +y Fx(socket-connect)p FB(,)15 b(89)2258 3205 y Fx(socket-local-addr)o +(es)o(s)p FB(,)f(93)2258 3304 y Fx(socket-option)p FB(,)h(95)2258 +3404 y Fx(socket-remote-add)o(re)o(ss)p FB(,)f(93)2258 +3504 y Fx(split-file-name)p FB(,)h(103)2258 3603 y Fx(start-tty-input)p +FB(,)g(80)2258 3703 y Fx(start-tty-output)p FB(,)f(80)2258 +3802 y Fx(status:exit-val)p FB(,)h(58)2258 3902 y Fx(status:stop-sig)p +FB(,)g(59)2258 4002 y Fx(status:term-sig)p FB(,)g(59)2258 +4101 y Fx(stdio->stdports)p FB(,)g(25)2258 4201 y Fx(stdports->stdio)p +FB(,)g(25)2258 4301 y Fx(stop-tty-input)p FB(,)g(80)2258 +4400 y Fx(stop-tty-output)p FB(,)g(80)2258 4500 y Fx(string->char-set)p +FB(,)f(107)2258 4599 y Fx(string-filter)p FB(,)h(20)2258 +4699 y Fx(string-match)p FB(,)h(98)2258 4799 y Fx(string-output-por)o +(t-)o(out)o(pu)o(t)p FB(,)e(26)2258 4898 y Fx(substitute-env-va)o(rs)o +FB(,)h(100)681 5147 y(156)p 1952 5071 323 4 v 1952 5173 +4 102 v 1173 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 +v 538 w FE(Mar)o(ch)k(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +eop +%%Page: 157 163 +157 162 bop 365 614 a Fx(suffix-splitter)p FB(,)15 b(1)-5 +b(13)365 714 y Fx(suspend)p FB(,)18 b(53)365 814 y Fx(sync-file)p +FB(,)f(41)365 914 y Fx(sync-file-system)p FB(,)d(41)365 +1014 y Fx(system-name)p FB(,)i(63)365 1202 y Fx(tell)p +FB(,)j(31)365 1302 y Fx(temp-file-channel)o FB(,)c(50)365 +1401 y Fx(temp-file-iterate)o FB(,)g(49)365 1501 y Fx(ticks/sec)p +FB(,)i(69)365 1601 y(time,)k(68,)f(70)365 1701 y Fx(time+ticks)p +FB(,)d(69)365 1801 y Fx(truncate-file)p FB(,)e(41)365 +1901 y Fx(tty-file-name)p FB(,)g(77)365 2001 y Fx(tty-info)p +FB(,)i(79)365 2101 y(tty-info)k(r)o(ecor)o(d)e(type,)i(77)365 +2201 y Fx(tty-info:control-)o(ch)o(ars)o FB(,)15 b(77)365 +2301 y Fx(tty-info:control-)o(fl)o(ags)o FB(,)g(77)365 +2401 y Fx(tty-info:input-fl)o(ag)o(s)p FB(,)g(77)365 +2500 y Fx(tty-info:input-sp)o(ee)o(d)p FB(,)g(77)365 +2600 y Fx(tty-info:local-fl)o(ag)o(s)p FB(,)g(77)365 +2700 y Fx(tty-info:min)p FB(,)h(77)365 2800 y Fx(tty-info:output-f)o +(la)o(gs)p FB(,)e(77)365 2900 y Fx(tty-info:output-s)o(pe)o(ed)p +FB(,)g(77)365 3000 y Fx(tty-info:time)p FB(,)h(77)365 +3100 y Fx(tty-info?)p FB(,)i(77)365 3200 y Fx(tty-name->pty-nam)o(e)p +FB(,)d(82)365 3300 y Fx(tty-process-group)o FB(,)h(81)365 +3400 y Fx(tty?)p FB(,)k(77)365 3500 y Fx(ttyc/2-stop-bits)p +FB(,)14 b(87)365 3599 y Fx(ttyc/CTS-output-f)o(lo)o(w-c)o(tl)o +FB(,)h(87)365 3699 y Fx(ttyc/RTS-input-fl)o(ow)o(-ct)o(l)p +FB(,)f(87)365 3799 y Fx(ttyc/carrier-flow)o(-c)o(tl)p +FB(,)g(87)365 3899 y Fx(ttyc/char-size)p FB(,)h(87)365 +3999 y Fx(ttyc/char-size5)p FB(,)g(87)365 4099 y Fx(ttyc/char-size6)p +FB(,)g(87)365 4199 y Fx(ttyc/char-size7)p FB(,)g(87)365 +4299 y Fx(ttyc/char-size8)p FB(,)g(87)365 4399 y Fx(ttyc/enable-parit)o +(y)p FB(,)f(87)365 4499 y Fx(ttyc/enable-read)p FB(,)g(87)365 +4599 y Fx(ttyc/hup-on-close)o FB(,)h(87)365 4698 y Fx +(ttyc/ignore-flags)o FB(,)g(87)365 4798 y Fx(ttyc/no-modem-syn)o(c)p +FB(,)f(87)365 4898 y Fx(ttyc/odd-parity)p FB(,)h(87)1943 +614 y Fx(ttychar/delayed-)o(su)o(sp)o(end)o FB(,)g(84)1943 +714 y Fx(ttychar/delete-c)o(ha)o(r)p FB(,)f(84)1943 814 +y Fx(ttychar/delete-l)o(in)o(e)p FB(,)g(84)1943 913 y +Fx(ttychar/delete-w)o(or)o(d)p FB(,)g(84)1943 1013 y +Fx(ttychar/discard)p FB(,)g(84)1943 1112 y Fx(ttychar/eof)p +FB(,)i(84)1943 1212 y Fx(ttychar/eol)p FB(,)g(84)1943 +1312 y Fx(ttychar/eol2)p FB(,)f(84)1943 1411 y Fx(ttychar/interrup)o(t) +p FB(,)f(84)1943 1511 y Fx(ttychar/literal-)o(ne)o(xt)o +FB(,)h(84)1943 1611 y Fx(ttychar/quit)p FB(,)g(84)1943 +1710 y Fx(ttychar/reprint)p FB(,)f(84)1943 1810 y Fx(ttychar/start)p +FB(,)h(84)1943 1910 y Fx(ttychar/status)p FB(,)f(84)1943 +2009 y Fx(ttychar/stop)p FB(,)h(84)1943 2109 y Fx(ttychar/suspend)p +FB(,)f(84)1943 2208 y Fx(ttyin/7bits)p FB(,)i(85)1943 +2308 y Fx(ttyin/beep-on-ov)o(er)o(fl)o(ow)p FB(,)e(85)1943 +2408 y Fx(ttyin/check-pari)o(ty)o FB(,)h(85)1943 2507 +y Fx(ttyin/cr->nl)p FB(,)g(85)1943 2607 y Fx(ttyin/ignore-bad)o(-p)o +(ar)o(ity)o(-c)o(har)o(s)p FB(,)2275 2707 y(85)1943 2806 +y Fx(ttyin/ignore-bre)o(ak)o FB(,)g(85)1943 2906 y Fx(ttyin/ignore-cr)p +FB(,)f(85)1943 3005 y Fx(ttyin/input-flow)o(-c)o(tl)o +FB(,)h(85)1943 3105 y Fx(ttyin/interrupt-)o(on)o(-b)o(rea)o(k)p +FB(,)f(85)1943 3205 y Fx(ttyin/lowercase)p FB(,)g(85)1943 +3304 y Fx(ttyin/mark-parit)o(y-)o(er)o(ror)o(s)p FB(,)g(85)1943 +3404 y Fx(ttyin/nl->cr)p FB(,)h(85)1943 3504 y Fx(ttyin/output-flo)o +(w-)o(ct)o(l)p FB(,)g(85)1943 3603 y Fx(ttyin/xon-any)p +FB(,)g(85)1943 3703 y Fx(ttyl/alt-delete-)o(wo)o(rd)o +FB(,)g(88)1943 3802 y Fx(ttyl/canonical)p FB(,)f(88)1943 +3902 y Fx(ttyl/case-map)p FB(,)h(88)1943 4002 y Fx(ttyl/echo)p +FB(,)i(88)1943 4101 y Fx(ttyl/echo-ctl)p FB(,)e(88)1943 +4201 y Fx(ttyl/echo-delete)o(-l)o(in)o(e)p FB(,)g(88)1943 +4301 y Fx(ttyl/echo-nl)p FB(,)g(88)1943 4400 y Fx(ttyl/enable-sign)o +(al)o(s)p FB(,)f(88)1943 4500 y Fx(ttyl/extended)p FB(,)h(88)1943 +4599 y Fx(ttyl/flush-outpu)o(t)p FB(,)f(88)1943 4699 +y Fx(ttyl/hardcopy-de)o(le)o(te)o FB(,)h(88)1943 4799 +y Fx(ttyl/no-flush-on)o(-i)o(nt)o(err)o(up)o(t)p FB(,)f(88)1943 +4898 y Fx(ttyl/no-kernel-s)o(ta)o(tu)o(s)p FB(,)h(88)365 +5147 y FE(Mar)o(ch)k(10,)g(1997)h(\226)f(21)13 b(:)f(47)p +1636 5071 323 4 v 1636 5173 4 102 v 540 w FD(DRAFT)p +1955 5173 V 1636 5176 323 4 v 1174 w FB(157)p eop +%%Page: 158 164 +158 163 bop 681 614 a Fx(ttyl/reprint-unr)o(ea)o(d-c)o(ha)o(rs)o +FB(,)15 b(88)681 714 y Fx(ttyl/ttou-signal)o FB(,)g(88)681 +814 y Fx(ttyl/visual-dele)o(te)o FB(,)g(88)681 914 y +Fx(ttyl/visual-dele)o(te)o(-li)o(ne)o FB(,)g(88)681 1014 +y Fx(ttyout/all-delay)o FB(,)g(86)681 1114 y Fx(ttyout/bs-delay)p +FB(,)f(86)681 1214 y Fx(ttyout/bs-delay0)o FB(,)h(86)681 +1314 y Fx(ttyout/bs-delay1)o FB(,)g(86)681 1414 y Fx(ttyout/cr->nl)p +FB(,)g(85)681 1514 y Fx(ttyout/cr-delay)p FB(,)f(86)681 +1614 y Fx(ttyout/cr-delay0)o FB(,)h(86)681 1713 y Fx(ttyout/cr-delay1)o +FB(,)g(86)681 1813 y Fx(ttyout/cr-delay2)o FB(,)g(86)681 +1913 y Fx(ttyout/cr-delay3)o FB(,)g(86)681 2013 y Fx(ttyout/delay-w/f)o +(il)o(l-c)o(ha)o(r)p FB(,)f(85)681 2113 y Fx(ttyout/discard-e)o(ot)o +FB(,)h(85)681 2213 y Fx(ttyout/enable)p FB(,)g(85)681 +2313 y Fx(ttyout/expand-ta)o(bs)o FB(,)g(85)681 2413 +y Fx(ttyout/ff-delay)p FB(,)f(86)681 2513 y Fx(ttyout/ff-delay0)o +FB(,)h(86)681 2613 y Fx(ttyout/ff-delay1)o FB(,)g(86)681 +2713 y Fx(ttyout/fill-w/de)o(l)p FB(,)f(85)681 2812 y +Fx(ttyout/nl->crnl)p FB(,)g(85)681 2912 y Fx(ttyout/nl-delay)p +FB(,)g(86)681 3012 y Fx(ttyout/nl-delay0)o FB(,)h(86)681 +3112 y Fx(ttyout/nl-delay1)o FB(,)g(86)681 3212 y Fx(ttyout/nl-does-c)o +(r)p FB(,)f(85)681 3312 y Fx(ttyout/no-col0-c)o(r)p FB(,)g(85)681 +3412 y Fx(ttyout/tab-delay)o FB(,)h(86)681 3512 y Fx(ttyout/tab-delay)o +(0)p FB(,)f(86)681 3612 y Fx(ttyout/tab-delay)o(1)p FB(,)g(86)681 +3712 y Fx(ttyout/tab-delay)o(2)p FB(,)g(86)681 3812 y +Fx(ttyout/tab-delay)o(x)p FB(,)g(86)681 3912 y Fx(ttyout/uppercase)o +FB(,)h(85)681 4011 y Fx(ttyout/vtab-dela)o(y)p FB(,)f(86)681 +4111 y Fx(ttyout/vtab-dela)o(y0)o FB(,)h(86)681 4211 +y Fx(ttyout/vtab-dela)o(y1)o FB(,)g(86)681 4399 y Fx(umask)p +FB(,)j(59)681 4499 y Fx(unix-address->so)o(ck)o(et-)o(ad)o(dr)o(ess)o +FB(,)1013 4599 y(92)681 4698 y Fx(unlock-region)p FB(,)d(39)681 +4798 y Fx(user-effective-g)o(id)o FB(,)g(60)681 4898 +y Fx(user-effective-u)o(id)o FB(,)g(60)2258 614 y Fx(user-gid)p +FB(,)i(60)2258 714 y(user)o(-info,)j(61)2258 814 y(user)o(-info:gid,)g +(61)2258 913 y(user)o(-info:home-dir)-6 b(,)20 b(61)2258 +1013 y(user)o(-info:name,)g(61)2258 1112 y(user)o(-info:shell,)g(61) +2258 1212 y(user)o(-info:uid,)g(61)2258 1312 y Fx(user-login-name)p +FB(,)15 b(60)2258 1411 y Fx(user-supplementar)o(y-)o(gid)o(s)p +FB(,)f(60)2258 1511 y Fx(user-uid)p FB(,)j(60)2258 1694 +y Fx(wait)p FB(,)i(57)2258 1793 y Fx(wait-any)p FB(,)e(57)2258 +1893 y Fx(wait-process-grou)o(p)p FB(,)d(58)2258 1993 +y Fx(with-current-inpu)o(t-)o(por)o(t)p FB(,)g(24)2258 +2092 y Fx(with-current-inpu)o(t-)o(por)o(t*)o FB(,)h(24)2258 +2192 y Fx(with-current-outp)o(ut)o(-po)o(rt)o FB(,)g(24)2258 +2291 y Fx(with-current-outp)o(ut)o(-po)o(rt)o(*)p FB(,)f(24)2258 +2391 y Fx(with-cwd)p FB(,)j(59)2258 2491 y Fx(with-cwd*)p +FB(,)g(59)2258 2590 y Fx(with-enabled-inte)o(rr)o(upt)o(s)p +FB(,)d(66)2258 2690 y Fx(with-enabled-inte)o(rr)o(upt)o(s*)o +FB(,)h(66)2258 2790 y Fx(with-env)p FB(,)i(74)2258 2889 +y Fx(with-env*)p FB(,)g(74)2258 2989 y Fx(with-errno-handle)o(r)p +FB(,)d(22)2258 3088 y Fx(with-errno-handle)o(r*)o FB(,)h(22)2258 +3188 y Fx(with-error-output)o(-p)o(ort)o FB(,)g(24)2258 +3288 y Fx(with-error-output)o(-p)o(ort)o(*)p FB(,)f(24)2258 +3387 y Fx(with-region-lock)p FB(,)g(39)2258 3487 y Fx +(with-region-lock*)o FB(,)h(39)2258 3587 y Fx(with-stdio-ports)p +FB(,)f(26)2258 3686 y Fx(with-stdio-ports*)o FB(,)h(26)2258 +3786 y Fx(with-total-env)p FB(,)g(74)2258 3885 y Fx(with-total-env*)p +FB(,)g(74)2258 3985 y Fx(with-umask)p FB(,)i(59)2258 +4085 y Fx(with-umask*)p FB(,)f(59)2258 4184 y Fx(write-string)p +FB(,)g(35)2258 4284 y Fx(write-string/part)o(ia)o(l)p +FB(,)e(36)681 5147 y(158)p 1952 5071 323 4 v 1952 5173 +4 102 v 1173 w FD(DRAFT)p 2271 5173 V 1952 5176 323 4 +v 538 w FE(Mar)o(ch)19 b(10,)g(1997)h(\226)f(21)13 b(:)f(47)p eop %%Trailer end diff --git a/doc/scsh-manual/man.tex b/doc/scsh-manual/man.tex index 7e802ae..eda3bec 100644 --- a/doc/scsh-manual/man.tex +++ b/doc/scsh-manual/man.tex @@ -10,6 +10,8 @@ \parskip = 3pt plus 3pt \sloppy +%\includeonly{syscalls} + \input{decls} \makeindex %%% End preamble diff --git a/doc/scsh-manual/procnotation.tex b/doc/scsh-manual/procnotation.tex index d6cd0bd..ce76480 100644 --- a/doc/scsh-manual/procnotation.tex +++ b/doc/scsh-manual/procnotation.tex @@ -187,8 +187,8 @@ There are three basic {\Scheme} forms that use extended process forms: \ex{exec-epf}, \cd{&}, and \ex{run}. \dfn {exec-epf} {. \var{epf}} {\noreturn} {syntax} -\dfnx {\&} {. \var{epf}} {\integer} {syntax} -\dfnx {run} {. \var{epf}} {\integer} {syntax} +\dfnx {\&} {. \var{epf}} {proc} {syntax} +\dfnx {run} {. \var{epf}} {proc} {syntax} \begin{desc} \index{exec-epf} \index{\&} \index{run} The \ex{(exec-epf . \var{epf})} form nukes the current process: it establishes @@ -257,7 +257,9 @@ to capture the output of processes as {\Scheme} data. \dfnx{run/sexps} {. \var{epf}} {list} {syntax} \begin{desc} These forms all fork off subprocesses, collecting the process' output -to stdout in some form or another. +to stdout in some form or another. +The subprocess runs with file descriptor 1 and the current output port +bound to a pipe. \begin{desctable}{0.7\linewidth} \ex{run/port} & Value is a port open on process's stdout. Returns immediately after forking child. \\ diff --git a/doc/scsh-manual/rdelim.tex b/doc/scsh-manual/rdelim.tex index eae40e9..97ee3e0 100644 --- a/doc/scsh-manual/rdelim.tex +++ b/doc/scsh-manual/rdelim.tex @@ -31,6 +31,8 @@ There are four possible choices for a \ex{handle-delim} parameter: \hline \end{tabular} \end{inset} +The first case, \ex{'trim}, is the standard default for all the routines +described in this section. The last three cases allow the programmer to distinguish between strings that are terminated by a delimiter character, and strings that are terminated by an end-of-file. @@ -68,7 +70,7 @@ See section~\ref{sec:char-sets} for information on character set manipulation. \begin{desc} Read until we encounter one of the chars in \var{char-set} or eof. The \var{handle-delim} parameter determines how the terminating character - is handled. It is described above, and defaults to \ex{'peek}. + is handled. It is described above, and defaults to \ex{'trim}. The \var{char-set} argument may be a charset, a string, a character, or a character predicate; it is coerced to a charset. @@ -94,7 +96,7 @@ See section~\ref{sec:char-sets} for information on character set manipulation. If an integer is returned (\ie, the read is successfully terminated by reading a delimiter character), then the \var{handle-delim} parameter determines how the terminating character is handled. - It is described above, and defaults to \ex{'peek}. + It is described above, and defaults to \ex{'trim}. \end{desc} @@ -137,3 +139,10 @@ the procedure call. % fills up, %READ-DELIMITED! will peek at one more character from the % input stream to determine if it terminates the input. If so, that % is returned, not #f. + +\begin{defundesc} {skip-char-set} {skip-chars [port]} {\integer} + Skip characters occurring in the set \var{skip-chars}; + return the number of characters skipped. + The \var{skip-chars} argument may be a charset, a string, a character, or a + character predicate; it is coerced to a charset. +\end{defundesc} diff --git a/doc/scsh-manual/running.tex b/doc/scsh-manual/running.tex index 9dd336d..5cbd3fc 100644 --- a/doc/scsh-manual/running.tex +++ b/doc/scsh-manual/running.tex @@ -181,6 +181,7 @@ where & \ex{-ds} & Do script. \\ \\ \var{end-option:} & \ex{-s} \var{script} \\ + & \ex{-sfd} \var{num} \\ & \ex{-c} \var{exp} \\ & \ex{--} \end{tabular} @@ -297,6 +298,14 @@ The following switches and end options are defined: by the switch-scanner and are passed through to the program as the tail of the command-line list. +\Item{-sfd \var{num}} + Loads the script from file descriptor \var{num}. + This switch is like the \ex{-s} switch, + except that the script is loaded from one of the process' open input + file descriptors. + For example, to have the script loaded from standard input, specify + \ex{-sfd 0}. + \Item{--} Terminate argument scanning and start up scsh in interactive mode. If the argument list just runs out, without either a terminating @@ -418,17 +427,19 @@ The only special characters are space, tab, newline, and backslash. six space characters, but you really have a tab character, and \emph{vice-versa}. -\item The newline character terminates the sequence of arguments, - and will also terminate a final non-empty argument. - (However, a newline following a space does not introduce a final - empty-string argument; it only terminates the argument list.) +\item The newline character terminates an argument, like the space character, + and also terminates the argument sequence. + This means that an empty line parses to the singleton list whose one + element is the empty string: \ex{("")}. + The grammar doesn't admit the empty list. \item The backslash character is the escape character. It escapes backslash, space, tab, and newline, turning off their special functions, and allowing them to be included in arguments. - The {\Ansi} C escape sequences, such as \verb|\n| and \verb|\t| are - also supported; these also produce argument-constituents---\verb|\n| - doesn't act like a terminating newline. + The {\Ansi} C escape sequences (\verb|\b|, \verb|\n|, \verb|\r| + and \verb|\t|) are also supported; + these also produce argument-constituents---\verb|\n| doesn't act + like a terminating newline. The escape sequence \verb|\|\emph{nnn} for \emph{exactly} three octal digits reads as the character whose {\Ascii} code is \emph{nnn}. It is an error if backslash is followed by just one or two octal digits: @@ -555,7 +566,9 @@ sort foo bar {\evalto} /usr/local/bin/scsh \\ sort foo bar {\evalto} /usr/local/bin/scsh -dm -m sort-toplevel -e top -s sort foo bar\end{centercode}} -An alternate method would have used a \ex{-n -o sort-toplevel} +An alternate method would have used a +\begin{code} +-n #f -o sort-toplevel\end{code} sequence of switches to specify a top-level package. \end{itemize} @@ -580,8 +593,9 @@ If these computations terminate with no errors, the scsh process exits with an exit code of 0. To return a specific exit status, use the \ex{exit} procedure explicitly, \eg, - \codex{scsh -c "(exit (run (| (fmt) (mail shivers@lcs.mit.edu))))"} - +\begin{tightcode} +scsh -c \\ + "(exit (status:exit-val (run (| (fmt) (mail shivers)))))"\end{tightcode} \section{The scsh virtual machine} To run the {\scm} implementation of scsh, you run a specially modified diff --git a/doc/scsh-manual/strings.tex b/doc/scsh-manual/strings.tex index 7837de0..a5a58e4 100644 --- a/doc/scsh-manual/strings.tex +++ b/doc/scsh-manual/strings.tex @@ -39,11 +39,19 @@ The code uses Henry Spencer's regular expression package. Returns the start position of the match denoted by \var{match-number}. The whole regexp is 0. Each further number represents positions enclosed by \ex{(\ldots)} sections. \var{Match-number} defaults to 0. + + If the regular expression matches as a whole, + but a particular parenthesized sub-expression does not match, then + \ex{match:start} returns {\sharpf}. \end{defundesc} \begin{defundesc} {match:end} {match [match-number]} \fixnum Returns the end position of the match denoted by \var{match-number}. \var{Match-number} defaults to 0 (the whole match). + + If the regular expression matches as a whole, + but a particular parenthesized sub-expression does not match, then + \ex{match:end} returns {\sharpf}. \end{defundesc} \begin{defundesc} {match:substring} {match [match-number]} \str @@ -51,10 +59,6 @@ The code uses Henry Spencer's regular expression package. \var{Match-number} defaults to 0 (the whole match). \end{defundesc} -\oops{Scsh regex matching doesn't currently flag un-matched subexpressions -in the \ex{match:begin}, \ex{match:end}, and \ex{match:substring} functions. -This needs to be fixed.} - Regular expression matching compiles patterns into special data structures which can be efficiently used to match against strings. The overhead of compiling patterns that will be used for multiple @@ -74,20 +78,6 @@ searches can be avoided by these lower-level routines: otherwise {\sharpf}. \var{Start} defaults to 0. \end{defundesc} -\begin{remarkenv} -The truth: S48 doesn't have the facilities for extending the garbage -collector to malloc'd C storage (unlike elk). So we do not really export -regular expression compilation. What we currently do is this: -\begin{tightcode} -(define regexp? string?) -(define (make-regexp str) str) -(define (regexp-exec regexp str [start]) - (string-match regexp str [start]))\end{tightcode} -% -This could be improved upon in another implementation (like elk). -\end{remarkenv} - - \defun{regexp-quote}{str}{\str} \begin{desc} Returns a regular expression that matches the string \var{str} exactly. diff --git a/doc/scsh-manual/syscalls.tex b/doc/scsh-manual/syscalls.tex index b381845..e0ef2a6 100644 --- a/doc/scsh-manual/syscalls.tex +++ b/doc/scsh-manual/syscalls.tex @@ -32,7 +32,7 @@ packet, it is \emph{not} accessed through a global variable. For reference purposes, the {\Unix} \ex{errno} numbers are bound to the variables \ex{errno/perm}, \ex{errno/noent}, {\etc} System calls never return \ex{error/intr}---they -automatically retry. (Currently only true for I/O calls.) +automatically retry. \begin{dfndesc} {errno-error}{errno syscall .\ data}{\noreturn}{procedure} @@ -111,10 +111,6 @@ the \ex{errno/intr} exception is never raised. If the programmer wishes to abort a system call on an interrupt, he should have the interrupt handler explicitly raise an exception or invoke a stored continuation to throw out of the system call. -\remark{This is not strictly true in the current implementation---only -some of the i/o syscalls loop. -But BSD variants never return \ex{EINTR} anyway, unless you explicitly -request it, so we'll live w/it for now.} \end{dfndescx} @@ -195,13 +191,13 @@ These procedures alter the dynamic binding of the current I/O port procedures to new values. \end{desc} -\defun {close} {port/fd} {\boolean} +\defun {close} {fd/port} {\boolean} \begin{desc} Close the port or file descriptor. - If \var{port/fd} is a file descriptor, and it has a port allocated to it, + If \var{fd/port} is a file descriptor, and it has a port allocated to it, the port is shifted to a new file descriptor created with \ex{(dup - port/fd)} before closing \ex{port/fd}. The port then has its revealed + fd/port)} before closing \ex{fd/port}. The port then has its revealed count set to zero. This reflects the design criteria that ports are not associated with file descriptors, but with open files. @@ -238,9 +234,9 @@ to new values. descriptors. It is exactly equivalent to the series of assignments \begin{code} -(set-current-input-port! (fdes->inport 0)) -(set-current-output-port! (fdes->inport 1)) -(set-error-output-port! (fdes->inport 2))\end{code} +(set-current-input-port! (fdes->inport 0)) +(set-current-output-port! (fdes->outport 1)) +(set-error-output-port! (fdes->outport 2))\end{code} However, you are more likely to find the dynamic-extent variant, \ex{with-stdio-ports*}, below, to be of use in general programming. \end{desc} @@ -275,7 +271,7 @@ interface described herein may be liable to change. \end{desc} \defun {make-string-output-port} {} {\port} -\defunx {string-output-port-output} {port} {\port} +\defunx {string-output-port-output} {port} {\str} \begin{desc} A string output port is a port that collects the characters given to it into a string. @@ -369,7 +365,7 @@ are used to shift back and forth between file descriptors and ports. When \ex{port->fdes} reveals a port's file descriptor, it increments the port's \var{revealed} field. When the user is through with the file descriptor, he can call \ex{(release-port-handle \var{port})}, which decrements the count. -The function \ex{(call/fdes fdes/port \var{proc})} automates this protocol. +The function \ex{(call/fdes fd/port \var{proc})} automates this protocol. \ex{call/fdes} uses \ex{dynamic-wind} to enforce the protocol. If \var{proc} throws out of the \ex{call/fdes} application, the unwind handler releases the descriptor handle; @@ -523,20 +519,20 @@ Decrement the port's revealed count. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{{\Unix} I/O} -\defun {dup} {port/fd [newfd]} {port/fd} -\defunx{dup->inport} {port/fd [newfd]} {port} -\defunx{dup->outport} {port/fd [newfd]} {port} -\defunx{dup->fdes} {port/fd [newfd]} {fd} +\defun {dup} {fd/port [newfd]} {fd/port} +\defunx{dup->inport} {fd/port [newfd]} {port} +\defunx{dup->outport} {fd/port [newfd]} {port} +\defunx{dup->fdes} {fd/port [newfd]} {fd} \begin{desc} These procedures provide the functionality of C's \ex{dup()} and \ex{dup2()}. The different routines return different types of values: \ex{dup->inport}, \ex{dup->outport}, and \ex{dup->fdes} return input ports, output ports, and integer file descriptors, respectively. \ex{dup}'s return value depends on on the type of -\var{port/fd}---it maps fd$\rightarrow$fd and port$\rightarrow$port. +\var{fd/port}---it maps fd$\rightarrow$fd and port$\rightarrow$port. These procedures use the {\Unix} \ex{dup()} syscall to replicate -the file descriptor or file port \var{port/fd}. +the file descriptor or file port \var{fd/port}. If a \var{newfd} file descriptor is given, it is used as the target of the dup operation, \ie, the operation is a \ex{dup2()}. In this case, procedures that return a port (such as \ex{dup->inport}) @@ -587,26 +583,17 @@ this is dependent on the OS implementation. \begin{defundesc} {open-file} {fname flags [perms]} {\port} \var{Perms} defaults to \cd{#o666}. - \var{Flags} is an integer bitmask, composed by or'ing together the following - constants: -\begin{code}\codeallowbreaks -open/read ; You may only -open/write ; choose one -open/read+write ; of these three -open/no-control-tty -open/nonblocking -open/append -open/create -open/truncate -open/exclusive - . ; Your Unix may have - . ; a few more.\end{code} + \var{Flags} is an integer bitmask, composed by or'ing together constants + listed in table~\ref{table:fdes-status-flags} + (page~\pageref{table:fdes-status-flags}). + You must use exactly one of the \ex{open/read}, \ex{open/write}, or + \ex{open/read+write} flags. % -Returns a port. The port is an input port if the \var{flags} permit it, -otherwise an output port. \R4RS/\scm/scsh do not have input/output ports, -so it's one or the other. This should be fixed. (You can hack simultaneous -i/o on a file by opening it r/w, taking the result input port, -and duping it to an output port with \ex{dup->outport}.) + The returned port is an input port if the \var{flags} permit it, + otherwise an output port. \R4RS/\scm/scsh do not have input/output ports, + so it's one or the other. This should be fixed. (You can hack simultaneous + i/o on a file by opening it r/w, taking the result input port, + and duping it to an output port with \ex{dup->outport}.) \end{defundesc} \defun{open-input-file}{fname [flags]}\port @@ -626,6 +613,89 @@ and duping it to an output port with \ex{dup->outport}.) Returns a file descriptor. \end{defundesc} +\defun{fdes-flags}{fd/port}{\integer} +\begin{defundescx}{set-fdes-flags}{fd/port \integer}{\undefined} +These procedures allow reading and writing of an open file's flags. +The only such flag defined by {\Posix} is \ex{fdflags/close-on-exec}; +your {\Unix} implementation may provide others. + +These procedures should not be particularly useful to the programmer, +as the scsh runtime already provides automatic control of the close-on-exec +property. +Unrevealed ports always have their file descriptors marked +close-on-exec, as they can be closed when the scsh process execs a new program. +Whenever the user reveals or unreveals a port's file descriptor, +the runtime automatically sets or clears the flag for the programmer. +Programmers that manipulate this flag should be aware of these extra, automatic +operations. +\end{defundescx} + +\defun{fdes-status}{fd/port}{\integer} +\begin{defundescx}{set-fdes-status}{fd/port \integer}{\undefined} +These procedures allow reading and writing of an open file's status flags +(table~\ref{table:fdes-status-flags}). +% +\begin{table} +\begin{center} +\begin{tabular}{@{}rp{1.5in}>{\ttfamily}l@{}} +& Allowed operations & Status flag \\ \cline{2-3} +\textbf{Open+Get+Set} & + \parbox[t]{1.5in}{\raggedright + These flags can be used in \ex{open-file}, \ex{fdes-status}, + and \ex{set-fdes-status} calls.} & +% + \begin{tabular}[t]{@{}>{\ttfamily}l@{}} + %% These are gettable and settable + open/append \\ + open/non-blocking \\ + open/async \textrm{(Non-\Posix)} \\ + open/fsync \textrm{(Non-\Posix)} + \end{tabular} +\\\cline{2-3} +\textbf{Open+Get} & + \parbox[t]{1.5in}{\raggedright + These flags can be used in \ex{open-file} and \ex{fdes-status} calls, + but are ignored by \ex{set-fdes-status}.\strut} & +% + \begin{tabular}[t]{@{}>{\ttfamily}l@{}} + %% These are gettable, not settable + open/read \\ + open/write \\ + open/read+write \\ + open/access-mask + \end{tabular} +\\\cline{2-3} +\textbf{Open} & + \parbox[t]{1.5in}{\raggedright + These flags are only relevant in + \ex{open-file} calls; + they are ignored by \ex{fdes-status} and \ex{set-fdes-status} calls.} & +% + \begin{tabular}[t]{@{}>{\ttfamily}l@{}} + %% These are neither gettable nor settable. + open/create \\ + open/exclusive \\ + open/no-control-tty \\ + open/truncate + \end{tabular} +\end{tabular} +\end{center} +\caption{Status flags for \texttt{open-file}, + \texttt{fdes-status} and \texttt{set-fdes-status}. + Only {\Posix} flags are guaranteed to be present; + your operating system may define others. + The \texttt{open/access-mask} value is not an actual flag, + but a bit mask used to select the field for the \texttt{open/read}, + \texttt{open/write} and \texttt{open/read+write} bits. + } +\label{table:fdes-status-flags} +\end{table} + +Note that this file-descriptor state is shared between file descriptors +created by \ex{dup}---if you create port \var{b} by applying \ex{dup} +to port \var{a}, and change {\var{b}}'s status flags, you will also have +changed {\var{a}}'s status flags. +\end{defundescx} \begin{defundesc}{pipe}{} {[\var{rport} \var{wport}]} Returns two ports, the read and write end-points of a {\Unix} pipe. @@ -702,8 +772,8 @@ Returns two ports, the read and write end-points of a {\Unix} pipe. of any particular read operation. \end{desc} -\defun {select }{rvec wvec evec [timeout]}{rvec' wvec' evec'} -\defunx{select!}{rvec wvec evec [timeout]}{nr nw ne} +\defun {select }{rvec wvec evec [timeout]}{[rvec' wvec' evec']} +\defunx{select!}{rvec wvec evec [timeout]}{[nr nw ne]} \begin{desc} The \ex{select} procedure allows a process to block and wait for events on multiple I/O channels. @@ -849,14 +919,14 @@ buffering is turned off $\var{policy} = \ex{bufpol/none}$). \end{defundesc} -\begin{defundesc}{force-output} {[fd/port]}{\noreturn} +\begin{defundesc}{force-output} {[fd/port]}{\undefined} This procedure does nothing when applied to an integer file descriptor or unbuffered port. It flushes buffered output when applied to a buffered port, and raises a write-error exception on error. Returns no value. \end{defundesc} -\begin{defundesc}{flush-all-ports} {}{\noreturn} +\begin{defundesc}{flush-all-ports} {}{\undefined} This procedure flushes all open output ports with buffered data. \end{defundesc} @@ -877,6 +947,11 @@ not with associated open file descriptors. Once a process locks a file, using some file descriptor \var{fd}, the next time \emph{any} file descriptor referencing that file is closed, all associated locks are released. +This severely limits the utility of {\Posix} advisory file locks, +and we'd recommend caution when using them. +It is not without reason that the FreeBSD man pages refer to {\Posix} +file locking as ``completely stupid.'' + Scsh moves Scheme ports from file descriptor to file descriptor with \ex{dup()} and \ex{close()} as required by the runtime, so it is impossible to keep file locks open across one of these shifts. @@ -892,6 +967,7 @@ associated file descriptor. NeXTSTEP users should also note that even minimalist {\Posix} file locking is not supported for NFS-mounted files in NeXTSTEP; NeXT claims they will fix this in NS release 4. +We'd appreciate hearing from users when and if this happens. } {\Posix} allows the user to lock a region of a file with either @@ -903,14 +979,18 @@ Locked regions are described by the \emph{lock-region} record: start len whence - pid)\end{code} -\index{lock-region?} -\index{lock-region:exclusive?} \index{lock-region:whence} -\index{lock-region:start} \index{lock-region:end} -\index{lock-region:len} \index{lock-region:pid} + proc)\end{code}% +\index{lock-region?}% +\index{lock-region:exclusive?} \index{lock-region:whence}% +\index{lock-region:start} \index{lock-region:end}% +\index{lock-region:len} \index{lock-region:proc}% % +\begin{itemize} +\item The \ex{exclusive?} field is true if the lock is exclusive; false if it is shared. + +\item The \ex{whence} field is one of the values from the \ex{seek} call: \ex{seek/set}, \ex{seek/delta}, or \ex{seek/end}, and determines the interpretation of the \ex{start} field: @@ -923,9 +1003,15 @@ file descriptor's current position in the file. end of the file. \end{itemize} The region of the file being locked is given by the \ex{start} and \ex{len} -fields. -The \ex{pid} field gives the process id of the process holding the region +fields; +if \ex{len} is zero, it means ``infinity,'' that is, the region extends +from the starting point through the end of the file, even as the file is +extended by subsequent write operations. + +\item +The \ex{proc} field gives the process object for the process holding the region lock, when relevant (see \ex{get-lock-region} below). +\end{itemize} \begin{defundesc}{make-lock-region}{exclusive? start len [whence]}{lock-region} This procedure makes a lock-region record. @@ -940,14 +1026,24 @@ These procedures lock a region of the file referenced by file descriptor The \ex{lock-region} procedure blocks until the lock is granted; the non-blocking variant returns a boolean indicating whether or not the lock was granted. +To take an exclusive (write) lock, you must have the file descriptor +open with write access; +to take a shared (read) lock, you must have the file descriptor +open with read access. \end{desc} \begin{defundesc}{get-lock-region}{fdes lock}{lock-region or \sharpf} -Return the first lock region on \var{fdes} that overlaps with -the lock region \var{lock}. -If there is no such lock, return false. -This procedure fills out the \ex{pid} field of the returned lock region, +Return the first lock region on \var{fdes} that would conflict with +lock region \var{lock}. +If there is no such lock region, return false. +This procedure fills out the \ex{proc} field of the returned lock region, and is the only procedure that has anything to do with this field. +(See section~\ref{sec:proc-objects} for a description of process objects.) +Note that if you apply this procedure to a file system that is shared +across multiple operating systems (\ie, an NFS file system), the \ex{proc} +field may be ambiguous. +We note, again, that {\Posix} advisory file locking is not a terribly useful +or well-designed facility. \end{defundesc} \begin{defundesc}{unlock-region}{fdes lock}{\undefined} @@ -1705,7 +1801,7 @@ Suspend the current process with a SIGSTOP signal. \begin{code} (fork (\l{} (fork/pipe a) (b)))\end{code} % - which returns the pid of \ex{b}'s process. + which returns the process object for \ex{b}'s process. To create a background three-process pipe \ex{a | b | c}, we write: % @@ -1714,7 +1810,7 @@ Suspend the current process with a SIGSTOP signal. (fork/pipe b) (c)))\end{code} % - which returns the pid of \ex{c}'s process. + which returns the process object for \ex{c}'s process. Note that these procedures affect file descriptors, not ports. That is, the pipe is allocated connecting the child's file descriptor @@ -1844,18 +1940,22 @@ values \ex{'early}, \ex{'late}, or {\sharpf} (\ie, no autoreap). \begin{description} \item [early] The child is reaped from the {\Unix} kernel's process table - into scsh as soon as possible after it dies. In the current - release of scsh, this happens at the next call to - \ex{wait}---when scsh is asked to wait for a particular - child to exit, it will reap \emph{all} outstanding zombies. - When signal handlers are added to a future release of scsh, - early autoreaping will use the \ex{SIGCHLD} signal to reap - zombies with minimum delay. + into scsh as soon as it dies. This is done by having a + signal handler for the \ex{SIGCHLD} signal reap the process. + \emph{ + If a scsh program sets its own handler for the \ex{SIGCHLD} + signal, the handler must reap dead children + by calling \ex{wait}, \ex{wait-any}, or \ex{reap-zombies}.} + We deprecate interrupt-driven code, and hope to provide + alternative tools in a future, multi-threaded release of scsh. \item [late] The child is not autoreaped until it dies \emph{and} the scsh program drops all pointers to its process object. That is, the process table is cleaned out during garbage collection. + \oops{The \ex{late} policy is not supported under the current + release of scsh. It requires more sophisticated gc hooks than + we can get from the release of {\scm} that we use.} \item [\sharpf] If autoreaping is turned off, process reaping is completely under @@ -2043,8 +2143,8 @@ Otherwise, this function returns false. \defun {umask}{} \fixnum \defunx {set-umask} {perms} \undefined -\defunx {with-umask*} {perms thunk} {values of thunk} -\dfnx {with-umask} {perms . body} {values of body} {syntax} +\defunx {with-umask*} {perms thunk} {value(s) of thunk} +\dfnx {with-umask} {perms . body} {value(s) of body} {syntax} \begin{desc} The process' current umask is retrieved with \ex{umask}, and set with \ex{(set-umask \var{perms})}. Calling \ex{with-umask*} changes the umask @@ -2080,20 +2180,20 @@ The special form \ex{with-cwd} is simply syntactic sugar for \ex{with-cwd*}. \defun {pid}{} \fixnum \defunx {parent-pid}{} \fixnum \defunx {process-group} {} \fixnum -\defunx {set-process-group} {[proc] pgrp} \undefined % [not implemented] +\defunx {set-process-group} {[proc/pid] pgrp} \undefined % [not implemented] \begin{desc} \ex{(pid)} and \ex{(parent-pid)} retrieve the process id for the current process and its parent. \ex{(process-group)} returns the process group of the current process. A process' process-group can be set with \ex{set-process-group}; -the value \var{pid} specifies the affected process. It may be either +the value \var{proc/pid} specifies the affected process. It may be either a process object or an integer process id, and defaults to the current process. \end{desc} \defun {set-priority} {which who priority} \undefined %; priority stuff unimplemented \defunx {priority} {which who} \fixnum % ; not implemented -\defunx {nice} {[pid delta]} \undefined %; not implemented +\defunx {nice} {[proc/pid delta]} \undefined %; not implemented \begin{desc} These procedures set and access the priority of processes. I can't remember how \ex{set-priority} and \ex{priority} work, so no @@ -2279,7 +2379,8 @@ fully-qualified domain name such as ``solar.csie.ntu.edu.tw.'' \section{Signal system} Signal numbers are bound to the variables \ex{signal/hup}, \ex{signal/int}, -\ldots +\ldots. See tables~\ref{table:signals-and-interrupts} and +\ref{table:uncatchable-signals} for the full list. \defun {signal-process} {proc sig} \undefined \defunx {signal-process-group} {prgrp sig} \undefined @@ -2290,24 +2391,194 @@ The \var{proc} and \var{prgrp} arguments are either processes or integer process ids. \end{desc} -I haven't done signal handlers yet. Should be straightforward: a mechanism -to assign procedures to signals. - \defun{itimer}{???} \undefined \defunx{pause-until-interrupt}{} \undefined \defun{sleep}{secs} \undefined +\defunx{sleep-until}{time}\undefined \begin{desc} -Sleeping is defined, but we don't offer a way to sleep for a more precise -interval (\eg, a microsecond timer), as this is not in {\Posix}. +The \ex{sleep} procedure causes the process to sleep for \var{secs} seconds. +The \ex{sleep-until} procedure causes the process to sleep until \var{time} +(see section~\ref{sec:time}). \end{desc} +\subsubsection{Interrupt handlers} +Scsh interrupt handlers are complicated by the fact that scsh is implemented on +top of the {\scm} virtual machine, which has its own interrupt system, +independent of the Unix signal system. +This means that {\Unix} signals are delivered in two stages: first, +{\Unix} delivers the signal to the {\scm} virtual machine, then +the {\scm} virtual machine delivers the signal to the executing Scheme program +as a {\scm} interrupt. +This ensures that signal delivery happens between two vm instructions, +keeping individual instructions atomic. + +The {\scm} machine has its own set of interrupts, which includes the +asynchronous {\Unix} signals (table~\ref{table:signals-and-interrupts}). +\begin{table} +\begin{minipage}{\textwidth} +\begin{center} +\newcommand{\kwd}[1]{\index{\texttt{#1}}\texttt{#1}} +\begin{tabular}{lll}\hline +Interrupt & Unix signal & OS Variant \\ \hline\hline +\kwd{interrupt/alrm}\footnote{Also bound to {\scm} interrupt + \kwd{interrupt/alarm}.} + & \kwd{signal/alrm} & \Posix \\ +% +\kwd{interrupt/int}\footnote{Also bound to {\scm} interrupt + \kwd{interrupt/keyboard}.} + & \kwd{signal/int} & \Posix \\ +% +\kwd{interrupt/memory-shortage} & N/A & \\ +\kwd{interrupt/chld} & \kwd{signal/chld} & \Posix \\ +\kwd{interrupt/cont} & \kwd{signal/cont} & \Posix \\ +\kwd{interrupt/hup} & \kwd{signal/hup} & \Posix \\ +\kwd{interrupt/quit} & \kwd{signal/quit} & \Posix \\ +\kwd{interrupt/term} & \kwd{signal/term} & \Posix \\ +\kwd{interrupt/tstp} & \kwd{signal/tstp} & \Posix \\ +\kwd{interrupt/usr1} & \kwd{signal/usr1} & \Posix \\ +\kwd{interrupt/usr2} & \kwd{signal/usr2} & \Posix \\ +\\ +\kwd{interrupt/info} & \kwd{signal/info} & BSD only \\ +\kwd{interrupt/io} & \kwd{signal/io} & BSD + SVR4 \\ +\kwd{interrupt/poll} & \kwd{signal/poll} & SVR4 only \\ +\kwd{interrupt/prof} & \kwd{signal/prof} & BSD + SVR4 \\ +\kwd{interrupt/pwr} & \kwd{signal/pwr} & SVR4 only \\ +\kwd{interrupt/urg} & \kwd{signal/urg} & BSD + SVR4 \\ +\kwd{interrupt/vtalrm} & \kwd{signal/vtalrm} & BSD + SVR4 \\ +\kwd{interrupt/winch} & \kwd{signal/winch} & BSD + SVR4 \\ +\kwd{interrupt/xcpu} & \kwd{signal/xcpu} & BSD + SVR4 \\ +\kwd{interrupt/xfsz} & \kwd{signal/xfsz} & BSD + SVR4 \\ +\end{tabular} +\end{center} +\caption{{\scm} virtual-machine interrupts and related {\Unix} signals. + Only the {\Posix} signals are guaranteed to be defined; however, + your implementation and OS may define other signals and + interrupts not listed here.} +\end{minipage} +\label{table:signals-and-interrupts} +\end{table} +% +\begin{table} +\newcommand{\kwd}[1]{\index{\texttt{#1}}\texttt{#1}} +\begin{center} +\begin{tabular}{lll}\hline +Unix signal & Type & OS Variant \\ \hline\hline +\kwd{signal/stop} & Uncatchable & \Posix \\ +\kwd{signal/kill} & Uncatchable & \Posix \\ +\\ +\kwd{signal/abrt} & Synchronous & \Posix \\ +\kwd{signal/fpe} & Synchronous & \Posix \\ +\kwd{signal/ill} & Synchronous & \Posix \\ +\kwd{signal/pipe} & Synchronous & \Posix \\ +\kwd{signal/segv} & Synchronous & \Posix \\ +\kwd{signal/ttin} & Synchronous & \Posix \\ +\kwd{signal/ttou} & Synchronous & \Posix \\ +\\ +\kwd{signal/bus} & Synchronous & BSD + SVR4 \\ +\kwd{signal/emt} & Synchronous & BSD + SVR4 \\ +\kwd{signal/iot} & Synchronous & BSD + SVR4 \\ +\kwd{signal/sys} & Synchronous & BSD + SVR4 \\ +\kwd{signal/trap} & Synchronous & BSD + SVR4 \\ +\end{tabular} +\end{center} +\caption{Uncatchable and synchronous {\Unix} signals. While these signals + may be sent with \texttt{signal-process} or + \texttt{signal-process-group}, + there are no corresponding scsh interrupt handlers. + Only the {\Posix} signals are guaranteed to be defined; however, + your implementation and OS may define other signals not listed + here.} +\label{table:uncatchable-signals} +\end{table} +Note that scsh does \emph{not} support signal handlers for ``synchronous'' +{\Unix} signals, such as \ex{signal/ill} or \ex{signal/pipe} +(see table~\ref{table:uncatchable-signals}). +Synchronous occurrences of these signals are better handled by raising +a Scheme exception. +We recommend you avoid using signal handlers unless you absolutely have +to; we intend to provide a better, higher-level interface to {\Unix} +signals after scsh has been ported to a multi-threaded platform. + +\begin{defundesc}{signal->interrupt}{\integer}{\integer} +The programmer maps from {\Unix} signals to {\scm} interrupts with the +\ex{signal->interrupt} procedure. +If the signal does not have a defined {\scm} interrupt, an errror is signaled. +\end{defundesc} + + +\begin{defundesc}{interrupt-set}{\zeroormore{\integer}}{\integer} +This procedure builds interrupt sets from its interrupt arguments. +A set is represented as an integer using a two's-complement representation of +the bit set. +\end{defundesc} + + +\defun{enabled-interrupts}{}{interrupt-set} +\defunx{set-enabled-interrupts}{interrupt-set}{interrupt-set} +\begin{desc} +Get and set the value of the enabled-interrupt set. +Only interrupts in this set have their handlers called when delivered. +When a disabled interrupt is delivered to the {\scm} machine, it is +held pending until it becomes enabled, at which time its handler is invoked. + +Interrupt sets are represented as integer bit sets (constructed with +the \ex{interrupt-set} function). +The \ex{set-enabled-interrupts} procedure returns the previous value of +the enabled-interrupt set. +\end{desc} + +\dfn {with-enabled-interrupts} {interrupt-set . body} {value(s) of body} {syntax} +\defunx{with-enabled-interrupts*}{interrupt-set thunk} {value(s) of thunk} +\begin{desc} +Run code with a given set of interrupts enabled. +Note that ``enabling'' an interrupt means enabling delivery from +the {\scm} vm to the scsh program. +Using the {\scm} interrupt system is fairly lightweight, and does not involve +actually making a system call. +Note that enabling an interrupt means that the assigned interrupt handler +is allowed to run when the interrupt is delivered. +Interrupts not enabled are held pending when delivered. + +Interrupt sets are represented as integer bit sets (constructed with +the \ex{interrupt-set} function). +\end{desc} + + +\begin{defundesc}{set-interrupt-handler}{interrupt handler}{old-handler} +Assigns a handler for a given interrupt, +and returns the interrupt's old handler. +The \var{handler} argument is \ex{\#f} (ignore), \ex{\#t} (default), or a +procedure taking an integer argument; +the return value follows the same conventions. +Note that the \var{interrupt} argument is an interrupt value, +not a signal value. +An interrupt is delivered to the {\scm} machine by (1) blocking all interrupts, +and (2) applying the handler procedure to the set of interrupts +that were enabled prior to the interrupt delivery. +If the procedure returns normally (\ie, it doesn't throw to a continuation), +the set of enabled interrupts will be returned to its previous value. +(To restore the enabled-interrupt set before throwing out of an interrupt +handler, see \ex{set-enabled-interrupts}) + +\note{If you set a handler for the \ex{interrupt/chld} interrupt, + you may break scsh's autoreaping process machinery. See the + discussion of autoreaping in section~\ref{sec:proc-objects}.} +\end{defundesc} + +\begin{defundesc}{interrupt-handler}{interrupt}{handler} +Return the handler for a given interrupt. +Note that the argument is an interrupt value, not a signal value. +A handler is either \ex{\#f} (ignore), \ex{\#t} (default), or a +procedure taking an integer argument. +\end{defundesc} + +% %set-unix-signal-handler +% %unix-signal-handler %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Time} \label{sec:time} -This time package does not currently work with NeXTSTEP, as NeXTSTEP -does not provide a {\Posix}-compliant time library that will even link. Scsh's time system is fairly sophisticated, particularly with respect to its careful treatment of time zones. @@ -2316,6 +2587,9 @@ all of the complexity is optional, and defaulting all the optional arguments reduces the system to a simple interface. +\remark{This time package does not currently work with NeXTSTEP, as NeXTSTEP +does not provide a {\Posix}-compliant time library that will even link.} + \subsection{Terminology} ``UTC'' and ``UCT'' stand for ``universal coordinated time,'' which is the official name for what is colloquially referred to as ``Greenwich Mean diff --git a/doc/scsh-manual/tty.tex b/doc/scsh-manual/tty.tex index 191fa3c..fba6abe 100644 --- a/doc/scsh-manual/tty.tex +++ b/doc/scsh-manual/tty.tex @@ -61,6 +61,18 @@ each operating system inevitably has non-standard extensions. While a particular scsh implementation may provide these extensions, they are not portable, and so are not documented here. +\subsection{Miscellaneous procedures} +\defun{tty?}{fd/port}{\boolean} +\begin{desc} +Return true if the argument is a tty. +\end{desc} + +\defun{tty-file-name}{fd/port}{\str} +\begin{desc} +The argument \var{fd/port} must be a file descriptor or port open on a tty. +Return the file-name of the tty. +\end{desc} + \subsection{The tty-info record type} The primary data-structure that describes a terminal's mode is @@ -317,14 +329,14 @@ If the scsh process already has a control terminal, the results are undefined. To arrange for the process to have no control terminal prior to calling this procedure, use the \ex{become-session-leader} procedure. -\oops{The control terminal code was added just before release time - for scsh release 0.4. Control terminals are one of the less-standardised - elements of Unix. We can't guarantee that the terminal is definitely - attached as a control terminal; we were only able to test this out - on HP-UX. If you intend to use this feature on your OS, you should - test it out first. If your OS requires the use of the \ex{TIOCSCTTY} - \ex{ioctl}, uncomment the appropriate few lines of code in the - file \ex{tty1.c} and send us email.} +%\oops{The control terminal code was added just before release time +% for scsh release 0.4. Control terminals are one of the less-standardised +% elements of Unix. We can't guarantee that the terminal is definitely +% attached as a control terminal; we were only able to test this out +% on HP-UX. If you intend to use this feature on your OS, you should +% test it out first. If your OS requires the use of the \ex{TIOCSCTTY} +% \ex{ioctl}, uncomment the appropriate few lines of code in the +% file \ex{tty1.c} and send us email.} \end{desc} \defun{become-session-leader}{}{\integer} @@ -352,6 +364,16 @@ This pair of procedures gets and sets the process group of a given terminal. \end{desc} +\defun{control-tty-file-name}{}{\str} +\begin{desc} +Return the file-name of the process' control tty. +On every version of Unix of which we are aware, this is just the string +\ex{"/dev/tty"}. +However, this procedure uses the official Posix interface, so it is more +portable than simply using a constant string. +\end{desc} + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Pseudo-terminals} Scsh implements an interface to Berkeley-style pseudo-terminals. diff --git a/doc/scsh-manual/xman.tex b/doc/scsh-manual/xman.tex index 2b63f4f..19cc0ef 100644 --- a/doc/scsh-manual/xman.tex +++ b/doc/scsh-manual/xman.tex @@ -4,7 +4,7 @@ \documentclass[twoside]{report} \usepackage{code,boxedminipage,draftfooters,makeidx,palatino,ct, - headings,mantitle,array,matter,mysize10,a4wide} + headings,mantitle,array,matter,a4} % Style issues \parskip = 3pt plus 3pt