From 0b4cfa8d2101a8702fd2ccb0c9c46b5357de1954 Mon Sep 17 00:00:00 2001 From: shivers Date: Tue, 8 Apr 1997 21:44:41 +0000 Subject: [PATCH] Added warning about opening the scsh structure before the scheme structure in modules. --- doc/scsh-manual.ps | 11473 +++++++++++++++++++++---------------------- 1 file changed, 5615 insertions(+), 5858 deletions(-) diff --git a/doc/scsh-manual.ps b/doc/scsh-manual.ps index b63c5cd..c3138b4 100644 --- a/doc/scsh-manual.ps +++ b/doc/scsh-manual.ps @@ -1,14 +1,14 @@ %!PS-Adobe-2.0 %%Creator: dvipsk 5.58f Copyright 1986, 1994 Radical Eye Software %%Title: man.dvi -%%Pages: 164 +%%Pages: 167 %%PageOrder: Ascend %%BoundingBox: 0 0 612 792 %%DocumentFonts: Palatino-Bold Palatino-Roman Palatino-Italic %%EndComments %DVIPSCommandLine: dvips -o man.ps man.dvi %DVIPSParameters: dpi=600, compressed, comments removed -%DVIPSSource: TeX output 1997.03.31:1731 +%DVIPSSource: TeX output 1997.04.08:1742 %%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 @@ -225,7 +225,7 @@ df<131FEBFF8C3801E0DE3803807E3807007C48133C121E123E003C5B127CA3485BA215 14F8003C137814F85AA438F001F0A3EB03E014C0EA7007148038380F00EA3C3CEA1FF8EA 07E015247DA21B>I E /Fg 167[40 4[31 3[47 5[20 73[{ TeXBase1Encoding ReEncodeFont}4 59.999974 /Palatino-Roman -rf /Fh 74 125 df<123C127E12FFAF127EAE123C1200A7123C127E12FFA4127E123C08 +rf /Fh 85 126 df<123C127E12FFAF127EAE123C1200A7123C127E12FFA4127E123C08 2F71AE27>33 D<00101320007C13F838FE01FCAAEAFC00007C13F8A900381370161778AE 27>I<90383C03C090387E07E0A7EBFE0F01FC13C0A2003FB512FC4814FEB7FCA36C14FE 3901F81F80AC007FB512FEB7FCA36C14FE6C14FC3903F03F00A200075BEBE07EA73803C0 @@ -233,170 +233,199 @@ rf /Fh 74 125 df<123C127E12FFAF127EAE123C1200A7123C127E12FFA4127E123C08 F0393F87C7F8387E07C3007C13C100FCEBC0FC12F814C1A300FCEBC0F800FE1470007F14 001387EA3FFF7E6C13F86C13FE6CEBFF80C614C0010F13E06D13F014CFECC3F814C10038 EBC0FC127C00FE147CA412FC00FE14F8007E13C1007FEBC3F0383F87C79038F7FFE06CB5 -12C06C1480000314006C13FC38003FE0EB07C0A56D5A1E3A7CB327>I40 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 +12C06C1480000314006C13FC38003FE0EB07C0A56D5A1E3A7CB327>I<131FEB7FC0497E +5A80EA03F1EBE1F8EA07E013C0A513C15C9039C3F1FF80D9E3E113C03803E7E3EBEFC101 +FF1480913881F800EC01F0EA01FEEBFC0301F85B00031307D807FC5B120F381FFE0FD83F +BE5BEB3F1FD87E1F90C7FC149F38FC0FBF14FE1307ECFC020103EB0F80EB01F8A238FE03 +FC387E07FE397F1FFF9F6CB61200149F6CEB0FFE390FFC03FC3903F000F822307EAE27> +38 D40 D<127012F812FE7E6C7E6C7EEA0FE06C7E1203 +7F6C7E1200137EA27FA2EB1F80A3EB0FC0A4EB07E0ACEB0FC0A4EB1F80A3EB3F00A2137E +A25B1201485A5B1207485AEA3FC0485A48C7FC5A12F81270133A7AB327>I<130F497EA6 +0078EB81E000FEEB87F000FF138FEBDFBF6CB512E06C14C0000F1400000313FCC613F0A2 +000313FC000F13FF003F14C04814E039FFDFBFF0EB1F8F00FE13870078EB81E00000EB80 +00A66DC7FC1C207BA627>II<120FEA3FC013E0EA7FF0A213F8A2123FA2120F120113F01203EA07E0 +121FEA7FC0EAFF8013005A12700D14738927>I<007FB512F8B612FCA46C14F81E067C99 +27>I<121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A0A728927>I<1538157C15FCA2140115 +F8140315F0140715E0140F15C0141F1580143F1500A25C147E14FE5C13015C13035C1307 +5C130F5CA2131F5C133F91C7FC5B137E13FE5B12015B12035BA212075B120F5B121F5B12 +3F90C8FC5A127E12FE5AA25A12781E3A7CB327>II<130E131FA2 +5B5BA25B5A5A127FB5FCA213BFEA7E3F1200B3AA003FB512805A15C01580A21A2F79AE27 +>IIII<001FB512E04814F0A315E090C8FCACEB1FF0EBFFFC14FF158015C09038F03FE09038 +C00FF0EB0007003EEB03F8001C1301C7FC15FC1400A3127C12FEA2140115F84813036C14 +F0007F130F9038801FE0393FE07FC06CB512806C14006C5B000113F838007FC01E2F7CAD +27>I<14FF010713C0011F13F04913F890B5FC48EB81FC3803FE0113F8EA07F0EA0FE090 +38C000F8001F1400485A90C8FCA25A127EEB0FF838FE3FFE48B51280B612C015E09038F8 +0FF09038E007F890388001FC90C7FC15FE48147E157F153FA3127EA3127F6C147F157E6C +6C13FE9038C001FC120F9038F007F83907F81FF06CB512E06C14C06C148090383FFE00EB +0FF820307DAE27>I<1278B612FE15FFA315FE39FC0001FCEC03F8EC07F0007814E0C712 +0FEC1FC01580143FEC7F00147E14FE5C13015C13035C13075CA2495AA3495AA3133F91C7 +FCA55B137EA9133C20307DAE27>III<121EEA7F80A2EAFFC0A4EA7F +80A2EA1E00C7FCAC121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A20729F27>I<120FEA3F +C0A2EA7FE0A4EA3FC0A2EA0F00C7FCAC120FEA3F8013C0127F13E0A3123FA2120F120713 +C0120FA2EA3F80EA7F005A5A12F812700B2A739F27>I<007FB512FEB7FCA4003F14FEC9 +FCA6003FB512FEB7FCA46C14FE20127D9F27>61 D<1230127812FE7E13C06C7EEA3FF8EA +0FFC6C7E3801FF806C7FEB3FF06D7EEB0FFEEB03FF6D13C09038007FE0EC3FF8EC0FFC14 +07A2140FEC3FF8EC7FE0903801FFC0491300EB0FFEEB1FF8495AEBFFC0485BD807FEC7FC +485AEA3FF8EA7FE0485A90C8FC5A127812301E287CAA27>IIII<007FB5FCB612C08115F87E3907E003FCEC00FE157E157F81A6157EA25D1403 +EC0FF890B55A15C015F081819038E000FE157FED3F80151FA2ED0FC0A6151F1680153FED +7F004A5A007FB55AB65A5D15E06C1480222E7FAD27>I<903803F80E90381FFE1F90383F +FFBF90B6FC5A3803FE0F3807F803497E48487E485A49137FA248C7123FA25A127E151E15 +0012FE5AAA7E127EA2151E007F143F7EA26C7E157F6D137E6C6C13FE3907F001FCEBF803 +3903FE0FF86CB512F06C14E0013F13C06D1300EB03F820307DAE27>I<387FFFFC14FFB6 +12C06C80813907E00FF81407EC01FC6E7EA2157E157F811680151FA316C0150FABED1F80 +A3153F1600A25D15FEA24A5A4A5A140F007FB55A5DB65A6C91C7FC14FC222E7FAD27>I< +007FB61280B712C0A37E3907E0000FA6ED078092C7FCA4EC07804A7EA390B5FCA5EBE00F +A36E5A91C8FCA4ED03C0ED07E0A7007FB6FCB7FCA36C15C0232E7FAD27>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 +FCAC387FFF80B57EA36C5B222E7EAD27>I<903807F03890381FFC7C90387FFFFC90B5FC +5A3803FC1F3807F00F380FE007EBC003001F13011380123F90C7FCA2127EA2157892C7FC +5AA8EC1FFF4A1380A3007E6D1300EC00FCA36C1301A21380121FEBC003120FEBE0073807 +F00F3803FC1F6CB5FC7EEB7FFE90381FFC78D907F0C7FC21307DAE27>I<3A7FFE07FFE0 +B54813F0A36C486C13E03A07E0007E00AF90B512FEA59038E0007EB03A7FFE07FFE0B548 +13F0A36C486C13E0242E7FAD27>I<007FB512E0B612F0A36C14E039001F8000B3B2007F +B512E0B612F0A36C14E01C2E7BAD27>I<3A7FFC07FF8016C0486C5A6C487E16803A07C0 +01F80014035D4A5A4A5A141F5D4AC7FC147E14FE5CEBC1F8EBC3F013C75CEBCFF0EBDFF8 +13FF8013FEEBFC7E143EEBF83F497E01E07F140F01C07F1407811403816E7EA26E7E157C +157E3A7FFC01FFC016E0486C5A6C487E16C0232E7FAD27>75 D<387FFFC080B5FC7E5CD8 +03F0C8FCB3AAED0780ED0FC0A7007FB6FCA2B7FC7E1680222E7FAD27>II<3A7FF003FFE0486C4813F0A213FC007F6D13E000 +079038003E0013DEA313CFA3148013C714C0A213C314E0A213C114F0A3EBC0F8A3147814 +7CA2143C143EA2141E141F140FA3EC07BEA3EC03FEEA7FFCEAFFFE1401A26C486C5A242E +7FAD27>II<007FB5FCB612E081816C803907E003FEEC00FF81ED3F80 +151F16C0150FA6151F1680153FED7F005DEC03FE90B55A5D5D5D92C7FC01E0C8FCADEA7F +FEB5FCA36C5A222E7FAD27>I<387FFFF0B512FE6E7E816C803907E01FF014076E7E1401 +811400A514015D14034A5A141F90B55A5D5DA281EBE01F6E7E14076E7EA816F0EDF1F8A4 +397FFE01FBB5EBFFF08016E06C48EB7FC0C8EA1F00252F7FAD27>82 +D<90387FC0E03901FFF1F0000713FF5A5AEA3FE0EB801F387F000F007E130712FE5A1403 +A3EC01E06C90C7FC127E127FEA3FC013F86CB47E6C13F86C13FE6CEBFF80C614C0010F13 +E0010013F0140FEC07F81403140115FC1400127812FCA46CEB01F8A26C130390388007F0 +9038F01FE090B5FC15C0150000F85B38701FF81E307CAE27>I<007FB61280B712C0A439 +FC03F00FA60078EC0780000091C7FCB3AB90B512C04880A36C5C222E7EAD27>I<3A7FFE +01FFF8B54813FCA36C486C13F83A07E0001F80B3AB6D133F00031500A26D5B0001147E6D +13FE6C6C485A90387F87F814FF6D5B010F13C06D5BD901FEC7FC262F80AD27>I<3A7FFC +03FFE06D5A00FF15F0007F15E0497E3A07E0007E00A46C6C5BA4EBF80100015CA46C6C48 +5AA490387E07E0A56D485AA4011F5B149FA3010F90C7FCA5EB07FEA46D5AA26D5A242F7F +AD27>II<393FFC1FFE387FFE3F815D +383FFC1F3903F00FE001F85B1201EBFC1F00005CEBFE3F017E90C7FCEB7F7FEB3F7E14FE +6D5AA26D5AA26D5AA21303130780130F80131F80EB3F7E147F497E017E7F141F01FC7F14 +0FD801F87F14071203496C7E120701E07F3A7FFC0FFF8000FF15C06D5A497E007F158022 +2E7EAD27>I<3A7FFC03FFE06D5A00FF15F0007F15E0497E3A07F000FE0000035CEBF801 +00015CA2EBFC0300005CEBFE07017E5BA26D485AA290381F9F80A3010F90C7FCA2EB07FE +A26D5AA26D5AAF90381FFF80497FA36D5B242E7FAD27>I<387FFFF0B512F8A314F000FC +C7FCB3B3ACB512F014F8A36C13F0153A71B327>91 D<127812F87EA27E127E127F7E7F12 +1F7F120F7F12077F1203A27F12017F12007F137E137F7F80131F80130FA2801307801303 +80130180130080147E147F80A21580141F15C0140F15E0140715F0140315F8140115FC14 +00A2157C15381E3A7CB327>I<387FFFF0B512F8A37EEA0001B3B3ACEA7FFFB5FCA36C13 +F0153A7EB327>I<131C137E3801FF80000713E0001F13F84813FC38FFE7FF13C3130000 +FC133F0078131E180B79AD27>I<13E0EA01F01207120F13E0EA1FC0EA3F00A2127E127C +12FC5AA4B4FC138013C0127FA2123F1380EA0F000C1773B227>96 +D<3803FFC0000F13F04813FC4813FF811380EC1FC0381F000F000480C71207A2EB0FFF13 +7F0003B5FC120F5A383FFC07EA7FC0130012FE5AA46C130F007F131FEBC0FF6CB612806C +15C07E000313F1C69038807F8022207C9F27>IIIIII<153F90391F +C0FF80D97FF313C048B612E05A4814EF390FF07F873A1FC01FC3C0EDC000EB800F48486C +7EA66C6C485AEBC01FA2390FF07F8090B5C7FC5C485BEB7FF0EB1FC090C9FCA27F6CB5FC +15E015F84814FE4880EB8001007EC7EA3F80007C140F00FC15C0481407A46C140F007C15 +80007F143F6C6CEB7F009038F807FF6CB55A000714F86C5CC614C0D90FFCC7FC23337EA0 +27>II<130F497E497E +A46D5A6DC7FC90C8FCA7383FFF80487FA37EEA000FB3A4007FB512F0B6FC15F815F07E1D +2F7BAE27>I +107 D<387FFF80B57EA37EEA000FB3B2007FB512F8B612FCA36C14F81E2E7CAD27>I<39 +7F07C01F3AFF9FF07FC09039FFF9FFE091B57E7E3A0FFC7FF1F89038F03FC001E0138001 +C01300A3EB803EB03A7FF0FFC3FF486C01E3138001F913E701F813E36C4801C313002920 +819F27>I<387FE07F39FFF1FFC001F713F090B5FC6C80000313C1EC01FCEBFE005B5BA2 +5BB03A7FFF83FFE0B500C713F0A36C018313E024207F9F27>II<387FE0FFD8FFF313C090B512F0816C800003EB81FE +49C67E49EB3F8049131F16C049130FA216E01507A6150F16C07F151F6DEB3F80157F6DEB +FF009038FF83FEECFFFC5D5D01F313C0D9F0FEC7FC91C8FCAC387FFF80B57EA36C5B2331 +7F9F27>I<90380FF03C90383FFE7E90B5FC000314FE5A380FFC1F381FE007EBC003383F +800148C7FC127EA200FE147E5AA67E007E14FEA2007F1301EA3F80EBC003381FE007380F +F81F6CB5FC7E6C147E38007FFCEB0FF090C7FCAC91381FFFF8A24A13FC6E13F8A226317E +9F27>I<397FFC03FC39FFFE0FFF023F13804A13C0007F90B5FC39007FFE1F14F89138F0 +0F809138E002004AC7FC5CA291C8FCA2137EAD007FB57EB67EA36C5C22207E9F27>I<90 +38FFF3800007EBFFC0121F5A5AEB803F38FC000F5AA2EC07806C90C7FCEA7F8013FC383F +FFF06C13FC000713FF00011480D8000F13C09038003FE014070078EB03F000FC1301A27E +14036CEB07E0EBE01F90B512C01580150000FB13FC38707FF01C207B9F27>I<133C137E +A8007FB512F0B612F8A36C14F0D8007EC7FCAE1518157EA415FE6D13FC1483ECFFF86D13 +F06D13E0010313C0010013001F297EA827>I<397FE01FF8486C487EA3007F131F000313 +00B21401A21403EBFC0F6CB612E016F07EEB3FFE90390FF87FE024207F9F27>I<3A7FFC +0FFF80486C4813C0A36C486C13803A07C000F800EBE00100035CA2EBF00300015CA2EBF8 +0700005CA390387C0F80A36D48C7FCA3EB3F3FEB1F3EA214FE6D5AA36D5AA26D5A22207E +9F27>I<3A7FFE07FFE000FF15F06D5A497E007F15E03A0F80001F00A36D5B0007143EA4 +14F0EBC1F83903E3FC7CA4EBE79EA200011478A301F713F8A2EBFF0F6C5CA3EBFE079038 +7C03E024207F9F27>I<393FFC1FFF486C5A168016006C487E3901F807E06C6C485A4A5A +017E90C7FC6D5AEB1F7E5C6D5A13076D5A5C80497E130F497E143EEB3E3FEB7E1F90387C +0F8001F87F00016D7E3803F0033A7FFE1FFF80A2B54813C06C486C1380A222207E9F27> +I<3A7FFC0FFF80486C4813C0A36C486C13803A07E000F800000313015D13F00001130301 +F85B1200A26D485A137CA290387E0F80133EA2011F90C7FC5CA2130F149E14BE130714FC +1303A25C1301A25CA213035CA213075C1208EA3E0F007F5B131FD87E7FC8FCEA7FFE6C5A +5B6C5AEA07C022317E9F27>I<001FB512FE4814FFA490380001FEEC03FCEC07F8EC0FF0 +001EEB1FE0C7EA3FC0EC7F80ECFF00495A495A495AEB1FE0495A495A49C7FC485A484813 +1E4848133F485A485A485A485AB7FCA46C14FE20207E9F27>II<127812FCB3B3B3 +A21278063A70B327>II 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 @@ -443,19 +472,22 @@ FC127F5B6C5A6C5AEA0F801E2C7E9C23>121 D E /Fk 104[75 2[37 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 +rf /Fl 140[32 30 1[45 41 1[66 1[42 5[36 3[37 14[50 2[59 +20[19 58[{.167 SlantFont TeXBase1Encoding ReEncodeFont}11 +75.000000 /Palatino-Roman rf /Fm 1 4 df<1338A50060130C00F8133E00FC137E00 +FE13FE383FBBF83807FFC000011300EA007C48B4FC000713C0383FBBF838FE38FE00FC13 +7E00F8133E0060130C00001300A517197B9A22>3 D E /Fn 7 94 +df<12C07E12707E7E7E120F6C7E6C7EA26C7E6C7EA21378A2137C133C133E131EA2131F +7FA21480A3EB07C0A6EB03E0B2EB07C0A6EB0F80A31400A25B131EA2133E133C137C1378 +A25BA2485A485AA2485A48C7FC120E5A5A5A5A5A13527CBD20>41 +D<15301578B3A6007FB812F8B912FCA26C17F8C80078C8FCB3A6153036367BAF41>43 +D48 DI<007FB812F8B912FCA3CCFCAEB912FCA36C17F836167B9F41>61 D91 D93 D E /Fn 5 111 df93 D E /Fo 5 111 df97 DI<3907801FC0390FE07FF03918F0E0F83930F1807CEBFB00D860FE133C5B5B00C114 7C5B1201A248485BA34A5AEA07C01660EC03E0A23A0F8007C0C0A2EDC180913803C300D8 -1F0013C7EC01FE000EEB00F8231B7D9929>110 D E /Fo 167[35 +1F0013C7EC01FE000EEB00F8231B7D9929>110 D E /Fp 167[35 4[28 3[42 5[18 73[{TeXBase1Encoding ReEncodeFont}4 53.333281 -/Palatino-Roman rf /Fp 4 53 df<13E01201120712FF12F91201B3A7487EB512C0A2 +/Palatino-Roman rf /Fq 4 53 df<13E01201120712FF12F91201B3A7487EB512C0A2 12217AA01E>49 DI<13FF000313C0380F03E0 @@ -477,7 +509,7 @@ D<130E131F5BA2133E131C90C7FCA7EA03E0487EEA0C78EA187C1230A212605B12C0A2EA A2380003E0EB00F01478147C143E143F1230127812FCA2143E48137E0060137C003813F8 381E03F0380FFFC00001130018227DA01E>I<14E01301A213031307A2130D131D133913 31136113E113C1EA01811203EA07011206120C121C12181230127012E0B6FCA2380001E0 -A6EB03F0EB3FFFA218227DA11E>I E /Fq 9 115 df<007FB612FEA2B8FCA36C15FEA228 +A6EB03F0EB3FFFA218227DA11E>I E /Fr 9 115 df<007FB612FEA2B8FCA36C15FEA228 077BA133>45 DI114 D E /Fr 14 121 df<153815FC14011407EC0FF8EC1FE0 +B7FCA46C5C2C2C7DAB33>114 D E /Fs 14 121 df<153815FC14011407EC0FF8EC1FE0 EC7FC0ECFF00495A495A495A495A5C495A495A49C7FC137E13FE485A5B12035B485AA248 5AA2121F5B123F90C8FCA35A127EA312FE5AAB127C127EA3123E123FA26C7EA26C7E7F6C 7E120313FC12016C7E137C131C1E426DB92C>40 D<14E0497E80806D7E147FEC3F80141F @@ -545,12 +577,12 @@ F9FFF8000790B5FC4815FCD81FF013F03A3FC07FE07E9039803FC0FED87F001381007E14 8300FE140348EC01FC16F891387F00F0C71400147EA214FEA25CA201011418001E157E00 3F5B127F018314FE00FF15FC01031301D8FE07EB03F839FC0FFC073A7E1FFE1FF0007FB6 12E06C15C0023F1300390FFC1FFE3903F007F027247AA32C>120 -D E /Fs 107[33 33 25[37 34 55 38 40 22 28 26 1[40 36 +D E /Ft 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 +41 35 44 1[40 52 55 63 2[22 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}59 66.666667 +/Palatino-Roman rf /Fu 12 107 df<007FB81280B912C0A26C17803204799641>0 D50 DI<126012F0B3B3B3B3A91260045377BD17>106 -D E /Fu 8 117 df<140EB3A2B812E0A3C7000EC8FCB3A22B2B7DA333>43 +D E /Fv 8 117 df<140EB3A2B812E0A3C7000EC8FCB3A22B2B7DA333>43 D<13381378EA01F8121F12FE12E01200B3AB487EB512F8A215267BA521>49 D<13FF000313E0380E03F0381800F848137C48137E00787F12FC6CEB1F80A4127CC7FC15 005C143E147E147C5C495A495A5C495A010EC7FC5B5B903870018013E0EA018039030003 @@ -594,14 +626,14 @@ C7FC0018C8FCA7137F3819FFE0381F81F0381E0078001C7F0018133EC7FC80A21580A212 7DA521>I104 D<13C0A41201A3120312 07120F121FB512E0A23807C000AC1430A73803E060A23801F0C03800FF80EB3F0014257F -A31A>116 D E /Fv 134[55 50 83 55 61 33 44 39 61 61 55 +A31A>116 D E /Fw 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 +rf /Fx 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 +172.833377 /Palatino-Bold rf /Fy 94 127 df<121C127FEAFF80B1EA7F00AF123E C7FCA8121C127FA2EAFF80A3EA7F00A2121C09346FB32C>33 D<003C131E007F137F4814 80A66C1400A6007E7FA6003E133EA3003C131E001C131C191977B32C>I<010F133C9038 1F807EA8013F13FE4A5AA4007FB612F0B712F8A4003F15F03A007E01F800A5EBFE0301FC @@ -844,7 +876,7 @@ B55A49C8FC6D7E6C7FC67F131FEB07F01303B380EB01FEECFFC06D13FF6E1380141F1407 7E6C7FC67F131FEB07F01303B380EB01FEECFFC06D13FF6E1380141F147F91B512004913 C04AC7FCEB03F85CB31307EB1FE013FF007F5BB55A49C8FC13F8EA7FC021417BB92C>I< 01F81370D803FE13F8380FFF0148138748EBCFF0397F9FFFE0D8FF0F13C0D8FC07138039 -F803FE00387000F81D0A79B22C>I E /Fy 14 121 df<133F14C0EB07F06D7E801301A2 +F803FE00387000F81D0A79B22C>I E /Fz 14 121 df<133F14C0EB07F06D7E801301A2 6D7EA3147FA36E7EA36E7EA36E7EA36E7EA36E7EA36E7EA26E7EA214014A7E5C4A7E9138 1E3F80143C14784A6C7E1301EB03E049486C7EEB0F80EB1F00496D7E137E5B48486D7E48 5A485A000F6E7E485A485A48C87E12FE167F4816800070151F293B7CB930>21 @@ -894,37 +926,33 @@ D<903907E001F090391FF807FC9039783E0E0F9039E01F1C1FD801C09038383F803A0380 0FF07F0100EBE0FF5A000E4A1300000C157E021F133C001C4AC7FC1218A2C7123FA292C8 FCA25CA2147EA214FEA24A130CA20101141C001E1518003F5BD87F81143801835C00FF15 60010714E03AFE0E7C01C0D87C1C495A2778383E0FC7FC391FF00FFC3907C003F029267E -A42F>120 D E /Fz 105[42 27[42 46 42 69 46 51 28 37 32 +A42F>120 D E /FA 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 +/Palatino-Bold rf /FB 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 +83.333337 /Palatino-Italic rf /FC 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 +rf /FD 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 3[37 1[37 4[19 44[{.167 SlantFont TeXBase1Encoding ReEncodeFont} -20 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 +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[{ +TeXBase1Encoding ReEncodeFont}19 119.999948 /Palatino-Bold +rf /FF 140[39 36 2[50 2[27 3[53 2[44 1[41 1[46 26[51 +16[46 46 3[46 1[23 46[{TeXBase1Encoding ReEncodeFont}13 +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[{ TeXBase1Encoding ReEncodeFont}13 170.833325 /Palatino-Bold rf end @@ -935,18 +963,16 @@ TeXDict begin %%EndSetup %%Page: 1 1 -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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +1 0 bop 75 1114 a FG(Scsh)41 b(Reference)i(Manual)p 75 +1183 3900 34 v 2539 1283 a FF(For)23 b(scsh)f(r)n(elease)f(0.4.5)75 +4280 y FE(Olin)29 b(Shivers)g(and)h(Brian)f(D.)g(Carlstrom)p +75 4350 3900 17 v eop %%Page: 2 2 -2 1 bop 681 1303 a FC(Acknowledgements)681 1784 y FB(Who)24 +2 1 bop 681 1303 a FD(Acknowledgements)681 1784 y FC(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 +b(all)h(the)h(while)g(becoming)g(famous)f(on)h FB(my)e +FC(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) @@ -977,315 +1003,303 @@ b(I'm)25 b(not)f(twitching.)37 b(I'm)25 b(contr)o(olling)681 (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 +3727 y(I)h(think.)805 3851 y(Oh,)g(yes,)g(the)g FB(acknowledgements.)k +FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +4243 y(September)e(4,)h(1994)2089 5147 y(ii)p eop %%Page: 3 3 -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 +3 2 bop 365 1307 a FD(Contents)365 1852 y FA(1)83 b(Introduction)2217 +b(1)490 1981 y FC(1.1)86 b(Obtaining)21 b(scsh)63 b Fz(:)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 +(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b FC(1)490 +2110 y(1.2)86 b(Building)21 b(scsh)50 b Fz(:)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(:)f(:)h(:)f(:)132 b FC(2)490 2239 y(1.3)86 b(Caveats)59 +b Fz(:)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 +b FC(2)490 2367 y(1.4)86 b(Naming)21 b(conventions)36 +b Fz(:)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 FC(3)490 2496 +y(1.5)86 b(Lexical)20 b(issues)44 b Fz(:)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 +f(:)h(:)f(:)132 b FC(4)681 2625 y(1.5.1)97 b(Extended)20 +b(symbol)i(syntax)g Fz(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b FC(4)681 2754 y(1.5.2)97 +b(Extended)20 b(string)i(syntax)78 b Fz(:)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 +FC(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 Fz(:)42 b(:)f(:)132 +b FC(5)681 3011 y(1.5.4)97 b(Her)o(e-strings)81 b Fz(:)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(:) +(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b FC(5)681 3140 y(1.5.5)97 +b(Dot)79 b Fz(:)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 +b FC(7)490 3269 y(1.6)86 b(Recor)o(d)20 b(types)h(and)f(the)h +Fy(define-record)15 b FC(form)80 b Fz(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:) +h(:)f(:)h(:)f(:)132 b FC(7)490 3398 y(1.7)86 b(A)20 b(wor)o(d)g(about)h +(Unix)g(standar)o(ds)29 b Fz(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)132 b FC(9)365 +3611 y FA(2)83 b(Process)20 b(notation)2035 b(10)490 +3739 y FC(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 Fz(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 +b FC(10)681 3868 y(2.1.1)97 b(Port)22 b(and)e(\002le)h(descriptor)f +(sync)85 b Fz(:)41 b(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:) +h(:)f(:)95 b FC(1)-5 b(1)490 3997 y(2.2)86 b(Pr)o(ocess)20 +b(forms)36 b Fz(:)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 FC(12)490 4126 y(2.3)86 b(Using)21 b(extended)f(pr)o(ocess)g(forms)h +(in)g(Scheme)75 b Fz(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)91 b FC(13)681 4254 y(2.3.1)97 b(Pr)o(ocedur)o(es)20 +b(and)g(special)g(forms)40 b Fz(:)h(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g +(:)f(:)h(:)f(:)h(:)f(:)91 b FC(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 +b Fz(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 +b FC(14)490 4512 y(2.4)86 b(Mor)o(e)19 b(complex)i(pr)o(ocess)g +(operations)i Fz(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)91 b FC(16)681 4641 y(2.4.1)97 b(Pids)21 +b(and)g(ports)g(together)65 b Fz(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +b Fz(:)j(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:) +h(:)f(:)91 b FC(17)490 4898 y(2.5)86 b(Conditional)21 +b(pr)o(ocess)g(sequencing)h(forms)45 b Fz(:)d(:)g(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FC(19)1761 5147 y(iii)p +eop %%Page: 4 4 -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(:) +4 3 bop 805 614 a FC(2.6)86 b(Pr)o(ocess)21 b(\002lters)41 +b Fz(:)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 +FC(20)681 825 y FA(3)82 b(System)20 b(Calls)2164 b(21)805 +953 y FC(3.1)86 b(Err)o(ors)58 b Fz(:)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 +g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FC(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 +b Fz(:)i(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 +b FC(23)805 1207 y(3.2)c(I/O)79 b Fz(:)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 +h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FC(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 +Fz(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 +b FC(24)996 1462 y(3.2.2)98 b(Port)21 b(manipulation)h(and)e(standar)o +(d)f(ports)48 b Fz(:)42 b(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 +b FC(24)996 1589 y(3.2.3)98 b(String)21 b(ports)40 b +Fz(:)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 FC(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 Fz(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 +b FC(26)996 1844 y(3.2.5)98 b(Port-mapping)21 b(machinery)61 +b Fz(:)42 b(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f +(:)h(:)90 b FC(29)996 1971 y(3.2.6)98 b(Unix)21 b(I/O)64 +b Fz(:)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 FC(31)996 +2098 y(3.2.7)98 b(Buf)o(fer)o(ed)18 b(I/O)57 b Fz(:)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 +(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FC(36)996 2225 y(3.2.8)98 +b(File)21 b(locking)48 b Fz(:)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 FC(37)805 2353 y(3.3)c(File)21 b(system)69 b Fz(:)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(:) +(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FC(40)805 +2480 y(3.4)c(Pr)o(ocesses)67 b Fz(:)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 +(:)f(:)h(:)f(:)h(:)90 b FC(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 Fz(:)41 +b(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FC(54)996 +2735 y(3.4.2)98 b(Pr)o(ocess)20 b(waiting)28 b Fz(:)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(:)f(:)h(:)f(:)h(:)90 b FC(57)996 2862 y(3.4.3)98 +b(Analysing)21 b(pr)o(ocess)g(status)f(codes)45 b Fz(:)d(:)f(:)h(:)f(:) +h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FC(58)805 +2989 y(3.5)c(Pr)o(ocess)21 b(state)79 b Fz(:)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(:)90 b FC(59)805 3116 y(3.6)c(User)20 +b(and)h(gr)o(oup)f(database)f(access)k Fz(:)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 +FC(61)805 3244 y(3.7)c(Accessing)21 b(command-line)g(ar)o(guments)49 +b Fz(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:) +90 b FC(61)805 3371 y(3.8)c(System)21 b(parameters)38 +b Fz(:)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 FC(63)805 3498 +y(3.9)c(Signal)21 b(system)40 b Fz(:)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(:) +f(:)h(:)90 b FC(63)805 3626 y(3.10)44 b(T)-5 b(ime)39 +b Fz(:)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(:) +b FC(67)996 3753 y(3.10.1)56 b(T)-8 b(erminology)70 b +Fz(:)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 FC(67)996 3880 +y(3.10.2)56 b(Basic)20 b(data)g(types)77 b Fz(:)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 +b FC(68)996 4007 y(3.10.3)56 b(T)-5 b(ime)21 b(zones)59 +b Fz(:)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 FC(69)996 +4135 y(3.10.4)56 b(Pr)o(ocedur)o(es)61 b Fz(:)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 +f(:)h(:)90 b FC(69)805 4262 y(3.1)-5 b(1)49 b(Envir)o(onment)22 +b(variables)30 b Fz(:)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 FC(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 Fz(:)d(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:) +f(:)h(:)90 b FC(75)996 4516 y(3.1)-5 b(1.2)61 b Fy($USER)p +FC(,)18 b Fy($HOME)p FC(,)h(and)h Fy($PATH)25 b Fz(:)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(:) +(:)90 b FC(76)805 4644 y(3.12)44 b(T)-8 b(erminal)21 +b(device)f(contr)o(ol)67 b Fz(:)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(31,)g(1997)h(\226) -f(17)13 b(:)f(31)p eop +b FC(76)996 4771 y(3.12.1)56 b(Portability)21 b(acr)o(oss)f(OS)h +(variants)35 b Fz(:)42 b(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:) +h(:)f(:)h(:)90 b FC(76)996 4898 y(3.12.2)56 b(Miscellaneous)21 +b(pr)o(ocedur)o(es)33 b Fz(:)42 b(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h +(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)90 b FC(77)2077 5147 y(iv)p +eop %%Page: 5 5 -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 +5 4 bop 681 614 a FC(3.12.3)55 b(The)21 b(tty-info)g(r)o(ecor)o(d)e +(type)52 b Fz(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:) +f(:)h(:)f(:)h(:)f(:)91 b FC(77)681 742 y(3.12.4)55 b(Using)22 +b(tty-info)f(r)o(ecor)o(ds)55 b Fz(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FC(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 +b Fz(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 +b FC(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 +1124 y(3.12.7)55 b(Pseudo-terminals)22 b Fz(:)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 FC(82)365 1335 y FA(4)83 b(Networking)2195 b(89)490 +1462 y FC(4.1)86 b(High-level)21 b(interface)73 b Fz(:)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(:) +(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FC(89)490 1590 y(4.2)86 +b(Sockets)77 b Fz(:)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 +(:)f(:)91 b FC(90)490 1717 y(4.3)86 b(Socket)20 b(addr)o(esses)54 +b Fz(:)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 FC(91)490 +1845 y(4.4)86 b(Socket)20 b(primitives)38 b Fz(:)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(:) +f(:)h(:)f(:)91 b FC(92)490 1972 y(4.5)86 b(Performing)21 +b(input)g(and)g(output)g(on)g(sockets)41 b Fz(:)h(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FC(94)490 2099 y(4.6)86 +b(Socket)20 b(options)76 b Fz(:)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 +(:)91 b FC(95)490 2227 y(4.7)86 b(Database-information)20 +b(entries)56 b Fz(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:) +h(:)g(:)f(:)h(:)f(:)h(:)f(:)91 b FC(96)365 2438 y FA(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 +FC(5.1)86 b(String)21 b(manipulation)63 b Fz(:)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 +f(:)91 b FC(98)681 2693 y(5.1.1)97 b(Regular)21 b(expr)o(essions)58 +b Fz(:)42 b(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f +(:)h(:)f(:)h(:)f(:)91 b FC(98)681 2820 y(5.1.2)97 b(Other)21 +b(string)h(manipulation)f(facilities)85 b Fz(:)42 b(:)f(:)h(:)f(:)h(:)g +(:)f(:)h(:)f(:)h(:)f(:)49 b FC(100)681 2947 y(5.1.3)97 +b(Manipulating)21 b(\002le-names)85 b Fz(:)41 b(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)49 b FC(101)490 +3075 y(5.2)86 b(ASCII)20 b(encoding)26 b Fz(:)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 +h(:)f(:)h(:)f(:)49 b FC(106)490 3202 y(5.3)86 b(Character)19 +b(sets)27 b Fz(:)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 +b FC(107)681 3330 y(5.3.1)97 b(Cr)o(eating)20 b(character)g(sets)27 +b Fz(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)49 b FC(107)681 3457 y(5.3.2)97 b(Querying)22 +b(character)d(sets)56 b Fz(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)49 b FC(107)681 3584 +y(5.3.3)97 b(Character)20 b(set)g(algebra)g Fz(:)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 FC(108)681 3712 y(5.3.4)97 b(Standar)o(d)19 b(character)g(sets)74 +b Fz(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)49 b FC(108)365 3923 y FA(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(1)m(12)490 4261 y FC(7.1)86 b(Recor)o(d)20 b(I/O)h(and)g(\002eld)f +(parsing)57 b Fz(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h +(:)g(:)f(:)h(:)f(:)h(:)f(:)54 b FC(1)-5 b(12)681 4389 +y(7.1.1)97 b(Reading)21 b(r)o(ecor)o(ds)68 b Fz(:)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(:)f(:)h(:)f(:)54 b FC(1)-5 b(13)681 4516 y(7.1.2)97 +b(Parsing)21 b(\002elds)39 b Fz(:)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 +b FC(1)-5 b(13)681 4644 y(7.1.3)97 b(Field)21 b(r)o(eaders)59 +b Fz(:)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 FC(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 +(empty-string)i(matches)g Fz(:)54 b FC(1)-5 b(17)681 +4898 y(7.1.5)97 b(Reader)20 b(limitations)57 b Fz(:)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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(:)f(:)h(:)f(:)54 b FC(1)-5 b(19)1774 5147 y(v)p eop %%Page: 6 6 -6 5 bop 805 614 a FB(7.2)86 b(A)-6 b(wk)48 b Fy(:)42 +6 5 bop 805 614 a FC(7.2)86 b(A)-6 b(wk)48 b Fz(:)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 FC(1)-5 b(19)996 739 y(7.2.1)98 b(Examples)50 b Fz(:)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 +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FC(122)681 946 +y FA(8)82 b(Miscellaneous)18 b(routines)1731 b(125)805 +1071 y FC(8.1)86 b(Integer)21 b(bitwise)g(ops)40 b Fz(:)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(:)f(:)h(:)49 b FC(125)805 1196 y(8.2)86 b(List)21 +b(pr)o(ocedur)o(es)40 b Fz(:)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 +b FC(125)805 1320 y(8.3)86 b(T)-8 b(op)21 b(level)82 +b Fz(:)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 +b FC(125)681 1528 y FA(9)82 b(Running)20 b(scsh)2096 +b(127)805 1652 y FC(9.1)86 b(Scsh)21 b(command-line)g(switches)72 +b Fz(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)49 b FC(128)996 1777 y(9.1.1)98 b(Scripts)20 +b(and)h(pr)o(ograms)72 b Fz(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h +(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FC(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 +(scsh)h(pr)o(ograms)62 b Fz(:)41 b(:)h(:)f(:)h(:)49 b +FC(128)996 2026 y(9.1.3)98 b(Module)20 b(system)37 b +Fz(:)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 FC(129)996 2150 y(9.1.4)98 +b(Switches)84 b Fz(:)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 +b FC(130)996 2275 y(9.1.5)98 b(The)21 b(meta)f(ar)o(gument)76 +b Fz(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)49 b FC(134)996 2399 y(9.1.6)98 b(Examples)50 +b Fz(:)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 FC(136)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 +Fz(:)e(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)49 b FC(138)805 2648 y(9.2)86 b(The)21 +b(scsh)g(virtual)g(machine)81 b Fz(:)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 FC(139)996 2773 y(9.2.1)98 b(VM)20 b(ar)o(guments)50 +b Fz(:)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 FC(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 Fz(:)42 b(:)f(:)h(:)f(:)h(:)49 b FC(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 +(ograms)37 b Fz(:)42 b(:)49 b FC(141)805 3147 y(9.3)86 +b(Compiling)22 b(scsh)g(pr)o(ograms)49 b Fz(:)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 +b FC(141)805 3271 y(9.4)86 b(Statically)20 b(linking)i(heap)f(images)26 +b Fz(:)42 b(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f +(:)h(:)f(:)h(:)49 b FC(142)805 3396 y(9.5)86 b(Standar)o(d)19 +b(\002le)i(locations)50 b Fz(:)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 +b FC(144)681 3603 y FA(10)40 b(Changes)20 b(from)h(the)e(previous)h +(release)1304 b(146)805 3728 y FC(10.1)44 b(New)21 b(featur)o(es)52 +b Fz(:)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(31,)g(1997)h(\226) -f(17)13 b(:)f(31)p eop +b FC(146)805 3852 y(10.2)44 b(Incompatible)21 b(impr)o(ovements)i +Fz(:)41 b(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)g(:)f(:)h +(:)f(:)h(:)f(:)h(:)49 b FC(148)805 3977 y(10.3)44 b(Backwar)o +(ds-compatible)19 b(impr)o(ovements)55 b Fz(:)42 b(:)f(:)h(:)f(:)h(:)f +(:)h(:)g(:)f(:)h(:)f(:)h(:)f(:)h(:)49 b FC(150)681 4184 +y FA(1)m(1)43 b(T)-9 b(odo)2427 b(153)2077 5147 y FC(vi)p +eop %%Page: 1 7 -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 +1 6 bop 365 1276 a Fx(Chapter)45 b(1)365 1730 y FD(Introduction)365 +2200 y FC(This)32 b(is)g(the)f(r)o(efer)o(ence)d(manual)j(for)g(scsh,)j +(a)d(Unix)g(shell)h(that)f(is)g(embedded)f(within)365 +2300 y(Scheme.)c(Scsh)21 b(is)h(a)e(Scheme)h(system)h(designed)f(for)g +(writing)h(useful)f(standalone)g(Unix)365 2400 y(pr)o(ograms)d(and)g +(shell)h(scripts\227it)g(spans)g(a)f(wide)g(range)g(of)h(application,)f +(fr)o(om)h(\223script\224)365 2499 y(applications)k(usually)f(handled)g +(with)h(perl)f(or)h(sh,)g(to)f(mor)o(e)g(standar)o(d)f(systems)i +(appli-)365 2599 y(cations)e(usually)h(written)f(in)g(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 @@ -1295,16 +1309,16 @@ 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 +3235 y(Shell.\224)365 3548 y Fw(1.1)99 b(Obtaining)26 +b(scsh)365 3781 y FC(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(/) +4140 y Fy(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 +o(he)o(me-)o(re)o(pos)o(it)o(or)o(y/)365 4500 y FC(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 @@ -1314,12 +1328,9 @@ b(,)16 b(the)g(Scheme)g(Shell)g(home)h(page,)f(and)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(31,)g(1997)h(\226)f(17) -13 b(:)f(31)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 +(about)i(the)g(system.)1777 5147 y(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 +2 7 bop 805 614 a FC(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 @@ -1327,7 +1338,7 @@ eop 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 +1194 y Fw(1.2)99 b(Building)26 b(scsh)681 1409 y FC(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 @@ -1338,46 +1349,44 @@ b(autocon\002g)i(tool)f(to)g(generate)f(self-con\002guring)h(shell)g 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 +2050 y Fy(gunzip)41 b(scsh-0.4.0.tar.gz)159 b FB(Uncompr)o(ess)20 +b(the)g(r)o(elease)i(tar)f(\002le.)938 2149 y Fy(untar)42 +b(xfv)g(scsh-0.4.0.tar)160 b FB(Unpack)20 b(the)g(sour)o(ce)h(code.)938 +2249 y Fy(cd)43 b(scsh-0.4.0)641 b FB(Move)21 b(to)f(the)h(sour)o(ce)f +(dir)o(ectory)m(.)938 2349 y Fy(./configure)728 b FB(Examine)20 +b(host;)g(build)h(Make\002le.)938 2448 y Fy(make)1036 +b FB(Build)21 b(system.)681 2588 y FC(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 +681 2687 y Fy(scshvm)p FC(,)18 b(and)i(a)g(heap)h(image)f(in)i(\002le)e +Fy(scsh/scsh.image)p FC(.)g(T)-7 b(yping)888 2880 y Fy(make)42 +b(install)681 3173 y FC(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 +3272 y Fy(/usr/local)p FC(\),)16 b(along)21 b(with)h(a)e(small)h(stub)g +(startup)f(binary)-9 b(,)20 b Fy(scsh)p FC(.)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 +3638 y Fy(./scshvm)41 b(-o)h(./scshvm)f(-i)h(scsh/scsh.image)681 +3778 y FC(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 +(how)681 4103 y(to)h(do)g(this.)681 4384 y Fw(1.3)99 +b(Caveats)681 4599 y FC(It)19 b(is)g(important)h(to)f(note)g(what)g +(scsh)h(is)f FB(not)p FC(,)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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p eop +(ol,)h(command-line)f(editing,)g(a)f(terse,)g(convenient)i(command)2092 +5147 y(2)p eop %%Page: 3 9 -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) +3 8 bop 365 614 a FC(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 Fy(.login)d +FC(or)365 714 y Fy(.profile)p FC(.)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 @@ -1396,201 +1405,190 @@ e(will)h(polish)h(it)e(up,)h(\002nish)h(it)e(of)o(f,)g(and)g(r)o 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 +b(.)365 2024 y Fw(1.4)99 b(Naming)25 b(conventions)365 +2263 y FC(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 +2685 y Fy(fdes)40 b FC(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 +(esent)f(I/O)573 2784 y(channels.)365 2976 y Fy(...*)40 +b FC(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) +FB(special)h(form)f FC(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 +(other)f(being)h(a)g FB(pr)o(ocedur)o(e)e FC(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 +(asterisk.)k(For)c(example:)756 3665 y Fy(;;;)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(31,)g(1997)h -(\226)f(17)13 b(:)f(31)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 +4799 y FB(action)p Fy(/)p FB(modi\002er)e FC(The)e(in\002x)h(\223)p +Fy(/)p FC(\224)e(is)h(pr)o(onounced)g(\223with,\224)43 +b(as)37 b(in)i Fy(exec/env)p FC(\227\223exec)573 4898 +y(with)21 b(envir)o(onment.\224)1777 5147 y(3)p eop %%Page: 4 10 -4 9 bop 681 614 a Fx(call/...)38 b FB(Pr)o(ocedur)o(es)30 +4 9 bop 681 614 a Fy(call/...)38 b FC(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 +(ar)o(e)888 714 y(usually)21 b(named)f(\223)p Fy(call/...)p +FC(,\224)c FB(e.g.)o FC(,)k Fy(\(call/fdes)40 b FB(port)j(pr)o(oc)o +Fy(\))p FC(,)20 b(which)h(calls)f FB(pr)o(oc)888 814 +y FC(on)f FB(port)o FC('s)f(\002le)g(descriptor)-6 b(,)18 +b(r)o(eturning)g(whatever)f FB(pr)o(oc)g FC(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 +(\002le)g(descriptor)-6 b(.\224)681 1082 y Fy(with-...)38 +b FC(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 +(have)h(names)888 1282 y(of)g(the)h(form)f Fy(with-...)p +FC(.)74 b(For)38 b(example,)k Fy(\(with-env)d FB(env)44 +b(body)3111 1309 y Fv(1)3192 1282 y Fy(...\))36 b FC(and)888 +1381 y Fy(\(with-env*)k FB(env)j(thunk)p Fy(\))p FC(.)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 +Fy(create-)38 b FC(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) +1849 y(temp)21 b(\002les,)g(\002fos,)g FB(etc.)p FC(\),)f(begin)h(with) +g Fy(create-...)p FC(.)681 2019 y Fy(delete-)38 b FC(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 +FB(etc.)p FC(\),)f(begin)h(with)g Fy(delete-...)p FC(.)702 +2287 y FB(r)o(ecord)o Fy(:)p FB(\002eld)62 b FC(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 +2487 y Fy(user-info:home-di)o(r)p FC(.)681 2656 y Fy(\045...)40 +b FC(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 +2755 y(commonly)f(used.)681 2925 y Fy(-info)39 b FC(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 +b(.)g(.)g Fy(-info)p FC(.)27 b(Examples:)g Fy(user-info)p +FC(,)18 b Fy(file-info)p FC(,)f Fy(group-info)p FC(,)888 +3124 y(and)k Fy(host-info)p FC(.)681 3319 y(Enumerated)15 +b(constants)i(fr)o(om)f(some)h(set)f FB(s)h FC(ar)o(e)e(usually)h +(named)g FB(s)p Fy(/)p FB(const)3022 3331 y Fv(1)3059 +3319 y FC(,)h FB(s)p Fy(/)p FB(const)3349 3331 y Fv(2)3387 +3319 y FC(,)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) +Fy(signal/cont)p FC(,)681 3518 y Fy(signal/kill)p FC(,)16 +b Fy(signal/int)p FC(,)g Fy(signal/hup)p FC(,)g(and)21 +b(so)g(forth.)681 3801 y Fw(1.5)99 b(Lexical)25 b(issues)681 +4018 y FC(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 FA(1.5.1)81 +b(Extended)18 b(symbol)i(syntax)681 4462 y FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +805 4656 y Fu(\017)41 b FC(In)29 b(scsh,)i(symbol)e(case)f(is)h(pr)o +(eserved)d(by)j Fy(read)e FC(and)h(is)g(signi\002cant)i(on)f(symbol)888 +4756 y(comparison.)e(This)21 b(means)1071 4898 y Fy(\(run)42 +b(\(less)f(Readme\)\))2092 5147 y FC(4)p eop %%Page: 5 11 -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 +5 10 bop 573 614 a FC(displays)21 b(the)g(right)g(\002le.)490 +798 y Fu(\017)41 b FC(\223)p Fy(-)p FC(\224)16 b(and)h(\223)p +Fy(+)p FC(\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 +y(symbols:)756 1056 y Fy(-O2)42 b(-geometry)e(+Wn)490 +1256 y Fu(\017)h FC(\223)p Fy(|)p FC(\224)22 b(and)i(\223)p +Fy(.)p FC(\224)e(ar)o(e)h(symbol)i(constituents.)36 b(This)24 +b(allows)h Fy(|)e FC(for)h(the)g(pipe)g(symbol,)573 1356 +y(and)30 b Fy(..)f FC(for)h(the)g(par)o(ent-dir)o(ectory)e(symbol.)55 +b(\(Of)30 b(course,)i(\223)p Fy(.)p FC(\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 +b(.\))490 1638 y Fu(\017)41 b FC(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 +573 1738 y(bols:)756 1897 y Fy(9x15)41 b(80x36-3+440)365 +2181 y FA(1.5.2)81 b(Extended)18 b(string)i(syntax)365 +2380 y FC(Scsh)e(strings)g(ar)o(e)e(allowed)h(to)h(contain)g(the)h(A)t +Ft(N)t(S)t(I)h FC(C)d(escape)g(sequences)h(such)f(as)g +Fy(\\n)g FC(and)365 2480 y Fy(\\161)p FC(.)365 2764 y +FA(1.5.3)81 b(Block)21 b(comments)e(and)h(executable)d(interpreter)o +(-triggers)365 2964 y FC(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 +y Fy(#!/usr/local/bin)o(/s)o(csh)37 b(-s)365 3281 y FC(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 +(special)f(header)f(by)i(tr)o(eating)f Fy(#!)f FC(as)i(a)e(comment)j +(marker)e(similar)g(to)h Fy(;)p FC(.)365 3679 y(When)18 +b(the)g(scsh)g(r)o(eader)d(encounters)j Fy(#!)p FC(,)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 +3916 y(Although)f(the)g(form)g(of)f(the)h Fy(#!)f FC(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 +(ogram.)365 4400 y FA(1.5.4)81 b(Here-strings)365 4599 +y FC(The)33 b(r)o(ead)e(macr)o(o)h Fy(#<)g FC(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 +4699 y(to)f(the)f Fy(<<)f FC(\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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +4898 y(intr)o(oduced)h(by)h(the)g Fy(#<)f FC(sequence.)1777 +5147 y(5)p eop %%Page: 6 12 -6 11 bop 681 614 a Fz(Character)o(-delimited)15 b(here-strings)681 -821 y FB(A)20 b FA(character-delimited)f FB(her)o(e-string)h(has)h(the) -g(form)888 988 y Fx(#<)p Fr(x)p Fx(...stuff...)p Fr(x)681 -1155 y FB(wher)o(e)i FA(x)g FB(is)h(any)f(single)h(character)e -(\(except)h Fx(<)p FB(,)g(see)g(below\),)h(which)h(is)f(used)f(to)h +6 11 bop 681 614 a FA(Character)o(-delimited)15 b(here-strings)681 +821 y FC(A)20 b FB(character-delimited)f FC(her)o(e-string)h(has)h(the) +g(form)888 988 y Fy(#<)p Fs(x)p Fy(...stuff...)p Fs(x)681 +1155 y FC(wher)o(e)i FB(x)g FC(is)h(any)f(single)h(character)e +(\(except)h Fy(<)p FC(,)g(see)g(below\),)h(which)h(is)f(used)f(to)h (delimit)681 1255 y(the)d(string)g(bounds.)26 b(Some)21 b(examples:)938 1423 y(Her)o(e-string)f(syntax)288 b(Or)o(dinary)20 -b(string)i(syntax)p 888 1457 1943 4 v 938 1526 a Fx(#<|Hello,)40 +b(string)i(syntax)p 888 1457 1943 4 v 938 1526 a Fy(#<|Hello,)40 b(world.|)227 b("Hello,)41 b(world.")938 1626 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 +3244 y FB(epf)44 b FC(::=)f Fy(\()p FB(pf)g(r)o(edir)1476 +3256 y Fv(1)1557 3244 y Fy(...)f FB(r)o(edir)1891 3256 +y Fo(n)1936 3244 y Fy(\))681 3394 y FC(wher)o(e)19 b +FB(pf)g FC(is)h(a)g(pr)o(ocess)f(form)h(and)f(the)h FB(r)o(edir)2101 +3406 y Fo(i)2149 3394 y FC(ar)o(e)e(r)o(edir)o(ection)h(specs.)25 +b(A)19 b FB(r)o(edir)o(ection)g(spec)681 3493 y FC(is)i(one)g(of:)888 +3623 y Fy(\(<)43 b FB([fdes])g(\002le-name)p Fy(\))209 +b(;)43 b(Open)f(file)g(for)h(read.)888 3722 y(\(>)g FB([fdes])g +(\002le-name)p Fy(\))209 b(;)43 b(Open)f(file)g(create/truncate.)888 +3822 y(\(<<)h FB([fdes])g(object)p Fy(\))280 b(;)43 b(Use)g +FB(object)p Fy('s)g(printed)d(rep.)888 3921 y(\(>>)j +FB([fdes])g(\002le-name)o Fy(\))166 b(;)43 b(Open)f(file)g(for)h +(append.)888 4021 y(\(=)g FB(fdes)h(fdes/port)o Fy(\))279 +b(;)43 b(Dup2)888 4121 y(\(-)g FB(fdes/port)o Fy(\))452 +b(;)43 b(Close)f FB(fdes/port)o Fy(.)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 +4368 y FC(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(\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 +(print-names.)82 b(So)40 b Fy(\(>)i(,x\))d FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +Fy(x)p FC(,\224)44 b(and)39 b Fy(\(<)k(/usr/shivers/.lo)o(gi)o(n\))34 +b FC(means)40 b(\223r)o(ead)d(fr)o(om)681 4898 y Fy(/usr/shivers/.lo)o +(gi)o(n)p FC(.\224)2071 5147 y(10)p eop %%Page: 11 17 -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 +11 16 bop 490 614 a FC(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 Fy(\(<)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 +1083 y FC(These)j(two)g(r)o(edir)o(ections)e(cause)h(the)h(\002le)f +Fy(fv[i])f FC(to)i(be)f(opened)g(on)h(stdin,)52 b(and)365 +1183 y Fy(/tmp/buf)18 b FC(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) +Fy(\(<<)42 b FB(object)q Fy(\))17 b FC(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 +FB(object)p FC(.)26 b(For)21 b(example,)573 1553 y Fy(\(<<)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 +1697 y FC(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 +(esentation)f(using)i(the)f Fy(display)e FC(pr)o(ocedur)o(e,)365 +1896 y(so)573 2039 y Fy(\(<<)42 b(\(A)h(five)f(element)f(list\)\))365 +2182 y FC(is)21 b(the)g(same)g(as)573 2326 y Fy(\(<<)42 +b("\(A)h(five)e(element)g(list\)"\))365 2469 y FC(is)21 +b(the)g(same)g(as)573 2612 y Fy(\(<<)42 b(,\(reverse)e('\(list)h +(element)g(five)h(A\)\)\))p FC(.)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(r)o(edir)o(ection)f Fy(\(=)43 b FB(fdes)h(fdes/port)o +Fy(\))26 b FC(causes)h FB(fdes/port)g FC(to)g(be)g(dup'd)g(into)h +(\002le)f(de-)365 2983 y(scriptor)21 b FB(fdes)p FC(.)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 +y Fy(\(=)43 b(2)g(1\))365 3269 y FC(causes)20 b(stderr)f(to)i(be)e(the) +h(same)g(as)g(stdout.)26 b FB(fdes/port)19 b FC(can)g(also)i(be)e(a)h +(port,)g(for)g(example:)573 3413 y Fy(\(=)43 b(2)g(,\(current-output)o +(-p)o(ort)o(\)\))365 3556 y FC(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 +FB(e.g.)o FC(,)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 +(using)h(the)f Fy(begin)e FC(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 +4114 y FA(2.1.1)81 b(Port)21 b(and)f(\002le)f(descriptor)h(sync)365 +4301 y FC(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 FB(e.g.)o +FC(,)365 4400 y(using)28 b Fy(call-with-input-)o(fi)o(le)20 +b FC(to)27 b(r)o(ebind)f(the)h(value)f(of)g Fy(\(current-input-po)o(rt) +o(\))p FC(\))365 4500 y(does)42 b FB(not)f FC(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 @@ -1837,15 +1823,13 @@ b(since)c(some)365 4699 y(Scheme)37 b(ports)g(ar)o(e)f(not)i(r)o(epr)o 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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(fers.)69 b(The)36 b(accumulated)f(string)1758 5147 y(1)-5 +b(1)p eop %%Page: 12 18 -12 17 bop 681 614 a FB(can)41 b(later)h(be)f(r)o(etrieved)g(fr)o(om)g +12 17 bop 681 614 a FC(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 +(bind)681 714 y Fy(\(current-output-)o(po)o(rt\))24 b +FC(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 @@ -1854,44 +1838,44 @@ b(So,)27 b(if)f(the)681 913 y(user)j(subsequently)i(forked)e(of)o(f)g (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 +y(the)25 b(special)g(r)o(edir)o(ection)f Fy(stdports)p +FC(.)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\)\)) +(ections:)888 1580 y Fy(\(=)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 +y FC(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 +(isn't)h(a)f(Unix)g(port)h(\()p FB(e.g.)o FC(,)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 +(with)h(the)g Fy(\(stdports->stdio\))14 b FC(pr)o(ocedur)o(e.)681 +2629 y Fw(2.2)99 b(Process)25 b(forms)681 2868 y FC(A)19 +b FB(pr)o(ocess)h(form)g FC(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 +3130 y Fy(\(begin)41 b(.)j FB(scheme-code)n Fy(\))888 +3230 y(\(|)f FB(pf)1072 3257 y Fv(1)1153 3230 y Fy(...)g +FB(pf)1381 3257 y Fo(n)1426 3230 y Fy(\))888 3329 y(\(|+)g +FB(connect-list)g(pf)1550 3356 y Fv(1)1631 3329 y Fy(...)f +FB(pf)1858 3356 y Fo(n)1904 3329 y Fy(\))888 3429 y(\(epf)g(.)h +FB(epf)p Fy(\))888 3528 y(\()p FB(pr)o(og)f(ar)o(g)1235 +3556 y Fv(1)1316 3528 y Fy(...)h FB(ar)o(g)1600 3556 +y Fo(n)1645 3528 y Fy(\))2134 3134 y(;)g(Run)f FB(scheme-code)h +Fy(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 +3694 y FC(The)19 b(default)g(case)g Fy(\()p FB(pr)o(og)42 +b(ar)o(g)1640 3721 y Fv(1)1721 3694 y Fy(...)g FB(ar)o(g)2004 +3721 y Fo(n)2049 3694 y Fy(\))19 b FC(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 +3962 y Fy(\(begin)41 b(\(apply)h(exec-path)d(`\()p FB(pr)o(og)j(ar)o(g) +2325 3989 y Fv(1)2406 3962 y Fy(...)g FB(ar)o(g)2689 +3989 y Fo(n)2735 3962 y Fy(\)\)\))681 4131 y(Exec-path)27 +b FC(is)j(the)h(version)g(of)g(the)f Fy(exec\(\))e FC(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 @@ -1900,46 +1884,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 +4630 y(surr)o(ounding)f Fy("...")d FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p eop +(can)g(say)888 4898 y Fy(\(more)42 b(Readme\))2071 5147 +y FC(12)p eop %%Page: 13 19 -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 +13 18 bop 365 614 a FC(and)21 b(get)f(the)h(right)h(\002le.)490 +739 y(A)31 b FB(connect-list)g FC(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 +Fy(\(\()p FB(fr)o(om)1791 866 y Fv(1)1872 839 y FB(fr)o(om)2028 +866 y Fv(2)2108 839 y Fy(...)43 b FB(to)o Fy(\))g(...\))21 +b FC(and)h(is)g(implicitly)365 938 y(backquoted.)k(For)21 +b(example,)573 1077 y Fy(\(|+)42 b(\(\(1)h(2)g(0\))f(\(3)h(1\)\))g +FB(pf)1498 1104 y Fv(1)1579 1077 y FB(pf)1632 1104 y +Fv(2)1669 1077 y Fy(\))365 1215 y FC(r)o(uns)26 b FB(pf)609 +1242 y Fv(1)672 1215 y FC(and)e FB(pf)890 1242 y Fv(2)928 +1215 y FC(.)38 b(The)25 b(\002rst)g(clause)g Fy(\(1)43 +b(2)g(0\))24 b FC(causes)h FB(pf)2221 1242 y Fv(1)2258 +1215 y FC('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 FB(pf)1426 +1342 y Fv(2)1463 1315 y FC('s)g(stdin)g(\(0\).)k(The)21 +b(second)h(clause)f Fy(\(3)42 b(1\))21 b FC(causes)g +FB(pf)3134 1342 y Fv(1)3171 1315 y FC('s)365 1415 y(\002le)g +(descriptor)g(3)f(to)h(be)f(connected)h(to)g FB(pf)1698 +1442 y Fv(2)1735 1415 y FC('s)g(\002le)g(descriptor)f(1.)490 +1539 y(The)32 b Fy(begin)e FC(pr)o(ocess)i(form)h(does)f(a)g +Fy(stdio->stdports)26 b FC(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 +1738 y Fy(begin)j FC(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 +(does)h(not)f(specify)g(whether)h(or)f(not)h Fy(|)f FC(and)f +Fy(|+)h FC(ar)o(e)e(r)o(eadable)g(sym-)365 2062 y(bols.)26 +b(Scsh)21 b(does.)365 2338 y Fw(2.3)99 b(Using)26 b(extended)d(process) +j(forms)f(in)f(Scheme)365 2553 y FC(Pr)o(ocess)32 b(forms)h(and)e +(extended)h(pr)o(ocess)f(forms)i(ar)o(e)d FB(not)i FC(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 @@ -1947,43 +1929,41 @@ b(They)32 b(ar)o(e)f(a)g(dif-)365 2652 y(fer)o(ent)f(notation)h(for)f 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 +b Fy(exec-epf)p FC(,)17 b Fy(&)p FC(,)j(and)g Fy(run)p +FC(.)365 3098 y Fy(\(exec-epf)40 b FB(.)21 b(epf)p Fy(\))86 +b Fu(\000)-14 b(!)87 b FB(no)21 b(r)o(eturn)g(value)1177 +b FC(syntax)365 3198 y Fy(\(&)43 b FB(.)21 b(epf)o Fy(\))87 +b Fu(\000)-14 b(!)87 b FB(pr)o(oc)1858 b FC(syntax)365 +3297 y Fy(\(run)42 b FB(.)21 b(epf)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(pr)o(oc)1771 b FC(syntax)573 3436 y(The)23 +b Fy(\(exec-epf)40 b(.)j FB(epf)p Fy(\))23 b FC(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) +y(computation.)573 3767 y(The)d Fy(\(&)43 b(.)g FB(epf)p +Fy(\))15 b FC(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 +(ocess)f(object.)573 3999 y(The)28 b Fy(\(run)42 b(.)h +FB(epf)p Fy(\))27 b FC(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(calls.)53 b(The)30 b(de\002nition)h(of)f(the)g Fy(exec-epf)d +FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +h(of)f(the)g Fy(&)f FC(and)h Fy(run)e FC(macr)o(os)h(ar)o(e)g(very)g +(simple:)756 4769 y Fy(\(&)42 b(.)h FB(epf)p Fy(\))170 +b Fu(\021)83 b Fy(\(fork)41 b(\()p Fz(\025)e Fy(\(\))k(\(exec-epf)d(.)j +FB(epf)p Fy(\)\)\))756 4868 y(\(run)e(.)j FB(epf)o Fy(\))83 +b Fu(\021)g Fy(\(wait)41 b(\(&)i(.)g FB(epf)p Fy(\)\))1756 +5147 y FC(13)p eop %%Page: 14 20 -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) +14 19 bop 681 614 a FA(2.3.1)81 b(Procedures)19 b(and)h(special)f +(forms)681 931 y FC(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 @@ -1995,171 +1975,163 @@ b(,)681 1229 y(the)25 b(pr)o(ogrammer)g(is)g(not)h(r)o(estricted)e(by)i (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 +Fy(|)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 +2050 a FC(r)o(edir)o(ection)99 b Fy(open)p FC(,)19 b +Fy(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 +Fn(+)h Fy(fork)p 1940 2279 V 888 2282 1055 4 v 681 2549 +a FC(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 +(of)g(the)g Fy(fork)f FC(and)g Fy(fork/pipe)e FC(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 +b(.)681 3359 y FA(2.3.2)81 b(Interfacing)19 b(process)h(output)g(to)g +(Scheme)681 3675 y FC(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 +681 3992 y Fy(\(run/port)40 b FB(.)20 b(epf)p Fy(\))87 +b Fu(\000)-14 b(!)87 b FB(port)1558 b FC(syntax)681 4092 +y Fy(\(run/file)40 b FB(.)20 b(epf)p Fy(\))87 b Fu(\000)-14 +b(!)87 b FB(string)1494 b FC(syntax)681 4191 y Fy(\(run/string)39 +b FB(.)20 b(epf)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(string)1407 +b FC(syntax)681 4291 y Fy(\(run/strings)38 b FB(.)21 +b(epf)p Fy(\))87 b Fu(\000)-15 b(!)87 b FB(string)21 +b(list)1237 b FC(syntax)681 4391 y Fy(\(run/sexp)40 b +FB(.)20 b(epf)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(object)1505 +b FC(syntax)681 4490 y Fy(\(run/sexps)39 b FB(.)21 b(epf)p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(list)1548 b FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +(pipe.)2071 5147 y(14)p eop %%Page: 15 21 -15 20 bop 805 636 a Fx(run/port)227 b FB(V)-8 b(alue)18 +15 20 bop 805 636 a Fy(run/port)227 b FC(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 +885 y Fy(run/file)227 b FC(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 +b(Returns)c(when)f(pr)o(ocess)g(exits.)805 1134 y Fy(run/string)139 +b FC(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 +1383 y Fy(run/strings)95 b FC(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(Returns)c(when)f(eof)g(r)o(ead.)805 1632 y Fy(run/sexp)227 +b FC(Reads)33 b(a)g(single)g(object)h(fr)o(om)e(pr)o(ocess')h(stdout) +1384 1732 y(with)44 b Fy(read)p FC(.)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 +1981 y Fy(run/sexps)183 b FC(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 +Fy(read)p FC(.)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 +2432 y Fy(run/strings)p FC(.)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 +(o-)573 2661 y(cedur)o(es.)365 2840 y Fy(\(run/port*)40 +b FB(thunk)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(port)1321 +b FC(pr)o(ocedur)o(e)365 2939 y Fy(\(run/file*)40 b FB(thunk)p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(string)1257 b FC(pr)o(ocedur)o(e)365 +3039 y Fy(\(run/string*)39 b FB(thunk)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(string)1170 b FC(pr)o(ocedur)o(e)365 3138 +y Fy(\(run/strings*)39 b FB(thunk)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(string)21 b(list)999 b FC(pr)o(ocedur)o(e)365 +3238 y Fy(\(run/sexp*)40 b FB(thunk)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(object)1268 b FC(pr)o(ocedur)o(e)365 3338 +y Fy(\(run/sexps*)39 b FB(thunk)p Fy(\))87 b Fu(\000)-14 +b(!)87 b FB(object)21 b(list)1097 b FC(pr)o(ocedur)o(e)573 +3471 y(For)21 b(example,)f Fy(\(run/port)40 b(.)j FB(epf)p +Fy(\))20 b FC(expands)g(into)756 3609 y Fy(\(run/port*)39 +b(\()p Fz(\025)g Fy(\(\))j(\(exec-epf)e(.)j FB(epf)p +Fy(\)\)\).)490 3827 y FC(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 +3927 y(str)o(eams)20 b(in)i(scsh:)365 4068 y Fy(\(port->string)39 +b FB(port)p Fy(\))86 b Fu(\000)-15 b(!)88 b FB(string)1186 +b FC(pr)o(ocedur)o(e)365 4167 y Fy(\(port->sexp-list)37 +b FB(port)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(list)1153 +b FC(pr)o(ocedur)o(e)365 4267 y Fy(\(port->string-lis)o(t)37 +b FB(port)p Fy(\))87 b Fu(\000)-15 b(!)87 b FB(string)21 +b(list)842 b FC(pr)o(ocedur)o(e)365 4367 y Fy(\(port->list)39 +b FB(r)o(eader)21 b(port)p Fy(\))86 b Fu(\000)-14 b(!)87 +b FB(list)1144 b FC(pr)o(ocedur)o(e)573 4500 y Fy(Port->string)32 +b FC(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 Fy(Port->sexp-list)21 +b FC(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 +(items.)47 b Fy(Port->string-lis)o(t)22 b FC(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(31,)g(1997)h(\226) -f(17)13 b(:)f(31)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 +(newlines)f(ar)o(e)e(not)1756 5147 y(15)p eop %%Page: 16 22 -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 +16 21 bop 888 614 a FC(part)39 b(of)h(the)g(r)o(eturned)e(strings.)83 +b Fy(Port->list)35 b FC(generalises)40 b(these)g(two)g(pr)o(o-)888 +714 y(cedur)o(es.)70 b(It)35 b(uses)h FB(r)o(eader)g +FC(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 +913 y Fy(port->string-list)20 b FC(and)26 b Fy(port->sexp-list)21 +b FC(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 Fy(port->list)d +FC(curried)j(with)i(the)e(appr)o(opriate)f(parsers:)1071 +1212 y Fy(\(port->string-li)o(st)37 b FB(port)o Fy(\))44 +b Fu(\021)f Fy(\(port->list)c(read-line)h FB(port)o Fy(\))1071 +1312 y(\(port->sexp-list)124 b FB(port)o Fy(\))44 b Fu(\021)f +Fy(\(port->list)c(read)j FB(port)o Fy(\))888 1512 y FC(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) +Fy(run/string*)126 b Fu(\021)87 b Fy(port->string)256 +b Fu(\016)44 b Fy(run/port*)1071 1811 y(run/strings*)82 +b Fu(\021)87 b Fy(port->string-lis)o(t)37 b Fu(\016)44 +b Fy(run/port*)1071 1910 y(run/sexp*)214 b Fu(\021)87 +b Fy(read)608 b Fu(\016)44 b Fy(run/port*)1071 2010 y(run/sexps*)170 +b Fu(\021)87 b Fy(port->sexp-list)124 b Fu(\016)44 b +Fy(run/port*)681 2376 y(\(reduce-port)38 b FB(port)20 +b(r)o(eader)h(op)f(.)h(seeds)p Fy(\))87 b Fu(\000)-14 +b(!)87 b FB(object)2488 2346 y Fm(\003)3170 2376 y FC(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 +FB(r)o(eader)f FC(to)h(r)o(ead)e(an)i(object)f(fr)o(om)888 +2733 y FB(port)p FC(.)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 Fy(reduce-port)c +FC(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 +888 2932 y(some)20 b(other)g(value)e Fz(v)s FC(,)i(then)g +FB(op)e FC(is)i(applied)e(to)i Fz(v)j FC(and)18 b(the)i(seeds:)k +Fy(\()p FB(op)43 b(v)g Fy(.)g FB(seeds)q Fy(\))p FC(.)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 +3231 y(ar)o(e)g(used,)g(then)h FB(op)f FC(must)i(r)o(eturn)e(multiple)h +(values.\))888 3381 y(For)g(example,)f Fy(\(port->list)39 +b FB(r)o(eader)44 b(port)o Fy(\))20 b FC(could)h(be)g(de\002ned)f(as) +1071 3559 y Fy(\(reverse)40 b(\(reduce-port)f FB(port)k(r)o(eader)g +Fy(cons)f('\(\)\)\))888 3786 y FC(An)25 b(imperative)f(way)g(to)h(look) +g(at)f Fy(reduce-port)c FC(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) +4352 y Fw(2.4)99 b(More)24 b(complex)h(process)h(operations)681 +4599 y FC(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)p eop +4898 y(for)c(manipulating)i(pr)o(ocesses.)2071 5147 y(16)p +eop %%Page: 17 23 -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 +17 22 bop 365 614 a FA(2.4.1)81 b(Pids)20 b(and)g(ports)g(together)365 +828 y Fy(\(run/port+proc)38 b FB(.)21 b(epf)o Fy(\))87 +b Fu(\000)-14 b(!)87 b FB([port)20 b(pr)o(oc])1120 b +FC(syntax)365 928 y Fy(\(run/port+proc*)38 b FB(thunk)p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB([port)20 b(pr)o(oc])883 +b FC(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) @@ -2169,106 +2141,100 @@ b FB(pr)o(ocedur)o(e)573 1054 y(This)32 b(special)f(form)h(and)f(its)h (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 +(passed)f(to)h(the)g Fy(wait)e FC(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 +g(the)h(following:)756 2062 y Fy(\(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 +2261 y(\(status)i(\(wait)i(child\)\)\))930 2361 y FC(.)12 +b(.)g(.)g(use)21 b Fy(paper)p FC(,)e Fy(status)p FC(,)f(and)i +Fy(child)f FC(her)o(e.)12 b(.)g(.)g Fy(\)\))573 2535 +y FC(Note)23 b(that)g(you)g(must)h FB(\002rst)f FC(do)g(the)g +Fy(port->string)18 b FC(and)k FB(then)g FC(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) +b(.)365 3018 y FA(2.4.2)81 b(Multiple)19 b(stream)g(capture)365 +3209 y FC(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 +3508 y Fy(run/collecting)15 b FC(form)21 b(and)f(its)i(analogous)f(pr)o +(ocedur)o(e,)d Fy(run/collecting*)p FC(.)365 3661 y Fy +(\(run/collecting)38 b FB(fds)20 b(.)h(epf)11 b Fy(\))87 +b Fu(\000)-15 b(!)88 b FB([port.)12 b(.)g(.)g(])1012 +b FC(syntax)365 3761 y Fy(\(run/collecting*)37 b FB(fds)21 +b(thunk)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB([port.)12 +b(.)g(.)g(])787 b FC(pr)o(ocedur)o(e)573 3906 y Fy(Run/collecting)15 +b FC(and)21 b Fy(run/collecting*)16 b FC(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 +Fy(run/collecting)24 b FC(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 +4452 y Fy(\(run/collecting)37 b(\(1)43 b(2\))f(\(ls\)\))573 +4599 y FC(r)o(uns)23 b Fy(ls)e FC(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 +4699 y(When)26 b(the)g Fy(ls)f FC(is)h(done,)h Fy(run/collecting)20 +b FC(r)o(eturns)25 b(thr)o(ee)g(values:)35 b(the)26 b +Fy(ls)f FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +Fy(run/collecting)13 b FC(r)o(eturns,)19 b(so)g(when)h(the)f(ports)g +(ar)o(e)f(closed,)1756 5147 y(17)p eop %%Page: 18 24 -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 +18 23 bop 888 614 a FC(they)28 b(vanish.)45 b(The)27 +b Fy(fds)f FC(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\)) +(otected,)e(then)1071 1214 y Fy(\(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 +(\(port->string)c(err\)\)\))888 1713 y FC(might)22 b(pr)o(oduce)e(the)h +(list)1071 2008 y Fy(\(256)42 b("")h("cat:)e(/usr/kmshea/mbox:)c +(Permission)i(denied"\))888 2404 y FC(What)31 b(is)h(the)f(deadlock)g +(hazar)o(d)e(that)i(causes)g Fy(run/collecting)25 b FC(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 +b(Unix)e(pr)o(ogram)g Fy(myprog)f FC(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 +Fy(\()p FC(\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 +Fy(\))p FC(\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 +Fy(myprog)d FC(with)k(stdout)g(and)e(stderr)g(r)o(edi-)888 +3802 y(r)o(ected)23 b FB(via)g(Unix)g(pipes)h FC(to)g(the)g(ports)h +Fy(port1)c FC(and)j Fy(port2)p FC(,)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 +(subsequently)h(says)f Fy(\(read)42 b(port2\))p FC(.)22 +b(The)c(Scheme)g Fy(read)888 4001 y FC(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 Fy(read\(\))d +FC(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 +Fy(myprog)f FC(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 +888 4499 y Fy(myprog)26 b FC(hangs,)k(waiting)f(for)f(the)g(pipe)g(to)h +(drain.)47 b(The)28 b Fy(myprog)e FC(child)i(is)h(stuck)888 +4599 y(in)i(a)e(stdout/)p Fy(port1)g FC(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 +Fy(port2)888 4699 y FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +(above:)2071 5147 y(18)p eop %%Page: 19 25 -19 24 bop 756 614 a Fx(\(receive)40 b(\(status)g(port1)i(port2\))1148 +19 24 bop 756 614 a Fy(\(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 @@ -2282,107 +2248,103 @@ y(;;)h(Write)f(a)h(close)e(paren)h(to)h(stderr.)1409 (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 +(string.)573 2291 y FC(In)29 b(or)o(der)e(to)i(avoid)f(this)h(pr)o +(oblem,)h Fy(run/collecting)23 b FC(and)28 b Fy(run/collecting*)573 +2391 y FC(\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 +2490 y(in)c(temp)h(\002les)f(\(using)h(the)f Fy(temp-file-channel)9 +b FC(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 +(pipes:)672 2872 y Fu(\017)42 b FC(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 +2971 y(disk)j(befor)o(e)f(r)o(eturning)g(fr)o(om)h Fy(run/collecting)p +FC(.)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 +(\002ll)g(up.)672 3212 y Fu(\017)42 b FC(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 +573 3693 y Fy(run/collecting*)14 b FC(itself)21 b(is)g(only)h(12)e +(lines)h(of)g(simple)g(code.)573 3834 y(See)27 b Fy(temp-file-channel) +21 b FC(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 +4262 y Fw(2.5)99 b(Conditional)26 b(process)g(sequencing)f(forms)365 +4492 y FC(These)c(forms)g(allow)g(conditional)h(execution)f(of)g(a)f +(sequence)h(of)g(pr)o(ocesses.)365 4649 y Fy(\(||)43 +b FB(pf)604 4677 y Fv(1)662 4649 y FB(.)12 b(.)g(.)g(pfn)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(boolean)1514 b FC(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-) +(successfully)g(\()p FB(i.e.)o FC(,)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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(successfully;)g(otherwise)g Fy(#f)p FC(.)1756 5147 y(19)p +eop %%Page: 20 26 -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 +20 25 bop 681 614 a Fy(\(&&)42 b FB(pf)920 641 y Fv(1)978 +614 y FB(.)12 b(.)g(.)g(pfn)p Fy(\))87 b Fu(\000)-14 +b(!)87 b FB(boolean)1514 b FC(syntax)888 756 y(Run)23 +b(each)f(pr)o(oc)g(until)h(one)g(fails)e(\()p FB(i.e.)p +FC(,)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 +(otherwise)i Fy(#f)p FC(.)681 1149 y Fw(2.6)99 b(Process)25 +b(\002lters)681 1363 y FC(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 +h(str)o(eams.)681 1513 y Fy(\(char-filter)38 b FB(\002lter)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(pr)o(ocedur)o(e)1085 +b FC(pr)o(ocedur)o(e)888 1654 y(The)27 b FB(\002lter)h +FC(ar)o(gument)e(is)i(a)f(character)p Fu(!)p FC(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 +FB(\002lter)h FC(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 +Fy(tr)43 b(A-Z)f(a-z)19 b FC(command,)i(we)g(can)f(say:)1071 +2451 y Fy(\(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.) +3422 y(\(string-filter)38 b FB(\002lter)20 b([bu\003en])p +Fy(\))88 b Fu(\000)-14 b(!)87 b FB(pr)o(ocedur)o(e)713 +b FC(pr)o(ocedur)o(e)888 3563 y(The)30 b FB(\002lter)g +FC(ar)o(gument)f(is)h(a)f(string)p Fu(!)p FC(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 +(input)i(port,)888 3763 y(applies)18 b FB(\002lter)h +FC(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 +3995 y(The)i(optional)g FB(bu\003en)h FC(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)p eop +FB(\002lter)g FC(will)h(never)e(be)h(applied)888 4194 +y(to)i(a)g(string)g(longer)g(than)g FB(bu\003en)i FC(chars.)i(The)20 +b(default)g FB(bu\003en)i FC(value)e(is)h(1024.)2071 +5147 y(20)p eop %%Page: 21 27 -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 +21 26 bop 365 1276 a Fx(Chapter)45 b(3)365 1731 y FD(System)51 +b(Calls)365 2226 y FC(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) +(binding)365 2426 y(for)j(P)t Ft(O)t(S)t(I)t(X)r FC(,)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 +FB(e.g.)o FC(,)f(symbolic)365 2525 y(links,)k Fy(fchown)p +FC(,)c Fy(fstat)p FC(,)g(sockets\).)365 2840 y Fw(3.1)99 +b(Errors)365 3073 y FC(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 Fy(errno)e +FC(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) +(ogrammer)e(to)365 3372 y(assume)26 b(that)g FB(if)f(a)h(syscall)g(r)o +(eturns,)h(it)e(succeeded.)40 b FC(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 @@ -2394,101 +2356,97 @@ b(When)26 b(a)f(standar)o(d)e(exception)i(system)h(is)g(de\002ned,)g 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 +(exceptions)h(contain)h(the)f(Unix)g Fy(errno)d FC(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 +Fy(errno)f FC(value)h(is)h(a)f(part)g(of)h(the)f(exception)h(packet,)f +(it)h(is)g FB(not)365 4348 y FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +Fy(errno)e FC(numbers)i(ar)o(e)f(bound)i(to)f(the)h(variables)365 +4586 y Fy(errno/perm)p FC(,)30 b Fy(errno/noent)p FC(,)f +FB(etc.)56 b FC(System)31 b(calls)g(never)g(r)o(eturn)f +Fy(error/intr)p FC(\227they)365 4686 y(automatically)21 +b(r)o(etry)-9 b(.)365 4845 y Fy(\(errno-error)39 b FB(errno)22 +b(syscall)e(.)h(data)p Fy(\))85 b Fu(\000)-14 b(!)87 +b FB(no)21 b(r)o(eturn)g(value)423 b FC(pr)o(ocedur)o(e)1756 +5147 y(21)p eop %%Page: 22 28 -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 +22 27 bop 888 614 a FC(Raises)30 b(a)f(Unix)h(err)o(or)e(exception)i +(for)f(Unix)h(err)o(or)e(number)i FB(errno)q FC(.)52 +b(The)29 b FB(syscall)888 714 y FC(and)f FB(data)f FC(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 +y Fy(\(with-errno-hand)o(le)o(r*)37 b FB(handler)21 b(thunk)p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(value\(s\))20 b(of)h(thunk)181 +b FC(pr)o(ocedur)o(e)681 1164 y Fy(\(with-errno-hand)o(le)o(r)38 +b FB(handler-spec)20 b(.)g(body)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(value)21 b(of)f(body)318 b FC(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 +(calling)g Fy(errno-error)p FC(.)47 b(Pr)o(ograms)888 +1410 y(can)20 b(use)f Fy(with-errno-handle)o(r*)13 b +FC(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 +FB(thunk)f FC(is)h(executing,)h FB(handler)e FC(is)h(called)e(on)i(two) +888 1647 y(ar)o(guments:)1071 1798 y Fy(\()p FB(handler)43 +b(errno)h(packet)o Fy(\))888 1948 y FB(packet)20 b FC(is)h(a)f(list)i +(of)f(the)f(form)1559 2136 y FB(packet)i Fn(=)g Fy(\()p +FB(errno-msg)43 b(syscall)h Fy(.)f FB(data)o Fy(\))p +Fz(;)888 2324 y FC(wher)o(e)24 b FB(errno-msg)g FC(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 +b(,)24 b FB(syscall)888 2423 y FC(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 FB(data)g +FC(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 +(syscall.)888 2661 y(If)32 b FB(handler)g FC(r)o(eturns,)j(the)d +(handler)g(sear)o(ch)f(continues)i(upwar)o(ds.)59 b FB(Handler)32 +b FC(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 +1071 3036 y Fy(\(with-errno-hand)o(ler)1245 3136 y(\(\()p +FB(errno)44 b(packet)o Fy(\))f FB(clause)h Fy(...\))1158 +3236 y FB(body1)1158 3335 y(body2)1158 3435 y Fy(...\))888 +3611 y FC(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 +FB(errno)j FC(to)f(the)f(err)o(or)6 b('s)30 b(integer)h(code,)h(and)e +(variable)f FB(packet)888 3910 y FC(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 +Fy(with-errno-hand)o(ler)18 b FC(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 +y Fy(\(\()p FB(errno)44 b Fy(...\))e FB(body)g Fy(...\))1071 +4622 y(\(else)g FB(body)g Fy(...\))888 4799 y FC(In)26 +b(the)g(\002rst)g(type)f(of)h(clause,)g(the)g FB(errno)g +FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p eop +6 b('s)25 b(errno)h(value.)41 b(An)26 b Fy(else)e FC(clause)2071 +5147 y(22)p eop %%Page: 23 29 -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) +23 28 bop 573 614 a FC(matches)23 b(any)g(errno)h(value.)32 +b(Note)24 b(that)f(the)h FB(errno)g FC(and)f FB(data)f +FC(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 Fy(\(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) +y(\(blatz)f(garglemumph\)\))573 2302 y FC(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 +2680 y Fy(errno/intr)15 b FC(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 +3636 y FA(3.1.1)81 b(Interactive)19 b(mode)h(and)g(error)h(handling)365 +3909 y FC(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 @@ -2504,200 +2462,190 @@ b(,)365 4407 y(and)29 b(generate)f(an)g(interactive)g(br)o(eakpoint)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 +Fy(\(fork\))p FC(,)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 FE(Mar)o(ch)f(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +(wishes.)1756 5147 y(23)p eop %%Page: 24 30 -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 +24 29 bop 681 614 a Fw(3.2)99 b(I/O)681 834 y FA(3.2.1)81 +b(Standard)18 b(R4RS)i(I/O)h(procedures)681 1022 y FC(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 +Fy(display)d FC(or)j Fy(read-char)p FC(\))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) +b(operations)k(such)g(as)f Fy(read-char)d FC(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 +(ocedur)o(es)f Fy(read-char)p FC(,)f Fy(char-ready?)p +FC(,)f Fy(write)p FC(,)j Fy(display)p FC(,)681 1748 y +Fy(newline)p FC(,)f(and)i Fy(write-char)c FC(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 +b(also)h(mandates)e(the)i(availability)e(of)i Fy(format)p +FC(,)d(and)681 1947 y(further)c(r)o(equir)o(es)g Fy(format)e +FC(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 Fy(peek-char)f +FC(and)i Fy(read)f FC(do)i FB(not)g FC(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 +(I/O.)681 2536 y FA(3.2.2)81 b(Port)20 b(manipulation)e(and)h(standard) +g(ports)681 2748 y Fy(\(close-after)38 b FB(port)20 b(consumer)p +Fy(\))88 b Fu(\000)-15 b(!)88 b FB(value\(s\))20 b(of)h(consumer)394 +b FC(pr)o(ocedur)o(e)888 2865 y(Returns)35 b Fy(\()p +FB(consumer)43 b(port)p Fy(\))p FC(,)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 +b(magic.)1071 3120 y Fl(Remark:)51 b Fk(Is)18 b(ther)o(e)h(a)g +(less-awkwar)o(d)e(name?)681 3372 y Fy(\(error-output-po)o(rt)o(\))81 +b Fu(\000)-14 b(!)87 b FB(port)1214 b FC(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 +Fy(current-output-)o(por)o(t)p FC(,)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 +(equivalent)g(of)g(stderr)-6 b(.)681 3814 y Fy(\(with-current-in)o(pu)o +(t-p)o(or)o(t*)37 b FB(port)20 b(thunk)p Fy(\))83 b Fu(\000)-14 +b(!)83 b FB(value\(s\))20 b(of)h(thunk)86 b FC(pr)o(ocedur)o(e)681 +3914 y Fy(\(with-current-ou)o(tp)o(ut-)o(po)o(rt)o(*)38 +b FB(port)17 b(thunk)p Fy(\))65 b Fu(\000)-15 b(!)66 +b FB(value\(s\))17 b(of)i(thunk)86 b FC(pr)o(ocedur)o(e)681 +4013 y Fy(\(with-error-outp)o(ut)o(-po)o(rt)o(*)37 b +FB(port)21 b(thunk)p Fy(\))86 b Fu(\000)-14 b(!)87 b +FB(value\(s\))20 b(of)h(thunk)122 b FC(pr)o(ocedur)o(e)888 +4157 y(These)31 b(pr)o(ocedur)o(es)e(install)j FB(port)e +FC(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 +FB(thunk)o FC(.)681 4456 y Fy(\(with-current-in)o(pu)o(t-p)o(or)o(t)37 +b FB(port)21 b(.)f(body)p Fy(\))86 b Fu(\000)-14 b(!)87 +b FB(value\(s\))20 b(of)h(body)295 b FC(syntax)681 4555 +y Fy(\(with-current-ou)o(tp)o(ut-)o(po)o(rt)37 b FB(port)20 +b(.)h(body)p Fy(\))86 b Fu(\000)-15 b(!)88 b FB(value\(s\))20 +b(of)h(body)251 b FC(syntax)681 4655 y Fy(\(with-error-outp)o(ut)o(-po) +o(rt)37 b FB(port)20 b(.)g(body)p Fy(\))87 b Fu(\000)-15 +b(!)87 b FB(value\(s\))21 b(of)f(body)339 b FC(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)p eop +(sugar)g(for)f(the)h Fy(with-current-)888 4898 y(input-port*)17 +b FC(pr)o(ocedur)o(e)h(and)j(friends.)2071 5147 y(24)p +eop %%Page: 25 31 -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 +25 30 bop 365 614 a Fy(\(set-current-inpu)o(t-)o(por)o(t!)37 +b FB(port)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(unde\002ned)580 +b FC(pr)o(ocedur)o(e)365 714 y Fy(\(set-current-outp)o(ut)o(-po)o(rt)o +(!)38 b FB(port)p Fy(\))86 b Fu(\000)-15 b(!)88 b FB(unde\002ned)536 +b FC(pr)o(ocedur)o(e)365 814 y Fy(\(set-error-output)o(-p)o(ort)o(!)37 +b FB(port)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(unde\002ned)624 +b FC(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 Fy(\(close)41 b FB(fd/port)p Fy(\))86 b Fu(\000)-15 +b(!)88 b FB(boolean)1355 b FC(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(.)573 1537 y(If)27 b FB(fd/port)g FC(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 +(eated)e(with)k Fy(\(dup)41 b(fd/port\))21 b FC(befor)o(e)i(clos-)573 +1737 y(ing)c Fy(fd/port)p FC(.)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 +g(of)g(\(as)f(appr)o(opriate\):)756 2343 y Fy(\(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 +(fd\)\))573 2651 y FC(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 +(this)h(is)g(not)h(an)e(err)o(or)-6 b(.)365 2951 y Fy +(\(stdports->stdio\))80 b Fu(\000)-14 b(!)87 b FB(unde\002ned)1111 +b FC(pr)o(ocedur)o(e)365 3051 y Fy(\(stdio->stdports\))80 +b Fu(\000)-14 b(!)87 b FB(unde\002ned)1111 b FC(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) +3430 y Fy(\(stdports->stdio)o(\))14 b FC(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 +y Fv(1)756 3802 y Fy(\(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 +4173 y(stdio->stdports)32 b FC(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 +h(to)g(the)g(series)g(of)f(assignments)756 4544 y Fy(\(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 +38 b(2\)\))p 365 4821 1146 4 v 450 4875 a Fq(1)485 4898 +y Ft(Why)16 b(not)g Fj(move->fdes)p Ft(?)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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)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 +(be)h(the)g(same)g(port.)1756 5147 y FC(25)p eop %%Page: 26 32 -26 31 bop 888 614 a FB(However)-6 b(,)57 b(you)51 b(ar)o(e)d(mor)o(e)i +26 31 bop 888 614 a FC(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 +714 y Fy(with-stdio-ports*)o FC(,)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) +909 y Fy(\(with-stdio-port)o(s*)37 b FB(thunk)p Fy(\))86 +b Fu(\000)-14 b(!)87 b FB(value\(s\))21 b(of)f(thunk)543 +b FC(pr)o(ocedur)o(e)681 1009 y Fy(\(with-stdio-port)o(s)37 +b FB(body)20 b(.)12 b(.)g(.)g Fy(\))88 b Fu(\000)-14 +b(!)87 b FB(value\(s\))20 b(of)h(body)680 b FC(syntax)888 +1151 y Fy(with-stdio-ports*)31 b FC(binds)37 b(the)h(standar)o(d)e +(ports)i Fy(\(current-input-)o(por)o(t\))o FC(,)888 1251 +y Fy(\(current-output-p)o(or)o(t\))p FC(,)23 b(and)k +Fy(\(error-output-por)o(t\))21 b FC(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 +FB(thunk)o FC(.)26 b(It)21 b(is)g(equivalent)g(to:)1071 +1519 y Fy(\(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 +1987 y FC(The)21 b Fy(with-stdio-ports)14 b FC(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 +2261 y FA(3.2.3)81 b(String)20 b(ports)681 2447 y FC(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 +2797 y Fy(\(make-string-inp)o(ut)o(-po)o(rt)37 b FB(string)p +Fy(\))87 b Fu(\000)-15 b(!)88 b FB(port)749 b FC(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) +(the)g(supplied)f(string.)681 3135 y Fy(\(make-string-out)o(pu)o(t-p)o +(or)o(t\))81 b Fu(\000)-15 b(!)88 b FB(port)952 b FC(pr)o(ocedur)o(e) +681 3234 y Fy(\(string-output-p)o(or)o(t-o)o(ut)o(pu)o(t)38 +b FB(port)p Fy(\))86 b Fu(\000)-15 b(!)88 b FB(string)619 +b FC(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 +(is)g(r)o(etrieved)e(by)i(applying)888 3576 y Fy(string-output-por)o +(t-)o(out)o(pu)o(t)15 b FC(to)21 b(the)g(port.)681 3771 +y Fy(\(call-with-strin)o(g-)o(out)o(pu)o(t-)o(por)o(t)37 +b FB(pr)o(ocedur)o(e)p Fy(\))86 b Fu(\000)-14 b(!)87 +b FB(string)301 b FC(pr)o(ocedur)o(e)888 3914 y(The)74 +b FB(pr)o(ocedur)o(e)e FC(value)h(is)h(called)f(on)h(a)f(port.)184 +b(When)74 b(it)g(r)o(eturns,)888 4013 y Fy(call-with-string-)o(ou)o +(tpu)o(t-)o(por)o(t)18 b FC(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 +(port)h(during)g(the)g(execution)g(of)g FB(pr)o(ocedur)o(e)o +FC(.)681 4387 y FA(3.2.4)81 b(Revealed)18 b(ports)j(and)e(\002le)h +(descriptors)681 4572 y FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p eop +(envir)o(onment,)k(and)30 b(ar)o(e)g(r)o(efer)o(enced)f(by)2071 +5147 y(26)p eop %%Page: 27 33 -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 +27 32 bop 365 614 a FC(small)29 b(integers)g(called)f +FB(\002le)h(descriptors)p FC(.)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 @@ -2718,8 +2666,8 @@ b(ar)o(e)365 1039 y(garbage-collected)c(Scheme)h(objects,)h(not)g 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 +(cumstances:)490 2055 y Fu(\017)41 b FC(when)21 b(interfacing)g(to)g +(for)o(eign)f(code)490 2223 y Fu(\017)41 b FC(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 @@ -2734,40 +2682,38 @@ b(intended)g(to)g(\002x)f(this)h(and)g(other)f(pr)o(oblems)h(arising)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 +b(,)35 b Fy(#f)e FC(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 +3564 y FB(r)o(evealed)h FC(and)f FB(closed?)p FC(.)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 +Fy(\(close)41 b(port\))p FC(,)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 +3763 y FB(closed?)20 b FC(\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 +Fy(\(close)41 b(fdes\))p FC(,)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 +(with)j Fy(\(dup)42 b(fdes\))p FC(.)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 +4480 y Fy(\(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) +FC(The)20 b FB(r)o(evealed)h FC(\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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +g(can)g(be)g(closed)g(when)g(the)h(port)f(is)g(collected.)1756 +5147 y(27)p eop %%Page: 28 34 -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) +28 33 bop 681 614 a FC(Essentially)-9 b(,)31 b(the)f +FB(r)o(evealed)e FC(\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 @@ -2775,40 +2721,40 @@ f(port's)h(\002le)f(descriptor)681 714 y(has)21 b(escaped)e(to)i(the)g (\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 +(\002le.)805 1162 y(Ports)36 b(allocated)f(with)h Fy(open-output-file) +29 b FC(and)35 b Fy(open-input-file)29 b FC(ar)o(e)34 +b(unr)o(e-)681 1262 y(vealed)24 b(ports\227)p FB(i.e.)p +FC(,)j FB(r)o(evealed)e FC(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 +y(The)44 b(functions)g Fy(fdes->output-port)o FC(,)g +Fy(fdes->input-por)o(t)p FC(,)f Fy(port->fdes)c FC(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) +(descriptors)f(and)g(ports.)101 b(When)681 1710 y Fy(port->fdes)31 +b FC(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 FB(r)o(evealed)681 +1810 y FC(\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) +1910 y Fy(\(release-port-ha)o(nd)o(le)37 b FB(port)o +Fy(\))p FC(,)65 b(which)58 b(decr)o(ements)d(the)i(count.)133 +b(The)57 b(func-)681 2009 y(tion)44 b Fy(\(call/fdes)39 +b(fd/port)i FB(pr)o(oc)o Fy(\))i FC(automates)g(this)h(pr)o(otocol.)94 +b Fy(call/fdes)40 b FC(uses)681 2109 y Fy(dynamic-wind)18 +b FC(to)23 b(enfor)o(ce)e(the)i(pr)o(otocol.)32 b(If)22 +b FB(pr)o(oc)g FC(thr)o(ows)h(out)g(of)g(the)g Fy(call/fdes)c +FC(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 +2308 y(sequently)32 b(tries)g(to)g(thr)o(ow)g FB(back)g +FC(into)h FB(pr)o(oc)n FC('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 +Fy(fdes->outport)21 b FC(or)681 2507 y Fy(fdes->inport)p +FC(,)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 +(via)e Fy(exec\(2\))p FC(,)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) @@ -2816,18 +2762,18 @@ 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 +Fy(\(current-input-)o(por)o(t\))o FC(,)681 3254 y Fy(\(current-output-) +o(po)o(rt\))o FC(,)k(and)h Fy(\(error-output-po)o(rt)o(\))p +FC(.)81 b(These)41 b(ports)g(ar)o(e)f(ini-)681 3354 y(tialised)28 +b(with)i FB(r)o(evealed)f FC(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) +3802 y Fy(exec\(\))p FC(\227since)29 b(all)h(memory)i(is)f(dr)o(opped)f +(at)g(an)h Fy(exec\(\))p FC(.)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 @@ -2841,55 +2787,53 @@ f(collector)-6 b(.)28 b(This)21 b(is)h(critical,)f(since)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 +Fy(dup\(2\))d FC(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 -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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p eop +(ound)f(underneath)h(the)g(port)g(by)h(the)f(scsh)g(kernel)g(when)2071 +5147 y(28)p eop %%Page: 29 35 -29 34 bop 365 614 a FB(necessary)-9 b(.)35 b(This)25 +29 34 bop 365 614 a FC(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 +Fy(exec\(2\))p FC(,)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 +(new)f(location)g(with)h Fy(dup)p FC(,)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 +Fy(f)p FC(.)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 +(input)f(fr)o(om)f Fy(f)p FC(.)25 b(So)c(we)g(write:)573 +1533 y Fy(\(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 +2152 y FC(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 +2252 y(system)31 b(opened)e Fy(f)p FC('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 +365 2351 y Fy(trace.log)22 b FC(into)27 b(\002le)f(descriptor)f(3,)h +(we'll)g(clobber)g Fy(f)p FC(!)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) +b(when)18 b(the)g Fy(run)e FC(form)i(tries)f(to)h(dup)f +Fy(trace.log)p FC('s)d(\002le)k(descriptor)365 2551 y(to)29 +b(3,)g Fy(dup)e FC(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 +2650 y(vealed)d(port)i(\()p FB(i.e.)o FC(,)h Fy(f)p FC(\).)38 +b(So,)26 b(it)g(will)g(\002rst)g(move)f Fy(f)g FC(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 +b Fy(f)f FC(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 +b Fy(prog)p FC('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 +(closed,)g(either)f(by)h(a)f Fy(close\(\))d FC(or)k(a)365 +3191 y Fy(dup2\(\))19 b FC(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) @@ -2900,30 +2844,27 @@ h(straightened)f(out.)55 b(The)30 b(only)h(time)f(the)h(user)f(has)g 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) +3832 y(mation.)365 4129 y FA(3.2.5)81 b(Port-mapping)19 +b(machinery)365 4336 y FC(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 +4677 y(to)e(r)o(emember)f(ar)o(e:)490 4898 y Fu(\017)41 +b FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +b(.)1756 5147 y(29)p eop %%Page: 30 36 -30 35 bop 805 614 a Ft(\017)41 b FB(The)16 b(association)h(between)f(a) +30 35 bop 805 614 a Fu(\017)41 b FC(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 +(never)888 714 y(changed)31 b FB(except)g FC(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 +Fy(dup2)p FC(,)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 +Fy(close)p FC(,)f(two-ar)o(gument)i Fy(dup)p FC(,)f(and)g +Fy(move->fdes)p FC(.)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 @@ -2932,183 +2873,178 @@ b(,)30 b(and)888 1212 y(marked)g(as)g(unr)o(evealed,)h(thus)g(pr)o 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 +1735 y Fy(\(fdes->inport)38 b FB(fd)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(port)1324 b FC(pr)o(ocedur)o(e)681 1835 y +Fy(\(fdes->outport)38 b FB(fd)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(port)1280 b FC(pr)o(ocedur)o(e)681 1935 y +Fy(\(port->fdes)39 b FB(port)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(\002xnum)1233 b FC(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 +2253 y Fy(\(port-revealed)38 b FB(port)p Fy(\))86 b Fu(\000)-15 +b(!)88 b FB(integer)21 b(or)g Fy(#f)911 b FC(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 +h(otherwise)h Fy(#f)p FC(.)681 2572 y Fy(\(release-port-ha)o(nd)o(le)37 +b FB(port)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(unde\002ned)754 +b FC(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 Fy(\(call/fdes)39 b FB(fd/port)19 +b(consumer)p Fy(\))88 b Fu(\000)-15 b(!)88 b FB(value\(s\))20 +b(of)h(consumer)392 b FC(pr)o(ocedur)o(e)888 3026 y(Calls)28 +b FB(consumer)g FC(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 FB(fd/port)f +FC(is)h(a)g(\002le)g(descriptor)-6 b(,)27 b(this)f(is)h(just)g +Fy(\()p FB(consumer)43 b(fd/port)o Fy(\))p FC(.)e(If)26 +b FB(fd/port)e FC(is)j(a)888 3225 y(port,)j(calls)d FB(consumer)h +FC(on)h(its)f(underlying)g(\002le)g(descriptor)-6 b(.)45 +b(While)29 b FB(consumer)f FC(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 +3455 y(When)30 b Fy(call/fdes)c FC(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 +y(thr)o(ow)20 b(into)g FB(consumer)g FC(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 +3654 y(r)o(evealed-count)f(bookkeeping.)681 3837 y Fy(\(move->fdes)39 +b FB(fd/port)19 b(tar)o(get-fd)p Fy(\))85 b Fu(\000)-14 +b(!)87 b FB(port)20 b(or)h(fdes)699 b FC(pr)o(ocedur)o(e)888 +3973 y(Maps)20 b(fd)p Fu(!)p FC(fd)g(and)g(port)p Fu(!)p +FC(port.)888 4103 y(If)27 b FB(fd/port)e FC(is)i(a)f(\002le-descriptor) +g(not)h(equal)g(to)g FB(tar)o(get-fd)n FC(,)h(dup)e(it)h(to)g +FB(tar)o(get-fd)d FC(and)888 4202 y(close)d(it.)26 b(Returns)c +FB(tar)o(get-fd)n FC(.)888 4332 y(If)j FB(fd/port)e FC(is)j(a)e(port,)i +(it)f(is)g(shifted)g(to)g FB(tar)o(get-fd)n FC(,)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 +b(.)24 b FB(Fd/port)o FC('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 +FB(tar)o(get-fd)n FC(\).)35 b(Returns)25 b(the)f(port.)36 +b(This)25 b(operation)f(r)o(esets)f FB(fd/port)o FC('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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +(when)h FB(fd/port)e FC(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 FB(tar)o(get-fd)n +FC(,)k(it)g(is)g(\002rst)g(r)o(elocated)e(to)i(some)h(other)f(\002le)g +(descriptor)-6 b(.)2071 5147 y(30)p eop %%Page: 31 37 -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 +31 36 bop 365 614 a FA(3.2.6)81 b(Unix)20 b(I/O)365 828 +y Fy(\(dup)42 b FB(fd/port)19 b([newfd])p Fy(\))86 b +Fu(\000)-14 b(!)87 b FB(fd/port)1185 b FC(pr)o(ocedur)o(e)365 +927 y Fy(\(dup->inport)39 b FB(fd/port)19 b([newfd])p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(port)926 b FC(pr)o(ocedur)o(e)365 +1027 y Fy(\(dup->outport)39 b FB(fd/port)19 b([newfd])p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(port)882 b FC(pr)o(ocedur)o(e)365 +1127 y Fy(\(dup->fdes)40 b FB(fd/port)19 b([newfd])p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(fd)1087 b FC(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 +(of)f(C's)h Fy(dup\(\))d FC(and)i Fy(dup2\(\))p FC(.)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 +(ent)e(types)i(of)g(values:)60 b Fy(dup->inport)p FC(,)573 +1452 y Fy(dup->outport)p FC(,)22 b(and)k Fy(dup->fdes)c +FC(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 +b(.)30 b Fy(dup)p FC('s)22 b(r)o(eturn)g(value)g(depends)g(on)h(on)g +(the)573 1651 y(type)d(of)h FB(fd/port)o FC(\227it)g(maps)f(fd)p +Fu(!)p FC(fd)g(and)g(port)p Fu(!)p FC(port.)573 1788 +y(These)h(pr)o(ocedur)o(es)f(use)i(the)g(Unix)f Fy(dup\(\))f +FC(syscall)i(to)g(r)o(eplicate)e(the)i(\002le)g(descrip-)573 +1888 y(tor)i(or)h(\002le)f(port)h FB(fd/port)n FC(.)37 +b(If)24 b(a)g FB(newfd)g FC(\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 +(operation,)i FB(i.e.)p FC(,)g(the)e(operation)g(is)h(a)f +Fy(dup2\(\))p FC(.)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 +Fy(dup->inport)p FC(\))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 +b(For)17 b(example,)g Fy(\(dup)42 b(\(current-input-p)o(or)o(t\))573 +2286 y(5\))17 b FC(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 +y(count)g(is)g(1.)25 b(If)18 b FB(newfd)h FC(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 +FB(newfd)g FC(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 +(another)g Fy(dup)p FC(\))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 +(ports,)62 b Fy(dup->inport)50 b FC(and)573 3057 y Fy(dup->outport)27 +b FC(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 FB(vice)h(versa)p +FC(.)25 b(For)20 b(example,)f(if)g Fy(p)h FC(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 +Fy(\(dup->outport)38 b(p\))573 3356 y FC(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 +3558 y Fy(\(seek)42 b FB(fd/port)19 b(offset)i([whence])p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(integer)896 b FC(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 +(descriptor)e(or)i(port.)65 b FB(whence)35 b FC(is)f(one)573 +3786 y(of)39 b Fu(f)p Fy(seek/set)p FC(,)h Fy(seek/delta)p +FC(,)g Fy(seek/end)p Fu(g)p FC(,)g(and)f(defaults)f(to)i +Fy(seek/set)p FC(.)78 b(If)573 3878 y Fy(seek/set)p FC(,)33 +b(then)i FB(offset)f FC(is)g(an)f(absolute)h(index)g(into)g(the)g +(\002le;)40 b(if)34 b Fy(seek/delta)p FC(,)573 3969 y(then)c +FB(offset)g FC(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 Fy(seek/end)p FC(,)573 4060 +y(then)e FB(offset)g FC(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 FB(fd/port)e +FC(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 +(I/O)g(str)o(eam.)756 4499 y Fl(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +4848 y Fy(\(tell)42 b FB(fd/port)p Fy(\))85 b Fu(\000)-14 +b(!)87 b FB(integer)1414 b FC(pr)o(ocedur)o(e)1756 5147 +y(31)p eop %%Page: 32 38 -32 37 bop 888 614 a FB(Returns)24 b(the)f(position)h(of)f(the)g(I/O)g +32 37 bop 888 614 a FC(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 +814 y(OS)21 b(implementation.)681 998 y Fy(\(open-file)39 +b FB(fname)21 b(\003ags)g([perms])p Fy(\))86 b Fu(\000)-15 +b(!)88 b FB(port)860 b FC(pr)o(ocedur)o(e)888 1135 y +FB(Perms)22 b FC(defaults)e(to)i Fy(#o666)p FC(.)k FB(Flags)21 +b FC(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 +1334 y(one)d(of)f(the)h Fy(open/read)p FC(,)e Fy(open/write)p +FC(,)f(or)i Fy(open/read+write)24 b FC(\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 +FB(\003ags)g FC(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 +1832 y(output)22 b(port)e(with)i Fy(dup->outport)p FC(.\))681 +2117 y Fy(\(open-input-file)37 b FB(fname)20 b([\003ags])p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(port)823 b FC(pr)o(ocedur)o(e)681 +2216 y Fy(\(open-output-fil)o(e)37 b FB(fname)21 b([\003ags)f(perms])p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(port)555 b FC(pr)o(ocedur)o(e)888 +2353 y(These)24 b(ar)o(e)f(equivalent)h(to)g Fy(open-file)p +FC(,)d(after)i(\002rst)h(setting)h(the)f(r)o(ead/write)f(bits)888 +2453 y(of)33 b(the)f FB(\003ags)h FC(ar)o(gument)f(to)g +Fy(open/read)d FC(or)k Fy(open/write)p FC(,)e(r)o(espectively)-9 +b(.)59 b FB(Flags)888 2552 y FC(defaults)20 b(to)h(zer)o(o)f(for)h +Fy(open-input-file)o FC(,)15 b(and)1071 2691 y Fy(\(bitwise-ior)39 +b(open/create)g(open/truncate\))888 2830 y FC(for)23 +b Fy(open-output-file)o FC(.)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 +(unary)h(R4RS)g(de\002nitions.)681 3213 y Fy(\(open-fdes)39 +b FB(fname)21 b(\003ags)g([perms])p Fy(\))86 b Fu(\000)-15 +b(!)88 b FB(integer)764 b FC(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 +y Fy(\(fdes-flags)39 b FB(fd/port)p Fy(\))85 b Fu(\000)-14 +b(!)87 b FB(integer)1152 b FC(pr)o(ocedur)o(e)681 3734 +y Fy(\(set-fdes-flags)37 b FB(fd/port)19 b(integer)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(unde\002ned)627 b +FC(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 +Ft(O)t(S)t(I)t(X)i FC(is)d Fy(fdflags/close-o)o(n-e)o(xe)o(c)p +FC(;)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 @@ -3122,109 +3058,104 @@ b(Whenever)28 b(the)h(user)f(r)o(eveals)f(or)h(unr)o(eveals)g(a)g 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(31,)g -(1997)h(\226)f(17)13 b(:)f(31)p eop +(these)h(extra,)888 4898 y(automatic)21 b(operations.)2071 +5147 y(32)p eop %%Page: 33 39 -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 +33 38 bop 1158 601 a FC(Allowed)21 b(operations)272 b +Fy(Status)41 b(flag)p 1108 634 1999 4 v 488 701 a FA(Open+Get+Set)97 +b FC(These)21 b(\003ags)g(can)f(be)h(used)1158 800 y(in)g +Fy(open-file)p FC(,)1158 900 y Fy(fdes-status)p FC(,)16 +b(and)1158 1000 y Fy(set-fdes-status)f FC(calls.)2158 +701 y Fy(open/append)2158 800 y(open/non-blockin)o(g)2158 +900 y(open/async)39 b FC(\(Non-)r(P)t Ft(O)t(S)t(I)t(X)r +FC(\))2158 1000 y Fy(open/fsync)g FC(\(Non-)r(P)t Ft(O)t(S)t(I)t(X)r +FC(\))p 1108 1033 V 658 1099 a FA(Open+Get)98 b FC(These)21 +b(\003ags)g(can)f(be)h(used)1158 1199 y(in)g Fy(open-file)c +FC(and)1158 1298 y Fy(fdes-status)f FC(calls,)21 b(but)1158 +1398 y(ar)o(e)e(ignor)o(ed)i(by)1158 1498 y Fy(set-fdes-status)p +FC(.)2158 1099 y Fy(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 +1108 1531 V 846 1597 a FA(Open)99 b FC(These)21 b(\003ags)g(ar)o(e)e +(only)1158 1697 y(r)o(elevant)h(in)h Fy(open-file)1158 +1797 y FC(calls;)g(they)g(ar)o(e)e(ignor)o(ed)1158 1896 +y(by)i Fy(fdes-status)16 b FC(and)1158 1996 y Fy(set-fdes-status)f +FC(calls.)2158 1597 y Fy(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 +2166 y FC(T)-8 b(able)38 b(3.1:)60 b(Status)38 b(\003ags)g(for)g +Fy(open-file)p FC(,)h Fy(fdes-status)34 b FC(and)k Fy(set-fdes-status)p +FC(.)365 2266 y(Only)23 b(P)t Ft(O)t(S)t(I)t(X)g FC(\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 +(de-)365 2365 y(\002ne)25 b(others.)37 b(The)24 b Fy(open/access-mask) +18 b FC(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 +Fy(open/read)p FC(,)d Fy(open/write)e FC(and)27 b Fy(open/read+write) +365 2565 y FC(bits.)365 2965 y Fy(\(fdes-status)39 b +FB(fd/port)p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(integer)1109 +b FC(pr)o(ocedur)o(e)365 3064 y Fy(\(set-fdes-status)37 +b FB(fd/port)19 b(integer)p Fy(\))88 b Fu(\000)-15 b(!)87 +b FB(unde\002ned)584 b FC(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 +Fy(dup)p FC(\227if)e(you)j(cr)o(eate)d(port)i FB(b)g +FC(by)g(applying)g Fy(dup)f FC(to)h(port)g FB(a)p FC(,)g(and)g(change) +573 3637 y FB(b)p FC('s)c(status)g(\003ags,)g(you)g(will)h(also)f(have) +f(changed)g FB(a)p FC('s)h(status)g(\003ags.)365 3927 +y Fy(\(pipe\))85 b Fu(\000)-14 b(!)87 b FB([rport)20 +b(wport)o(])1475 b FC(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 +(Unix)f(pipe.)365 4359 y Fy(\(read-string)39 b FB(nbytes)21 +b([fd/port])p Fy(\))85 b Fu(\000)-15 b(!)87 b FB(string)21 +b(or)g Fy(#f)648 b FC(pr)o(ocedur)o(e)365 4458 y Fy(\(read-string!)39 +b FB(str)20 b([fd/port)f(start)i(end])p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(nr)o(ead)21 b(or)f Fy(#f)428 b FC(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 +y(not)33 b(enough)h(data)e(\(eof\).)61 b Fy(read-string!)28 +b FC(r)o(eads)k(the)h(data)e(into)j(string)g FB(str)f +FC(at)573 4799 y(the)21 b(indices)g(in)h(the)f(half-open)g(interval)g +Fn([)p FB(start)p Fz(;)14 b FB(end)o Fn(\))p FC(;)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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +b(string:)42 b FB(start)c Fn(=)f(0)29 b FC(and)f FB(end)38 +b Fn(=)g Fy(\(string-length)g FB(string)o Fy(\))p FC(.)50 +b(They)29 b(will)1756 5147 y(33)p eop %%Page: 34 40 -34 39 bop 888 614 a FB(persistently)29 b(r)o(etry)e(on)i(partial)e(r)o +34 39 bop 888 614 a FC(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 +y Fy(read-string)21 b FC(r)o(eturns)k(the)h(string)g(r)o(ead;)g +Fy(read-string!)21 b FC(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 +(check.)888 1274 y(The)g(values)e(of)i FB(start)f FC(and)g +FB(end)g FC(must)h(specify)f(a)f(well-de\002ned)h(interval)g(in)h +FB(str)p FC(,)f FB(i.e.)p FC(,)888 1373 y Fn(0)k Fu(\024)g +FB(start)f Fu(\024)h FB(end)g Fu(\024)g Fy(\(string-length)37 +b FB(str)q Fy(\))o FC(.)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 +Fy(\(read-string/par)o(ti)o(al)37 b FB(nbytes)21 b([fd/port])p +Fy(\))85 b Fu(\000)-15 b(!)88 b FB(string)20 b(or)h Fy(#f)299 +b FC(pr)o(ocedur)o(e)681 1887 y Fy(\(read-string!/pa)o(rt)o(ial)37 +b FB(str)20 b([fd/port)f(start)h(end])p Fy(\))83 b Fu(\000)-14 +b(!)84 b FB(nr)o(ead)20 b(or)h Fy(#f)86 b FC(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) +y(mediately)d(available)e(\()p FB(e.g.)o FC(,)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 +(immediately)g(available)e(\()p FB(e.g.)o FC(,)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(if)h(you)h(r)o(equest)e(an)h Fz(n)29 b(>)g Fn(0)24 +b FC(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 @@ -3233,20 +3164,20 @@ b(eof\).)888 2752 y(Ther)o(e)25 b(is)h(one)g(case)f(in)h(which)h(the)f (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 +(eturn)g(a)h(zer)o(o-byte)e(r)o(ead.)888 3181 y Fy(read-string/parti)o +(al)37 b FC(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 +(value.)31 b Fy(read-string!/par)o(ti)o(al)16 b FC(r)o(eads)22 +b(the)h(data)e(into)888 3380 y(string)30 b FB(str)e FC(at)g(the)h +(indices)g(in)g(the)f(half-open)g(interval)g Fn([)p FB(start)p +Fz(;)14 b FB(end)p Fn(\))p FC(;)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 +FB(start)e Fn(=)f(0)c FC(and)g FB(end)23 b Fn(=)g Fy(\(string-length)38 +b FB(string)p Fy(\))o FC(.)888 3580 y(The)20 b(values)e(of)i +FB(start)f FC(and)g FB(end)g FC(must)h(specify)f(a)f(well-de\002ned)h +(interval)g(in)h FB(str)p FC(,)f FB(i.e.)p FC(,)888 3679 +y Fn(0)30 b Fu(\024)g FB(start)g Fu(\024)g FB(end)g Fu(\024)g +Fy(\(string-length)38 b FB(str)p Fy(\))p FC(.)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 @@ -3259,36 +3190,33 @@ b(you)888 4139 y(r)o(equest)k(one,)h(\(2\))d(you)i(turn)g(on)g 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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +f(particular)g(r)o(ead)f(operation.)681 4753 y Fy(\(select)84 +b FB(rvec)21 b(wvec)f(evec)h([timeout])p Fy(\))85 b Fu(\000)-14 +b(!)87 b FB([rvec')20 b(wvec')h(evec'])308 b FC(pr)o(ocedur)o(e)681 +4852 y Fy(\(select!)40 b FB(rvec)21 b(wvec)f(evec)h([timeout])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB([nr)21 b(nw)g(ne])562 +b FC(pr)o(ocedur)o(e)2071 5147 y(34)p eop %%Page: 35 41 -35 40 bop 573 614 a FB(The)26 b Fx(select)e FB(pr)o(ocedur)o(e)h +35 40 bop 573 614 a FC(The)26 b Fy(select)e FC(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 +573 714 y(multiple)c(I/O)g(channels.)31 b(The)23 b FB(rvec)f +FC(and)g FB(evec)h FC(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 +b FB(wvec)30 b FC(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) +(guments.)54 b(Every)29 b(element)i(of)573 1112 y FB(rvec')22 +b FC(is)g(r)o(eady)f(for)g(input;)i(every)f(element)g(of)g +FB(wvec')g FC(is)g(r)o(eady)e(for)i(output;)h(every)573 +1212 y(element)e(of)f FB(evec')h FC(has)g(an)g(exceptional)f(condition) +i(pending.)573 1350 y(The)d Fy(select)e FC(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) +b FB(timeout)g FC(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 +y Fy(#f)p FC(,)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 @@ -3301,29 +3229,29 @@ 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 +573 2484 y(the)25 b(actual,)g(primitive)g Fy(select)d +FC(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 +2821 y(The)j Fy(select!)d FC(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 +Fy(#f)e FC(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 +f(in)h(to)g Fy(select!)d FC(ar)o(e)h(allowed)i(to)g(contain)g +Fy(#f)573 3319 y FC(values)c(as)h(well)g(as)f(integers)h(and)g(ports.) +756 3506 y Fl(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) +Fy(\(write-string)39 b FB(string)20 b([fd/port)f(start)i(end])p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(unde\002ned)373 b +FC(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 @@ -3335,32 +3263,29 @@ b(A)25 b(non-blocking)i(i/o)f(err)o(or)f(is)g(consider)o(ed)g(an)573 (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 +(characters)e(of)h FB(string)g FC(in)h(the)f(half-open)g(interval)573 +4799 y Fn([)p FB(start)p Fz(;)14 b FB(end)p Fn(\))p FC(.)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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)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 +b FB(start)59 b Fn(=)f(0)39 b FC(and)573 4898 y FB(end)26 +b Fn(=)f Fy(\(string-length)38 b FB(string)p Fy(\))p +FC(.)30 b(The)22 b(values)g(of)h FB(start)f FC(and)g +FB(end)g FC(must)h(specify)1756 5147 y(35)p eop %%Page: 36 42 -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 +36 41 bop 888 614 a FC(a)17 b(well-de\002ned)f(interval)g(in)i +FB(str)p FC(,)f FB(i.e.)p FC(,)g Fn(0)23 b Fu(\024)g +FB(start)f Fu(\024)h FB(end)g Fu(\024)g Fy(\(string-length)37 +b FB(str)q Fy(\))o FC(.)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) +b Fy(write-string)p FC('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 +1294 y Fy(\(write-string/pa)o(rt)o(ial)37 b FB(string)19 +b([fd/port)f(start)h(end])p Fy(\))74 b Fu(\000)-14 b(!)75 +b FB(nwritten)87 b FC(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 +(ess)c(analog)k(to)888 1537 y Fy(write-string)p FC(.)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 @@ -3372,11 +3297,11 @@ b(Partial)27 b(writes)h(can)g(occur)f(when)i(\(1\))d(we)i(write)g(of)o 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 +2341 y Fu(\017)41 b FC(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) +(implies)i(we)e(wr)o(ote)h FB(something)p FC(.)988 2576 +y Fu(\017)41 b FC(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 @@ -3386,16 +3311,16 @@ b(then)i(the)1071 2775 y(write)e(is)g(r)o(etried.)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 +FB(e.g.)o FC(,)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 +FB(nwritten)23 b Fz(>)f Fn(0)p FC(,)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 +(\003ush)h(operation\).)681 3985 y FA(3.2.7)81 b(Buf)o(fered)20 +b(I/O)681 4172 y FC(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 @@ -3409,59 +3334,56 @@ b(of)o(f)f(completely\).)805 4699 y(It)24 b(can)g(be)f(useful)h(to)g (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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +b(Because)21 b(shells)2071 5147 y(36)p eop %%Page: 37 43 -37 42 bop 365 614 a FB(fr)o(equently)31 b(shar)o(e)e(stdin)i(with)h +37 42 bop 365 614 a FC(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 +Fy(\(current-input-po)o(rt)o(\))12 b FC(to)19 b(block)g(buf)o(fering)f +(for)365 1013 y(higher)k(performance.)365 1169 y Fy(\(set-port-bufferi) +o(ng)37 b FB(port)20 b(policy)g([size])p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(unde\002ned)377 b FC(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.) +FB(i.e.)p FC(,)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 +(that)g(may)f(be)h(chosen:)805 1771 y Fy(bufpol/block)161 +b FC(General)21 b(block)g(buf)o(fering)f(\(general)g(default\))805 +1870 y Fy(bufpol/line)205 b FC(Line)21 b(buf)o(fering)f(\(tty)h +(default\))805 1970 y Fy(bufpol/none)205 b FC(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 +(terminal)g(devices.)573 2461 y(The)30 b FB(size)h FC(ar)o(gument)e(r)o +(equests)i(an)f(I/O)g(buf)o(fer)f(of)h FB(size)h FC(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 +(is)h(turned)g(of)o(f)f(\()p FB(i.e.)p FC(,)573 2660 +y FB(size)h Fn(=)g(0)d FC(for)h(any)g(policy)g(is)g(equivalent)g(to)g +FB(policy)h Fn(=)h Fy(bufpol/none)-5 b FC(\).)365 2970 +y Fy(\(force-output)39 b FB([fd/port])p Fy(\))84 b Fu(\000)-14 +b(!)87 b FB(unde\002ned)915 b FC(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 +y Fy(\(flush-all-ports\))80 b Fu(\000)-14 b(!)87 b FB(unde\002ned)1111 +b FC(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 +4205 y FA(3.2.8)81 b(File)20 b(locking)365 4400 y FC(Scsh)i(pr)o +(ovides)h(P)t Ft(O)t(S)t(I)t(X)j FC(advisory)c(\002le)g(locking.)30 +b FB(Advisory)21 b FC(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 @@ -3471,12 +3393,9 @@ b FA(Advisory)21 b FB(locks)h(ar)o(e)f(locks)h(that)g(can)g(be)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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +(esour)o(ce.)1756 5147 y(37)p eop %%Page: 38 44 -38 43 bop 888 614 a FE(Remark:)94 b Fk(Unfortunately)-8 +38 43 bop 888 614 a Fl(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 @@ -3511,57 +3430,54 @@ b(.)888 2032 y(NeXTSTEP)21 b(users)e(should)i(also)f(note)i(that)h (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) +2306 y(if)f(this)g(happens.)807 2479 y FC(P)t Ft(O)t(S)t(I)t(X)29 +b FC(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 +FB(lock-r)o(egion)f FC(r)o(ecor)o(d:)888 2767 y Fy(\(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) +y Fu(\017)j FC(The)21 b Fy(exclusive?)c FC(\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 +3807 y Fu(\017)41 b FC(The)e Fy(whence)d FC(\002eld)j(is)g(one)h(of)e +(the)h(values)g(fr)o(om)f(the)h Fy(seek)e FC(call:)62 +b Fy(seek/set)p FC(,)888 3907 y Fy(seek/delta)p FC(,)15 +b(or)20 b Fy(seek/end)p FC(,)c(and)i(determines)i(the)f(interpr)o +(etation)g(of)g(the)g Fy(start)888 4006 y FC(\002eld:)988 +4171 y FA(\226)41 b FC(If)30 b Fy(seek/set)p FC(,)f(the)i +Fy(start)d FC(value)i(is)h(simply)g(an)f(absolute)g(index)h(into)g(the) +1071 4271 y(\002le.)988 4403 y FA(\226)41 b FC(If)21 +b Fy(seek/delta)p FC(,)16 b(the)21 b Fy(start)e FC(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 +4634 y FA(\226)41 b FC(If)20 b Fy(seek/end)p FC(,)e(the)i +Fy(start)f FC(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 +(locked)h(is)f(given)g(by)g(the)h Fy(start)d FC(and)h +Fy(len)g FC(\002elds;)888 4898 y(if)33 b Fy(len)e FC(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(31,)g(1997)h(\226)f(17) -13 b(:)f(31)p eop +(egion)f(extends)h(fr)o(om)f(the)2071 5147 y(38)p eop %%Page: 39 45 -39 44 bop 573 614 a FB(starting)24 b(point)h(thr)o(ough)f(the)g(end)g +39 44 bop 573 614 a FC(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) +714 y(subsequent)f(write)g(operations.)490 866 y Fu(\017)41 +b FC(The)21 b Fy(proc)e FC(\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 +965 y(lock,)f(when)g(r)o(elevant)f(\(see)g Fy(get-lock-region)15 +b FC(below\).)365 1138 y Fy(\(make-lock-region)37 b FB(exclusive?)17 +b(start)g(len)g([whence])p Fy(\))55 b Fu(\000)-14 b(!)56 +b FB(lock-r)o(egion)87 b FC(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 +(d.)30 b(The)23 b Fy(whence)e FC(\002eld)i(defaults)f(to)573 +1364 y Fy(seek/set)p FC(.)365 1633 y Fy(\(lock-region)39 +b FB(fdes)21 b(lock)p Fy(\))87 b Fu(\000)-15 b(!)88 b +FB(unde\002ned)960 b FC(pr)o(ocedur)o(e)365 1733 y Fy +(\(lock-region/no-b)o(lo)o(ck)37 b FB(fdes)21 b(lock)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(boolean)648 b FC(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 +1959 y FB(fdes)p FC(.)60 b(The)32 b Fy(lock-region)c +FC(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 @@ -3569,112 +3485,106 @@ y(was)29 b(granted.)51 b(T)-8 b(o)30 b(take)f(an)g(exclusive)g 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 +365 2527 y Fy(\(get-lock-region)37 b FB(fdes)21 b(lock)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(lock-r)o(egion)20 +b(or)h Fy(#f)548 b FC(pr)o(ocedur)o(e)573 2653 y(Return)27 +b(the)g(\002rst)h(lock)f(r)o(egion)g(on)h FB(fdes)f FC(that)g(would)g +(con\003ict)h(with)g(lock)g(r)o(egion)573 2753 y FB(lock)o +FC(.)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 +2853 y(the)e Fy(proc)f FC(\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 +(systems)g(\()p FB(i.e.)p FC(,)g(an)g(NFS)f(\002le)h(system\),)573 +3251 y(the)27 b Fy(proc)e FC(\002eld)h(may)h(be)f(ambiguous.)44 +b(W)-8 b(e)27 b(note,)h(again,)g(that)h(P)t Ft(O)t(S)t(I)t(X)h +FC(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 +y Fy(\(unlock-region)38 b FB(fdes)21 b(lock)p Fy(\))87 +b Fu(\000)-14 b(!)87 b FB(unde\002ned)873 b FC(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 +4015 y Fy(\(with-region-lock)o(*)37 b FB(fdes)21 b(lock)g(thunk)p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(value\(s\))20 b(of)h(thunk)242 +b FC(pr)o(ocedur)o(e)365 4115 y Fy(\(with-region-lock)37 +b FB(fdes)21 b(lock)f(body)g(.)12 b(.)g(.)g Fy(\))88 +b Fu(\000)-15 b(!)88 b FB(value\(s\))20 b(of)g(body)379 +b FC(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 Fy(\()p FB(thunk)o +Fy(\))p FC(.)26 b(When)573 4341 y FB(thunk)i FC(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 +FB(e.g.)o FC(,)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 +(eturn)f(fr)o(om)h FB(thunk)o FC(,)46 b(its)41 b(r)o(eturn)f(values)g +(ar)o(e)g(r)o(eturned)f(by)573 4766 y Fy(with-region-lock)o(*)p +FC(.)f(The)28 b Fy(with-region-loc)o(k)21 b FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +b(.)1756 5147 y(39)p eop %%Page: 40 46 -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 +40 45 bop 681 614 a Fw(3.3)99 b(File)25 b(system)681 +828 y FC(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 +o(es)e(which)j(manipulate)e(\002le)h FB(names)p FC(.)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 +(documented)i(in)g(section)g(5.1.3.)681 1172 y Fy(\(create-director)o +(y)37 b FB(fname)21 b([perms)f(override?])p Fy(\))87 +b Fu(\000)-15 b(!)87 b FB(unde\002ned)207 b FC(pr)o(ocedur)o(e)681 +1271 y Fy(\(create-fifo)38 b FB(fname)21 b([perms)g(override?])p +Fy(\))86 b Fu(\000)-15 b(!)88 b FB(unde\002ned)424 b +FC(pr)o(ocedur)o(e)681 1371 y Fy(\(create-hard-lin)o(k)37 +b FB(oldname)17 b(newname)g([override?])p Fy(\))52 b +Fu(\000)-14 b(!)54 b FB(unde\002ned)87 b FC(pr)o(ocedur)o(e)681 +1471 y Fy(\(create-symlink)37 b FB(old-name)18 b(new-name)g +([override?])p Fy(\))67 b Fu(\000)-14 b(!)68 b FB(unde\002ned)87 +b FC(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 +888 1737 y(The)h FB(override?)g FC(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 +1973 y Fy(#f)273 b FC(signal)21 b(an)g(err)o(or)f(\(default\))1071 +2122 y Fy('query)97 b FC(pr)o(ompt)21 b(the)g(user)1071 +2272 y FB(other)190 b FC(delete)29 b(the)h(old)g(object)g(\(with)h +Fy(delete-file)25 b FC(or)1432 2371 y Fy(delete-directory,)g +FC(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 FB(Perms)g FC(defaults)f(to)h +Fy(#o777)e FC(\(but)h(is)i(masked)e(by)h(the)g(curr)o(ent)f(umask\).) +1071 2799 y Fl(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 +(do)i(not)g(have.)681 3417 y Fy(\(delete-director)o(y)37 +b FB(fname)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(unde\002ned)820 +b FC(pr)o(ocedur)o(e)681 3516 y Fy(\(delete-file)38 b +FB(fname)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(unde\002ned)1038 +b FC(pr)o(ocedur)o(e)681 3616 y Fy(\(delete-filesys-)o(ob)o(jec)o(t)37 +b FB(fname)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(unde\002ned)602 +b FC(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 +b Fy(delete-)888 3852 y(filesys-object)15 b FC(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 +(symlinks,)j(\002fos,)f FB(etc.)p FC(.)681 4189 y Fy(\(read-symlink)38 +b FB(fname)p Fy(\))87 b Fu(\000)-15 b(!)88 b FB(string)1121 +b FC(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 Fy(fname)p FC(.)681 +4563 y Fy(\(rename-file)38 b FB(old-fname)20 b(new-fname)h([override?]) +p Fy(\))86 b Fu(\000)-15 b(!)88 b FB(unde\002ned)129 +b FC(pr)o(ocedur)o(e)888 4699 y(If)34 b(you)h(override)e(an)h(existing) +h(object,)i(then)e FB(old-fname)e FC(and)g FB(new-fname)h +FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +Fy(rename\(\))p FC(.)2071 5147 y(40)p eop %%Page: 41 47 -41 46 bop 756 614 a FE(Remark:)186 b Fk(Ther)o(e)37 b(is)f(an)j +41 46 bop 756 614 a Fl(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 @@ -3684,14 +3594,14 @@ Fk('s)g(existence)e(check)g(and)h(the)756 888 y(actual)i(r)o(ename)g 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 +(unlikely)f(to)i(occur)f(in)h(practice.)365 1487 y Fy(\(set-file-mode) +38 b FB(fname/fd/port)19 b(mode)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(unde\002ned)503 b FC(pr)o(ocedur)o(e)365 +1587 y Fy(\(set-file-owner)38 b FB(fname/fd/port)18 b(uid)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(unde\002ned)524 b +FC(pr)o(ocedur)o(e)365 1687 y Fy(\(set-file-group)38 +b FB(fname/fd/port)18 b(gid)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(unde\002ned)529 b FC(pr)o(ocedur)o(e)573 1840 y(These)30 b(pr)o(ocedur)o(es)f(set)h(the)h(permission)h(bits,)h (owner)e(id,)h(and)e(gr)o(oup)g(id)h(of)f(a)573 1939 y(\002le,)35 b(r)o(espectively)-9 b(.)58 b(The)32 b(\002le)g(can)g(be)g @@ -3699,63 +3609,60 @@ y(\002le,)35 b(r)o(espectively)-9 b(.)58 b(The)32 b(\002le)g(can)g(be)g 2039 y(either)19 b(an)g(integer)h(\002le)g(descriptor)f(or)g(a)g(port)h (open)g(on)g(the)f(\002le.)26 b(Setting)19 b(\002le)h(user)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) +2365 y Fy(\(set-file-times)38 b FB(fname)20 b([access-time)g(mod-time]) +p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(unde\002ned)116 +b FC(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 +FB(fname)g FC(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 +(status-change)g(\()p Fy(ctime)p FC(\))d(is)k(set)f(to)g(the)h(cur)o(-) +573 3016 y(r)o(ent)c(time.)365 3243 y Fy(\(sync-file)40 +b FB(fd/port)p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(unde\002ned)1101 +b FC(pr)o(ocedur)o(e)365 3342 y Fy(\(sync-file-system)o(\))81 +b Fu(\000)-14 b(!)87 b FB(unde\002ned)1067 b FC(pr)o(ocedur)o(e)573 +3495 y(Calling)28 b Fy(sync-file)c FC(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) +y(given)17 b(\002le.)24 b(If)17 b FB(fd/port)e FC(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 +573 3695 y(Calling)33 b Fy(sync-file-system)27 b FC(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 +(e)g(not)k(P)t Ft(O)t(S)t(I)t(X)r FC(.)93 b(Inter)o(estingly)44 +b(enough,)49 b Fy(sync-file-)573 4039 y(system)30 b FC(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)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 +b(for)g(humor)g(value.)k(See)20 b(the)h Fy(sync\(2\))d +FC(man)j(page)f(for)g(Unix)h(enlightenment.)365 4365 +y Fy(\(truncate-file)38 b FB(fname/fd/port)19 b(len)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(unde\002ned)577 b +FC(pr)o(ocedur)o(e)573 4518 y(The)21 b(speci\002ed)f(\002le)h(is)g(tr)o +(uncated)f(to)h FB(len)h FC(bytes)f(in)g(length.)365 +4844 y Fy(\(file-info)40 b FB(fname/fd/port)19 b([chase?])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(\002le-info-r)o(ecord)417 +b FC(pr)o(ocedur)o(e)1756 5147 y(41)p eop %%Page: 42 48 -42 47 bop 888 614 a FB(The)32 b Fx(file-info)d FB(pr)o(ocedur)o(e)h(r)o +42 47 bop 888 614 a FC(The)32 b Fy(file-info)d FC(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 +b(If)23 b(the)h FB(chase?)f FC(\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 +888 913 y(r)o(efer)-6 b(.)23 b(If)16 b FB(chase?)g FC(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) +b(The)20 b FB(chase?)f FC(\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 +888 1252 y(The)c(value)f(r)o(eturned)g(is)h(a)g FB(\002le-info)g(r)o +(ecord)p FC(,)g(de\002ned)f(to)h(have)g(the)g(following)h(str)o(uc-)888 +1352 y(tur)o(e:)1071 1531 y Fy(\(define-record)38 b(file-info)1158 +1631 y(type)260 b(;)43 b Fu(f)p Fy(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(regular,)f(socket,)h(symlink)p Fu(g)1158 1830 y Fy(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 @@ -3766,35 +3673,32 @@ 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) +2907 y FC(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 +y Fy(\(file-info:uid)38 b(x\))888 3216 y FC(and)44 b(similarly)h(for)f +(the)h(other)f(\002elds.)97 b(The)44 b Fy(type)f FC(\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 +(the)888 3415 y Fy(file-info?)17 b FC(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 +y(they)29 b(ar)o(e)e(built)h(on)h(top)g(of)f Fy(file-info)p +FC(,)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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +4 v 1121 4013 a Fy(file-type)706 b FC(type)1121 4113 +y Fy(file-inode)662 b FC(inode)1121 4213 y Fy(file-mode)706 +b FC(mode)1121 4312 y Fy(file-nlinks)618 b FC(nlinks)1121 +4412 y Fy(file-owner)662 b FC(uid)1121 4511 y Fy(file-group)g +FC(gid)1121 4611 y Fy(file-size)706 b FC(size)1121 4711 +y Fy(file-last-access)398 b FC(atime)1121 4810 y Fy(file-last-mod)530 +b FC(mtime)1121 4910 y Fy(file-last-status)o(-c)o(han)o(ge)93 +b FC(ctime)2071 5147 y(42)p eop %%Page: 43 49 -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 +43 48 bop 573 614 a FC(Example:)756 769 y Fy(;;)42 b(All)h(my)f(files)g +(in)h(/usr/tmp:)756 869 y(\(filter)d(\()p Fz(\025)f Fy(\(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("/usr/tmp"\)\)\))756 1154 y Fl(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 @@ -3806,116 +3710,111 @@ 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 +y Fy(\(file-directory?)37 b FB(fname/fd/port)19 b([chase?])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(boolean)398 b FC(pr)o(ocedur)o(e)365 +2142 y Fy(\(file-fifo?)39 b FB(fname/fd/port)19 b([chase?])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(boolean)616 b FC(pr)o(ocedur)o(e)365 +2242 y Fy(\(file-regular?)38 b FB(fname/fd/port)19 b([chase?])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(boolean)485 b FC(pr)o(ocedur)o(e)365 +2342 y Fy(\(file-socket?)39 b FB(fname/fd/port)18 b([chase?])p +Fy(\))86 b Fu(\000)-15 b(!)88 b FB(boolean)528 b FC(pr)o(ocedur)o(e)365 +2441 y Fy(\(file-special?)38 b FB(fname/fd/port)19 b([chase?])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(boolean)485 b FC(pr)o(ocedur)o(e)365 +2541 y Fy(\(file-symlink?)38 b FB(fname/fd/port)p Fy(\))85 +b Fu(\000)-14 b(!)87 b FB(boolean)779 b FC(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 +(which)g Fy(file-info)c FC(is)k(applied;)573 2870 y(the)30 +b(sole)g(exception)g(is)h Fy(file-symlink?)p FC(,)c(which)j(does)g(not) +h(take)f(the)g(optional)573 2970 y FB(chase?)20 b FC(second)h(ar)o +(gument.)573 3247 y(For)g(example,)756 3386 y Fy(\(file-directory)o(?) +37 b("/usr/dalbertz"\))168 b Fn(=)-14 b Fu(\))218 b Fy(#t)365 +3616 y(\(file-not-readabl)o(e?)37 b FB(fname)p Fy(\))87 +b Fu(\000)-15 b(!)88 b FB(boolean)813 b FC(pr)o(ocedur)o(e)365 +3715 y Fy(\(file-not-writabl)o(e?)37 b FB(fname)p Fy(\))87 +b Fu(\000)-15 b(!)88 b FB(boolean)813 b FC(pr)o(ocedur)o(e)365 +3815 y Fy(\(file-not-executa)o(bl)o(e?)37 b FB(fname)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(boolean)726 b FC(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 +756 4108 1909 4 v 756 4213 a Fy(#f)621 b FC(Access)21 +b(permitted)756 4362 y Fy('search-denied)93 b FC(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(31,)g(1997)h -(\226)f(17)13 b(:)f(31)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 +(access.)756 4596 y Fy('permission)225 b FC(Permission)22 +b(denied.)756 4746 y Fy('no-directory)137 b FC(Some)21 +b(dir)o(ectory)f(doesn't)h(exist.)756 4895 y Fy('nonexistent)181 +b FC(File)21 b(doesn't)h(exist.)1756 5147 y(43)p eop %%Page: 44 50 -44 49 bop 911 614 a FB(A)22 b(\002le)g(is)h(consider)o(ed)f(writeable)g +44 49 bop 911 614 a FC(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 +g(calls)g(do)g(not)g(take)f(a)h FB(chase?)f FC(\003ag.)1071 +989 y Fl(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 +y(check.)681 1341 y Fy(\(file-readable?)k FB(fname)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(boolean)987 b FC(pr)o(ocedur)o(e)681 +1440 y Fy(\(file-writable?)37 b FB(fname)p Fy(\))87 b +Fu(\000)-14 b(!)87 b FB(boolean)987 b FC(pr)o(ocedur)o(e)681 +1540 y Fy(\(file-executable)o(?)37 b FB(fname)p Fy(\))87 +b Fu(\000)-14 b(!)87 b FB(boolean)900 b FC(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 +g(of)g(the)g(pr)o(eceding)888 1781 y Fy(file-not-...?)16 +b FC(pr)o(ocedur)o(es.)681 1974 y Fy(\(file-not-exists)o(?)37 +b FB(fname)21 b([chase?])p Fy(\))85 b Fu(\000)-14 b(!)87 +b FB(object)664 b FC(pr)o(ocedur)o(e)888 2115 y(Returns:)1071 +2230 y Fy(#f)622 b FC(Exists.)1071 2379 y Fy(#t)g FC(Doesn't)22 +b(exist.)1071 2529 y Fy('search-denied)94 b FC(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 +(ch.)681 2853 y Fy(\(file-exists?)38 b FB(fname)21 b([chase?])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(boolean)780 b FC(pr)o(ocedur)o(e)888 +2994 y(This)22 b(is)f(simply)g Fy(\(not)42 b(\(file-not-exists?)37 +b FB(fname)43 b([chase?])o Fy(\)\))681 3286 y(\(directory-files)37 +b FB([dir)20 b(dot\002les?])p Fy(\))85 b Fu(\000)-14 +b(!)87 b FB(string)21 b(list)615 b FC(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 +FB(dir)p FC(,)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 FB(dot\002les?)e +FC(\003ag)i(\(default)e Fy(#f)p FC(\))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 +b(of)g(the)h(value)f(of)h FB(dot\002les?)o FC(,)h(the)e(two)i(\002les)f +Fy(.)f FC(and)h Fy(..)e FC(ar)o(e)888 3727 y FB(never)f +FC(r)o(eturned.)888 3860 y(The)c(dir)o(ectory)f FB(dir)h +FC(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 Fy +(\(directory-files)37 b("/etc"\))888 4240 y FC(r)o(eturns)1071 +4379 y Fy(\("chown")j("exports")g("fstab")h(...\))888 +4519 y FB(not)1071 4659 y Fy(\("/etc/chown")d("/etc/exports")g +("/etc/fstab")h(...\))888 4799 y FC(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(31,)g -(1997)h(\226)f(17)13 b(:)f(31)p eop +(manually)888 4898 y(pr)o(epend)20 b(the)h(dir)o(ectory:)2071 +5147 y(44)p eop %%Page: 45 51 -45 50 bop 756 614 a Fx(\(map)41 b(\()p Fy(\025)e Fx(\(f\))k +45 50 bop 756 614 a Fy(\(map)41 b(\()p Fz(\025)e Fy(\(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 +764 y FC(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 Fy(\(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 +1215 y FC(or)21 b(use)g(the)f Fy(glob)g FC(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 +(be)g(generated)g(by)h Fy(\(run/strings)39 b(\(ls\)\))p +FC(,)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 +b(Using)21 b Fy(directory-files)14 b FC(is)22 b(r)o(eliable.)365 +1758 y Fy(\(glob)42 b FB(pat)733 1785 y Fv(1)791 1758 +y FB(.)12 b(.)g(.)g Fy(\))87 b Fu(\000)-14 b(!)87 b FB(string)21 +b(list)1283 b FC(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 +2103 y(literally)-9 b(.)869 2073 y Fv(2)932 2103 y FC(C)21 +b(shell)h Fy({a,b,c})c FC(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 +(the)h(special)f(meaning)i(of)e Fy({)p FC(,)g Fy(})p +FC(,)h Fy(*)p FC(,)f Fy([)p FC(,)g Fy(])p FC(,)g(and)g +Fy(?)p FC(.)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 @@ -3923,13 +3822,13 @@ 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 +Fy(.)p FC(\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 Fy(.)g FC(or)g +Fy(..)g FC(unless)h(it)f(is)h(a)f(constant)h(pattern,)h(as)e(in)h +Fy(\(glob)573 2976 y("../*/*.c"\))p FC(.)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 +3076 y(simple)h(glob)g(pattern)g Fy(".*")p FC(.)573 3214 +y(Some)g(examples:)756 3364 y Fy(\(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 @@ -3940,102 +3839,96 @@ y(\(glob)h("lexer/*.c")e("parser/*.c"\))756 4161 y(\(glob)i ("\\\\{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 +1146 4 v 450 4875 a Fq(2)485 4898 y Ft(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +(does.)1756 5147 y FC(45)p eop %%Page: 46 52 -46 51 bop 1071 614 a Fx(\(glob)42 b("*\\\\*"\))1245 714 +46 51 bop 1071 614 a Fy(\(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 +1650 y FC(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 +(ectories,)g FB(e.g.)o FC(,)1071 2243 y Fy(\(glob)42 +b("/usr/man/man?/)o("\))37 b Fn(=)-14 b Fu(\))1420 2342 +y Fy(\("/usr/man/man1)o(/")37 b("/usr/man/man2/")g(...\))888 +2537 y FC(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 +2899 y Fy(\(directory-files)37 b("../include"\))h Fn(=)-14 +b Fu(\))1245 2999 y Fy(\("cig.h")41 b("decls.h")e(...\))1071 +3198 y(\(glob)j("../include/*"\))37 b Fn(=)-14 b Fu(\))1245 +3298 y Fy(\("../include/cig.)o(h")37 b("../include/decl)o(s.h)o(")g +(...\))681 3564 y(\(glob-quote)i FB(str)p Fy(\))87 b +Fu(\000)-14 b(!)87 b FB(string)1319 b FC(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 +(matches)h FB(str)q FC(.)48 b(All)28 b(wild-car)o(d)888 +3801 y(characters)20 b(in)h FB(str)g FC(ar)o(e)e(quoted)j(with)f(a)f +(backslash.)1071 3964 y Fy(\(glob-quote)39 b("Any)j(*.c)g(files?"\)) +1245 4064 y Fn(=)-14 b Fu(\))44 b Fy("Any)e(\\*.c)g(files\\?")681 +4330 y(\(file-match)d FB(r)o(oot)20 b(dot-\002les?)f(pat)1790 +4357 y Fv(1)1848 4330 y FB(pat)1954 4357 y Fv(2)2012 +4330 y FB(.)12 b(.)g(.)34 b(pat)2239 4357 y Fo(n)2284 +4330 y Fy(\))87 b Fu(\000)-15 b(!)87 b FB(string)21 b(list)205 +b FC(pr)o(ocedur)o(e)888 4468 y Fy(file-match)26 b FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +Fy(find\(1\))p FC(.)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 FB(r)o(oot)o +FC(,)g(matching)h(the)888 4898 y(\002rst-level)c(\002les)h(against)f +(pattern)g FB(pat)2091 4925 y Fv(1)2128 4898 y FC(,)h(the)f +(second-level)g(\002les)g(against)h FB(pat)3329 4925 +y Fv(2)3366 4898 y FC(,)f(and)2071 5147 y(46)p eop %%Page: 47 53 -47 52 bop 573 614 a FB(so)23 b(forth.)33 b(The)23 b(list)g(of)g +47 52 bop 573 614 a FC(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 +839 y(The)h(\002les)h Fy(.)f FC(and)g Fy(..)g FC(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 +573 939 y(the)g FB(dot-\002les?)e FC(ar)o(gument)h(is)i +Fy(#t)p FC(.)573 1065 y(A)j(given)g FB(pat)999 1092 y +Fo(i)1052 1065 y FC(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 +(\002le)h(name.)k FB(E.g.)o FC(,)c(pattern)f Fy("t")f +FC(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 Fy("^t$")f +FC(matches)i(only)h(a)e(\002le)h(whose)h(entir)o(e)e(name)h(is)573 +1363 y(\223)p Fy(t)p FC(\224.)573 1489 y(The)21 b FB(pat)839 +1516 y Fo(i)887 1489 y FC(patterns)f(can)h(be)f(mor)o(e)h(general)f +(than)h(stated)f(above.)672 1640 y Fu(\017)42 b FC(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 +(em-)756 1740 y(bedding)27 b Fy(/)g FC(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 +1839 y Fy("a/b/c")j FC(gives)j(a)g(match)g(equivalent)h(to)f(the)h +(list)f(of)h(patterns)e Fy("a")43 b("b")756 1939 y("c")p +FC(.)672 2057 y Fu(\017)f FC(A)24 b FB(pat)951 2084 y +Fo(i)1004 2057 y FC(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 +(e)756 2356 y(raises)h(an)h(err)o(or)f(condition,)j Fy(file-match)20 +b FC(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 +b(keeps)g Fy(file-match)c FC(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 +y(Some)d(examples:)911 2906 y Fy(\(file-match)39 b("/usr/lib")g(#f)k +("m$")f("^tab"\))f Fn(=)-14 b Fu(\))1085 3005 y Fy(\("/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("\\\\.c$"\))k Fn(=)-14 b Fu(\))1085 3304 y Fy(\("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 @@ -4043,17 +3936,14 @@ 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 +b(file-directory?\))37 b Fn(=)-14 b Fu(\))1085 4400 y +Fy(\("/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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +(my)g(directory.)1756 5147 y FC(47)p eop %%Page: 48 54 -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 +48 53 bop 1226 614 a Fy(\(define)41 b(\(ext)h(extension\))1313 +714 y(\()p Fz(\025)d Fy(\(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 @@ -4061,40 +3951,40 @@ b(fn)43 b(extension\)\)\))1226 913 y(\(define)e(\(true)g(.)j(x\))e 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 +Fn(=)-14 b Fu(\))1401 1810 y Fy(\("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) +2156 y FC(Note)32 b(that)g(when)g FB(r)o(oot)f FC(is)h(the)g(curr)o +(ent)f(working)i(dir)o(ectory)e(\()p Fy(".")p FC(\),)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 +Fy("")p FC(,)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 +b(,)23 b(\223)p Fy(.)p FC(\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) +(extension)i(delimiter)-6 b(.)681 2872 y Fy(\(create-temp-fil)o(e)37 +b FB([pr)o(e\002x])p Fy(\))85 b Fu(\000)-14 b(!)87 b +FB(string)905 b FC(pr)o(ocedur)o(e)888 3010 y Fy(Create-temp-file)12 +b FC(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 +3209 y Fy("/usr/tmp/)p FB(pid)-5 b Fy(")p FC(,)20 b(wher)o(e)f +FB(pid)h FC(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 +(of)g(\002lenames)g(that)g(have)f FB(pr)o(e\002x)g FC(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 +(with)g(permission)g Fy(#o600)e FC(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 +3707 y(with)22 b Fy(set-file-mode)15 b FC(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 +4138 y(moment)22 b Fy(create-temp-file)14 b FC(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 @@ -4104,137 +3994,130 @@ b(pid)f(component)i(of)f(the)f(default)g(pr)o(e\002x)888 (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 +(eated)d(this)j(way)f(in)g Fy(/usr/tmp/)d FC(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(31,)g -(1997)h(\226)f(17)13 b(:)f(31)p eop +(write)g(access)g(to)g Fy(/usr/tmp/)p FC(,)d(so)k(even)2071 +5147 y(48)p eop %%Page: 49 55 -49 54 bop 573 614 a FB(if)18 b(an)h(attacker)e(cannot)i(access)f(the)h +49 54 bop 573 614 a FC(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 +b Fy(temp-file-itera)o(te)p FC(,)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 +1516 y(dir)o(ectory)-9 b(,)19 b FB(e.g.)o FC(,)i Fy($HOME)p +FC(.)652 1651 y(3.)41 b(Ensur)o(e)21 b(that)g Fy(/usr/tmp)e +FC(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 +(olled)g(by)g(the)g(dynamic)g(variable)573 2019 y Fy(*temp-file-templ)o +(at)o(e*)p FC(,)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 Fy(temp-file-iterat)o(e)p +FC(.)365 2363 y Fy(\(temp-file-iterat)o(e)37 b FB(maker)21 +b([template])p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(object)2302 +2333 y Fv(+)2855 2363 y FC(pr)o(ocedur)o(e)365 2463 y +Fy(*temp-file-templa)o(te)o(*)1784 b FB(string)573 2606 +y FC(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 +b(examples:)672 2875 y Fu(\017)42 b FC(Linking)21 b(a)g(\002le)f(to)i +(a)e(fr)o(esh)g(backup)g(temp)h(name.)672 3009 y Fu(\017)42 +b FC(Cr)o(eating)19 b(and)i(opening)g(an)g(unused,)g(secur)o(e)e(temp)i +(\002le.)672 3144 y Fu(\017)42 b FC(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 +(uses)j FB(template)f FC(to)g(generate)g(a)g(series)g(of)h(trial)f +(\002le)h(names.)573 3413 y FB(T)-9 b(emplate)19 b FC(is)j(a)e +Fy(format)e FC(contr)o(ol)j(string,)g(and)g(defaults)f(to)756 +3555 y Fy("/usr/tmp/)p FB(pid)-6 b Fy(.~a")573 3698 y +FC(wher)o(e)21 b FB(pid)h FC(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 +3797 y(calling)g Fy(format)d FC(to)j(instantiate)f(the)h(template's)f +Fy(~a)g FC(\002eld)g(with)i(a)e(varying)g(string.)573 +3932 y FB(Maker)32 b FC(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 +4131 y(the)29 b(\002rst)g(r)o(eturn)f(value)g(is)h Fy(#f)f +FC(or)g(if)h FB(maker)f FC(raises)h(the)g Fy(errno/exist)24 +b FC(errno)k(ex-)573 4231 y(ception,)h Fy(temp-file-itera)o(te)20 +b FC(will)28 b(loop,)h(generating)e(a)g(new)g(\002le)g(name)g(and)573 +4330 y(calling)18 b FB(maker)h FC(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 +4430 y(r)o(eturning)j(whatever)f(value\(s\))f FB(maker)i +FC(r)o(eturned.)573 4565 y(After)j(a)g(number)h(of)g(unsuccessful)h +(trials,)g Fy(temp-file-itera)o(te)19 b FC(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(31,)g(1997)h -(\226)f(17)13 b(:)f(31)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 +y(Thus,)21 b(if)g(we)h(ignor)o(e)f(its)g(optional)h FB(pr)o(e\002x)e +FC(ar)o(gument,)h Fy(create-temp-file)14 b FC(could)573 +4898 y(be)20 b(de\002ned)h(as:)1756 5147 y(49)p eop %%Page: 50 56 -50 55 bop 1071 614 a Fx(\(define)41 b(\(create-temp-fi)o(le\))1158 +50 55 bop 1071 614 a Fy(\(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 +913 y(\()p Fz(\025)f Fy(\(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 +1328 y FC(T)-8 b(o)22 b(r)o(ename)d(a)i(\002le)g(to)g(a)f(temporary)g +(name:)1071 1505 y Fy(\(temp-file-itera)o(te)37 b(\()p +Fz(\025)i Fy(\(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 +2081 y FC(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 +2280 y(grammer)j(can)g(assume)f(that)h(if)g(the)g Fy(temp-file-iterate) +23 b FC(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 +Fy(delete-file)22 b FC(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 +(ectory:)1071 2895 y Fy(\(temp-file-itera)o(te)37 b(\()p +Fz(\025)i Fy(\(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 +3171 y FC(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 +FB(e.g.)o FC(,)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 +3609 y(able)17 b Fy(*temp-file-temp)o(lat)o(e*)o FC(,)12 +b(which)18 b(itself)f(defaults)f(to)h Fy("/usr/tmp/)p +FB(pid)-5 b Fy(.~a")p FC(,)888 3708 y(wher)o(e)17 b FB(pid)g +FC(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 +(allowing)h(world)g(write)f(access)888 3908 y(\()p FB(e.g.)o +FC(,)i(his)g(home)h(dir)o(ectory\).)681 4115 y Fy(\(temp-file-chann)o +(el)o(\))81 b Fu(\000)-14 b(!)87 b FB([inp)20 b(outp])1013 +b FC(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 +(befor)o(e)g Fy(temp-file-channel)20 b FC(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)p eop +4898 y Fy(Temp-file-channel)14 b FC(is)21 b(analogous)h(to)f +Fy(port-pipe)c FC(with)k(two)h(exceptions:)2071 5147 +y(50)p eop %%Page: 51 57 -51 56 bop 672 614 a Ft(\017)42 b FB(If)16 b(the)h(writer)f(pr)o(ocess)g +51 56 bop 672 614 a Fu(\017)42 b FC(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 +y Fu(\017)42 b FC(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 @@ -4245,283 +4128,272 @@ 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 +(or)g(exited.)365 1924 y Fw(3.4)99 b(Processes)365 2167 +y Fy(\(exec)42 b FB(pr)o(og)19 b(ar)o(g1)h(.)12 b(.)g(.)g(ar)o(gn)p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(no)21 b(r)o(eturn)g(value)759 +b FC(pr)o(ocedur)o(e)365 2266 y Fy(\(exec-path)40 b FB(pr)o(og)19 +b(ar)o(g1)h(.)12 b(.)g(.)g(ar)o(gn)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(no)21 b(r)o(eturn)g(value)541 b FC(pr)o(ocedur)o(e)365 +2366 y Fy(\(exec/env)40 b FB(pr)o(og)20 b(env)g(ar)o(g1)g(.)12 +b(.)g(.)g(ar)o(gn)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(no)21 +b(r)o(eturn)g(value)444 b FC(pr)o(ocedur)o(e)365 2466 +y Fy(\(exec-path/env)38 b FB(pr)o(og)20 b(env)g(ar)o(g1)g(.)12 +b(.)g(.)g(ar)o(gn)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(no)21 +b(r)o(eturn)g(value)226 b FC(pr)o(ocedur)o(e)573 2591 +y(The)27 b Fy(.../env)d FC(variants)i(take)h(an)g(envir)o(onment)g +(speci\002ed)g(as)g(a)f(string)p Fu(!)p FC(string)573 +2691 y(alist.)43 b(An)27 b(envir)o(onment)g(of)f Fy(#t)g +FC(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 FB(i.e.)p FC(,)f(the)h(value)f(of)h(the)g +(external)f(char)g Fy(**environ)p FC(\).)573 2926 y([Rationale:)33 +b Fy(#f)23 b FC(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 Fy(#t)p +FC(,)g(but)g(would)h(cause)f(an)g(ambiguity)g(on)h(Schemes)f(that)g +(identify)h Fy(#f)e FC(and)573 3125 y Fy(\(\))p FC(.])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) +(ectories)f(in)h(the)g(list)h Fy(exec-path-)573 3360 +y(list)29 b FC(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 +Fy("bin/prog")c FC(always)k(executes)f(the)i(pr)o(ogram)e +Fy(bin/prog)e FC(in)j(the)573 3659 y(curr)o(ent)20 b(working)i(dir)o +(ectory)-9 b(.)24 b(See)c Fy($path)f FC(and)h Fy(exec-path-list)p +FC(,)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 Fy(execv\(\))p FC(.)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) +4039 y Fy(\(apply)41 b(exec)h(prog)f(arglist\))573 4220 +y FC(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 +4419 y Fy(\045exec)19 b FC(below)-8 b(.)573 4554 y(Note)21 +b(that)h(the)f(C)g Fy(exec\(\))e FC(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 +(executed,)e FB(e.g.)756 4799 y Fy(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +b(envp\);)1756 5147 y FC(51)p eop %%Page: 52 58 -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 +52 57 bop 888 614 a FC(The)22 b(scsh)g Fy(exec)p FC(,)d +Fy(exec-path)p FC(,)f Fy(exec/env)p FC(,)g(and)i Fy(exec-path/env)c +FC(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 +(always)e(identical)888 814 y(to)31 b(the)f Fy(prog)e +FC(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 +b(two)f(items,)i(he)e(can)g(use)g(the)h(low-level)f Fy(\045exec)e +FC(and)i Fy(exec-path-searc)o(h)888 1013 y FC(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 +(exception.)681 1307 y Fy(\(\045exec)41 b FB(pr)o(og)19 +b(ar)o(glist)h(env)p Fy(\))87 b Fu(\000)-14 b(!)87 b +FB(unde\002ned)975 b FC(pr)o(ocedur)o(e)681 1406 y Fy +(\(exec-path-searc)o(h)37 b FB(fname)21 b(pathlist)p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(string)21 b(or)g Fy(#f)474 +b FC(pr)o(ocedur)o(e)888 1549 y(The)31 b Fy(\045exec)d +FC(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 FB(ar)o(glist)27 +b FC(parameter)e(is)j(a)e(list)i(of)f(ar)o(guments;)j +FB(env)d FC(is)h(either)f(a)f(string)p Fu(!)p FC(string)j(al-)888 +1748 y(ist)e(or)e Fy(#t)p FC(.)40 b(The)26 b(new)g(pr)o(ogram's)g +Fy(argv[0])c FC(will)27 b(be)e(taken)h(fr)o(om)f Fy(\(car)42 +b FB(ar)o(glist)p Fy(\))p FC(,)888 1848 y FB(not)20 b +FC(fr)o(om)f FB(pr)o(og)o FC(.)25 b(An)20 b(envir)o(onment)g(of)g +Fy(#t)f FC(means)h(the)g(curr)o(ent)f(pr)o(ocess')g(envir)o(on-)888 +1947 y(ment.)26 b Fy(\045exec)19 b FC(does)i(not)g(\003ush)h(buf)o(fer) +o(ed)c(output)j(\(see)f Fy(flush-all-ports)p FC(\).)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 +Fy(\045exec)p FC(,)h(coer)o(ce)e(the)g Fy(prog)g FC(and)g +Fy(arg)f FC(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 +g(print-names.)888 2414 y Fy(exec-path-search)f FC(sear)o(ches)25 +b(the)i(dir)o(ectories)e(of)i FB(pathlist)e FC(looking)j(for)e(an)g +(oc-)888 2514 y(curr)o(ence)32 b(of)g(\002le)h Fy(fname)p +FC(.)58 b(If)33 b(no)g(executable)e(\002le)i(is)f(found,)k(it)c(r)o +(eturns)g Fy(#f)p FC(.)60 b(If)888 2614 y Fy(fname)28 +b FC(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 +y(if)30 b(not,)i(it)d(still)i(r)o(eturns)e Fy(#f)p FC(.)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 +y Fy(exec-path-search)25 b FC(and)30 b(executing)i(it)f(with)h +Fy(\045exec)p FC(,)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 +(operation)888 3311 y(fails.)888 3445 y(See)d Fy($path)f +FC(and)h Fy(exec-path-list)p FC(,)15 b(below)-8 b(.)681 +3639 y Fy(\(exit)41 b FB([status])p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(no)21 b(r)o(eturn)g(value)1098 b FC(pr)o(ocedur)o(e)681 +3739 y Fy(\(\045exit)41 b FB([status])p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(no)21 b(r)o(eturn)g(value)1054 b FC(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 +b(low-level)g Fy(\045exit)d FC(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 +(fer)o(ed)18 b(output.)681 4274 y Fy(\(call-terminally)37 +b FB(thunk)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(no)21 +b(r)o(eturn)g(value)678 b FC(pr)o(ocedur)o(e)888 4417 +y Fy(call-terminally)23 b FC(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) +4516 y(exits.)d(Although)c Fy(call-terminally)14 b FC(could)21 +b(be)f(implemented)h(as)1071 4658 y Fy(\()p Fz(\025)39 +b Fy(\(thunk\))h(\(thunk\))h(\(exit)h(0\)\))888 4799 +y FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +(esh)h(stack)f(and)2071 5147 y(52)p eop %%Page: 53 59 -53 58 bop 573 614 a FB(also)23 b(start)g(with)h(a)e(fr)o(esh)g(dynamic) +53 58 bop 573 614 a FC(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 +(some)g(live)573 913 y(continuation\).)365 1240 y Fy(\(suspend\))84 +b Fu(\000)-15 b(!)88 b FB(unde\002ned)1459 b FC(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 +(OP)g(signal.)365 1720 y Fy(\(fork)42 b FB([thunk])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(pr)o(oc)20 b(or)h +Fy(#f)1281 b FC(pr)o(ocedur)o(e)365 1820 y Fy(\(\045fork)41 +b FB([thunk])p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(pr)o(oc)19 +b(or)i Fy(#f)1238 b FC(pr)o(ocedur)o(e)573 1973 y Fy(fork)28 +b FC(with)j(no)g(ar)o(guments)f(is)h(like)f(C)g Fy(fork\(\))p +FC(.)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 FB(pr)o(ocess)g(object)g +FC(\(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) +(eturns)f Fy(#f)p FC(.)573 2317 y Fy(fork)h FC(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) +b(The)21 b(child)g(pr)o(ocess)f(calls)h FB(thunk)f FC(and)g(then)i +(exits.)573 2562 y Fy(fork)27 b FC(\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 +2661 y(to)e(non-interactive.)42 b Fy(\045fork)25 b FC(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 +y(forks.)365 2988 y Fy(\(fork/pipe)40 b FB([thunk])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(pr)o(oc)20 b(or)h +Fy(#f)1063 b FC(pr)o(ocedur)o(e)365 3088 y Fy(\(\045fork/pipe)39 +b FB([thunk])p Fy(\))86 b Fu(\000)-15 b(!)88 b FB(pr)o(oc)19 +b(or)i Fy(#f)1020 b FC(pr)o(ocedur)o(e)573 3241 y(Like)27 +b Fy(fork)e FC(and)i Fy(\045fork)p FC(,)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) +3585 y(In)28 b(ef)o(fect,)f Fy(fork/pipe)d FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +g(performing)h(a)e(sequence)i(of)573 3884 y Fy(fork/pipe)16 +b FC(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 Fy(a)573 3984 y(|)43 +b(b)p FC(,)20 b(we)h(write:)756 4174 y Fy(\(fork)41 b(\()p +Fz(\025)e Fy(\(\))k(\(fork/pipe)c(a\))k(\(b\)\)\))573 +4364 y FC(which)22 b(r)o(eturns)e(the)h(pr)o(ocess)f(object)h(for)g +Fy(b)p FC('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 Fy(a)43 +b(|)h(b)f(|)g(c)p FC(,)20 b(we)h(write:)756 4699 y Fy(\(fork)41 +b(\()p Fz(\025)e Fy(\(\))k(\(fork/pipe)c(a\))1279 4799 +y(\(fork/pipe)g(b\))1279 4898 y(\(c\)\)\))1756 5147 y +FC(53)p eop %%Page: 54 60 -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 +54 59 bop 888 614 a FC(which)22 b(r)o(eturns)e(the)h(pr)o(ocess)f +(object)i(for)e Fy(c)p FC('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 +b FB(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 +Fy(dup)g FB(befor)o(e)h(allocating)f(the)g(I/O)g(pipe.)888 +1148 y FC(This)h(means,)g(for)g(example,)f(that)g(the)h(ports)g(bound)f +(to)h Fy(\(current-input-po)o(rt)o(\))888 1247 y FC(and)f +Fy(\(current-output)o(-p)o(ort)o(\))11 b FC(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 +g(I/O)g(sour)o(ces)g(and)f(sinks,)j FB(not)d FC(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(it)c(can)f(do)h(this)g(using)h Fy(with-current-out)o(put)o(-p)o(or)o +(t)888 1880 y FC(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 +y Fy(set-current-input)o(-p)o(ort)o(!)17 b FC(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) +(sides)g(of)g(the)f(pipe:)1071 2349 y Fy(\(fork/pipe)39 +b(\()p Fz(\025)g Fy(\(\))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) +3017 y FC(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 +3413 y Fy(\(fork/pipe+)39 b FB(conns)21 b([thunk])p Fy(\))85 +b Fu(\000)-14 b(!)87 b FB(pr)o(oc)20 b(or)h Fy(#f)803 +b FC(pr)o(ocedur)o(e)681 3512 y Fy(\(\045fork/pipe+)38 +b FB(conns)21 b([thunk])p Fy(\))86 b Fu(\000)-14 b(!)87 +b FB(pr)o(oc)19 b(or)i Fy(#f)760 b FC(pr)o(ocedur)o(e)888 +3655 y(Like)26 b Fy(fork/pipe)p FC(,)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(speci\002ed)g(by)h(the)g(connection)h(list)f FB(conns)p +FC(.)26 b(See)20 b(the)1071 3898 y Fy(\(|+)42 b FB(conns)i(pf)1537 +3925 y Fv(1)1618 3898 y Fy(...)f FB(pf)1846 3925 y Fo(n)1891 +3898 y Fy(\))888 4041 y FC(pr)o(ocess)21 b(form)f(for)h(a)f +(description)h(of)g(connection)h(lists.)681 4317 y FA(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +4503 y FC(Scsh)27 b(uses)g FB(pr)o(ocess)f(objects)i +FC(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 Fy(fork)19 +b FC(pr)o(ocedur)o(e,)f(and)j(have)f(the)h(following)h(exposed)e(str)o +(uctur)o(e:)888 4799 y Fy(\(define-record)38 b(proc)1237 +4898 y(pid\))2071 5147 y FC(54)p eop %%Page: 55 61 -55 60 bop 393 614 a FB(The)28 b(only)g(exposed)f(slot)i(in)f(a)f(pr)o +55 60 bop 393 614 a FC(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) +Fy(proc?)g FC(and)h Fy(proc:pid)p FC(.)j(Pr)o(ocess)e(objects)g(ar)o(e) +f(cr)o(eated)365 913 y(with)i(the)f Fy(fork)e FC(pr)o(ocedur)o(e.)365 +1065 y Fy(\(pid->proc)40 b FB(pid)20 b([pr)o(obe?])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(pr)o(oc)1111 b FC(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 +1507 y(indexed)19 b(by)g(the)h(given)f(pid,)h Fy(pid->proc)p +FC('s)c(action)j(is)h(determined)f(by)h(the)f FB(pr)o(obe?)573 +1607 y FC(parameter)g(\(default)g Fy(#f)p FC(\):)p 1174 +1677 1455 4 v 1174 1777 4 100 v 1227 1747 a FB(pr)o(obe?)p +1666 1777 V 270 w FC(Return)p 2625 1777 V 1174 1780 1455 +4 v 1174 1796 V 1174 1896 4 100 v 1227 1866 a Fy(#f)p +1666 1896 V 404 w FB(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 +1969 a Fy('create)p 1666 1999 V 184 w FC(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 +V 103 w Fy(#f)p 2625 2102 V 1174 2105 1455 4 v 490 2287 +a FC(Sometime)h(after)e(a)h(child)g(pr)o(ocess)g(terminates,)g(scsh)h +(will)g(perform)f(a)g Fy(wait)f FC(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 @@ -4545,28 +4417,26 @@ b(a)g(child)g(pr)o(ocess)f(moves)i(its)f(exit)g(status)g(information)h (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 +Fy(wait)c FC(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 +4233 y Fu(\017)41 b FC(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(garbage)g(collected.)490 4602 y Fu(\017)41 b FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(child's)h(exit)g(status)f(will)h(be)g(r)o(eaped)d(and)1756 +5147 y(55)p eop %%Page: 56 62 -56 61 bop 681 614 a FB(thr)o(own)17 b(away)-9 b(.)24 +56 61 bop 681 614 a FC(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 @@ -4582,75 +4452,72 @@ 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 +1479 y Fy(\(autoreap-policy)37 b FB([policy])p Fy(\))85 +b Fu(\000)-15 b(!)88 b FB(old-policy)810 b FC(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) +Fy('early)p FC(,)d Fy('late)p FC(,)g(or)j Fy(#f)f FC(\()p +FB(i.e.)o FC(,)h(no)g(autor)o(eap\).)888 1973 y FA(early)41 +b FC(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 +(for)h(the)1071 2172 y Fy(SIGCHLD)34 b FC(signal)j(r)o(eap)e(the)i(pr)o +(ocess.)147 b FB(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 Fy(SIGCHLD)d FB(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 +2371 y(calling)h Fy(wait)p FB(,)g Fy(wait-any)p FB(,)f(or)h +Fy(reap-zombies)p FB(.)48 b FC(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 +y FA(late)40 b FC(The)21 b(child)h(is)f(not)h(autor)o(eaped)d(until)j +(it)f(dies)g FB(and)g FC(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) +y Fl(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 +3298 y Fy(#f)41 b FC(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 +3497 y(r)o(eaped)h(by)i(manually)h(calling)f(the)h Fy(reap-zombies)28 +b FC(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 +(policies,)k(a)e(particular)f(pr)o(ocess)g Fz(p)h FC(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 +h Fy(\(wait)41 b Fz(p)p Fy(\))p FC(.)47 b FB(All)28 b +FC(zombies)888 3955 y(can)21 b(be)f(manually)h(r)o(eaped)e(with)i +Fy(reap-zombies)p FC(.)888 4085 y(The)40 b Fy(autoreap-policy)34 +b FC(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 Fy(autoreap-policy)19 +b FC(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 +Fy(\(reap-zombies\))81 b Fu(\000)-14 b(!)87 b FB(boolean)1321 +b FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +(r)o(unning)h(or)f(suspended.)2071 5147 y(56)p eop %%Page: 57 63 -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 +57 62 bop 365 906 a FA(Issues)20 b(with)g(process)g(reaping)365 +1110 y FC(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 +1309 y(pr)o(ocess)h(is)h FB(not)f(eligible)h FC(as)f(a)g(r)o(eturn)g +(value)g(for)g(a)g(futur)o(e)f Fy(wait-process-grou)o(p)21 +b FC(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 +1608 y(to)24 b FB(stopped)e FC(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 @@ -4663,78 +4530,76 @@ g(childr)o(en,)h(and)f(does)g(not)h(wish)g(auto-)365 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 +2487 y(pid:)27 b Fy(run/port*)p FC(,)17 b(and)k(its)h(r)o(elated)e(pr)o +(ocedur)o(es)g(and)h(special)g(forms)g(\()p Fy(run/strings)p +FC(,)c FB(et)365 2586 y(al.)p FC(\).)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 +(avoid)h(these)g(forms,)i(or)e(use)g Fy(wait-any)c FC(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 FA(3.4.2)81 b(Process)20 b(waiting)365 3401 y Fy(\(wait)42 +b FB(pr)o(oc/pid)18 b([\003ags])p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(status)1168 b FC(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 +y(The)28 b FB(pr)o(oc/pid)e FC(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 +3730 y(teger)23 b(pr)o(ocess)f(id.)33 b Fy(Wait)22 b +FC(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 Fy(wait/stopped-chil)o +(dre)o(n)22 b FC(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 +FB(\003ags)g FC(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 +Fy(wait/poll)p 1591 4546 V 622 w FC(Return)f Fy(#f)f +FC(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 +Fy(wait/stopped-chi)o(ldr)o(en)p 1591 4649 V 96 w FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +4649 V 573 4652 2662 4 v 365 4845 a Fy(\(wait-any)40 +b FB([\003ags])p Fy(\))86 b Fu(\000)-14 b(!)87 b FB([pr)o(oc)19 +b(status])1069 b FC(pr)o(ocedur)o(e)1756 5147 y(57)p +eop %%Page: 58 64 -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 +58 63 bop 888 614 a FC(The)24 b(optional)g FB(\003ags)f +FC(ar)o(gument)g(is)g(as)g(for)g Fy(wait)p FC(.)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 +(to)h(exit)f(\(or)h(stop,)f(if)h(the)f Fy(wait/stopped-chil)o(dr)o(en) +14 b FC(\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 +(for)h(which)h(to)g(wait,)g(the)f(two)h(values)f Fy([#f)42 +b(#t])25 b FC(ar)o(e)g(r)o(eturned.)40 b(If)26 b(the)888 +1013 y Fy(wait/poll)18 b FC(\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 +1112 y(for)f(waiting,)g(then)g(the)g(values)f Fy([#f)43 +b(#f])19 b FC(ar)o(e)h(r)o(eturned:)p 1688 1181 1057 +4 v 1688 1281 4 100 v 1741 1251 a([)p Fy(#f)g(#f)p FC(])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 +Fy(#f)e(#t)p FC(])p 2042 1384 V 102 w(No)h(childr)o(en)p +2742 1384 V 1688 1387 1057 4 v 888 1490 a Fy(Wait-any)71 +b FC(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 +(pr)o(ocedur)o(e)e(\()p Fy(wait)p FC(,)55 b Fy(wait-any)p +FC(,)e(and)888 1689 y Fy(wait-process-grou)o(p)p FC(\).)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 +Fy(wait-any)c FC(is)k(depr)o(ecated.)681 2214 y Fy(\(wait-process-gr)o +(ou)o(p)38 b FB(pr)o(oc/pid)18 b([\003ags])p Fy(\))86 +b Fu(\000)-14 b(!)87 b FB([pr)o(oc)19 b(status])338 b +FC(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 FB(pr)o(oc/pid)e +FC(\(either)888 2455 y(a)21 b(pr)o(ocess)f(object)h(or)g(a)f(pid\).)25 +b(The)c FB(\003ags)f FC(ar)o(gument)h(is)g(as)f(for)h +Fy(wait)p FC(.)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 @@ -4743,251 +4608,242 @@ y(\(section)29 b(3.4.1\),)e(as)g(this)i(loses)f(pr)o(ocess)g(gr)o(oup)f 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 +(subject)g(to)888 3087 y(r)o(eaping.)681 3482 y FA(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 +FC(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 Fy(wait)e FC(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 +Ft(O)t(S)t(I)t(X)r FC(;)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 +b(with)g(exit)g(code)f(0,)i(P)t Ft(O)t(S)t(I)t(X)i FC(does)c(r)o(equir) +o(e)f Fy(wait)g FC(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 Fy(\(zero?)42 b +FB(status)o Fy(\))21 b FC(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 +FB(e.g.)o FC(,)888 4556 y Fy(\(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(31,)g(1997)h(\226) -f(17)13 b(:)f(31)p eop +FB(status)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(integer)21 +b(or)g Fy(#f)760 b FC(pr)o(ocedur)o(e)2071 5147 y(58)p +eop %%Page: 59 65 -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 +59 64 bop 365 614 a Fy(\(status:stop-sig)37 b FB(status)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(integer)21 b(or)g +Fy(#f)760 b FC(pr)o(ocedur)o(e)365 714 y Fy(\(status:term-sig)37 +b FB(status)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(integer)21 +b(or)g Fy(#f)760 b FC(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 +Fy(wait)p FC(,)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 +b Fy(status:exit-val)25 b FC(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.) +FB(i.e.)o FC(,)i(the)e(value)f(the)i(child)f(passed)g(to)g +Fy(exit)f FC(or)h(r)o(e-)573 1280 y(turned)20 b(fr)o(om)h +Fy(main)p FC(\).)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 +(signal,)g Fy(status:stop-sig)13 b FC(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 +(abnormally)-9 b(,)19 b Fy(status:term-sig)13 b FC(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 +2129 y Fw(3.5)99 b(Process)26 b(state)365 2364 y Fy(\(umask\))85 +b Fu(\000)-15 b(!)88 b FB(\002xnum)1633 b FC(pr)o(ocedur)o(e)365 +2463 y Fy(\(set-umask)40 b FB(perms)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(unde\002ned)1126 b FC(pr)o(ocedur)o(e)365 +2563 y Fy(\(with-umask*)39 b FB(perms)21 b(thunk)p Fy(\))86 +b Fu(\000)-14 b(!)87 b FB(value\(s\))20 b(of)h(thunk)581 +b FC(pr)o(ocedur)o(e)365 2662 y Fy(\(with-umask)39 b +FB(perms)21 b(.)g(body)p Fy(\))86 b Fu(\000)-15 b(!)88 +b FB(value\(s\))20 b(of)h(body)796 b FC(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) +j Fy(umask)p FC(,)k(and)49 b(set)g(with)573 2884 y Fy(\(set-umask)39 +b FB(perms)p Fy(\))p FC(.)52 b(Calling)30 b Fy(with-umask*)25 +b FC(changes)30 b(the)g(umask)g(to)g FB(perms)573 2984 +y FC(for)25 b(the)g(duration)h(of)f(the)g(call)g(to)h +FB(thunk)o FC(.)39 b(If)25 b(the)h(pr)o(ogram)e(thr)o(ows)i(out)g(of)f +FB(thunk)573 3083 y FC(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) +FB(thunk)f FC(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 FB(perms)f +FC(value.)57 b(The)31 b(special)g(form)h Fy(with-umask)27 +b FC(is)573 3382 y(equivalent)f(in)g(ef)o(fect)e(to)i(the)g(pr)o +(ocedur)o(e)e Fy(with-umask*)p FC(,)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) +Fy(\()p Fz(\025)38 b Fy(\(\))43 b(...\))20 b FC(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 +3766 y Fy(\(chdir)41 b FB([fname])p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(unde\002ned)1245 b FC(pr)o(ocedur)o(e)365 +3865 y Fy(\(cwd\))85 b Fu(\000)-14 b(!)87 b FB(string)1761 +b FC(pr)o(ocedur)o(e)365 3965 y Fy(\(with-cwd*)40 b FB(fname)20 +b(thunk)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(value\(s\))20 +b(of)h(thunk)668 b FC(pr)o(ocedur)o(e)365 4064 y Fy(\(with-cwd)40 +b FB(fname)21 b(.)f(body)p Fy(\))86 b Fu(\000)-14 b(!)87 +b FB(value\(s\))21 b(of)f(body)884 b FC(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 +y(changed)c(with)h Fy(chdir)d FC(\(although)j(in)g(most)g(cases,)f +Fy(with-cwd)d FC(is)k(pr)o(eferrable\).)i(If)573 4400 +y Fy(chdir)17 b FC(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 +4500 y(dir)o(ectory)-9 b(.)31 b(The)23 b Fy(with-cwd*)c +FC(pr)o(ocedur)o(e)i(calls)i Fy(thunk)d FC(with)k(the)f(cwd)g(temporar) +o(-)573 4599 y(ily)30 b(set)f(to)h FB(fname)p FC(;)j(when)d +FB(thunk)e FC(r)o(eturns,)j(or)e(is)h(exited)f(in)g(a)g(non-local)h +(fashion)573 4699 y(\()p FB(e.g.)o FC(,)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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +b(The)25 b(special)f(form)g Fy(with-cwd)d FC(is)k(simply)g(syn-)573 +4898 y(tactic)20 b(sugar)h(for)f Fy(with-cwd*)p FC(.)1756 +5147 y(59)p eop %%Page: 60 66 -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 +60 65 bop 681 614 a Fy(\(pid\))85 b Fu(\000)-14 b(!)87 +b FB(\002xnum)1720 b FC(pr)o(ocedur)o(e)681 714 y Fy(\(parent-pid\))82 +b Fu(\000)-14 b(!)87 b FB(\002xnum)1415 b FC(pr)o(ocedur)o(e)681 +814 y Fy(\(process-group\))81 b Fu(\000)-15 b(!)88 b +FB(\002xnum)1284 b FC(pr)o(ocedur)o(e)681 913 y Fy(\(set-process-gro)o +(up)37 b FB([pr)o(oc/pid])18 b(pgrp)p Fy(\))85 b Fu(\000)-14 +b(!)87 b FB(unde\002ned)473 b FC(pr)o(ocedur)o(e)888 +1063 y Fy(\(pid\))25 b FC(and)i Fy(\(parent-pid\))22 +b FC(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 Fy(\(process-group\)) +12 b FC(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) +(oup)f(can)g(be)h(set)g(with)g Fy(set-process-group)o +FC(;)888 1361 y(the)19 b(value)f FB(pr)o(oc/pid)e FC(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 +y Fy(\(set-priority)38 b FB(which)20 b(who)g(priority)p +Fy(\))86 b Fu(\000)-15 b(!)88 b FB(unde\002ned)559 b +FC(pr)o(ocedur)o(e)681 1776 y Fy(\(priority)40 b FB(which)19 +b(who)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(\002xnum)1100 +b FC(pr)o(ocedur)o(e)681 1876 y Fy(\(nice)41 b FB([pr)o(oc/pid)18 +b(delta])p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(unde\002ned)1035 +b FC(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 +(emem-)888 2125 y(ber)28 b(how)h Fy(set-priority)23 b +FC(and)k Fy(priority)e FC(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 +b(.)681 2382 y Fy(\(user-login-name)o(\))81 b Fu(\000)-14 +b(!)87 b FB(string)1237 b FC(pr)o(ocedur)o(e)681 2481 +y Fy(\(user-uid\))83 b Fu(\000)-14 b(!)87 b FB(\002xnum)1502 +b FC(pr)o(ocedur)o(e)681 2581 y Fy(\(user-effective-)o(ui)o(d\))81 +b Fu(\000)-15 b(!)88 b FB(\002xnum)1066 b FC(pr)o(ocedur)o(e)681 +2680 y Fy(\(user-gid\))83 b Fu(\000)-14 b(!)87 b FB(\002xnum)1502 +b FC(pr)o(ocedur)o(e)681 2780 y Fy(\(user-effective-)o(gi)o(d\))81 +b Fu(\000)-15 b(!)88 b FB(\002xnum)1066 b FC(pr)o(ocedur)o(e)681 +2880 y Fy(\(user-supplement)o(ar)o(y-g)o(id)o(s\))81 +b Fu(\000)-15 b(!)88 b FB(\002xnum)20 b(list)722 b FC(pr)o(ocedur)o(e) +681 2979 y Fy(\(set-uid)40 b FB(uid)p Fy(\))87 b Fu(\000)-15 +b(!)87 b FB(unde\002ned)1305 b FC(pr)o(ocedur)o(e)681 +3079 y Fy(\(set-gid)40 b FB(gid)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(unde\002ned)1309 b FC(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 +3328 y Fy(set-uid)g FC(and)j Fy(set-gid)d FC(r)o(outines)j(corr)o +(espond)g(to)g(the)i(P)t Ft(O)t(S)t(I)t(X)i Fy(setuid\(\))28 +b FC(and)888 3428 y Fy(setgid\(\))18 b FC(pr)o(ocedur)o(es.)681 +3643 y Fy(\(process-times\))81 b Fu(\000)-15 b(!)88 b +FB([\002xnum)19 b(\002xnum)h(\002xnum)g(\002xnum])440 +b FC(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 +Fy(time+ticks)p FC(.)h(That's)e(Unix.)681 4605 y Fy(\(cpu-ticks/sec\)) +81 b Fu(\000)-15 b(!)88 b FB(integer)1292 b FC(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)p eop +Fy(process-times)15 b FC(to)22 b(seconds.)2071 5147 y(60)p +eop %%Page: 61 67 -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 +61 66 bop 365 614 a Fw(3.6)99 b(User)25 b(and)f(group)h(database)g +(access)365 829 y FC(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 +FB(e.g.)n FC(,)k(the)365 928 y(ones)22 b(traditionally)f(stor)o(ed)f +(in)h Fy(/etc/passwd)16 b FC(and)k Fy(/etc/group)p FC(.\))365 +1078 y Fy(\(user-info)40 b FB(uid/name)p Fy(\))86 b Fu(\000)-15 +b(!)88 b FB(r)o(ecord)1135 b FC(pr)o(ocedur)o(e)573 1219 +y(Return)24 b(a)e Fy(user-info)e FC(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 +y(ular)d(user:)756 1485 y Fy(\(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 +y FC(The)21 b FB(uid/name)f FC(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 +1942 y Fy(\(->uid)41 b FB(uid/name)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(\002xnum)1275 b FC(pr)o(ocedur)o(e)365 2042 +y Fy(\(->username)39 b FB(uid/name)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(string)1097 b FC(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 +2474 y Fy(\(group-info)39 b FB(gid/name)p Fy(\))86 b +Fu(\000)-15 b(!)88 b FB(r)o(ecord)1096 b FC(pr)o(ocedur)o(e)573 +2615 y(Return)19 b(a)g Fy(group-info)14 b FC(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 +2715 y(ular)h(gr)o(oup:)756 2881 y Fy(\(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 +3147 y FC(The)21 b FB(gid/name)e FC(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 +3442 y Fw(3.7)99 b(Accessing)26 b(command-line)e(arguments)365 +3681 y Fy(command-line-argu)o(me)o(nts)1564 b FB(string)21 +b FC(list)365 3781 y Fy(\(command-line\))82 b Fu(\000)-15 +b(!)88 b FB(string)20 b(list)1242 b FC(pr)o(ocedur)o(e)573 +3905 y(The)44 b(list)h(of)g(strings)g Fy(command-line-argu)o(men)o(ts) +38 b FC(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 +b(Calling)17 b Fy(\(command-line\))573 4104 y FC(r)o(eturns)h(the)h +(complete)g Fy(argv)e FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +756 4343 y Fy(/usr/shivers/bi)o(n/)o(myl)o(s)37 b(-CF)43 +b(src)573 4482 y FC(then)21 b Fy(command-line-arg)o(ume)o(nt)o(s)15 +b FC(is)756 4621 y Fy(\("-CF")41 b("src"\))573 4759 y +FC(and)20 b Fy(\(command-line\))15 b FC(r)o(eturns)756 +4898 y Fy(\("/usr/shivers/)o(bi)o(n/m)o(yl)o(s")37 b("-CF")42 +b("src"\))1756 5147 y FC(61)p eop %%Page: 62 68 -62 67 bop 888 614 a Fx(command-line)32 b FB(r)o(eturns)k(a)g(fr)o(esh)g +62 67 bop 888 614 a Fy(command-line)32 b FC(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 +y Fy(command-line-argu)o(me)o(nts)14 b FC(has)21 b(been)f(modi\002ed)h +(or)g(is)g(lexically)g(shadowed.)681 1003 y Fy(\(arg)42 +b FB(ar)o(glist)20 b(n)h([default])p Fy(\))85 b Fu(\000)-14 +b(!)87 b FB(string)1128 b FC(pr)o(ocedur)o(e)681 1102 +y Fy(\(arg*)41 b FB(ar)o(glist)20 b(n)h([default-thunk])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(string)858 b FC(pr)o(ocedur)o(e)681 +1202 y Fy(\(argv)41 b FB(n)21 b([default])p Fy(\))86 +b Fu(\000)-14 b(!)87 b FB(string)1320 b FC(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 +y Fy(arg)28 b FC(r)o(eturns)g(the)h Fz(n)1535 1412 y +Fv(th)1630 1442 y FC(element)g(of)f FB(ar)o(glist)p FC(.)49 +b(The)28 b(index)h(is)g(1-based.)47 b(If)29 b FB(n)f +FC(is)h(too)888 1541 y(lar)o(ge,)20 b FB(default)g FC(is)h(r)o +(eturned;)f(if)g(no)i FB(default)o FC(,)f(then)g(an)f(err)o(or)g(is)h +(signaled.)888 1674 y Fy(arg*)j FC(is)h(similar)-6 b(,)27 +b(except)d(that)h(the)h FB(default-thunk)e FC(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 +y Fy(\(argv)42 b FB(n)p Fy(\))26 b FC(is)h(simply)g Fy(\(arg)42 +b(\(command-line\))c(\(+)43 b FB(n)h Fy(1\)\))p FC(.)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 +1071 2170 y Fy(\(arg)42 b(command-line-arg)o(um)o(ent)o(s)37 +b FB(n)q Fy(\))1071 2270 y(\(argv)42 b FB(n)p Fy(\))888 +2435 y FC(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 +y(\002ed)e Fy(command-line-arg)o(um)o(ent)o(s)p FC(\))o(.)888 +2666 y(Example:)1071 2831 y Fy(\(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 @@ -4995,114 +4851,108 @@ y(\002ed)e Fx(command-line-arg)o(um)o(ent)o(s)p FB(\))o(.)888 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 +3694 y FC(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 +(the)g Fy(\(command-line\))15 b FC(list)22 b(is)f(the)888 +3893 y(scsh)26 b(pr)o(ogram,)f FB(not)f FC(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 +3992 y(in)d(\002le)e Fy(fullecho)p FC(:)1071 4157 y Fy (#!/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 +4357 y(\(for-each)j(\()p Fz(\025)f Fy(\(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +4621 y FC(and)21 b(we)f(r)o(un)i(the)f(pr)o(ogram)1071 +4760 y Fy(fullecho)40 b(hello)i(world)888 4898 y FC(the)21 +b(pr)o(ogram)f(will)i(print)f(out)2071 5147 y(62)p eop %%Page: 63 69 -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 +63 68 bop 756 614 a Fy(fullecho)40 b(hello)h(world)573 +767 y FC(not)756 919 y Fy(/usr/local/bin/)o(sc)o(sh)c(-s)43 +b(fullecho)d(hello)i(world)573 1110 y FC(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 +1561 y Fy(/usr/local/bin/)o(sc)o(sh)37 b(-s)573 1713 +y FC(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 +2132 y Fw(3.8)99 b(System)25 b(parameters)365 2380 y +Fy(\(system-name\))82 b Fu(\000)-14 b(!)87 b FB(string)1412 +b FC(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 +3026 y Fw(3.9)99 b(Signal)26 b(system)365 3251 y FC(Signal)g(numbers)h +(ar)o(e)e(bound)i(to)f(the)h(variables)e Fy(signal/hup)p +FC(,)e Fy(signal/int)p FC(,)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 +3506 y Fy(\(signal-process)38 b FB(pr)o(oc)19 b(sig)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(unde\002ned)850 b +FC(pr)o(ocedur)o(e)365 3606 y Fy(\(signal-process-g)o(ro)o(up)37 +b FB(pr)o(grp)20 b(sig)p Fy(\))86 b Fu(\000)-14 b(!)87 +b FB(unde\002ned)544 b FC(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)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 +b(.)33 b(The)24 b FB(pr)o(oc)e FC(and)i FB(pr)o(grp)e +FC(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 Fy(\(itimer)41 +b FB(???)p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(unde\002ned)1335 +b FC(pr)o(ocedur)o(e)365 4260 y Fy(\(pause-until-inte)o(rr)o(upt)o(\)) +81 b Fu(\000)-14 b(!)87 b FB(unde\002ned)849 b FC(pr)o(ocedur)o(e)365 +4415 y Fy(\(sleep)41 b FB(secs)p Fy(\))88 b Fu(\000)-14 +b(!)87 b FB(unde\002ned)1372 b FC(pr)o(ocedur)o(e)365 +4515 y Fy(\(sleep-until)39 b FB(time)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(unde\002ned)1094 b FC(pr)o(ocedur)o(e)573 +4662 y(The)29 b Fy(sleep)f FC(pr)o(ocedur)o(e)g(causes)h(the)h(pr)o +(ocess)f(to)h(sleep)f(for)h FB(secs)g FC(seconds.)53 +b(The)573 4761 y Fy(sleep-until)26 b FC(pr)o(ocedur)o(e)j(causes)i(the) +g(pr)o(ocess)g(to)g(sleep)g(until)h FB(time)f FC(\(see)f(sec-)573 +4861 y(tion)21 b(3.10\).)1756 5147 y(63)p eop %%Page: 64 70 -64 69 bop 910 535 2407 4 v 960 604 a FB(Interr)o(upt)854 +64 69 bop 910 535 2407 4 v 960 604 a FC(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 +638 V 910 654 V 960 724 a Fy(interrupt/alrm)1576 694 +y Fo(a)2149 724 y Fy(signal/alrm)184 b FC(P)t Ft(O)t(S)t(I)t(X)960 +824 y Fy(interrupt/int)1532 794 y Fo(b)2149 824 y Fy(signal/int)228 +b FC(P)t Ft(O)t(S)t(I)t(X)960 924 y Fy(interrupt/memor)o(y-s)o(ho)o +(rta)o(ge)93 b FC(N/A)960 1024 y Fy(interrupt/chld)573 +b(signal/chld)184 b FC(P)t Ft(O)t(S)t(I)t(X)960 1123 +y Fy(interrupt/cont)573 b(signal/cont)184 b FC(P)t Ft(O)t(S)t(I)t(X)960 +1223 y Fy(interrupt/hup)617 b(signal/hup)228 b FC(P)t +Ft(O)t(S)t(I)t(X)960 1322 y Fy(interrupt/quit)573 b(signal/quit)184 +b FC(P)t Ft(O)t(S)t(I)t(X)960 1422 y Fy(interrupt/term)573 +b(signal/term)184 b FC(P)t Ft(O)t(S)t(I)t(X)960 1522 +y Fy(interrupt/tstp)573 b(signal/tstp)184 b FC(P)t Ft(O)t(S)t(I)t(X)960 +1621 y Fy(interrupt/usr1)573 b(signal/usr1)184 b FC(P)t +Ft(O)t(S)t(I)t(X)960 1721 y Fy(interrupt/usr2)573 b(signal/usr2)184 +b FC(P)t Ft(O)t(S)t(I)t(X)960 1920 y Fy(interrupt/info)573 +b(signal/info)182 b FC(BSD)21 b(only)960 2020 y Fy(interrupt/io)661 +b(signal/io)270 b FC(BSD)21 b(+)g(SVR4)960 2119 y Fy(interrupt/poll)573 +b(signal/poll)182 b FC(SVR4)20 b(only)960 2219 y Fy(interrupt/prof)573 +b(signal/prof)182 b FC(BSD)21 b(+)g(SVR4)960 2319 y Fy(interrupt/pwr) +617 b(signal/pwr)226 b FC(SVR4)20 b(only)960 2418 y Fy(interrupt/urg) +617 b(signal/urg)226 b FC(BSD)21 b(+)g(SVR4)960 2518 +y Fy(interrupt/vtalr)o(m)486 b(signal/vtalrm)94 b FC(BSD)21 +b(+)g(SVR4)960 2618 y Fy(interrupt/winch)529 b(signal/winch)138 +b FC(BSD)21 b(+)g(SVR4)960 2717 y Fy(interrupt/xcpu)573 +b(signal/xcpu)182 b FC(BSD)21 b(+)g(SVR4)960 2817 y Fy(interrupt/xfsz) +573 b(signal/xfsz)182 b FC(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 +3181 y(the)20 b(P)t Ft(O)t(S)t(I)t(X)i FC(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) +681 3357 1146 4 v 763 3411 a Ff(a)800 3434 y Ft(Also)c(bound)f(to)h +(Scheme)f(48)h(interr)o(upt)f Fj(interrupt/alarm)p Ft(.)769 +3492 y Ff(b)800 3516 y Ft(Also)h(bound)f(to)h(Scheme)f(48)h(interr)o +(upt)f Fj(interrupt/keyboard)p Ft(.)681 3818 y FA(Interrupt)j(handlers) +681 4044 y FC(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 @@ -5118,73 +4968,67 @@ b(\002rst,)30 b(Unix)e(delivers)f(the)h(signal)g(to)g(the)g(Scheme)g 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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +FB(not)f FC(support)h(signal)2071 5147 y(64)p eop %%Page: 65 71 -65 70 bop 943 1542 1709 4 v 993 1612 a FB(Unix)21 b(signal)159 +65 70 bop 943 1542 1709 4 v 993 1612 a FC(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) +943 1662 V 993 1731 a Fy(signal/stop)95 b FC(Uncatchable)125 +b(P)t Ft(O)t(S)t(I)t(X)993 1831 y Fy(signal/kill)95 b +FC(Uncatchable)125 b(P)t Ft(O)t(S)t(I)t(X)993 2030 y +Fy(signal/abrt)95 b FC(Synchr)o(onous)103 b(P)t Ft(O)t(S)t(I)t(X)993 +2130 y Fy(signal/fpe)139 b FC(Synchr)o(onous)103 b(P)t +Ft(O)t(S)t(I)t(X)993 2230 y Fy(signal/ill)139 b FC(Synchr)o(onous)103 +b(P)t Ft(O)t(S)t(I)t(X)993 2329 y Fy(signal/pipe)95 b +FC(Synchr)o(onous)103 b(P)t Ft(O)t(S)t(I)t(X)993 2429 +y Fy(signal/segv)95 b FC(Synchr)o(onous)103 b(P)t Ft(O)t(S)t(I)t(X)993 +2528 y Fy(signal/ttin)95 b FC(Synchr)o(onous)103 b(P)t +Ft(O)t(S)t(I)t(X)993 2628 y Fy(signal/ttou)95 b FC(Synchr)o(onous)103 +b(P)t Ft(O)t(S)t(I)t(X)993 2827 y Fy(signal/bus)139 b +FC(Synchr)o(onous)101 b(BSD)20 b(+)h(SVR4)993 2927 y +Fy(signal/emt)139 b FC(Synchr)o(onous)101 b(BSD)20 b(+)h(SVR4)993 +3027 y Fy(signal/iot)139 b FC(Synchr)o(onous)101 b(BSD)20 +b(+)h(SVR4)993 3126 y Fy(signal/sys)139 b FC(Synchr)o(onous)101 +b(BSD)20 b(+)h(SVR4)993 3226 y Fy(signal/trap)95 b FC(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 +Fy(signal-process)24 b FC(or)31 b Fy(signal-process-)o(gro)o(up)o +FC(,)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 +b(the)i(P)t Ft(O)t(S)t(I)t(X)h FC(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(31,)g(1997)h(\226) -f(17)13 b(:)f(31)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 +3889 y(listed)21 b(her)o(e.)1756 5147 y(65)p eop %%Page: 66 72 -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 +66 71 bop 681 614 a FC(handlers)20 b(for)h(\223synchr)o(onous\224)h +(Unix)e(signals,)i(such)f(as)g Fy(signal/ill)c FC(or)k +Fy(signal/pipe)681 714 y FC(\(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 +f(to)h(a)g(multi-thr)o(eaded)e(platform.)681 1167 y Fy +(\(signal->interru)o(pt)37 b FB(integer)p Fy(\))87 b +Fu(\000)-14 b(!)87 b FB(integer)839 b FC(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 Fy(signal->interrupt)15 b FC(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 +681 1819 y Fy(\(interrupt-set)38 b FB(integer)1570 1831 +y Fv(1)1628 1819 y FB(.)12 b(.)g(.)g(integer)1962 1831 +y Fo(n)2008 1819 y Fy(\))87 b Fu(\000)-15 b(!)88 b FB(integer)575 +b FC(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 +2165 y(the)f(bit)g(set.)681 2471 y Fy(\(enabled-interru)o(pt)o(s\))81 +b Fu(\000)-15 b(!)88 b FB(interrupt-set)880 b FC(pr)o(ocedur)o(e)681 +2571 y Fy(\(set-enabled-int)o(er)o(rup)o(ts)37 b FB(interrupt-set)p +Fy(\))87 b Fu(\000)-15 b(!)88 b FB(interrupt-set)233 +b FC(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 @@ -5193,15 +5037,15 @@ 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 +y Fy(interrupt-set)23 b FC(function\).)49 b(The)29 b +Fy(set-enabled-int)o(err)o(up)o(ts)22 b FC(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 +(upt)e(set.)681 3560 y Fy(\(with-enabled-in)o(te)o(rru)o(pt)o(s)37 +b FB(interrupt-set)17 b(.)g(body)p Fy(\))53 b Fu(\000)-15 +b(!)54 b FB(value\(s\))17 b(of)f(body)87 b FC(syntax)681 +3659 y Fy(\(with-enabled-in)o(te)o(rru)o(pt)o(s*)37 b +FB(interrupt-set)16 b(thunk)p Fy(\))43 b Fu(\000)-15 +b(!)44 b FB(value\(s\))15 b(of)h(thunk)87 b FC(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 @@ -5215,95 +5059,89 @@ 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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +4641 y Fy(interrupt-set)16 b FC(function\).)681 4847 +y Fy(\(set-interrupt-h)o(an)o(dle)o(r)37 b FB(interrupt)21 +b(handler)p Fy(\))87 b Fu(\000)-15 b(!)88 b FB(old-handler)167 +b FC(pr)o(ocedur)o(e)2071 5147 y(66)p eop %%Page: 67 73 -67 72 bop 573 614 a FB(Assigns)28 b(a)g(handler)f(for)g(a)g(given)h +67 72 bop 573 614 a FC(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 +714 y(handler)-6 b(.)25 b(The)20 b FB(handler)g FC(ar)o(gument)g(is)h +Fy(#f)e FC(\(ignor)o(e\),)h Fy(#t)g FC(\(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 +913 y(tions.)h(Note)22 b(that)f(the)h FB(interrupt)g +FC(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) +1312 y(cedur)o(e)23 b(r)o(eturns)h(normally)i(\()p FB(i.e.)o +FC(,)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 +1611 y Fy(set-enabled-inte)o(rr)o(upt)o(s)p FC(\))573 +1740 y Fu(f)p FC(Note)29 b(If)f(you)i(set)f(a)g(handler)f(for)h(the)g +Fy(interrupt/chld)24 b FC(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 +y(tor)o(eaping)20 b(in)h(section)h(3.4.1.)p Fu(g)365 +2221 y Fy(\(interrupt-handle)o(r)37 b FB(interrupt)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(handler)747 b FC(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 +b(A)30 b(handler)g(is)g(either)g Fy(#f)g FC(\(ignor)o(e\),)h +Fy(#t)573 2555 y FC(\(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 Fw(3.10)99 +b(T)-5 b(ime)365 3181 y FC(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) +3637 y Fl(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 +573 3820 y(link.)365 4068 y FA(3.10.1)81 b(T)-9 b(erminology)365 +4251 y FC(\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 +4475 y(P)t Ft(O)t(S)t(I)t(X)28 b FC(allows)d(a)g(single)g(time)g(zone)g +(to)g(specify)f FB(two)g FC(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)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 +(\223summer)h(time.\224)1756 5147 y(67)p eop %%Page: 68 74 -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 +68 73 bop 681 614 a FA(3.10.2)80 b(Basic)20 b(data)g(types)681 +810 y FC(W)-8 b(e)21 b(have)f(two)h(types:)26 b FB(time)20 +b FC(and)h FB(date)p FC(.)805 945 y(A)j FB(time)g FC(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 +1014 y Fv(3)1635 1044 y FC(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 +1478 y(A)32 b FB(date)f FC(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 +1577 y(location/time-zone)21 b(in)h(the)f(world,)f FB(e.g.)p +FC(:)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 +1876 y(r)o(ecor)o(d)19 b(type:)888 2084 y Fy(\(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 @@ -5317,47 +5155,44 @@ y(tz-name)302 b(;)43 b(Time-zone)d(name:)h(#f)i(or)g(a)g(string.)976 (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 +FC(If)31 b(the)g Fy(tz-secs)e FC(\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 +Fy(tz-name)e FC(and)j Fy(summer?)d FC(\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 +3721 y(If)38 b(the)g Fy(tz-name)d FC(\002eld)j(is)h(given,)j(it)d(is)f +(a)g(time-zone)g(string)h(such)f(as)g Fy("EST")e FC(or)681 +3821 y Fy("HKT")25 b FC(understood)i(by)g(the)h(OS.)e(Since)j(P)t +Ft(O)t(S)t(I)t(X)i FC(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 +Fy(summer?)d FC(\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 +(ent)d(seconds;)31 b(the)c Fy(summer?)d FC(\003ag)k(says)681 +4418 y(which)21 b(one.)805 4553 y(A)i(date)e(with)j Fy(tz-name)f +Fn(=)j Fy(tz-secs)e Fn(=)i Fy(#f)c FC(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 +(time)h(zone.)p 681 4742 1146 4 v 766 4796 a Fq(3)800 +4819 y Ft(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +(light-cones.)2071 5147 y FC(68)p eop %%Page: 69 75 -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 +69 74 bop 490 614 a FC(Ther)o(e)20 b(is)h(r)o(edundancy)e(in)j(the)e +Fy(date)g FC(data)f(str)o(uctur)o(e.)25 b(For)c(example,)f(the)h +Fy(year-day)365 714 y FC(\002eld)f(is)g(r)o(edundant)e(with)i(the)g +Fy(month-day)c FC(and)j Fy(month)e FC(\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) +Fy(week-day)d FC(\002eld.)43 b(The)27 b Fy(summer?)d +FC(and)j Fy(tz-name)c FC(\002elds)k(ar)o(e)f(r)o(edun-)365 +913 y(dant)33 b(with)g(the)g Fy(tz-secs)d FC(\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 @@ -5368,62 +5203,59 @@ y(completely)-9 b(.)58 b(However)-6 b(,)34 b(when)e(date)f(r)o(ecor)o 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) +o(ocedur)o(e)f(below)-8 b(.)365 1563 y Fy(\(make-date)40 +b FB(s)16 b(min)f(h)h(mday)e(mon)h(y)h([tzn)f(tzs)g(summ?)g(wday)g +(yday])p Fy(\))41 b Fu(\000)-14 b(!)43 b FB(date)87 b +FC(pr)o(ocedur)o(e)573 1707 y(When)25 b(making)g(a)f +Fy(date)f FC(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 +Fy(#f)p FC(,)f Fy(#f)p FC(,)g Fy(#f)p FC(,)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 +1906 y(cr)o(eating)g(a)g Fy(date)f FC(r)o(ecor)o(d)g(to)i(pass)g(as)f +(an)h(ar)o(gument)f(to)h Fy(time)p FC(.)365 2185 y FA(3.10.3)81 +b(T)-5 b(ime)20 b(zones)365 2373 y FC(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 +623 2597 y Fy(#f)273 b FC(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 +2996 y(String)139 b(A)18 b(P)t Ft(O)t(S)t(I)t(X)i FC(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 +FB(i.e.)p FC(.,)27 b(the)g(sort)g(of)g(time)g(zone)f(assigned)h(to)g +(the)g Fy($TZ)984 3195 y FC(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.) +3438 y(time)h(in)h(that)e(zone.)26 b(It)21 b(is)g FB(not)f +FC(\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 +(of)f(either)h(0)f(or)h Fy("UCT0")p FC(.)365 3828 y FA(3.10.4)81 +b(Procedures)365 4039 y Fy(\(time+ticks\))i Fu(\000)-15 +b(!)87 b FB([secs)22 b(ticks])1297 b FC(pr)o(ocedur)o(e)365 +4139 y Fy(\(ticks/sec\))83 b Fu(\000)-14 b(!)87 b FB(r)o(eal)1579 +b FC(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 +573 4364 y(not)h(pr)o(ovided)f(by)j(P)t Ft(O)t(S)t(I)t(X)r +FC(,)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) +Fy(\(ticks/sec\))p FC(.)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(31,)g(1997)h(\226)f(17) -13 b(:)f(31)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 +g(given)573 4898 y(by)g Fy(\(ticks/sec\))p FC(.)i(For)f(example,)f(on)h +(BSD,)e(time)i(is)f(r)o(eported)f(at)h Fn(1)p Fz(\026)p +FC(s)g(r)o(esolution,)1756 5147 y(69)p eop %%Page: 70 76 -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 +70 75 bop 888 614 a FC(so)34 b Fy(\(ticks/sec\))28 b +FC(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) +(esolution,)i(the)f FB(ticks)f FC(value)g(is)h(always)888 +949 y(0,)j(and)h Fy(\(ticks/sec\))16 b FC(r)o(eturns)k(1.)1071 +1129 y Fl(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 @@ -5450,47 +5282,45 @@ y(stamps)16 b(could)g(be)h(collected)f(with)h(little)g(over)o(head,)e (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 +2976 y Fy(\(date\))84 b Fu(\000)-14 b(!)87 b FB(date-r)o(ecord)1545 +b FC(pr)o(ocedur)o(e)681 3075 y Fy(\(date)41 b FB([time)20 +b(tz])p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(date-r)o(ecord)1213 +b FC(pr)o(ocedur)o(e)888 3219 y(Simple)21 b Fy(\(date\))d +FC(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 +Fy(date)g FC(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 FB(tz)o FC(.)31 +b FB(T)-5 b(ime)23 b FC(defaults)f(to)h(the)f(curr)o(ent)g(time;)i +FB(tz)e FC(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 +y(If)25 b(the)g FB(tz)f FC(ar)o(gument)h(is)g(an)g(integer)-6 +b(,)25 b(the)h(date's)e Fy(tz-name)e FC(\002eld)j(is)g(a)h(P)t +Ft(O)t(S)t(I)t(X)j FC(time)888 3788 y(zone)17 b(of)f(the)h(form)f(\223) +p Fy(UTC+)p Fs(hh)c Fy(:)p Fs(mm)h Fy(:)p Fs(ss)g FC(\224;)k(the)g +(trailing)g Fy(:)p Fs(mm)c Fy(:)p Fs(ss)30 b FC(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 +4086 y Fy(\(time\))84 b Fu(\000)-14 b(!)87 b FB(integer)1685 +b FC(pr)o(ocedur)o(e)681 4185 y Fy(\(time)41 b FB([date])p +Fy(\))86 b Fu(\000)-15 b(!)88 b FB(integer)1447 b FC(pr)o(ocedur)o(e) +888 4329 y(Simple)21 b Fy(\(time\))d FC(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(31,)g -(1997)h(\226)f(17)13 b(:)f(31)p eop +i Fy(time)e FC(converts)h(a)g(date)f(to)h(a)g(time.)51 +b FB(Date)888 4564 y FC(defaults)20 b(to)h(the)g(curr)o(ent)f(date.)888 +4699 y(Note)31 b(that)f(the)h(input)g FB(date)f FC(r)o(ecor)o(d)e(is)j +(over)o(constrained.)54 b Fy(time)29 b FC(ignor)o(es)h +FB(date)p FC('s)888 4799 y Fy(week-day)k FC(and)i Fy(year-day)d +FC(\002elds.)73 b(If)36 b(the)h(date's)f Fy(tz-secs)d +FC(\002eld)k(is)g(set,)j(the)888 4898 y Fy(tz-name)18 +b FC(and)j Fy(summer?)c FC(\002elds)k(ar)o(e)f(ignor)o(ed.)2071 +5147 y(70)p eop %%Page: 71 77 -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 +71 76 bop 573 614 a FC(If)26 b(the)g Fy(tz-secs)e FC(\002eld)i(is)g +Fy(#f)p FC(,)h(then)g(the)f(time-zone)g(is)h(taken)f(fr)o(om)g(the)g +Fy(tz-name)573 714 y FC(\002eld.)35 b(A)24 b(false)g +Fy(tz-name)d FC(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 +(date's)f Fy(summer?)e FC(\002eld)j(is)g(used)g(to)g(r)o(esolve)f(am-) +573 913 y(biguities:)805 1015 y Fy(#f)161 b FC(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 @@ -5499,222 +5329,212 @@ 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 +(cases,)i(the)f Fy(summer?)c FC(\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 +1738 y(Spring,)f(then)h(the)g(value)f(of)h Fy(summer?)d +FC(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 +(r)o(egar)o(dless)e(of)h(the)h Fy(summer?)d FC(value.)573 +2064 y(The)k Fy(summer?)d FC(\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 +y Fy(\(date->string)39 b FB(date)p Fy(\))86 b Fu(\000)-15 +b(!)88 b FB(string)1186 b FC(pr)o(ocedur)o(e)365 2435 +y Fy(\(format-date)39 b FB(fmt)20 b(date)p Fy(\))86 b +Fu(\000)-14 b(!)87 b FB(string)1094 b FC(pr)o(ocedur)o(e)573 +2563 y Fy(Date->string)16 b FC(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 +(01:03:52)d(1973)573 2789 y Fy(Format-date)26 b FC(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 +FB(fmt)o FC(.)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 +(speci\002ers)g(supported)f(by)h Fy(format-date)p FC(.)365 +3260 y Fy(\(fill-in-date!)38 b FB(date)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(date)1207 b FC(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 +y Fu(\017)42 b FA(year)-5 b(,)20 b(month,)f(month-day)g +Fu(\))i FA(year)o(-day)756 3741 y FC(If)g(the)g Fy(year)p +FC(,)f Fy(month)p FC(,)f(and)i Fy(month-day)d FC(\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 +Fy(year-day)e FC(\002eld)j(is)g(set)f(to)i(the)f(corr)o(esponding)f +(value.)672 3961 y Fu(\017)42 b FA(year)-5 b(,)20 b(year)o(-day)f +Fu(\))h FA(month,)g(month-day)756 4060 y FC(If)41 b(the)h +Fy(month)e FC(and)h Fy(month-day)d FC(\002elds)k(ar)o(en't)f(set,)47 +b(but)42 b(the)g Fy(year)e FC(and)756 4160 y Fy(year-day)17 +b FC(\002elds)k(ar)o(e)e(set,)i(then)g Fy(month)e FC(and)h +Fy(month-day)d FC(ar)o(e)i(calculated.)672 4280 y Fu(\017)42 +b FA(year)-5 b(,)20 b(month,)f(month-day)-8 b(,)19 b(year)o(-day)g +Fu(\))i FA(week-day)756 4380 y FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +756 4479 y Fy(week-day)17 b FC(\002eld)k(is)g(then)g(set.)672 +4599 y Fu(\017)42 b FA(tz-secs)18 b Fu(\))j FA(tz-name)756 +4699 y FC(If)i Fy(tz-secs)d FC(is)k(de\002ned,)g(but)g +Fy(tz-name)c FC(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 Fy(UTC+)p Fs(hh)11 +b Fy(:)p Fs(mm)j Fy(:)p Fs(ss)f FC(\224;)26 b(the)f(trailing)h +Fy(:)p Fs(mm)13 b Fy(:)p Fs(ss)38 b FC(portion)26 b(is)756 +4898 y(deleted)19 b(if)i(it)g(is)g(zer)o(oes.)1756 5147 +y(71)p eop %%Page: 72 78 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) +a Fy(~~)99 b FC(Converted)20 b(to)h(the)g Fy(~)f FC(character)-6 +b(.)759 1399 y Fy(~a)99 b FC(abbr)o(eviated)18 b(weekday)i(name)759 +1523 y Fy(~A)99 b FC(full)20 b(weekday)g(name)759 1648 +y Fy(~b)99 b FC(abbr)o(eviated)18 b(month)k(name)759 +1772 y Fy(~B)99 b FC(full)20 b(month)i(name)759 1897 +y Fy(~c)99 b FC(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 +y(\()p Fy(~X)42 b(~x)p FC(\))759 2121 y Fy(~d)99 b FC(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 +2245 y Fy(~H)99 b FC(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 Fy(~I)99 +b FC(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 Fy(~j)99 b FC(day)20 b(of)h(the)f(year)g +(as)h(a)f(decimal)g(number)h(\(001-366\))759 2619 y Fy(~m)99 +b FC(month)22 b(as)e(a)g(decimal)h(number)g(\(01-12\))759 +2744 y Fy(~M)99 b FC(minute)21 b(as)g(a)f(decimal)g(number)h(\(00-59\)) +759 2868 y Fy(~p)99 b FC(AM/PM)19 b(designation)j(associated)e(with)i +(a)e(12-hour)g(clock)759 2993 y Fy(~S)99 b FC(second)21 +b(as)f(a)g(decimal)h(number)f(\(00-61\))759 3117 y Fy(~U)99 +b FC(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 Fy(~w)99 b FC(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 +3366 y Fy(~W)99 b FC(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 Fy(~x)99 +b FC(date)19 b(using)j(the)f(date)f(r)o(epr)o(esentation)f(for)i(the)g +(locale)759 3615 y Fy(~X)99 b FC(time)21 b(using)g(the)g(time)g(r)o +(epr)o(esentation)f(for)g(the)h(locale)759 3740 y Fy(~y)99 +b FC(year)20 b(without)i(century)e(\(00-99\))759 3864 +y Fy(~Y)99 b FC(year)20 b(with)h(century)g(\()p FB(e.g.)o +FC(1990\))759 3989 y Fy(~Z)99 b FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +4089 y(determinable)1275 4278 y(Figur)o(e)f(3.1:)k Fy(format-date)17 +b FC(conversion)k(speci\002ers)p 3542 4301 V 681 4304 +2865 4 v 2071 5147 a(72)p eop %%Page: 73 79 -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 +73 78 bop 672 614 a Fu(\017)42 b FA(tz-name,)17 b(date,)i(summer?)25 +b Fu(\))c FA(tz-secs,)d(summer?)756 714 y FC(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 +Fy(tz-name)756 814 y FC(is)j(also)h(pr)o(ovided,)e(and)h +Fy(tz-secs)d FC(is)k(not)g(set,)f(then)h Fy(tz-secs)d +FC(and)h Fy(summer?)756 913 y FC(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 +Fy(summer?)p FC(.)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 Fy(summer?)d +FC(is)j(set)g(to)g Fy(#f)p FC(.)672 1256 y Fu(\017)42 +b FA(local)19 b(time,)g(date,)g(summer?)25 b Fu(\))20 +b FA(tz-name,)e(tz-secs,)h(summer?)756 1356 y FC(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 +(pr)o(ovided)f(\(both)h Fy(tz-name)d FC(and)j Fy(tz-secs)d +FC(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 +(escape:)45 b(if)31 b(both)g Fy(tz-name)573 1941 y FC(and)c +Fy(tz-secs)d FC(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 +(should)f(take)f(pr)o(ecedence.)756 2242 y Fl(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 +2670 y Fw(3.1)l(1)100 b(Environment)24 b(variables)365 +2924 y Fy(\(setenv)41 b FB(var)20 b(val)p Fy(\))87 b +Fu(\000)-15 b(!)88 b FB(unde\002ned)1226 b FC(pr)o(ocedur)o(e)365 +3024 y Fy(\(getenv)41 b FB(var)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(string)1476 b FC(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 +y(nal)h(C)g(variable)f Fy(char)41 b(**environ)p FC(.)26 +b(An)c(envir)o(onment)h(variable)d FB(var)i FC(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 +(string)i FB(val)p FC(,)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 +(entry)g(of)g(the)h(form)f Fy(")p FB(var)o Fy(=)p FB(val)o +Fy(")p FC(.)41 b(If)573 3552 y FB(val)20 b FC(is)h Fy(#f)p +FC(,)f(then)h(any)g(entry)g(for)f FB(var)h FC(is)g(deleted.)365 +3775 y Fy(\(env->alist\))83 b Fu(\000)-15 b(!)87 b FB(string)p +Fu(!)p FB(string)21 b(alist)1006 b FC(pr)o(ocedur)o(e)573 +3927 y(The)21 b Fy(env->alist)c FC(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 +4026 y FB(e.g.)o FC(,)756 4213 y Fy(\(\("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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)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 +FB(alist)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(unde\002ned)1142 +b FC(pr)o(ocedur)o(e)1756 5147 y(73)p eop %%Page: 74 80 -74 79 bop 888 614 a FA(Alist)29 b FB(must)g(be)f(an)g(alist)h(whose)g +74 79 bop 888 614 a FB(Alist)29 b FC(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 +h(curr)o(ent)e(Unix)i(envir)o(onment)g(\()p FB(i.e.)o +FC(,)888 913 y(converted)23 b(to)g(a)g(null-terminated)g(C)g(vector)f +(of)h Fy(")p FB(var)p Fy(=)p FB(val)o Fy(")f FC(strings)i(which)g(is)g +(as-)888 1013 y(signed)d(to)h(the)e(global)h Fy(char)42 +b(**environ)p FC(\).)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 +b(They)20 b(ar)o(e)e(all)h(de\002ned)h(using)g Fy(equal?)e +FC(for)h(key)h(com-)681 1375 y(parison.)681 1517 y Fy(\(alist-delete)38 +b FB(key)20 b(alist)p Fy(\))87 b Fu(\000)-14 b(!)87 b +FB(alist)1110 b FC(pr)o(ocedur)o(e)888 1651 y(Delete)21 +b(any)g(entry)f(labelled)g(by)h(value)f FB(key)p FC(.)681 +1931 y Fy(\(alist-update)38 b FB(key)20 b(val)h(alist)p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(alist)988 b FC(pr)o(ocedur)o(e)888 +2066 y(Delete)21 b FB(key)f FC(fr)o(om)h FB(alist)p FC(,)f(then)h(cons) +h(on)f(a)f Fy(\()p FB(key)43 b Fy(.)g FB(val)p Fy(\))20 +b FC(entry)-9 b(.)681 2346 y Fy(\(alist-compress)37 b +FB(alist)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(alist)1154 +b FC(pr)o(ocedur)o(e)888 2480 y(Compr)o(esses)21 b FB(alist)g +FC(by)f(r)o(emoving)h(shadowed)g(entries.)26 b(Example:)1071 +2639 y Fy(;;;)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 +(\(1)f(.)h(c\))g(\(3)g(.)g(d\))g(\)\))1245 2838 y Fn(=)-14 +b Fu(\))87 b Fy(\(\(1)43 b(.)g(a\))g(\(2)f(.)h(b\))g(\(3)g(.)g(d\)\)) +681 3095 y(\(with-env*)c FB(env-alist-delta)20 b(thunk)p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(value\(s\))20 b(of)h(thunk)391 +b FC(pr)o(ocedur)o(e)681 3194 y Fy(\(with-total-env*)37 +b FB(env-alist)20 b(thunk)p Fy(\))87 b Fu(\000)-15 b(!)88 +b FB(value\(s\))20 b(of)g(thunk)319 b FC(pr)o(ocedur)o(e)888 +3329 y(These)35 b(pr)o(ocedur)o(es)d(call)i FB(thunk)f +FC(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 FB(thunk)g +FC(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 +(its)g(inner)h(value.)888 3757 y(The)17 b FB(env-alist-delta)e +FC(ar)o(gument)h(speci\002es)g(a)g FB(modi\002cation)f +FC(to)i(the)g(curr)o(ent)e(envir)o(on-)888 3857 y(ment\227)p +FB(thunk)p FC('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) +(by)h(the)g(alist)g(delta.)888 4085 y(The)g FB(env-alist)g +FC(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 FB(thunk)o FC(.)681 +4366 y Fy(\(with-env)40 b FB(env-alist-delta)19 b(.)i(body)p +Fy(\))86 b Fu(\000)-15 b(!)88 b FB(value\(s\))20 b(of)g(body)608 +b FC(syntax)681 4465 y Fy(\(with-total-env)37 b FB(env-alist)20 +b(.)h(body)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(value\(s\))20 +b(of)h(body)535 b FC(syntax)888 4599 y(These)34 b(special)f(forms)h(pr) +o(ovide)f(syntactic)h(sugar)f(for)h Fy(with-env*)c FC(and)j +Fy(with-)888 4699 y(total-env*)p FC(.)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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)p eop +Fy(let)e FC(and)888 4898 y Fy(let*)e FC(forms.)2071 5147 +y(74)p eop %%Page: 75 81 -75 80 bop 490 614 a FB(Example:)39 b(These)28 b(four)f(pieces)h(of)f +75 80 bop 490 614 a FC(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 +Fy($TERM)365 706 y FC(and)21 b Fy($EDITOR)c FC(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 @@ -5732,71 +5552,68 @@ y(;;)g(EXEC-PATH/ENV)i(procedure.)573 2029 y(\(let*)e(\(\(env)h 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 +("shivers@cs.cmu.edu"\)\)\)\))365 2691 y FA(3.1)m(1.1)81 +b(Path)19 b(lists)h(and)f(colon)i(lists)365 2866 y FC(Envir)o(onment)h +(variables)e(such)i(as)f Fy($PATH)e FC(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 +(esentation,)f(see)365 3231 y(the)c Fy(field-reader)16 +b FC(and)k Fy(join-strings)c FC(functions)22 b(in)f(section)g(7.1.)573 +3367 y Fl(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 +b(module.)365 3795 y Fy(\(add-before)39 b FB(elt)21 b(befor)o(e)h(list) +p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(list)1085 b FC(pr)o(ocedur)o(e)365 +3895 y Fy(\(add-after)40 b FB(elt)21 b(after)f(list)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(list)1170 b FC(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 +4122 y(is)g(signi\002cant.)573 4248 y Fy(add-before)c +FC(adds)k FB(elt)g FC(to)h(the)g(list)g(immediately)g(befor)o(e)e(the)h +(\002rst)h(occurr)o(ence)f(of)573 4348 y FB(befor)o(e)f +FC(in)g(the)f(list.)26 b(If)19 b FB(befor)o(e)h FC(is)g(not)g(in)g(the) +f(list,)h FB(elt)f FC(is)h(added)e(to)i(the)f(end)g(of)h(the)f(list.) +573 4474 y Fy(add-after)f FC(is)j(similar:)27 b FB(elt)22 +b FC(is)f(added)f(after)g(the)i(last)f(occurr)o(ence)g(of)g +FB(after)p FC(.)27 b(If)21 b FB(after)573 4573 y FC(is)g(not)g(found,)g +FB(elt)g FC(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)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 +b(Both)21 b(functions)h(use)g Fy(equal?)c FC(for)j(com-)573 +4898 y(paring)f(elements.)1756 5147 y(75)p eop %%Page: 76 82 -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 +76 81 bop 681 614 a FA(3.1)m(1.2)80 b Fy($USER)p FA(,)19 +b Fy($HOME)p FA(,)f(and)i Fy($PATH)681 797 y FC(Like)25 +b(sh)i(and)e(unlike)h(csh,)h(scsh)g(has)e FB(no)h FC(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 +Fy($HOME)f FC(and)i Fy($PATH)p FC(.)e(Scsh)681 1096 y(never)23 +b(uses)h Fy($USER)d FC(at)i(all.)34 b(It)24 b(computes)g +Fy(\(user-login-nam)o(e\))17 b FC(fr)o(om)23 b(the)h(system)g(call)681 +1196 y Fy(\(user-uid\))p FC(.)681 1344 y Fy(home-directory)2045 +b FB(string)681 1444 y Fy(exec-path-list)1914 b FB(string)20 +b FC(list)888 1584 y(Scsh)29 b(accesses)e Fy($HOME)g +FC(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 Fy(home-directory)p +FC(.)h(It)g(uses)h(this)g(value)e(for)h Fy(~)g FC(lookups)h(and)f(for)g +(r)o(eturn-)888 1783 y(ing)i(to)f(home)g(on)h Fy(\(chdir\))p +FC(.)888 1915 y(Scsh)g(accesses)f Fy($PATH)f FC(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 +Fy(exec-path-list)p FC(.)55 b(This)33 b(list)g(is)g(used)f(for)888 +2115 y Fy(exec-path)17 b FC(and)k Fy(exec-path/env)15 +b FC(sear)o(ches.)681 2408 y Fw(3.12)99 b(T)-11 b(erminal)24 +b(device)h(control)681 2622 y FC(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) @@ -5810,73 +5627,71 @@ b(W)-8 b(e've)681 3120 y(also)30 b(made)f(an)h(ef)o(fort)f(to)h(use)g 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 +(obfuscatory)g(constants)681 3419 y(named)20 b Fy(ICRNL)p +FC(,)f Fy(INPCK)p FC(,)f Fy(IUCLC)p FC(,)g(and)j Fy(ONOCR)p +FC(.)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 +3993 y FA(3.12.1)80 b(Portability)19 b(across)h(OS)h(variants)681 +4176 y FC(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 +(the)i(P)t Ft(O)t(S)t(I)t(X)i FC(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 +(P)t Ft(O)t(S)t(I)t(X)h FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p eop +2071 5147 y(76)p eop %%Page: 77 83 -77 82 bop 365 614 a FB(featur)o(es)20 b(of)i(the)g(terminal)g(driver)-6 +77 82 bop 365 614 a FC(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 +Ft(O)t(S)t(I)t(X)r FC(;)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 +Ft(O)t(S)t(I)t(X)j FC(constants)e(will)f(be)g(bound)g(identi\002ers.) +490 988 y Fu(\017)41 b FC(If)22 b(your)g(OS)h(supports)f(a)g +(particular)f(non-)r(P)t Ft(O)t(S)t(I)t(X)27 b FC(\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 +(\003ag's)i(value.)490 1245 y Fu(\017)41 b FC(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 +(be)e(pr)o(esent,)573 1344 y(but)c(bound)g(to)g Fy(#f)p +FC(.)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 +b(,)18 b(note)h(that)f(although)j(P)t Ft(O)t(S)t(I)t(X)r +FC(,)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) +(not)j(documented)f(her)o(e.)365 2488 y FA(3.12.2)81 +b(Miscellaneous)17 b(procedures)365 2687 y Fy(\(tty?)42 +b FB(fd/port)p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(boolean)1399 +b FC(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 Fy(\(tty-file-name)38 +b FB(fd/port)p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(string)1054 +b FC(pr)o(ocedur)o(e)573 3118 y(The)24 b(ar)o(gument)f +FB(fd/port)f FC(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 +(of)h(the)g(tty)-9 b(.)365 3477 y FA(3.12.3)81 b(The)20 +b(tty-info)g(record)h(type)365 3660 y FC(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 +Fy(tty-info)365 3760 y FC(r)o(ecor)o(d,)19 b(de\002ned)h(as)h(follows:) +573 3934 y Fy(\(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 @@ -5885,228 +5700,219 @@ y(control-chars)82 b(;)43 b(String:)e(Magic)g(input)h(chars)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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +4830 y(time\))434 b(;)43 b(Int:)f(Raw-mode)e(input)i(policy)1756 +5147 y FC(77)p eop %%Page: 78 84 -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 +78 83 bop 681 614 a FA(The)20 b(control-characters)e(string)681 +822 y FC(The)h Fy(control-chars)13 b FC(\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 +Ft(O)t(S)t(I)t(X)j FC(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 +(if)g(the)g(non-)683 1263 y(P)t Ft(O)t(S)t(I)t(X)e FC(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 +(bound)681 1562 y(to)k Fy(#f)p FC(.)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) +b(in)g(the)g Fy(tty-info:contro)o(l-)o(cha)o(rs)60 b +FC(string)67 b(to)h(the)e(special)h(character)681 1905 +y Fy(disable-tty-char)21 b FC(\(and)27 b(then)h(use)g(the)f +Fy(\(set-tty-info)39 b FB(fd/port)j(info)p Fy(\))27 b +FC(pr)o(ocedur)o(e)681 2004 y(to)21 b(update)f(the)h(terminal's)g +(state\).)681 2303 y FA(The)f(\003ag)g(\002elds)681 2510 +y FC(The)48 b Fy(tty-info)d FC(r)o(ecor)o(d's)i Fy(input-flags)p +FC(,)k Fy(output-flags)p FC(,)f Fy(control-flags)p FC(,)f(and)681 +2610 y Fy(local-flags)22 b FC(\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 +Ft(O)t(S)t(I)t(X)h FC(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 +(to)g(see)681 3151 y(if)25 b(the)g(non-)r(P)t Ft(O)t(S)t(I)t(X)k +FC(\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 +(the)f(\003ag)h(will)h(be)e(bound)h(to)g Fy(#f)p FC(.)681 +3649 y FA(The)f(speed)f(\002elds)681 3856 y FC(The)26 +b Fy(input-speed)c FC(and)27 b Fy(output-speed)21 b FC(\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 +h(P)t Ft(O)t(S)t(I)t(X)r FC(:)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(31,)g(1997)h(\226) -f(17)13 b(:)f(31)p eop +Fy('exta)d FC(and)681 4898 y Fy('extb)p FC(.)2071 5147 +y(78)p eop %%Page: 79 85 -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 +79 84 bop 365 614 a FA(The)21 b(min)f(and)f(time)h(\002elds)365 +807 y FC(The)31 b(integer)f Fy(min)f FC(and)h Fy(time)e +FC(\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 +b(warned)f(that)k(P)t Ft(O)t(S)t(I)t(X)g FC(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 +1238 y Fy(tty-info)14 b FC(r)o(ecor)o(d)h(to)i(shar)o(e)e(storage)i +(for)f(the)h Fy(min)f FC(\002eld)g(and)g(the)h Fy(ttychar/eof)12 +b FC(element)365 1337 y(of)32 b(the)f(contr)o(ol-characters)f(string,)k +(and)d(for)g(the)h Fy(time)e FC(\002eld)h(and)g(the)g +Fy(ttychar/eol)365 1437 y FC(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) +(set)h(the)g Fy(min)f FC(and)g Fy(time)f FC(\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) +2038 y FA(3.12.4)81 b(Using)20 b(tty-info)f(records)365 +2253 y Fy(\(make-tty-info)38 b FB(if)16 b(of)g(cf)f(lf)h(ispeed)g +(ospeed)g(min)f(time)p Fy(\))43 b Fu(\000)-14 b(!)43 +b FB(tty-info-r)o(ecord)85 b FC(pr)o(ocedur)o(e)365 2353 +y Fy(\(copy-tty-info)38 b FB(tty-info-r)o(ecord)p Fy(\))85 +b Fu(\000)-15 b(!)88 b FB(tty-info-r)o(ecord)504 b FC(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 +(cr)o(eate)f(new)i Fy(tty-info)c FC(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) +2679 y(to)27 b(the)f Fy(tty-info)d FC(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 +2779 y(the)32 b Fy(make-tty-info)26 b FC(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 +2848 y Fv(4)1841 2878 y FC(Instead,)h(it)g(simply)g(r)o(eturns)f(a)g +Fy(tty-info)573 2978 y FC(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 +Ft(S)t(C)t(I)t(I)573 3078 y FC(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 +(oduced)h(by)573 3277 y Fy(copy-tty-info)16 b FC(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 +f(it)h(fr)o(eely)-9 b(.)365 3582 y Fy(\(tty-info)40 b +FB(fd/port)p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(tty-info-r)o(ecord)984 +b FC(pr)o(ocedur)o(e)573 3728 y(The)32 b FB(fd/port)f +FC(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 +b(This)25 b(pr)o(ocedur)o(e)d(r)o(eturns)i(a)f Fy(tty-info)e +FC(r)o(ecor)o(d)573 3927 y(describing)g(the)g(terminal's)g(curr)o(ent)f +(mode.)365 4133 y Fy(\(set-tty-info/now)37 b FB(fd/port)19 +b(info)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(no-value)685 +b FC(pr)o(ocedur)o(e)365 4233 y Fy(\(set-tty-info/dra)o(in)37 +b FB(fd/port)19 b(info)p Fy(\))87 b Fu(\000)-14 b(!)87 +b FB(no-value)598 b FC(pr)o(ocedur)o(e)365 4332 y Fy +(\(set-tty-info/flu)o(sh)37 b FB(fd/port)19 b(info)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(no-value)598 b FC(pr)o(ocedur)o(e) +573 4478 y(The)32 b FB(fd/port)f FC(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 +a Fq(4)485 4819 y Ft(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(part)f(of)h(the)h(P)t Fp(O)t(S)t(I)t(X)d Ft(spec.)1756 +5147 y FC(79)p eop %%Page: 80 86 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 +a FC(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 Fy +(set-tty-info/now)181 b FC(Make)19 b(change)i(immediately)-9 +b(.)p 3426 754 V 1004 853 V 1057 824 a Fy(set-tty-info/drai)o(n)94 +b FC(Drain)20 b(output,)h(then)h(change.)p 3426 853 V +1004 953 V 1057 923 a Fy(set-tty-info/flus)o(h)94 b FC(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 +953 V 1004 956 2425 4 v 681 1261 a FA(3.12.5)80 b(Other)20 +b(terminal-device)d(procedures)681 1492 y Fy(\(send-tty-break)37 +b FB(fd/port)19 b([duration])p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(no-value)555 b FC(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 +b(I/O)h(port)f FB(fd/port)o FC(.)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 +(terminal's)g(transmission)h(line.)888 1972 y(The)h FB(duration)f +FC(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 +y(local)i(community)h(standar)o(ds.)681 2509 y Fy(\(drain-tty)39 +b FB(fd/port)p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(no-value)1140 +b FC(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 +b(If)36 b FB(fd/port)f FC(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 +3203 y Fy(\(flush-tty/input)37 b FB(fd/port)p Fy(\))85 +b Fu(\000)-14 b(!)87 b FB(no-value)878 b FC(pr)o(ocedur)o(e)681 +3302 y Fy(\(flush-tty/outpu)o(t)37 b FB(fd/port)p Fy(\))86 +b Fu(\000)-15 b(!)87 b FB(no-value)835 b FC(pr)o(ocedur)o(e)681 +3402 y Fy(\(flush-tty/both)37 b FB(fd/port)p Fy(\))85 +b Fu(\000)-14 b(!)87 b FB(no-value)922 b FC(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 +Fy(\(start-tty-outpu)o(t)37 b FB(fd/port)p Fy(\))86 b +Fu(\000)-15 b(!)87 b FB(no-value)835 b FC(pr)o(ocedur)o(e)681 +3996 y Fy(\(stop-tty-output)37 b FB(fd/port)p Fy(\))85 +b Fu(\000)-14 b(!)87 b FB(no-value)878 b FC(pr)o(ocedur)o(e)681 +4096 y Fy(\(start-tty-input)37 b FB(fd/port)p Fy(\))85 +b Fu(\000)-14 b(!)87 b FB(no-value)878 b FC(pr)o(ocedur)o(e)681 +4195 y Fy(\(stop-tty-input)37 b FB(fd/port)p Fy(\))85 +b Fu(\000)-14 b(!)87 b FB(no-value)922 b FC(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 +b(\003ow)-8 b(.)31 b(The)23 b Fy(stop-tty-output)15 b +FC(and)22 b Fy(start-tty-output)16 b FC(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 +(device.)46 b(The)28 b Fy(stop-tty-input)888 4651 y FC(and)21 +b Fy(start-tty-input)15 b FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +b(.)2071 5147 y(80)p eop %%Page: 81 87 -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 +81 86 bop 365 614 a FA(3.12.6)81 b(Control)20 b(terminals,)e(sessions,) +h(and)h(terminal)f(process)h(groups)365 813 y Fy(\(open-control-tty)37 +b FB(tty-name)19 b([\003ags])p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(port)678 b FC(pr)o(ocedur)o(e)573 933 y(This)18 +b(pr)o(ocedur)o(e)e(opens)i(terminal)g(device)f FB(tty-name)g +FC(as)g(the)h(pr)o(ocess')g(contr)o(ol)g(ter)o(-)573 +1032 y(minal)j(\(see)g(the)g Fy(termios)d FC(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 +y(nals\).)29 b(The)22 b FB(tty-name)e FC(ar)o(gument)i(is)g(a)g +(\002le-name)g(such)g(as)g Fy(/dev/ttya)p FC(.)k(The)c +FB(\003ags)573 1232 y FC(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 Fy(open-file)573 +1331 y FC(call;)g(it)f(defaults)e(to)h Fy(open/read+write)p +FC(,)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 +FB(\003ags)g FC(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 +Fy(dup->outport)p FC(.)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 @@ -6115,68 +5921,66 @@ 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 +2613 y(pr)o(ocedur)o(e,)f(use)j(the)g Fy(become-session-l)o(ead)o(er)14 +b FC(pr)o(ocedur)o(e.)365 2790 y Fy(\(become-session-l)o(ea)o(der)o(\)) +81 b Fu(\000)-14 b(!)87 b FB(integer)944 b FC(pr)o(ocedur)o(e)573 +2921 y(This)20 b(is)g(the)g(C)g Fy(setsid\(\))c FC(call.)27 +b(P)t Ft(O)t(S)t(I)t(X)c FC(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 +(subsequently)i(use)f Fy(open-control-tty)12 b FC(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) +3924 y Fy(\(tty-process-grou)o(p)37 b FB(fd/port)p Fy(\))86 +b Fu(\000)-15 b(!)88 b FB(integer)847 b FC(pr)o(ocedur)o(e)365 +4024 y Fy(\(set-tty-process-)o(gr)o(oup)37 b FB(fd/port)19 +b(pgrp)p Fy(\))86 b Fu(\000)-15 b(!)88 b FB(unde\002ned)400 +b FC(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 +(termi-)573 4255 y(nal.)365 4432 y Fy(\(control-tty-file)o(-n)o(ame)o +(\))81 b Fu(\000)-14 b(!)87 b FB(string)976 b FC(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 +(string)f Fy("/dev/tty")p FC(.)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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +573 4863 y(ply)k(using)g(a)g(constant)g(string.)1756 +5147 y(81)p eop %%Page: 82 88 -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 +82 87 bop 681 614 a FA(3.12.7)80 b(Pseudo-terminals)681 +797 y FC(Scsh)21 b(implements)g(an)g(interface)e(to)j(Berkeley-style)e +(pseudo-terminals.)681 946 y Fy(\(fork-pty-sessio)o(n)37 +b FB(thunk)p Fy(\))65 b Fu(\000)-14 b(!)65 b FB([pr)o(ocess)18 +b(pty-in)f(pty-out)f(tty-name])85 b FC(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) +f FB(thunk)o FC(.)26 b(In)21 b(the)g(child)g(pr)o(ocess)988 +1451 y Fu(\017)41 b FC(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 +1582 y Fu(\017)41 b FC(The)29 b(child)g(is)g(placed)e(in)j(its)f(own,)i +(new)e(session)h(\(see)e Fy(become-session-)1071 1682 +y(leader)p FC(\).)988 1814 y Fu(\017)41 b FC(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 +1071 1914 y(\(see)e Fy(open-control-tty)o FC(\).)988 +2046 y Fu(\017)41 b FC(The)21 b Fy(\(error-output-po)o(rt)o(\))15 +b FC(is)21 b(unbuf)o(fer)o(ed.)888 2211 y(The)16 b Fy(fork-pty-session) +10 b FC(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 +(terminal)f(device.)681 2600 y Fy(\(open-pty\))83 b Fu(\000)-14 +b(!)87 b FB(pty-inport)18 b(tty-name)1073 b FC(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) @@ -6184,20 +5988,20 @@ 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 +b(you)f(can)f(easily)g(use)g Fy(\(dup->outport)39 b FB(pty-inport)m +Fy(\))29 b FC(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) +y Fy(\(pty-name->tty-n)o(am)o(e)38 b FB(pty-name)p Fy(\))84 +b Fu(\000)-14 b(!)87 b FB(tty-name)642 b FC(pr)o(ocedur)o(e)681 +3660 y Fy(\(tty-name->pty-n)o(am)o(e)38 b FB(tty-name)p +Fy(\))85 b Fu(\000)-15 b(!)88 b FB(pty-name)641 b FC(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 +(names.)k(For)c(example,)1071 4065 y Fy(\(pty-name->tty-n)o(ame)37 +b("/dev/ptyq3"\))h Fn(=)-14 b Fu(\))87 b Fy("/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 +Fn(=)-14 b Fu(\))87 b Fy("/dev/ptyrc")1071 4370 y Fl(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 @@ -6205,13 +6009,11 @@ y(that)j(I've)e(no)g(r)o(eal)f(idea)h(if)g(it)g(generalises)e(acr)o 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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p eop +4850 y Fy(\(make-pty-genera)o(to)o(r\))81 b Fu(\000)-15 +b(!)88 b FB(pr)o(ocedur)o(e)982 b FC(pr)o(ocedur)o(e)2071 +5147 y(82)p eop %%Page: 83 89 -83 88 bop 573 614 a FB(This)17 b(pr)o(ocedur)o(e)e(r)o(eturns)h(a)g +83 88 bop 573 614 a FC(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 @@ -6219,26 +6021,24 @@ 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 +y(r)o(eturns)20 b Fy(#f)g FC(every)g(time)h(it)g(is)g(called.)k +(Example:)756 1179 y Fy(\(define)40 b(pg)j(\(make-pty-genera)o(to)o +(r\)\))756 1279 y(\(pg\))e Fn(=)-14 b Fu(\))87 b Fy("/dev/ptyp0")756 +1378 y(\(pg\))41 b Fn(=)-14 b Fu(\))87 b Fy("/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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +b Fn(=)-14 b Fu(\))87 b Fy("/dev/ptyqe")756 1731 y(\(pg\))41 +b Fn(=)-14 b Fu(\))87 b Fy("/dev/ptyqf")170 b Fs(\(Last)41 +b(one\))756 1830 y Fy(\(pg\))g Fn(=)-14 b Fu(\))87 b +Fy(#f)756 1930 y(\(pg\))41 b Fn(=)-14 b Fu(\))87 b Fy(#f)1104 +2017 y(.)1104 2050 y(.)1104 2083 y(.)1756 5147 y FC(83)p +eop %%Page: 84 90 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 +a FC(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 +v 1138 1649 a(P)t Ft(O)t(S)t(I)t(X)p 3139 1679 V 1083 +1779 V 1136 1749 a Fy(ttychar/delete-ch)o(ar)267 b(ERASE)185 +b FC(del)p 3139 1779 V 1083 1878 V 1136 1848 a Fy(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 @@ -6249,8 +6049,8 @@ 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 +2595 V 1083 2695 4 100 v 1136 2665 a FC(SVR4)21 b(and)f(4.3+BSD)p +3139 2695 V 1083 2795 V 1136 2765 a Fy(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 @@ -6259,18 +6059,16 @@ 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 +3313 V 1083 3412 4 100 v 1136 3383 a FC(4.3+BSD)p 3139 +3412 V 1083 3512 V 1136 3482 a Fy(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 +3751 a FC(T)-8 b(able)23 b(3.4:)29 b(Indices)23 b(into)i(the)e +Fy(tty-info)d FC(r)o(ecor)o(d's)i FB(contr)o(ol-chars)g +FC(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)p eop +(P)t Ft(O)t(S)t(I)t(X)h FC(entries)681 3950 y(ar)o(e)19 +b(guaranteed)h(to)h(be)f(non-)p Fy(#f)p FC(.)2071 5147 +y(84)p eop %%Page: 85 91 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 @@ -6306,142 +6104,134 @@ 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 +3209 2262 V 383 2265 2830 4 v 365 2500 a FC(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 +(\003ags)h(for)f(the)h Fy(tty-info)c FC(r)o(ecor)o(d's)365 +2600 y FB(input-\003ags)i FC(\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 +2699 y(Only)22 b(the)h(P)t Ft(O)t(S)t(I)t(X)h FC(entries)d(ar)o(e)e +(guaranteed)h(to)h(be)f(non-)p Fy(#f)p FC(.)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 +495 3059 4 100 v 550 3029 a(P)t Ft(O)t(S)t(I)t(X)p 3096 +3059 V 495 3159 V 548 3129 a Fy(ttyout/enable)574 b(OPOST)178 +b FC(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.) +a Fy(ttyout/nl->crnl)486 b(ONLCR)178 b FC(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 +3567 a Fy(ttyout/discard-eo)o(t)355 b(ONOEOT)134 b FC(Discar)o(d)20 +b(EOT)h(chars.)p 3096 3597 V 495 3697 V 548 3667 a Fy +(ttyout/expand-tab)o(s)355 b(OXTABS)1958 3637 y Fv(5)2092 +3667 y FC(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 +3816 V 495 3916 V 548 3886 a Fy(ttyout/cr->nl)574 b(OCRNL)178 +b FC(Map)20 b(cr)g(to)i(nl.)p 3096 3916 V 495 4015 V +548 3985 a Fy(ttyout/nl-does-cr)398 b(ONLRET)134 b FC(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 +548 4085 a Fy(ttyout/no-col0-cr)398 b(ONOCR)178 b FC(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 +V 548 4185 a Fy(ttyout/delay-w/fi)o(ll)o(-ch)o(ar)93 +b(OFILL)178 b FC(Send)20 b(\002ll)i(char)e(to)h(delay)-9 +b(.)p 3096 4215 V 495 4314 V 548 4284 a Fy(ttyout/fill-w/del)398 +b(OFDEL)178 b FC(Fill)22 b(char)e(is)j(A)t Ft(S)t(C)t(I)t(I)h +FC(DEL.)p 3096 4314 V 495 4414 V 548 4384 a Fy(ttyout/uppercase)442 +b(OLCUC)178 b FC(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 +(\003ags)h(for)g(the)g Fy(tty-info)c FC(r)o(ecor)o(d's)365 +4752 y FB(output-\003ags)f FC(\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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +g(chars.)365 4851 y(Only)f(the)h(P)t Ft(O)t(S)t(I)t(X)h +FC(entries)d(ar)o(e)e(guaranteed)h(to)h(be)f(non-)p Fy(#f)p +FC(.)1756 5147 y(85)p eop %%Page: 86 92 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 +a FC(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 +4 100 v 102 w Fy(ttyout/bs-delay)224 b FC(Bit-\002eld)21 +b(mask)p 3274 1482 V 1578 1581 V 1631 1551 a Fy(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 +3274 1681 V 1581 1684 1696 4 v 731 1750 a FC(Carriage-r)o(eturn)d +(delay)p 1578 1780 4 100 v 102 w Fy(ttyout/cr-delay)224 +b FC(Bit-\002eld)21 b(mask)p 3274 1780 V 1578 1880 V +1631 1850 a Fy(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 +1696 4 v 922 2249 a FC(Form-feed)f(delay)p 1578 2279 +4 100 v 102 w Fy(ttyout/ff-delay)224 b FC(Bit-\002eld)21 +b(mask)p 3274 2279 V 1578 2378 V 1631 2348 a Fy(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 2478 V 1581 2481 1696 4 v 764 2548 a FC(Horizontal-tab)f(delay)p +1578 2577 4 100 v 102 w Fy(ttyout/tab-delay)180 b FC(Bit-\002eld)21 +b(mask)p 3274 2577 V 1578 2677 V 1631 2647 a Fy(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 +b FC(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 +w Fy(ttyout/nl-delay)224 b FC(Bit-\002eld)21 b(mask)p +3274 3076 V 1578 3175 V 1631 3145 a Fy(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 +3274 3275 V 1581 3278 1696 4 v 893 3345 a FC(V)-9 b(ertical)20 +b(tab)g(delay)p 1578 3374 4 100 v 102 w Fy(ttyout/vtab-delay)136 +b FC(Bit-\002eld)21 b(mask)p 3274 3374 V 1578 3474 V +1631 3444 a Fy(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 +V 1581 3577 1696 4 v 1415 3643 a FC(All)p 1578 3673 4 +100 v 103 w Fy(ttyout/all-delay)180 b FC(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 +Fy(tty-info)14 b FC(r)o(ecor)o(d's)681 3925 y FB(output-\003ags)h +FC(\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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +(characters.)25 b(They)d(ar)o(e)d(non-)r(P)t Ft(O)t(S)t(I)t(X)r +FC(,)k(and)e(have)f(non-)p Fy(#f)h FC(values)g(only)h(on)g(SVR4)681 +4124 y(systems.)2071 5147 y(86)p eop %%Page: 87 93 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 +a FC(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 Ft(O)t(S)t(I)t(X)p +3183 1789 V 409 1888 V 462 1858 a Fy(ttyc/char-size)530 +b(CSIZE)315 b FC(Character)19 b(size)i(mask)p 3183 1888 +V 409 1988 V 462 1958 a Fy(ttyc/char-size5)486 b(CS5)403 +b FC(5)21 b(bits)p 3183 1988 V 409 2088 V 462 2058 a +Fy(ttyc/char-size6)486 b(CS6)403 b FC(6)21 b(bits)p 3183 +2088 V 409 2187 V 462 2157 a Fy(ttyc/char-size7)486 b(CS7)403 +b FC(7)21 b(bits)p 3183 2187 V 409 2287 V 462 2257 a +Fy(ttyc/char-size8)486 b(CS8)403 b FC(8)21 b(bits)p 3183 +2287 V 409 2386 V 462 2357 a Fy(ttyc/enable-pari)o(ty)355 +b(PARENB)271 b FC(Generate)20 b(and)h(detect)f(parity)-9 +b(.)p 3183 2386 V 409 2486 V 462 2456 a Fy(ttyc/odd-parity)486 +b(PARODD)271 b FC(Odd)21 b(parity)-9 b(.)p 3183 2486 +V 409 2586 V 462 2556 a Fy(ttyc/enable-read)442 b(CREAD)315 +b FC(Enable)20 b(r)o(eception)h(of)f(chars.)p 3183 2586 +V 409 2685 V 462 2655 a Fy(ttyc/hup-on-clos)o(e)399 b(HUPCL)315 +b FC(Hang)21 b(up)g(on)g(last)g(close.)p 3183 2685 V +409 2785 V 462 2755 a Fy(ttyc/no-modem-sy)o(nc)355 b(LOCAL)315 +b FC(Ignor)o(e)21 b(modem)g(lines.)p 3183 2785 V 409 +2885 V 462 2855 a Fy(ttyc/2-stop-bits)442 b(CSTOPB)271 +b FC(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 +3183 3004 V 409 3104 V 462 3074 a Fy(ttyc/ignore-flag)o(s)399 +b(CIGNORE)227 b FC(Ignor)o(e)21 b(contr)o(ol)g(\003ags.)p +3183 3104 V 409 3203 V 462 3173 a Fy(ttyc/CTS-output-)o(flo)o(w-)o(ctl) +93 b(CCTS_OFLOW)i FC(CTS)20 b(\003ow)i(contr)o(ol)f(of)g(output)p +3183 3203 V 409 3303 V 462 3273 a Fy(ttyc/RTS-input-f)o(low)o(-c)o(tl) +137 b(CRTS_IFLOW)95 b FC(R)m(TS)21 b(\003ow)h(contr)o(ol)f(of)g(input)p +3183 3303 V 409 3403 V 462 3373 a Fy(ttyc/carrier-flo)o(w-c)o(tl)224 +b(MDMBUF)p 3183 3403 V 409 3406 2777 4 v 365 3641 a FC(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 +b(ar)o(e)e(the)j(named)e(\003ags)h(for)g(the)g Fy(tty-info)d +FC(r)o(ecor)o(d's)365 3740 y FB(contr)o(ol-\003ags)32 +b FC(\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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +b(line.)26 b(Only)21 b(the)i(P)t Ft(O)t(S)t(I)t(X)h FC(entries)d(ar)o +(e)e(guaranteed)h(to)h(be)g(non-)p Fy(#f)p FC(.)1756 +5147 y(87)p eop %%Page: 88 94 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 @@ -6485,26 +6275,23 @@ 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 +3497 3530 V 725 3534 2776 4 v 681 3769 a FC(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 +(\003ags)h(for)g(the)g Fy(tty-info)c FC(r)o(ecor)o(d's)681 +3868 y FB(local-\003ags)k FC(\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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +3968 y(user)20 b(interface.)25 b(Only)c(the)i(P)t Ft(O)t(S)t(I)t(X)i +FC(entries)20 b(ar)o(e)g(guaranteed)f(to)i(be)g(non-)p +Fy(#f)p FC(.)2071 5147 y(88)p eop %%Page: 89 95 -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 +89 94 bop 365 1274 a Fx(Chapter)45 b(4)365 1727 y FD(Networking)365 +2220 y FC(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 +FB(de)g(facto)365 2519 y FC(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 @@ -6515,8 +6302,8 @@ y(The)29 b(Scheme)f(Under)o(gr)o(ound)f(has)i(also)g(r)o(eleased)e(a)h 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 +(interface.)365 3364 y Fw(4.1)99 b(High-level)26 b(interface)365 +3595 y FC(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 @@ -6529,46 +6316,44 @@ 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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(networking)h(pr)o(ogrammer)-6 b(.)365 4350 y Fy(\(socket-connect)38 +b FB(pr)o(otocol-family)18 b(socket-type)h(.)h(ar)o(gs)p +Fy(\))87 b Fu(\000)-15 b(!)87 b FB(socket)139 b FC(pr)o(ocedur)o(e)573 +4500 y Fy(socket-connect)92 b FC(is)98 b(intended)g(for)g(cr)o(eating)f +(client)i(applications.)573 4599 y FB(pr)o(otocol-family)49 +b FC(is)k(speci\002ed)f(as)g(either)g(the)g Fy(protocol-family/i)o(nte) +o(rn)o(et)573 4699 y FC(or)85 b Fy(protocol-family)o(/un)o(ix)o +FC(.)212 b FB(socket-type)83 b FC(is)i(speci\002ed)f(as)h(either)573 +4799 y Fy(socket-type/stre)o(am)44 b FC(or)51 b Fy(socket-type/data)o +(gra)o(m)p FC(.)109 b(See)50 b Fy(socket)f FC(for)h(a)573 +4898 y(mor)o(e)20 b(complete)h(description)g(of)g(these)g(terms.)1756 +5147 y(89)p eop %%Page: 90 96 -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 +90 95 bop 888 614 a FC(The)20 b(variable)e FB(ar)o(gs)g +FC(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 +888 947 y Fy(socket-connect)e FC(r)o(eturns)24 b(a)g +Fy(socket)e FC(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 +b(See)18 b Fy(socket)e FC(for)i(a)h(description)g(of)f(the)h +FB(socket)g(r)o(ecord)p FC(.)681 1238 y Fy(\(bind-listen-acc)o(ep)o +(t-l)o(oo)o(p)37 b FB(pr)o(otocol-family)13 b(pr)o(oc)i(ar)o(g)p +Fy(\))43 b Fu(\000)-15 b(!)44 b FB(does-not-r)o(eturn)86 +b FC(pr)o(ocedur)o(e)888 1380 y Fy(bind-listen-accep)o(t-)o(loo)o(p)22 +b FC(is)29 b(intended)f(for)g(cr)o(eating)f(server)g(applications.)888 +1480 y FB(pr)o(otocol-family)k FC(is)j(speci\002ed)g(as)f(either)g(the) +h Fy(protocol-family/i)o(nt)o(ern)o(et)27 b FC(or)888 +1579 y Fy(protocol-family/u)o(ni)o(x)p FC(.)d FB(pr)o(oc)d +FC(is)i(a)e(pr)o(ocedur)o(e)g(of)h(two)h(ar)o(guments:)28 +b(a)22 b Fy(socket)888 1679 y FC(and)c(a)f(socket-addr)o(ess.)23 +b FB(ar)o(g)17 b FC(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 +b(See)23 b Fy(socket)d FC(for)k(a)e(mor)o(e)h(complete)h(description) +888 1878 y(of)d(these)g(terms.)888 2011 y FB(pr)o(oc)g +FC(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 @@ -6576,184 +6361,177 @@ 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 +(client)g(pr)o(ograms.)681 2838 y Fw(4.2)99 b(Sockets)681 +3078 y Fy(\(create-socket)38 b FB(pr)o(otocol-family)18 +b(type)h([pr)o(otocol])p Fy(\))85 b Fu(\000)-15 b(!)88 +b FB(socket)269 b FC(pr)o(ocedur)o(e)681 3178 y Fy(\(create-socket-p)o +(ai)o(r)38 b FB(type)p Fy(\))85 b Fu(\000)-14 b(!)87 +b FB([socket)2275 3190 y Fv(1)2333 3178 y FB(socket)2533 +3190 y Fv(2)2570 3178 y FB(])572 b FC(pr)o(ocedur)o(e)681 +3277 y Fy(\(close-socket)38 b FB(socket)p Fy(\))86 b +Fu(\000)-14 b(!)87 b FB(unde\002ned)998 b FC(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 +3601 y(pr)o(otocol.)888 3734 y(The)43 b FB(pr)o(otocol-family)c +FC(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 +4300 y Fy(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 +(er)o(ne)o(t)888 4699 y FC(The)23 b FB(type)f FC(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)p eop +b(T)-7 b(ypical)20 b(values)h(ar)o(e:)2071 5147 y(90)p +eop %%Page: 91 97 -91 96 bop 756 614 a Fx(socket-type/str)o(ea)o(m)756 714 +91 96 bop 756 614 a Fy(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 +1007 y FC(The)19 b FB(pr)o(otocol)e FC(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 +(typically)i(cr)o(eated)e(with)i Fy(create-socket)p FC(.)103 +b(However)-6 b(,)573 1537 y Fy(create-socket-pa)o(ir)14 +b FC(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 Fy(protocol-family/u) +o(nix)29 b FC(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 FB(socket)g(r)o(ecord) +p FC(,)g(de\002ned)h(to)g(have)f(the)h(following)h(str)o(uctur)o(e:)756 +1899 y Fy(\(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 +2391 y FC(The)26 b Fy(family)e FC(speci\002es)j(the)f(pr)o(otocol)h +(family)g(of)f(the)h(socket.)43 b(The)26 b Fy(inport)e +FC(and)573 2491 y Fy(outport)h FC(\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 +2690 y(been)18 b(established)g(via)g Fy(connect-socket)13 +b FC(or)19 b Fy(accept-connecti)o(on)p FC(.)f(For)h(a)f(data-)573 +2790 y(gram)j(socket,)g FB(outport)f FC(can)h(be)g(immediately)g(using) +h Fy(send-message)p FC(,)16 b(and)21 b FB(inport)573 +2890 y FC(can)f(be)h(used)f(after)g Fy(bind)f FC(has)i(cr)o(eated)d(a)j +(local)f(addr)o(ess.)573 3021 y Fy(close-socket)j FC(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 +i(the)e(inport)g(and)g(outport)h(because)e(using)i Fy(close)573 +3220 y FC(on)j(sockets)h(is)f(not)g(curr)o(ently)f(portable)h(acr)o +(oss)f(operating)h(systems.)365 3510 y Fw(4.3)99 b(Socket)26 +b(addresses)365 3724 y FC(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 +FB(socket-)365 4023 y(addr)o(ess)21 b(r)o(ecord)p FC(,)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 +4207 y Fy(\(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 +FC(The)21 b Fy(family)d FC(is)j(one)g(of)g(the)g(following)h +(constants:)573 4699 y Fy(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +(ern)o(et)1756 5147 y FC(91)p eop %%Page: 92 98 -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 +92 97 bop 681 614 a Fy(\(unix-address->s)o(oc)o(ket)o(-a)o(dd)o(res)o +(s)37 b FB(pathname)p Fy(\))56 b Fu(\000)-14 b(!)57 b +FB(socket-addr)o(ess)86 b FC(pr)o(ocedur)o(e)888 752 +y Fy(unix-address->soc)o(ke)o(t-a)o(dd)o(res)o(s)33 b +FC(r)o(eturns)38 b(a)g FB(socket-addr)o(ess)g FC(based)g(on)i(the)888 +851 y(string)e FB(pathname)n FC(.)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 +FB(pathname)o FC(.)681 1136 y Fy(\(internet-addres)o(s-)o(>so)o(ck)o +(et)o(-ad)o(dr)o(ess)f FB(host-addr)o(ess)14 b(service-port)p +Fy(\))43 b Fu(\000)-15 b(!)44 b FB(socket-addr)o(ess)86 +b FC(pr)o(ocedur)o(e)888 1273 y Fy(internet-address-)o(>s)o(ock)o(et)o +(-ad)o(dr)o(ess)28 b FC(r)o(eturns)34 b(a)h FB(socket-addr)o(ess)e +FC(based)h(on)888 1373 y(an)25 b(integer)g FB(host-addr)o(ess)f +FC(and)g(an)h(integer)g FB(service-port)p FC(.)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 +1572 y(constants:)1071 1734 y Fy(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 +y(internet-address)o(/br)o(oa)o(dc)o(ast)888 2126 y FC(The)h(use)f(of)h +Fy(internet-addres)o(s/a)o(ny)23 b FC(is)30 b(described)e(below)i(in)g +Fy(bind-socket)p FC(.)888 2226 y Fy(internet-address/)o(lo)o(opb)o(ac)o +(k)11 b FC(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 Fy(internet-address)o(/br)o(oa)o(dca)o +(st)21 b FC(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 +(a)f(host's)i(addr)o(ess,)e(see)g(the)h Fy(host-info)c +FC(func-)888 2656 y(tion.)681 2841 y Fy(\(socket-address-)o(>u)o(nix)o +(-a)o(dd)o(res)o(s)37 b FB(socket-addr)o(ess)p Fy(\))56 +b Fu(\000)-14 b(!)57 b FB(pathname)86 b FC(pr)o(ocedur)o(e)681 +2940 y Fy(\(socket-address-)o(>i)o(nte)o(rn)o(et)o(-ad)o(dr)o(ess)37 +b FB(socket-addr)o(ess)p Fy(\))42 b Fu(\000)-14 b(!)43 +b FB([host-addr)o(ess)14 b(service-port])86 b FC(pr)o(ocedur)o(e)888 +3077 y(The)227 b(r)o(outines)h Fy(socket-address-)o(>in)o(te)o(rne)o +(t-)o(ad)o(dre)o(ss)220 b FC(and)888 3177 y Fy(socket-address->u)o(ni)o +(x-a)o(dd)o(res)o(s)74 b FC(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 +b(.)681 3766 y Fw(4.4)99 b(Socket)25 b(primitives)681 +3980 y FC(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 +4149 y Fv(1)1805 4179 y FC(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) +4306 a Fq(1)800 4329 y Ft(Some)f(r)o(ecommended)d(ones)j(ar)o(e:)812 +4446 y Fd(\017)41 b Ft(\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 +b Ft(\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 +y Fd(\017)41 b Ft(\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(31,)g -(1997)h(\226)f(17)13 b(:)f(31)p eop +(Documents)h(V)-7 b(olume)16 b(1,)g(PS1:8\))2071 5147 +y FC(92)p eop %%Page: 93 99 -93 98 bop 365 614 a FB(of)22 b(BSD.)e(In)i(the)g(absence)e(of)i(these,) +93 98 bop 365 614 a FC(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 +864 y Fy(\(connect-socket)38 b FB(socket)20 b(socket-addr)o(ess)p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(unde\002ned)415 b +FC(pr)o(ocedur)o(e)573 1005 y Fy(connect-socket)52 b +FC(sets)58 b(up)g(a)f(connection)i(fr)o(om)f(a)f FB(socket)g +FC(to)i(a)e(r)o(emote)573 1105 y FB(socket-addr)o(ess)o +FC(.)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 +(each)d Fy(send-message)p FC(,)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 +1795 y Fy(\(bind-socket)39 b FB(socket)20 b(socket-addr)o(ess)p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(unde\002ned)546 b +FC(pr)o(ocedur)o(e)573 1937 y Fy(bind-socket)24 b FC(assigns)29 +b(a)f(certain)g(local)g FB(socket-addr)o(ess)f FC(to)i(a)f +FB(socket)p FC(.)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 +Fy(listen-socket)18 b FC(for)k(str)o(eam)h(sockets)g(and)g +Fy(receive-message)573 2236 y FC(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 +e(of)i Fy(internet-address)o(/a)o(ny)573 2469 y FC(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(-) @@ -6763,210 +6541,197 @@ e(of)i Fx(internet-address)o(/a)o(ny)573 2469 y FB(indicates)f(that)h 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 +(r)o(eused.)573 3100 y(See)d Fy(delete-file)p FC(.)365 +3292 y Fy(\(listen-socket)38 b FB(socket)21 b(backlog)p +Fy(\))86 b Fu(\000)-15 b(!)88 b FB(unde\002ned)686 b +FC(pr)o(ocedur)o(e)573 3434 y Fy(listen-socket)21 b FC(allows)27 +b(a)e(str)o(eam)h FB(socket)g FC(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 +FB(backlog)f FC(connection)i(r)o(equests.)24 b(Queued)17 +b(connections)573 3633 y(may)k(be)f(accepted)f(by)i Fy +(accept-connectio)o(n)p FC(.)365 3825 y Fy(\(accept-connectio)o(n)37 +b FB(socket)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB([new-socket)20 +b(socket-addr)o(ess])192 b FC(pr)o(ocedur)o(e)573 3967 +y Fy(accept-connectio)o(n)24 b FC(r)o(eceives)30 b(a)g(connection)i(on) +f(a)f FB(socket)p FC(,)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 +(the)g(connection.)365 4358 y Fy(\(socket-local-add)o(re)o(ss)37 +b FB(socket)p Fy(\))87 b Fu(\000)-15 b(!)88 b FB(socket-addr)o(ess)503 +b FC(pr)o(ocedur)o(e)365 4458 y Fy(\(socket-remote-ad)o(dr)o(ess)37 +b FB(socket)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(socket-addr)o(ess)460 +b FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +4699 y(or)33 b(both.)62 b Fy(socket-local-ad)o(dr)o(ess)26 +b FC(r)o(eturns)32 b(the)h(local)g FB(socket-addr)o(ess)e +FC(r)o(ecor)o(d)573 4799 y(associated)46 b(with)i FB(socket)o +FC(.)104 b Fy(socket-remote-add)o(res)o(s)41 b FC(r)o(eturns)46 +b(the)h(r)o(emote)573 4898 y FB(socket-addr)o(ess)20 +b FC(r)o(ecor)o(d)f(associated)h(with)h FB(socket)p FC(.)1756 +5147 y(93)p eop %%Page: 94 100 -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 +94 99 bop 681 614 a Fy(\(shutdown-socket)37 b FB(socket)20 +b(how-to)p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(unde\002ned)616 +b FC(pr)o(ocedur)o(e)888 781 y Fy(shutdown-socket)19 +b FC(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 +g(by)f(the)h FB(how-to)e FC(ar)o(gument,)h(one)i(of:)1071 +1098 y Fy(shutdown/receive)o(s)1071 1198 y(shutdown/sends)1071 +1298 y(shutdown/sends+r)o(ece)o(iv)o(es)681 1851 y Fw(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 +2128 y Fy(\(receive-message)37 b FB(socket)15 b(length)g([\003ags])p +Fy(\))43 b Fu(\000)-15 b(!)44 b FB([string-or-)p Fy(#f)p +FC(socket-addr)o(ess])83 b(pr)o(ocedur)o(e)681 2227 y +Fy(\(receive-message)o(!)37 b FB(socket)16 b(string)g([start])e([end])h +([\003ags])p Fy(\))43 b Fu(\000)-14 b(!)43 b FB([count-or-)p +Fy(#f)p FC(socket-addr)o(ess])83 b(pr)o(ocedur)o(e)681 +2327 y Fy(\(receive-message)o(/p)o(art)o(ia)o(l)37 b +FB(socket)16 b(length)f([\003ags])p Fy(\))42 b Fu(\000)-14 +b(!)44 b FB([string-or-)p Fy(#f)p FC(socket-addr)o(ess])83 +b(pr)o(ocedur)o(e)681 2427 y Fy(\(receive-message)o(!/)o(par)o(ti)o(al) +37 b FB(socket)16 b(string)f([start])g([end])g([\003ags])p +Fy(\))43 b Fu(\000)-15 b(!)44 b FB([count-or-)p Fy(#f)p +FC(socket-addr)o(ess])83 b(pr)o(ocedur)o(e)681 2602 y +Fy(\(send-message)38 b FB(socket)16 b(string)f([start])g([end])g +([\003ags])g([socket-addr)o(ess])p Fy(\))42 b Fu(\000)-15 +b(!)44 b FB(unde\002ned)87 b FC(pr)o(ocedur)o(e)681 2701 +y Fy(\(send-message/pa)o(rt)o(ial)37 b FB(socket)15 b(string)h([start]) +f([end])g([\003ags])g([socket-addr)o(ess])p Fy(\))41 +b Fu(\000)-14 b(!)44 b FB(count)86 b FC(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 +(outines)g(such)g(as)g Fy(read-string)888 2938 y FC(and)i +Fy(write-string)20 b FC(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 +Fy(receive-message)15 b FC(and)21 b Fy(send-message)16 +b FC(calls)22 b(par)o(-)888 3138 y(allel)37 b(the)h Fy(read-string)33 +b FC(and)j Fy(write-string)d FC(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) +(r)o(outines)g(is)g(that)g Fy(receive-message)32 b FC(r)o(e-)888 +3495 y(turns)21 b(the)f(r)o(emote)g FB(socket-addr)o(ess)f +FC(and)h FB(send-message)g FC(takes)g(an)g(optional)i(r)o(emote)888 +3595 y Fy(socket-address)p FC(.)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 +FB(\003ags)f FC(\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 +Fy(message/out-of-b)o(and)1071 4370 y(message/peek)1071 +4469 y(message/dont-rou)o(te)888 4746 y FC(See)29 b Fy(read-string)d +FC(and)j Fy(write-string)c FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +(values.)2071 5147 y(94)p eop %%Page: 95 101 -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 +95 100 bop 365 614 a Fw(4.6)99 b(Socket)26 b(options)365 +845 y Fy(\(socket-option)38 b FB(socket)21 b(level)g(option)p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(value)699 b FC(pr)o(ocedur)o(e)365 +944 y Fy(\(set-socket-optio)o(n)37 b FB(socket)21 b(level)g(option)f +(value)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(unde\002ned)174 +b FC(pr)o(ocedur)o(e)573 1065 y Fy(socket-option)19 b +FC(and)24 b Fy(set-socket-option)18 b FC(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 +b(The)28 b FB(level)573 1264 y FC(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(A)573 1363 y(level)30 b(of)h Fy(level/socket)26 b FC(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 +1563 y(pr)o(ovided)19 b(by)i Fy(protocol-info)p FC(,)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 +b(option)h(type)f(ar)o(e:)756 2048 y Fy(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 +3231 y FC(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 +(type)e(ar)o(e:)756 3488 y Fy(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 +756 4185 y(tcp/max-segment)573 4371 y FC(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 +b(is)h(only)h(one)f(option)h(of)e(this)i(type:)33 b Fy(socket/linger)p +FC(.)f(It)24 b(is)573 4571 y(set)i(with)g(either)g Fy(#f)p +FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(type:)36 b Fy(socket/send-tim)o(eou)o(t)20 b FC(and)1756 +5147 y(95)p eop %%Page: 96 102 -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 +96 101 bop 888 614 a Fy(socket/receive-ti)o(me)o(out)o +FC(.)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 +1006 y Fw(4.7)99 b(Database-information)24 b(entries)681 +1242 y Fy(\(host-info)39 b FB(name-or-socket-addr)o(ess)p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(host-info)583 b FC(pr)o(ocedur)o(e) +681 1342 y Fy(\(network-info)38 b FB(name-or-socket-addr)o(ess)p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(network-info)319 b +FC(pr)o(ocedur)o(e)681 1441 y Fy(\(service-info)38 b +FB(name-or-number)18 b([pr)o(otocol-name])p Fy(\))56 +b Fu(\000)-15 b(!)59 b FB(service-info)88 b FC(pr)o(ocedur)o(e)681 +1541 y Fy(\(protocol-info)38 b FB(name-or-number)p Fy(\))87 +b Fu(\000)-15 b(!)88 b FB(pr)o(otocol-info)493 b FC(pr)o(ocedur)o(e)888 +1664 y Fy(host-info)22 b FC(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 +y(string)d FB(name)f FC(or)f FB(socket-addr)o(ess)o FC(.)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 +FB(host-)888 1864 y(info)g(r)o(ecord)p FC(,)f(de\002ned)h(to)g(have)f +(the)h(following)h(str)o(uctur)o(e:)1071 2027 y Fy(\(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 +2522 y(host-info)17 b FC(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 +2685 y Fy(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 +b FC(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 FB(name)g +FC(or)h FB(socket-addr)o(ess)o FC(.)k(The)21 b(value)f(r)o(eturned)g +(by)h(this)h(r)o(outine)888 3479 y(is)f(a)g FB(network-info)f(r)o +(ecord)p FC(,)g(de\002ned)h(to)g(have)f(the)h(following)h(str)o(uctur)o +(e:)1071 3642 y Fy(\(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 +b FC(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 FB(name)e +FC(or)h(integer)g FB(port)o FC(.)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 FB(service-info)g(r)o +(ecord)p FC(,)f(de\002ned)g(to)h(have)f(the)h(following)i(str)o(uctur)o +(e:)1071 4500 y Fy(\(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +b(Protocol)c(name)2071 5147 y FC(96)p eop %%Page: 97 103 -97 102 bop 573 614 a Fx(protocol-info)12 b FB(allows)19 +97 102 bop 573 614 a Fy(protocol-info)12 b FC(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 +(on)i(ei-)573 714 y(ther)i(its)g(string)h FB(name)f FC(or)g(integer)g +FB(number)q FC(.)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 FB(pr)o(otocol-info)f(r)o(ecord)p +FC(,)h(de\002ned)h(to)g(have)f(the)h(following)h(str)o(uctur)o(e:)756 +980 y Fy(\(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +b(;)43 b(Protocol)d(number\))1756 5147 y FC(97)p eop %%Page: 98 104 -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 +98 103 bop 681 1265 a Fx(Chapter)44 b(5)681 1707 y FD(Strings)51 +b(and)i(characters)681 2190 y FC(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 @@ -6980,167 +6745,162 @@ b(the)g(awk)681 2616 y(loop.)26 b(The)19 b(pr)o(ocedur)o(es)f (\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 +(a)f(convenient)i(way)-9 b(.)681 3199 y Fw(5.1)99 b(String)25 +b(manipulation)681 3417 y FC(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 +(for)f(manipulating)i(them.)681 3774 y FA(5.1.1)81 b(Regular)19 +b(expressions)681 3960 y FC(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 +(package.)681 4211 y Fy(\(string-match)38 b FB(r)o(egexp)20 +b(string)g([start])p Fy(\))86 b Fu(\000)-14 b(!)87 b +FB(match)19 b(or)i(false)389 b FC(pr)o(ocedur)o(e)888 +4354 y(Sear)o(ch)20 b FB(string)i FC(starting)g(at)f(position)i +FB(start)o FC(,)f(looking)h(for)f(a)f(match)g(for)h FB(r)o(egexp)n +FC(.)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(31,)g(1997)h(\226) -f(17)13 b(:)f(31)p eop +4553 y Fy(#f)p FC(.)25 b FB(Start)20 b FC(defaults)g(to)h(0.)681 +4849 y Fy(\(regexp-match?)38 b FB(obj)p Fy(\))87 b Fu(\000)-15 +b(!)88 b FB(boolean)1135 b FC(pr)o(ocedur)o(e)2071 5147 +y(98)p eop %%Page: 99 105 -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 +99 104 bop 573 614 a FC(Is)21 b(the)g(object)g(a)f(r)o(egular)g(expr)o +(ession)g(match?)365 894 y Fy(\(match:start)39 b FB(match)19 +b([match-number])p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(\002xnum)20 +b(or)h(false)299 b FC(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 +FB(match-number)o FC(.)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 Fy(\(...\))f FC(sections.)26 +b FB(Match-number)20 b FC(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 Fy(match:start)c +FC(r)o(eturns)j Fy(#f)p FC(.)365 1736 y Fy(\(match:end)40 +b FB(match)19 b([match-number])p Fy(\))85 b Fu(\000)-14 +b(!)87 b FB(\002xnum)643 b FC(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 +FB(match-number)o FC(.)573 1969 y FB(Match-number)20 +b FC(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 +Fy(match:end)c FC(r)o(eturns)k Fy(#f)p FC(.)365 2477 +y Fy(\(match:substring)37 b FB(match)19 b([match-number])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(string)21 b(or)g(false)164 +b FC(pr)o(ocedur)o(e)573 2611 y(Returns)33 b(the)f(substring)h(matched) +f(by)g(match)g FB(match-number)o FC(.)60 b FB(Match-number)573 +2711 y FC(defaults)20 b(to)h(0)f(\(the)h(whole)g(match\).)k(If)c(ther)o +(e)f(was)h(no)g(match,)g(r)o(eturns)f(false.)490 2973 +y(Regular)g(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 +3414 y Fy(\(make-regexp)39 b FB(str)p Fy(\))87 b Fu(\000)-14 +b(!)87 b FB(r)o(e)1416 b FC(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) +(the)f(given)i(string.)365 3827 y Fy(\(regexp?)41 b FB(obj)p +Fy(\))87 b Fu(\000)-15 b(!)88 b FB(boolean)1397 b FC(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 +4241 y Fy(\(regexp-exec)39 b FB(r)o(egexp)20 b(str)h([start])p +Fy(\))85 b Fu(\000)-14 b(!)87 b FB(match)19 b(or)i(false)544 +b FC(pr)o(ocedur)o(e)573 4375 y(Apply)26 b(the)g(r)o(egular)e(expr)o +(ession)i FB(r)o(egexp)f FC(to)h(the)g(string)h FB(str)f +FC(starting)h(at)e(position)573 4474 y FB(start)p FC(.)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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(otherwise)j Fy(#f)p FC(.)k FB(Start)573 4574 y FC(defaults)20 +b(to)h(0.)365 4854 y Fy(\(regexp-quote)39 b FB(str)p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(string)1233 b FC(pr)o(ocedur)o(e) +1756 5147 y(99)p eop %%Page: 100 106 -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 +100 105 bop 888 614 a FC(Returns)24 b(a)f(r)o(egular)e(expr)o(ession)i +(that)g(matches)g(the)g(string)h FB(str)f FC(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 +FB(str)p FC(.)1071 993 y Fy(\(regexp-quote)38 b("*Hello*)i(world."\)) +1245 1093 y Fn(=)-14 b Fu(\))44 b Fy("\\\\*Hello\\\\*)38 +b(world\\\\.")681 1489 y FA(5.1.2)81 b(Other)20 b(string)g +(manipulation)d(facilities)681 1707 y Fy(\(index)41 b +FB(string)21 b(char)f([start])p Fy(\))86 b Fu(\000)-15 +b(!)88 b FB(\002xnum)20 b(or)g(false)732 b FC(pr)o(ocedur)o(e)681 +1806 y Fy(\(rindex)40 b FB(string)21 b(char)f([start])p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(\002xnum)20 b(or)h(false)688 +b FC(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 FB(string)g FC(looking)i(for)d(an)h(occurr)o(ence)f +(of)g(char)o(-)888 2034 y(acter)k FB(char)p FC(.)25 b +Fy(index)19 b FC(sear)o(ches)g(left-to-right;)i Fy(rindex)d +FC(sear)o(ches)i(right-to-left.)888 2173 y Fy(index)j +FC(r)o(eturns)g(the)i(smallest)f(index)g Fz(i)g FC(of)h +FB(string)f FC(gr)o(eater)e(than)j(or)f(equal)h(to)f +FB(start)888 2273 y FC(such)g(that)e FB(string)p Fn([)p +Fz(i)p Fn(])27 b(=)g FB(char)o FC(.)32 b(The)23 b(default)e(for)i +FB(start)g FC(is)g(zer)o(o.)30 b(If)23 b(ther)o(e)f(is)h(no)h(such)888 +2373 y(match,)d Fy(index)e FC(r)o(eturns)h(false.)888 +2512 y Fy(rindex)39 b FC(r)o(eturns)h(the)h(lar)o(gest)f(index)g +Fz(i)h FC(of)f FB(string)h FC(less)g(than)g FB(start)g +FC(such)g(that)888 2612 y FB(string)p Fn([)p Fz(i)p Fn(])28 +b(=)g FB(char)o FC(.)34 b(The)23 b(default)g(for)g FB(start)g +FC(is)h Fy(\(string-length)38 b FB(string)p Fy(\))p FC(.)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) +Fy(rindex)d FC(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 +y(MIT)g(string)i(match)f(commands:)888 3235 y Fy([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 +3733 y(...)p Fs(etc.)681 3832 y FC(These)f(ar)o(e)g(not)h(curr)o(ently) +g(pr)o(ovided.)681 3988 y Fy(\(substitute-env-)o(va)o(rs)37 +b FB(fname)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(string)816 +b FC(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(31,)g(1997)h(\226)f(17) -13 b(:)f(31)p eop +(braces.)1071 4512 y Fy(\(substitute-env-)o(var)o(s)37 +b("$USER/.login"\))1237 4611 y Fn(=)-14 b Fu(\))104 b +Fy("shivers/.login)o(")1071 4711 y(\(substitute-env-)o(var)o(s)37 +b("$)p Fu(f)p Fy(USER)p Fu(g)p Fy(_log"\))77 b Fn(=)-14 +b Fu(\))104 b Fy("shivers_log")2051 5147 y FC(100)p eop %%Page: 101 107 -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 +101 106 bop 365 614 a FA(5.1.3)81 b(Manipulating)18 b(\002le-names)365 +797 y FC(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 +1096 y(the)23 b(pathname)f(abstractions)g(of)j(C)t Ft(O)t(M)t(M)t(O)t +(N)i FC(L)t Ft(I)t(S)t(P)e FC(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 +(little)h(less)g(general.)365 1446 y FA(T)-9 b(erminology)365 +1629 y FC(These)30 b(pr)o(ocedur)o(es)e(car)o(efully)h(adher)o(e)f(to)i +(the)i(P)t Ft(O)t(S)t(I)t(X)i FC(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 +(terminology)-9 b(.)490 1953 y(A)17 b FB(\002le-name)g +FC(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(component)p 688 2375 2220 4 v 738 2445 a Fy(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 +b(\(\))709 b("main.c")490 2831 y FC(Note)24 b(that)g(the)g(r)o(elative) +f(\002lename)h Fy(src/des/main.c)18 b FC(and)23 b(the)i(absolute)e +(\002lename)365 2931 y Fy(/src/des/main.c)17 b FC(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 +(component)i Fy("")365 3030 y FC(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 @@ -7148,47 +6908,44 @@ b(Mor)o(e)26 b(than)g(two)h(leading)f(slashes)h(at)f(the)h(beginning)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.) +b(P)t Ft(O)t(S)t(I)t(X)i FC(permits)d(the)g(OS)365 3553 +y(to)j(give)f(special)g(meaning)h(to)g FB(two)f FC(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.) +FB(dir)o(ectory)e(form)h FC(is)h(either)f(a)g(\002le-name)g(terminated) +g(by)g(a)g(slash,)g FB(e.g.)p FC(,)365 3877 y(\223)p +Fy(/src/des/)p FC(\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 +(\002le-name)f(is)h(dot)f(\(\223)p Fy(.)p FC(\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 +(r)o(ule,)i(we)g(extend)f(the)h(syntax)g(of)i(P)t Ft(O)t(S)t(I)t(X)h +FC(\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 +o(ectory)f(\223)p Fy(/)p FC(\224.)25 b(\(However)-6 b(,)20 +b(\223)p Fy(/)p FC(\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 +(ambiguous)h(form:)31 b Fy(/)23 b FC(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)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 +b(So,)50 b(you)45 b(say)1735 5147 y(101)p eop %%Page: 102 108 -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 +102 107 bop 681 614 a FC(\223)p Fy(/usr/include)p FC(\224,)22 +b(and)k(\223)p Fy(.)p FC(\224,)h(not)h(\223)p Fy(/usr/include/)p +FC(\224)20 b(and)27 b(\223\224.)43 b(The)27 b(sole)g(exceptions)681 +714 y(ar)o(e)g Fy(file-name-as-dire)o(cto)o(ry)22 b FC(and)29 +b Fy(directory-as-fil)o(e-)o(nam)o(e)p FC(,)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 +(these)h(forms,)i(and)d Fy(file-name-directo)o(ry)o FC(,)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 @@ -7197,12 +6954,12 @@ b(most)681 1013 y(pr)o(ocedur)o(es)k(that)i(expect)g(a)g(dir)o(ectory)f (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 +FB(i.e.)p FC(,)20 b(as)h(r)o(oot.)681 1624 y FA(Procedures)681 +1855 y Fy(\(file-name-direc)o(to)o(ry?)37 b FB(fname)p +Fy(\))86 b Fu(\000)-14 b(!)87 b FB(boolean)726 b FC(pr)o(ocedur)o(e)681 +1955 y Fy(\(file-name-non-d)o(ir)o(ect)o(or)o(y?)37 b +FB(fname)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(boolean)551 +b FC(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 @@ -7210,269 +6967,258 @@ b FB(pr)o(ocedur)o(e)888 2087 y(These)18 b(pr)o(edicates)f(r)o(eturn)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 +2536 y(File)g(name)177 b Fy(...-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 +(re)o(cto)o(ry)37 b FB(fname)p Fy(\))87 b Fu(\000)-15 +b(!)88 b FB(string)685 b FC(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 +3532 y(needed:)1071 3688 y Fy(\(file-name-as-di)o(rec)o(to)o(ry)37 +b("src/des"\))123 b Fn(=)-14 b Fu(\))103 b Fy("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 +b Fn(=)-14 b Fu(\))103 b Fy("src/des/")1071 3965 y(.)p +FC(,)20 b Fy(/)p FC(,)g(and)g Fy("")g FC(ar)o(e)g(special:)1071 +4065 y Fy(\(file-name-as-di)o(rec)o(to)o(ry)37 b("."\))387 +b Fn(=)-14 b Fu(\))103 b Fy("")1071 4165 y(\(file-name-as-di)o(rec)o +(to)o(ry)37 b("/"\))387 b Fn(=)-14 b Fu(\))103 b Fy("/")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 Fn(=)-14 b Fu(\))103 b Fy("/")681 4642 y(\(directory-as-fi)o(le)o +(-na)o(me)37 b FB(fname)p Fy(\))87 b Fu(\000)-15 b(!)88 +b FB(string)685 b FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +(esent:)2051 5147 y(102)p eop %%Page: 103 109 -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-) +103 108 bop 756 601 a Fy(\(directory-as-f)o(il)o(e-n)o(am)o(e)38 +b("foo/bar/"\))78 b Fn(=)-14 b Fu(\))104 b Fy("foo/bar")756 +779 y(/)20 b FC(and)g Fy("")g FC(ar)o(e)f(special:)756 +878 y Fy(\(directory-as-f)o(il)o(e-n)o(am)o(e)38 b("/"\))386 +b Fn(=)-14 b Fu(\))104 b Fy("/")756 978 y(\(directory-as-f)o(il)o(e-n)o +(am)o(e)38 b(""\))430 b Fn(=)-14 b Fu(\))104 b Fy(".")19 +b FC(\()p FB(i.e.)p FC(,)h(the)h(cwd\))365 1269 y Fy +(\(file-name-absolu)o(te)o(?)38 b FB(fname)p Fy(\))86 +b Fu(\000)-14 b(!)87 b FB(boolean)770 b FC(pr)o(ocedur)o(e)573 +1412 y(Does)20 b FB(fname)f FC(begin)h(with)g(a)f(r)o(oot)h(or)f +Fy(~)h FC(component?)26 b(\(Recognising)21 b Fy(~)e FC(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 +(P)t Ft(O)t(S)t(I)t(X)h FC(r)o(ules.\))756 1654 y Fy(\(file-name-abso)o +(lu)o(te?)37 b("/usr/shivers"\))77 b Fn(=)-14 b Fu(\))103 +b Fy(#t)756 1754 y(\(file-name-abso)o(lu)o(te?)37 b("src/des"\))297 +b Fn(=)-14 b Fu(\))103 b Fy(#f)756 1854 y(\(file-name-abso)o(lu)o(te?) +37 b("~/src/des"\))209 b Fn(=)-14 b Fu(\))103 b Fy(#t)756 +2031 y FC(Non-obvious)21 b(case:)756 2131 y Fy(\(file-name-abso)o(lu)o +(te?)37 b(""\))605 b Fn(=)-14 b Fu(\))103 b Fy(#t)20 +b FC(\()p FB(i.e.)p FC(,)g(r)o(oot\))365 2422 y Fy(\(file-name-direct)o +(or)o(y)38 b FB(fname)p Fy(\))86 b Fu(\000)-14 b(!)87 +b FB(string)21 b(or)g(false)559 b FC(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 +FB(fname)h FC(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 +(eturn)g(it)h(as-is.)756 2807 y Fy(\(file-name-dire)o(ct)o(ory)37 +b("/usr/bdc"\))165 b Fn(=)-14 b Fu(\))104 b Fy("/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 +b Fn(=)-14 b Fu(\))104 b Fy("/usr/bdc/")756 3007 y(\(file-name-dire)o +(ct)o(ory)37 b("bdc/.login"\))77 b Fn(=)-14 b Fu(\))104 +b Fy("bdc/")756 3106 y(\(file-name-dire)o(ct)o(ory)37 +b("main.c"\))253 b Fn(=)-14 b Fu(\))104 b Fy("")756 3284 +y FC(Root)21 b(has)g(no)h(dir)o(ectory)e(component:)756 +3383 y Fy(\(file-name-dire)o(ct)o(ory)37 b("/"\))473 +b Fn(=)-14 b Fu(\))104 b Fy("")756 3483 y(\(file-name-dire)o(ct)o(ory) +37 b(""\))517 b Fn(=)-14 b Fu(\))104 b Fy("")365 3774 +y(\(file-name-nondir)o(ec)o(tor)o(y)37 b FB(fname)p Fy(\))87 +b Fu(\000)-14 b(!)87 b FB(string)686 b FC(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 +4060 y Fy(\(file-name-nond)o(ir)o(ect)o(or)o(y)38 b("/usr/ian"\))165 +b Fn(=)-14 b Fu(\))104 b Fy("ian")756 4159 y(\(file-name-nond)o(ir)o +(ect)o(or)o(y)38 b("/usr/ian/"\))121 b Fn(=)-14 b Fu(\))104 +b Fy("")756 4259 y(\(file-name-nond)o(ir)o(ect)o(or)o(y)38 +b("ian/.login"\))77 b Fn(=)-14 b Fu(\))104 b Fy(".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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +b Fn(=)-14 b Fu(\))104 b Fy("main.c")756 4458 y(\(file-name-nond)o(ir)o +(ect)o(or)o(y)38 b(""\))517 b Fn(=)-14 b Fu(\))104 b +Fy("")756 4558 y(\(file-name-nond)o(ir)o(ect)o(or)o(y)38 +b("/"\))473 b Fn(=)-14 b Fu(\))104 b Fy("/")365 4849 +y(\(split-file-name)37 b FB(fname)p Fy(\))87 b Fu(\000)-14 +b(!)87 b FB(string)21 b(list)864 b FC(pr)o(ocedur)o(e)1735 +5147 y(103)p eop %%Page: 104 110 -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 +104 109 bop 888 614 a FC(Split)21 b(a)f(\002le-name)h(into)g(its)g +(components.)1071 757 y Fy(\(split-file-name)37 b("src/des/main.c")o +(\))1237 857 y Fn(=)-14 b Fu(\))267 b Fy(\("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"\)) +1114 y Fn(=)-14 b Fu(\))136 b Fy(\("")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") +y Fn(=)-14 b Fu(\))790 b Fy(\("main.c"\))1071 1530 y(\(split-file-name) +37 b("/"\))1237 1630 y Fn(=)-14 b Fu(\))104 b Fy(\(""\))681 +1920 y(\(path-list->file)o(-n)o(ame)37 b FB(path-list)19 +b([dir])p Fy(\))86 b Fu(\000)-15 b(!)88 b FB(string)521 +b FC(pr)o(ocedur)o(e)888 2062 y(Inverse)21 b(of)g Fy(split-file-name)o +FC(.)1071 2230 y Fy(\(path-list->file)o(-na)o(me)37 b('\("src")k("des") +g("main.c"\)\))1245 2329 y Fn(=)-14 b Fu(\))87 b Fy("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 +b("src")f("des")h("main.c"\)\))1245 2528 y Fn(=)-14 b +Fu(\))87 b Fy("/src/des/main.c")1071 2728 y FC(Optional)21 +b FB(dir)g FC(ar)o(g)f(anchors)h(r)o(elative)e(path-lists:)1071 +2827 y Fy(\(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 +Fn(=)-14 b Fu(\))87 b Fy("/usr/shivers/src)o(/d)o(es/)o(ma)o(in)o(.c") +888 3194 y FC(The)21 b(optional)h FB(dir)e FC(ar)o(gument)g(is)i +(usefully)f Fy(\(cwd\))p FC(.)681 3488 y Fy(\(file-name-exten)o(si)o +(on)37 b FB(fname)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(string)816 +b FC(pr)o(ocedur)o(e)888 3630 y(Return)22 b(the)e(\002le-name's)h +(extension.)1071 3751 y Fy(\(file-name-exten)o(sio)o(n)37 +b("main.c"\))341 b Fn(=)-14 b Fu(\))104 b Fy(".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(31,)g(1997)h(\226) -f(17)13 b(:)f(31)p eop +b Fn(=)-14 b Fu(\))104 b Fy(".old")1071 3950 y(\(file-name-exten)o(sio) +o(n)37 b("/usr/shivers"\))77 b Fn(=)-14 b Fu(\))104 b +Fy("")1071 4099 y FC(W)-8 b(eir)o(d)20 b(cases:)1071 +4199 y Fy(\(file-name-exten)o(sio)o(n)37 b("foo."\))124 +b Fn(=)-14 b Fu(\))104 b Fy(".")1071 4298 y(\(file-name-exten)o(sio)o +(n)37 b("foo.."\))80 b Fn(=)-14 b Fu(\))104 b Fy(".")1071 +4447 y FC(Dot)21 b(\002les)h(ar)o(e)d(not)i(extensions:)1071 +4547 y Fy(\(file-name-exten)o(sio)o(n)37 b("/usr/shivers/.lo)o(gi)o +(n"\))76 b Fn(=)-14 b Fu(\))104 b Fy("")681 4850 y(\(file-name-sans-)o +(ex)o(ten)o(si)o(on)37 b FB(fname)p Fy(\))87 b Fu(\000)-14 +b(!)87 b FB(string)598 b FC(pr)o(ocedur)o(e)2051 5147 +y(104)p eop %%Page: 105 111 -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 +105 110 bop 573 614 a FC(Return)21 b(everything)g(but)g(the)g +(extension.)756 757 y Fy(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 +b("main.c"\))253 b Fn(=)-14 b Fu(\))104 b Fy("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 +b Fn(=)-14 b Fu(\))104 b Fy("main.c"")756 956 y(\(file-name-sans)o(-e)o +(xte)o(ns)o(ion)37 b("/usr/shivers"\))922 1056 y Fn(=)-14 +b Fu(\))103 b Fy("/usr/shivers")756 1205 y FC(W)-8 b(eir)o(d)20 +b(cases:)756 1304 y Fy(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 +b("foo."\))123 b Fn(=)-14 b Fu(\))104 b Fy("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 +b Fn(=)-14 b Fu(\))104 b Fy("foo.")756 1581 y FC(Dot)21 +b(\002les)g(ar)o(e)e(not)j(extensions:)756 1681 y Fy(\(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 +1781 y Fn(=)-14 b Fu(\))103 b Fy("/usr/shivers/.l)o(ogi)o(n)573 +1994 y FC(Note)39 b(that)h(appending)f(the)h(r)o(esults)f(of)g +Fy(file-name-extens)o(ion)33 b FC(and)39 b Fy(file-)573 +2093 y(name-sans-extens)o(io)o(n)15 b FC(in)21 b(all)g(cases)f(pr)o +(oduces)g(the)h(original)g(\002le-name.)365 2386 y Fy +(\(parse-file-name)37 b FB(fname)p Fy(\))87 b Fu(\000)-14 +b(!)87 b FB([dir)20 b(name)h(extension])502 b FC(pr)o(ocedur)o(e)573 +2529 y(Let)31 b Fz(f)39 b FC(be)31 b Fy(\(file-name-nondir)o(ec)o(tor)o +(y)37 b FB(fname)p Fy(\))p FC(.)57 b(This)32 b(function)g(r)o(eturns)e +(the)573 2628 y(thr)o(ee)20 b(values:)672 2796 y Fu(\017)42 +b Fy(\(file-name-dire)o(ct)o(ory)37 b FB(fname)p Fy(\))672 +2930 y Fu(\017)42 b Fy(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 +b FB(f)p Fy(\)\))672 3063 y Fu(\017)42 b Fy(\(file-name-exte)o(ns)o +(ion)37 b FB(f)p Fy(\))573 3231 y FC(The)d(inverse)g(of)g +Fy(parse-file-name)p FC(,)d(in)k(all)f(cases,)j(is)d +Fy(string-append)p FC(.)61 b(The)573 3331 y(boundary)20 +b(case)h(of)f Fy(/)h FC(was)f(chosen)i(to)f(pr)o(eserve)e(this)j +(inverse.)365 3624 y Fy(\(replace-extensio)o(n)37 b FB(fname)21 +b(ext)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(string)782 +b FC(pr)o(ocedur)o(e)573 3766 y(This)26 b(pr)o(ocedur)o(e)e(r)o +(eplaces)g FB(fname)p FC('s)i(extension)h(with)f FB(ext)p +FC(.)40 b(It)26 b(is)g(exactly)f(equiva-)573 3866 y(lent)c(to)756 +4006 y Fy(\(string-append)37 b(\(file-name-sans-e)o(xt)o(ens)o(io)o(n)h +FB(fname)p Fy(\))43 b FB(ext)o Fy(\))365 4358 y(\(simplify-file-na)o +(me)37 b FB(fname)p Fy(\))87 b Fu(\000)-15 b(!)88 b FB(string)860 +b FC(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 +(dance)e(with)575 4799 y(P)t Ft(O)t(S)t(I)t(X)r FC(.)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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(dance)d(with)28 b(P)t Ft(O)t(S)t(I)t(X)r FC(.)41 b(Double-dots)25 +b(\(par)o(ent)f(dir)o(ectory\))g(ar)o(e)g(left)1735 5147 +y(105)p eop %%Page: 106 112 -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 +106 111 bop 888 614 a FC(alone,)27 b(in)e(case)g(they)g(come)h(after)e +(symlinks)j(or)e(appear)f(in)h(a)g Fy(/../)p FB(machine)n +Fy(/...)888 714 y FC(\223super)o(-r)o(oot\224)19 b(form)i(\(which)i(P)t +Ft(O)t(S)t(I)t(X)h FC(permits\).)681 950 y Fy(\(resolve-file-na)o(me)37 +b FB(fname)21 b([dir])p Fy(\))86 b Fu(\000)-15 b(!)88 +b FB(string)730 b FC(pr)o(ocedur)o(e)988 1106 y Fu(\017)41 +b FC(Do)21 b Fy(~)g FC(expansion.)988 1254 y Fu(\017)41 +b FC(If)23 b FB(dir)h FC(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 +1354 y(r)o(elative)19 b(to)j(dir)o(ectory)d FB(dir)p +FC(.)681 1590 y Fy(\(expand-file-nam)o(e)37 b FB(fname)21 +b([dir])p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(string)774 +b FC(pr)o(ocedur)o(e)888 1746 y(Resolve)22 b(and)e(simplify)h(the)g +(\002le-name.)681 2082 y Fy(\(home-dir)40 b FB([user])p +Fy(\))87 b Fu(\000)-15 b(!)88 b FB(string)1300 b FC(pr)o(ocedur)o(e)888 +2238 y Fy(home-dir)17 b FC(r)o(eturns)j FB(user)q FC('s)g(home)h(dir)o +(ectory)-9 b(.)24 b FB(User)d FC(defaults)e(to)h(the)g(curr)o(ent)g +(user)-6 b(.)1071 2438 y Fy(\(home-dir\))471 b Fn(=)-14 +b Fu(\))104 b Fy("/user1/lecture)o(r/s)o(hi)o(ver)o(s")1071 +2537 y(\(home-dir)40 b("ctkwan"\))79 b Fn(=)-14 b Fu(\))104 +b Fy("/user0/researc)o(h/c)o(tk)o(wan)o(")681 2946 y(\(home-file)39 +b FB([user])21 b(fname)p Fy(\))87 b Fu(\000)-14 b(!)87 +b FB(string)1033 b FC(pr)o(ocedur)o(e)888 3103 y(Returns)21 +b(\002le-name)e FB(fname)h FC(r)o(elative)f(to)h FB(user)q +FC('s)g(home)h(dir)o(ectory;)e FB(user)i FC(defaults)e(to)888 +3202 y(the)i(curr)o(ent)f(user)-6 b(.)1071 3356 y Fy(\(home-file)39 +b("man"\))473 b Fn(=)-14 b Fu(\))104 b Fy("/usr/shivers/ma)o(n")1071 +3456 y(\(home-file)39 b("fcmlau")i("man"\))80 b Fn(=)-14 +b Fu(\))104 b Fy("/usr/fcmlau/man)o(")805 3824 y FC(The)26 +b(general)e Fy(substitute-env-va)o(rs)19 b FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p eop +(expanding)h(\002le-names.)681 4258 y Fw(5.2)99 b(ASCII)24 +b(encoding)681 4519 y Fy(\(char->ascii)38 b FB(character)p +Fy(\))87 b Fu(\000)-15 b(!)87 b FB(integer)1029 b FC(pr)o(ocedur)o(e) +681 4619 y Fy(\(ascii->char)38 b FB(integer)p Fy(\))87 +b Fu(\000)-14 b(!)87 b FB(character)1028 b FC(pr)o(ocedur)o(e)888 +4751 y(These)36 b(ar)o(e)f(identical)g(to)i Fy(char->integer)30 +b FC(and)35 b Fy(integer->char)c FC(except)k(that)888 +4851 y(they)21 b(use)g(the)i(A)t Ft(S)t(C)t(I)t(I)h FC(encoding.)2051 +5147 y(106)p eop %%Page: 107 113 -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 +107 112 bop 365 614 a Fw(5.3)99 b(Character)25 b(sets)365 +828 y FC(Scsh)c(pr)o(ovides)g(a)f Fy(char-set)e FC(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 +(Mac's)g(MIT)g(Scheme.)365 1175 y Fy(\(char-set?)40 b +FB(x)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(boolean)1367 +b FC(pr)o(ocedur)o(e)573 1315 y(Returns)21 b(tr)o(ue)g(if)g(the)g +(object)g FB(x)f FC(is)h(a)f(character)g(set.)365 1580 +y FA(5.3.1)81 b(Creating)20 b(character)f(sets)365 1786 +y Fy(\(char-set)40 b FB(char)946 1798 y Fv(1)983 1786 +y FB(.)12 b(.)g(.)g Fy(\))87 b Fu(\000)-14 b(!)87 b FB(char-set)1156 +b FC(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 Fy +(\(chars->char-set)37 b FB(chars)p Fy(\))87 b Fu(\000)-14 +b(!)87 b FB(char-set)955 b FC(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 +h(the)g(list)g FB(chars)p FC(.)365 2426 y Fy(\(string->char-set)37 +b FB(s)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(char-set)1056 +b FC(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 +FB(s)q FC(.)365 2753 y Fy(\(predicate->char-)o(se)o(t)38 +b FB(pr)o(ed)p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(char-set)812 +b FC(pr)o(ocedur)o(e)573 2892 y(Returns)30 b(a)f(character)f(set)i +(containing)g(every)f(character)f FB(c)h FC(such)h(that)g +Fy(\()p FB(pr)o(ed)42 b(c)p Fy(\))573 2992 y FC(r)o(eturns)20 +b(tr)o(ue.)365 3180 y Fy(\(ascii-range->cha)o(r-)o(set)37 +b FB(lower)21 b(upper)p Fy(\))87 b Fu(\000)-15 b(!)87 +b FB(char-set)472 b FC(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 +b(A)t Ft(S)t(C)t(I)t(I)g FC(code)c(lies)573 3419 y(in)h(the)g +(half-open)f(range)h Fn([)p FB(lower)p Fz(;)14 b FB(upper)p +Fn(\))p FC(.)365 3685 y FA(5.3.2)81 b(Querying)20 b(character)f(sets) +365 3891 y Fy(\(char-set-members)37 b FB(char-set)p Fy(\))86 +b Fu(\000)-14 b(!)87 b FB(character-list)647 b FC(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 +(members)h(of)g FB(char-set)o FC(.)365 4155 y Fy(\(char-set-contain)o +(s?)37 b FB(char-set)20 b(char)p Fy(\))86 b Fu(\000)-14 +b(!)87 b FB(boolean)587 b FC(pr)o(ocedur)o(e)573 4286 +y(This)21 b(pr)o(ocedur)o(e)e(tests)i FB(char)f FC(for)h(membership)g +(in)g(set)g FB(char-set)o FC(.)756 4442 y Fl(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 @@ -7482,68 +7228,64 @@ b(This)21 b(made)756 4624 y(sense,)34 b(but)e(was)h(unfortunately)f 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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(was)i(counter)o(-intuitive)f(and)h(at)h(odds)d(with)1735 +5147 y FC(107)p eop %%Page: 108 114 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 +y FA(5.3.3)81 b(Character)19 b(set)h(algebra)681 1339 +y Fy(\(char-set-invert)37 b FB(char-set)p Fy(\))86 b +Fu(\000)-14 b(!)87 b FB(char-set)867 b FC(pr)o(ocedur)o(e)681 +1439 y Fy(\(char-set-union)37 b FB(char-set)1642 1451 +y Fv(1)1700 1439 y FB(char-set)1965 1451 y Fv(2)2002 +1439 y Fy(\))87 b Fu(\000)-14 b(!)87 b FB(char-set)551 +b FC(pr)o(ocedur)o(e)681 1538 y Fy(\(char-set-inters)o(ec)o(tio)o(n)37 +b FB(char-set)1948 1550 y Fv(1)2006 1538 y FB(char-set)2270 +1550 y Fv(2)2307 1538 y Fy(\))87 b Fu(\000)-14 b(!)87 +b FB(char-set)246 b FC(pr)o(ocedur)o(e)681 1638 y Fy(\(char-set-differ) +o(en)o(ce)37 b FB(char-set)1860 1650 y Fv(1)1918 1638 +y FB(char-set)2183 1650 y Fv(2)2220 1638 y Fy(\))87 b +Fu(\000)-14 b(!)87 b FB(char-set)333 b FC(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 +b(for)h(character)f(sets.)681 2130 y FA(5.3.4)81 b(Standard)18 +b(character)h(sets)681 2313 y FC(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 +4 v 749 2555 4 100 v 802 2525 a Fy(char-set:upper-c)o(as)o(e)268 +b FC(A\226Z)p 3474 2555 V 749 2655 V 802 2625 a Fy(char-set:lower-c)o +(as)o(e)g FC(a\226z)p 3474 2655 V 749 2754 V 802 2725 +a Fy(char-set:numeric)398 b FC(0\2269)p 3474 2754 V 749 +2854 V 802 2824 a Fy(char-set:whitesp)o(ac)o(e)268 b +FC(space,)20 b(newline,)h(tab,)f(linefeed,)g(page,)g(r)o(eturn)p +3474 2854 V 749 2954 V 802 2924 a Fy(char-set:not-whi)o(te)o(spa)o(ce) +93 b FC(Complement)22 b(of)e Fy(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(31,)g -(1997)h(\226)f(17)13 b(:)f(31)p eop +b FC(A\226Z)20 b(and)h(a\226z)p 3474 3053 V 749 3153 +V 802 3123 a Fy(char-set:alphanu)o(me)o(ric)180 b FC(Alphabetic)20 +b(or)h(numeric)p 3474 3153 V 749 3253 V 802 3223 a Fy(char-set:graphic) +398 b FC(Printing)22 b(characters)d(and)i(space)p 3474 +3253 V 749 3256 2729 4 v 681 3458 a Fy(\(char-upper-case)o(?)37 +b FB(character)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(boolean)796 +b FC(pr)o(ocedur)o(e)681 3558 y Fy(\(char-lower-case)o(?)37 +b FB(character)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(boolean)796 +b FC(pr)o(ocedur)o(e)681 3657 y Fy(\(char-numeric?)81 +b FB(character)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(boolean)883 +b FC(pr)o(ocedur)o(e)681 3757 y Fy(\(char-whitespace)o(?)37 +b FB(character)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(boolean)796 +b FC(pr)o(ocedur)o(e)681 3856 y Fy(\(char-alphabetic)o(?)37 +b FB(character)p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(boolean)796 +b FC(pr)o(ocedur)o(e)681 3956 y Fy(\(char-alphanumer)o(ic)o(?)38 +b FB(character)p Fy(\))86 b Fu(\000)-15 b(!)88 b FB(boolean)708 +b FC(pr)o(ocedur)o(e)681 4056 y Fy(\(char-graphic?)38 +b FB(character)p Fy(\))86 b Fu(\000)-15 b(!)88 b FB(boolean)926 +b FC(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.)2051 +5147 y(108)p eop %%Page: 109 115 -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 +109 114 bop 365 1272 a Fx(Chapter)45 b(6)365 1723 y FD(Reading)53 +b(delimited)e(strings)365 2214 y FC(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) @@ -7559,120 +7301,115 @@ 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 +(operations)f(described)e(below)i(take)f(a)h Fy(handle-delim)365 +3281 y FC(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 +(possible)i(choices)f(for)g(a)f Fy(handle-delim)c FC(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 +3619 a Fy(handle-delim)p 1199 3649 V 98 w FC(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 +v 626 3739 a Fy('trim)p 1199 3769 V 406 w FC(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 +V 626 3838 a Fy('peek)p 1199 3868 V 406 w FC(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 +3868 V 573 3968 V 626 3938 a Fy('concat)p 1199 3968 V +318 w FC(Append)f(delimiter)h(character)e(to)i(r)o(eturned)f(value.)p +2997 3968 V 573 4068 V 626 4038 a Fy('split)p 1199 4068 +V 362 w FC(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 +Fy('trim)p FC(,)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 +4651 y Fy(\(read-line)40 b FB([port)19 b(handle-newline])p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(string)21 b(or)g(eof-object)306 +b FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +b(A)20 b(line)h(is)573 4898 y(terminated)f(by)h(newline)g(or)g(eof.) +1735 5147 y(109)p eop %%Page: 110 116 -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 +110 115 bop 888 614 a FB(handle-newline)19 b FC(determines)f(what)h +Fy(read-line)c FC(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(general)e Fy(handle-delim)d FC(case)j(above,)h(and)f(defaults)h(to)g +Fy('trim)f FC(\(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 +(is)g(newline)g(terminated.)681 1305 y Fy(\(read-paragraph)37 +b FB([port)20 b(handle-delim])p Fy(\))85 b Fu(\000)-14 +b(!)87 b FB(string)21 b(or)f(eof)387 b FC(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 +1645 y(only)e(of)e(white)h(space.)27 b(The)22 b FB(handle-delim)e +FC(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 +y Fy('trim)p FC(.)24 b(The)c Fy('peek)f FC(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) +2211 y(manipulation.)681 2361 y Fy(\(read-delimited)37 +b FB(char-set)20 b([port)g(handle-delim])p Fy(\))85 b +Fu(\000)-14 b(!)87 b FB(string)21 b(or)g(eof)101 b FC(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 +(in)h FB(char-set)f FC(or)h(eof.)102 b(The)888 2602 y +FB(handle-delim)19 b FC(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 +Fy('trim)p FC(.)888 2835 y(The)g FB(char-set)f FC(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 +(ced)f(to)h(a)f(charset.)681 3127 y Fy(\(read-delimited!)37 +b FB(char-set)15 b(buf)h([port)f(handle-delim)f(start)i(end])p +Fy(\))43 b Fu(\000)-15 b(!)44 b FB(nchars)16 b(or)g(eof)g(or)g(#f)86 +b FC(pr)o(ocedur)o(e)888 3268 y(A)21 b(side-ef)o(fecting)e(variant)h +(of)h Fy(read-delimited)p FC(.)888 3402 y(The)26 b(data)f(is)i(written) +f(into)h(the)f(string)h FB(buf)g FC(at)e(the)h(indices)h(in)f(the)g +(half-open)g(in-)888 3501 y(terval)h Fn([)p FB(start)o +Fz(;)14 b FB(end)p Fn(\))p FC(;)31 b(the)c(default)f(interval)h(is)g +(the)g(whole)h(string:)39 b FB(start)c Fn(=)f(0)26 b +FC(and)888 3601 y FB(end)k Fn(=)g Fy(\(string-length)38 +b FB(buf)p Fy(\))p FC(.)f(The)24 b(values)g(of)h FB(start)f +FC(and)g FB(end)g FC(must)h(specify)g(a)888 3700 y(well-de\002ned)c +(interval)f(in)h FB(str)p FC(,)g FB(i.e.)p FC(,)f Fn(0)j +Fu(\024)g FB(start)f Fu(\024)h FB(end)g Fu(\024)g Fy(\(string-length)37 +b FB(buf)q Fy(\))p FC(.)888 3834 y(It)21 b(r)o(eturns)e +FB(nbytes)q FC(,)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 +y(a)32 b(delimiter)f(character)f(being)i(found,)i Fy(#f)d +FC(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 +FB(i.e.)p FC(,)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 +(the)g FB(handle-delim)e FC(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 +y(faults)f(to)g Fy('trim)p FC(.)681 4657 y Fy(\(\045read-delimited)o(!) +37 b FB(char-set)15 b(buf)i(gobble?)f([port)f(start)g(end])p +Fy(\))43 b Fu(\000)-14 b(!)43 b FB([char-or-eof-or-#f)14 +b(integer])87 b FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +b FB(terminator)c FC(and)f FB(num-r)o(ead)o FC(.)2053 +5147 y(1)-5 b(10)p eop %%Page: 111 117 -111 116 bop 573 614 a Fz(terminator)40 b FB(A)20 b(value)g(describing)h +111 116 bop 573 614 a FA(terminator)40 b FC(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) +(eof-object)166 b Fu(\))g FC(Read)21 b(terminated)f(by)h(this)g(value.) +805 941 y Fy(#f)912 b Fu(\))166 b FC(Filled)21 b(buf)o(fer)e(without)j +(\002nding)g(a)e(delimiter)-6 b(.)573 1090 y FA(num-read)39 +b FC(Number)21 b(of)g(characters)e(r)o(ead)g(into)j FB(buf)p +FC(.)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 +1356 y(then)27 b(the)g FB(gobble?)f FC(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 @@ -7680,37 +7417,34 @@ 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 +(e)e(call.)365 1945 y Fy(\(skip-char-set)38 b FB(skip-chars)20 +b([port])p Fy(\))85 b Fu(\000)-14 b(!)87 b FB(integer)697 +b FC(pr)o(ocedur)o(e)573 2087 y(Skip)20 b(characters)f(occurring)i(in)g +(the)g(set)f FB(skip-chars)o FC(;)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,) +FB(skip-chars)g FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(edicate;)e(it)j(is)g(coer)o(ced)f(to)h(a)f(charset.)1740 +5147 y(1)-5 b(1)g(1)p eop %%Page: 112 118 -112 117 bop 681 1307 a Fw(Chapter)44 b(7)681 1792 y FC(A)-14 +112 117 bop 681 1307 a Fx(Chapter)44 b(7)681 1792 y FD(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 +2567 y FC(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 +Fy(/etc/passwd)p FC(\).)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 +y(colon-separated)26 b Fy($PATH)e FC(lists.)45 b(These)27 +b(r)o(outines)g(can)f(be)h(used)f(with)i(scsh's)g Fy(awk)d +FC(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 +3265 y(of)d(r)o(ecor)o(ds.)681 3658 y Fw(7.1)99 b(Record)25 +b(I/O)g(and)f(\002eld)h(parsing)681 3932 y FC(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 @@ -7718,212 +7452,202 @@ b(them)i(into)g(\002elds.)25 b(A)17 b(r)o(ecor)o(d)e(is)j(de\002ned)f 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 +b FB(match)e FC(\002elds,)j(to)f FB(separate)g FC(\002elds,)h(or)f(to)g +FB(terminate)681 4330 y FC(\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 +Fy($PATH)d FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +4898 y(strings)21 b(terminated)g(by)f(speci\002c)h(characters.)2053 +5147 y(1)-5 b(12)p eop %%Page: 113 119 -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) +113 118 bop 365 614 a FA(7.1.1)81 b(Reading)19 b(records)365 +821 y Fy(\(record-reader)38 b FB([delims)15 b(elide-delims?)g +(handle-delim])p Fy(\))42 b Fu(\000)-14 b(!)43 b FB(pr)o(ocedur)o(e)86 +b FC(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 +1184 y Fy(\()p FB(r)o(eader)43 b([port])n Fy(\))h Fu(\000)-15 +b(!)44 b FB(string)21 b(or)g(eof)573 1322 y FC(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 +(characters)573 1422 y(in)32 b FB(delims)g FC(or)f(eof.)58 +b(If)32 b FB(elide-delims?)f FC(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) +b FB(elide-delims?)g FC(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 +(ead.)573 1953 y(The)26 b FB(delims)g FC(set)g(defaults)f(to)i(the)f +(set)g Fu(f)p FC(newline)p Fu(g)p FC(.)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 +(charset.)97 b(The)573 2152 y FB(elide-delims?)20 b FC(\003ag)h +(defaults)f(to)h Fy(#f)p FC(.)573 2285 y(The)f FB(handle-delim)f +FC(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(.)805 2525 y Fy('trim)185 b FC(Delimiters)19 b(ar)o(e)e(trimmed.)25 +b(\(The)18 b(default\))805 2624 y Fy('split)141 b FC(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 +3023 y Fy('concat)97 b FC(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 +3492 y(string)g(or)g(eof.)365 3759 y FA(7.1.2)81 b(Parsing)20 +b(\002elds)365 3966 y Fy(\(field-splitter)38 b FB([r)o(egexp)19 +b(num-\002elds])p Fy(\))86 b Fu(\000)-14 b(!)87 b FB(pr)o(ocedur)o(e) +460 b FC(pr)o(ocedur)o(e)365 4066 y Fy(\(infix-splitter)38 +b FB([delim)17 b(num-\002elds)h(handle-delim])p Fy(\))65 +b Fu(\000)-14 b(!)66 b FB(pr)o(ocedur)o(e)87 b FC(pr)o(ocedur)o(e)365 +4165 y Fy(\(suffix-splitter)37 b FB([delim)16 b(num-\002elds)f +(handle-delim])p Fy(\))45 b Fu(\000)-14 b(!)47 b FB(pr)o(ocedur)o(e)87 +b FC(pr)o(ocedur)o(e)365 4265 y Fy(\(sloppy-suffix-sp)o(li)o(tte)o(r)37 +b FB([delim)15 b(num-\002elds)h(handle-delim])p Fy(\))41 +b Fu(\000)-14 b(!)43 b FB(pr)o(ocedur)o(e)87 b FC(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 +f(can)f(be)g(used)h(as)f(follows:)756 4528 y Fy(\()p +FB(parser)43 b(string)h([start])o Fy(\))f Fu(\000)-14 +b(!)43 b FB(string-list)573 4699 y FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(specifying)g(a)g(pattern)f(that)h FB(separates)g FC(\002elds,)h(a)e +(pattern)573 4898 y(that)k FB(terminates)f FC(\002elds,)h(or)g(a)f +(pattern)g(that)h FB(matches)f FC(\002elds:)1737 5147 +y(1)-5 b(13)p eop %%Page: 114 120 -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 +114 119 bop 1121 601 a FC(Pr)o(ocedur)o(e)748 b(Pattern)p +1071 634 1835 4 v 1121 704 a Fy(field-splitter)509 b +FC(matches)21 b(\002elds)1121 804 y Fy(infix-splitter)509 +b FC(separates)19 b(\002elds)1121 903 y Fy(suffix-splitter)465 +b FC(terminates)20 b(\002elds)1121 1003 y Fy(sloppy-suffix-sp)o(li)o +(tte)o(r)160 b FC(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 +y FB(delim)331 b FC(=)84 b Fy("[)43 b(\\t\\n]+|$")95 +b FC(\(suf)o(\002x)20 b(delimiter:)26 b(white)21 b(space)f(or)h(eos\)) +1771 1705 y Fy("[)43 b(\\t\\n]+")183 b FC(\(in\002x)21 +b(delimiter:)26 b(white)21 b(space\))1121 1805 y FB(r)o(e)453 +b FC(=)84 b Fy("[^)42 b(\\t\\n]+")140 b FC(\(non-white-space\))1121 +1904 y FB(num-\002elds)158 b FC(=)84 b Fy(#f)534 b FC(\(as)21 +b(many)g(\002elds)f(as)h(possible\))1121 2004 y FB(handle-delim)81 +b FC(=)j Fy('trim)402 b FC(\(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 +888 2339 y(The)26 b(r)o(egular)e(expr)o(ession)h FB(delim)f +FC(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 +Fy(make-regexp)11 b FC(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 +(ession)h FB(r)o(e)h FC(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(to)h(non-white-space.)888 3112 y(The)g(boolean)g FB(handle-delim)f +FC(determines)g(what)h(to)g(do)g(with)h(delimiters.)1121 +3192 y Fy('trim)185 b FC(Delimiters)21 b(ar)o(e)e(thr)o(own)j(away)e +(after)f(parsing.)26 b(\(default\))1121 3292 y Fy('concat)97 +b FC(Delimiters)21 b(ar)o(e)e(appended)h(to)h(the)g(\002eld)f(pr)o +(eceding)g(them.)1121 3391 y Fy('split)141 b FC(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 +f(list.)888 3528 y(The)31 b FB(num-\002elds)f FC(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 +3628 y(\002elds)20 b(to)h(parse.)j(If)c Fy(#f)f FC(\(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 +b(a)h(pos-)888 3727 y(itive)25 b(integer)g Fz(n)p FC(,)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 +Fz(n)e FC(\002elds)i(in)f(the)g(r)o(ecor)o(d.)40 b(If)26 +b FB(num-\002elds)f FC(is)i(a)e(negative)888 3927 y(integer)20 +b(or)g(zer)o(o,)f(then)i Fu(j)p Fz(n)p Fu(j)f FC(\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 +4126 y Fu(j)p Fz(n)p Fu(j)e FC(\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 +y Fy(\()p FB(parse)43 b(string)h([start])o Fy(\))f Fn(=)-14 +b Fu(\))44 b FB(string-list)888 4562 y FC(The)30 b(optional)g +FB(start)g FC(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 +(an)f(err)o(or)g(if)h FB(start)i Fz(>)f Fy(\(string-length)38 +b FB(string)p Fy(\))p FC(.)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(31,)g(1997)h(\226) -f(17)13 b(:)f(31)p eop +888 4898 y(kinds)c(of)e(\002eld)h(parsing:)2053 5147 +y(1)-5 b(14)p eop %%Page: 115 121 -115 120 bop 573 614 a Fx(field-splitter)36 b FB(The)20 +115 120 bop 573 614 a Fy(field-splitter)36 b FC(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 +573 759 y Fy(suffix-splitter)35 b FC(Delimiters)d(ar)o(e)f(interpr)o +(eted)f(as)h(element)h FB(terminators)p FC(.)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(,)42 b(then)d(the)f(string)h Fy("")e FC(is)h(the)g(empty)756 +958 y(r)o(ecor)o(d)24 b Fy(\(\))p FC(,)k Fy("foo|")c +FC(pr)o(oduces)i(a)g(one-\002eld)g(r)o(ecor)o(d)f Fy(\("foo"\))p +FC(,)g(and)i Fy("foo")756 1058 y FC(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 +o(ds)f(is:)961 1349 y Fz(<)p FB(r)o(ecord)p Fz(>)98 b +FC(::=)h Fy("")186 b FC(\(Empty)21 b(r)o(ecor)o(d\))1431 +1448 y Fu(j)134 b Fz(<)p FB(element)p Fz(>)21 b(<)p FB(delim)p +Fz(>)e(<)p FB(r)o(ecord)p Fz(>)756 1637 y FC(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) +Fy("$")p FC(\).)573 1981 y Fy(infix-splitter)36 b FC(Delimiters)44 +b(ar)o(e)e(interpr)o(eted)g(as)h(element)g FB(separators)p +FC(.)94 b(If)756 2080 y(comma)21 b(is)g(the)g(delimiter)-6 +b(,)21 b(then)g(the)h(string)f Fy("foo,")e FC(pr)o(oduces)h(a)g +(two-\002eld)756 2180 y(r)o(ecor)o(d)f Fy(\("foo")41 +b(""\))p FC(.)756 2302 y(The)20 b(syntax)h(of)g(in\002x-delimited)g(r)o +(ecor)o(ds)e(is:)961 2471 y Fz(<)p FB(r)o(ecord)p Fz(>)431 +b FC(::=)99 b Fy("")186 b FC(\(For)o(ced)20 b(to)h(be)f(empty)h(r)o +(ecor)o(d\))1764 2570 y Fu(j)134 b Fz(<)p FB(r)o(eal-in\002x-r)o(ecord) +p Fz(>)961 2769 y(<)p FB(r)o(eal-in\002x-r)o(ecord)p +Fz(>)97 b FC(::=)i Fz(<)p FB(element)p Fz(>)21 b(<)p +FB(delim)p Fz(>)e(<)p FB(r)o(eal-in\002x-r)o(ecord)p +Fz(>)1764 2869 y Fu(j)134 b Fz(<)p FB(element)p Fz(>)756 +3057 y FC(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 +o(d)h(grammar)g(\()p FB(i.e.)o FC(,)67 b Fz(<)p FB(r)o(eal-in\002x-r)o +(ecord)p Fz(>)p FC(\))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 +3356 y(empty)21 b(string,)h Fy(\(""\))p FC(,)d(not)j(as)f(the)g(empty)h +(r)o(ecor)o(d)d Fy(\(\))p FC(.)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 +(doesn't)g(make)g Fy(string-append)756 3555 y FC(and)i +Fy(append)e FC(isomorphic.)27 b(For)21 b(example,)911 +3722 y Fy(\(\(infix-splitter)37 b(":"\))42 b(\(string-append)37 +b FB(x)44 b Fy(":")e FB(y)o Fy(\)\))756 3889 y FC(doesn't)21 +b(always)f(equal)911 4034 y Fy(\(append)40 b(\(\(infix-splitter)d +(":"\))42 b FB(x)p Fy(\))1259 4133 y(\(\(infix-splitter)37 +b(":"\))42 b FB(y)p Fy(\)\))756 4278 y FC(It)23 b(fails)g(when)h +FB(x)e FC(or)i FB(y)e FC(ar)o(e)g(the)h(empty)h(string.)33 +b(T)-8 b(erminator)24 b(semantics)g FB(does)756 4378 +y FC(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(For)23 b(example,)756 4699 y(Unix)g Fy($PATH)e FC(lists)k(have)e +(separator)f(semantics.)34 b(The)23 b(path)h(list)g Fy("/bin:")c +FC(is)756 4799 y(br)o(oken)h(up)g(into)i Fy(\("/bin")41 +b(""\))p FC(,)20 b(not)i Fy(\("/bin"\))p FC(.)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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +b(.)1737 5147 y(1)k(15)p eop %%Page: 116 122 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 @@ -7936,10 +7660,10 @@ 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 +b("bar"\))946 1379 y FC(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 +3542 1403 4 868 v 681 1406 2865 4 v 888 1654 a Fy(sloppy-suffix)36 +b FC(The)23 b(same)f(as)g(the)g Fy(suffix)e FC(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 @@ -7947,9 +7671,9 @@ 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 +(egex)1071 2152 y Fy("[)43 b(\\t]+|$")p FC(.)24 b(\(But)d(you)g(would)h +(be)f(better)g(of)o(f)f(using)i Fy(field-splitter)16 +b FC(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) @@ -7957,48 +7681,45 @@ 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 +2866 y(you)h(say)-9 b(.)681 3015 y Fy(\(join-strings)38 +b FB(string-list)20 b([delimiter)h(grammar])p Fy(\))85 +b Fu(\000)-14 b(!)87 b FB(string)282 b FC(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 +y(delimiter)f(string.)888 3388 y(The)40 b FB(grammar)f +FC(ar)o(gument)g(is)h(one)h(of)e(the)h(symbols)h Fy(infix)d +FC(\(the)i(default\))e(or)888 3487 y Fy(suffix)p FC(;)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 +3819 y(space)h Fy(")43 b(")p FC(.)888 3952 y(Example:)1071 +4117 y Fy(\(join-strings)38 b('\("foo")j("bar")g("baz"\))h(":"\))1245 +4217 y Fn(=)-14 b Fu(\))87 b Fy("foo:bar:baz")681 4567 +y FA(7.1.3)81 b(Field)19 b(readers)681 4774 y Fy(\(field-reader)38 +b FB([\002eld-parser)20 b(r)o(ec-r)o(eader])p Fy(\))86 +b Fu(\000)-14 b(!)87 b FB(pr)o(ocedur)o(e)418 b FC(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +o(eads)e(r)o(ecor)o(ds)g(with)j(\002eld)f(str)o(uctur)o(e)2053 +5147 y(1)-5 b(16)p eop %%Page: 117 123 -117 122 bop 573 614 a FB(fr)o(om)27 b(a)f(port.)45 b(The)27 +117 122 bop 573 614 a FC(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 +(useful)f(in)g(the)573 714 y Fy(awk)19 b FC(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 +865 y Fy(\()p FB(r)o(eader)43 b([port])n Fy(\))h Fn(=)-14 +b Fu(\))86 b FB([raw-r)o(ecord)20 b(parsed-r)o(ecord])42 +b Fy(or)h FB([eof)21 b(\(\)])573 1054 y FC(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 +(a)g(r)o(ecor)o(d)g(using)i FB(r)o(ec-r)o(eader)o FC(.)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 +1254 y(is)25 b(parsed)e(with)i FB(\002eld-parser)p FC(.)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 +([eof-object)g Fy(\(\))p FC(].)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 @@ -8007,27 +7728,27 @@ b(r)o(ecor)o(d)f(r)o(eader)573 1829 y(can)d(pr)o(oduce,)f(and)g(the)h 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 +b(example,)f(if)g(port)h Fy(p)f FC(is)i(open)f(on)g Fy(/etc/passwd)p +FC(,)16 b(then)756 2317 y Fy(\(\(field-reader)37 b(\(infix-splitter)h +(":")k(7\)\))g(p\))573 2459 y FC(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) +2772 y("/bin/csh"\))595 2910 y FC(The)23 b FB(\002eld-parser)f +FC(defaults)g(to)g(the)h(value)f(of)g Fy(\(field-splitter\))p +FC(,)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 FB(r)o(ec-r)o(eader)f +FC(defaults)g(to)h Fy(read-line)p FC(.)573 3286 y(Figur)o(e)35 +b(7.2)e(shows)k Fy(field-reader)30 b FC(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 +3676 y FA(7.1.4)81 b(Forward-progress)21 b(guarantees)d(and)i +(empty-string)e(matches)365 3869 y FC(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 +Fy(^)p FC(,)i Fy($)p FC(,)g Fy(.*)p FC(,)g(and)f Fy(foo|[^f]*)d +FC(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 @@ -8040,14 +7761,12 @@ y(pr)o(essions)23 b(ar)o(e)f(car)o(eful)e(to)j(handle)g(this)g (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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +y(at)d(location)i Fz(i)p FC(,)e(then)h(it)g(is)g(guaranteed)e(it)i +(could)g(not)g(have)f(matched)g(a)g(longer)h(pattern)1737 +5147 y(1)-5 b(17)p eop %%Page: 118 124 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 +a Fy(;;;)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 @@ -8061,55 +7780,52 @@ b(Sep)g(24)h(12:45)e(scsh.scm)718 2322 y(;;;)h(Internet)f(hostname)f ("[^.]+")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 +p Fz(\025)f Fy(\(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) +3817 y(\()p Fz(\025)i Fy(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +(26)j(to)g(7.)1305 4096 y FC(Figur)o(e)21 b(7.2:)j(Some)d(examples)f +(of)h Fy(field-reader)p 3542 4120 V 681 4123 2865 4 v +2053 5147 a FC(1)-5 b(18)p eop %%Page: 119 125 -119 124 bop 365 614 a FB(starting)23 b(with)f(character)f -Fy(i)p FB(.)29 b(So)22 b(we)g(can)g(safely)f(begin)h(our)h(sear)o(ch)e -(for)g(the)h(next)g(match)365 714 y(at)f(char)f Fy(i)e -Fm(+)g(1)p FB(.)490 854 y(W)-5 b(ith)24 b(this)h(pr)o(ovision,)f(every) +119 124 bop 365 614 a FC(starting)23 b(with)f(character)f +Fz(i)p FC(.)29 b(So)22 b(we)g(can)g(safely)f(begin)h(our)h(sear)o(ch)e +(for)g(the)h(next)g(match)365 714 y(at)f(char)f Fz(i)e +Fn(+)g(1)p FC(.)490 854 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 953 y(pr)o(ogr)o(ess,)c(and)g(the)h(loop)h(is)f(guaranteed)e(to)i (terminate.)490 1093 y(This)i(has)g(the)h(ef)o(fect)d(you)i(want)g (with)h(\002eld)f(parsing.)32 b(For)24 b(example,)e(if)h(you)h(split)f (a)365 1193 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 -1292 y(characters:)573 1455 y Fx(\(\(suffix-splitte)o(r)37 -b(""\))43 b("foo"\))e Fm(=)-14 b Ft(\))87 b Fx(\("")42 -b("f")g("o")h("o"\))365 1617 y FB(However)-6 b(,)27 b(even)e(though)i +1292 y(characters:)573 1455 y Fy(\(\(suffix-splitte)o(r)37 +b(""\))43 b("foo"\))e Fn(=)-14 b Fu(\))87 b Fy(\("")42 +b("f")g("o")h("o"\))365 1617 y FC(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 1717 y(ommend)c(using)f(it.)26 b(Say)20 b(what)h(you)g(mean\227just)h(use)f(a)f(\002eld)h(splitter:) -573 1879 y Fx(\(\(field-splitter)37 b("."\))42 b("foo"\))f -Fm(=)-14 b Ft(\))87 b Fx(\("f")42 b("o")g("o"\))365 2041 -y FB(Or)-6 b(,)21 b(mor)o(e)f(ef)o(\002ciently)-9 b(,)573 -2204 y Fx(\(\()p Fy(\025)38 b Fx(\(s\))43 b(\(map)e(string)h -(\(string->list)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 +573 1879 y Fy(\(\(field-splitter)37 b("."\))42 b("foo"\))f +Fn(=)-14 b Fu(\))87 b Fy(\("f")42 b("o")g("o"\))365 2041 +y FC(Or)-6 b(,)21 b(mor)o(e)f(ef)o(\002ciently)-9 b(,)573 +2204 y Fy(\(\()p Fz(\025)38 b Fy(\(s\))43 b(\(map)e(string)h +(\(string->list)c(s\)\)\))k("foo"\))365 2494 y FA(7.1.5)81 +b(Reader)20 b(limitations)365 2697 y FC(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 +365 2996 y(into)g(input)f(str)o(eams.)365 3312 y Fw(7.2)99 +b(A)-7 b(wk)365 3546 y FC(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 +(ovided)e(by)i(the)g Fy(awk)e FC(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 @@ -8120,101 +7836,95 @@ 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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +(called)g Fy(awk)p FC(.)k(It)d(looks)h(like)f(this:)573 +4699 y Fy(\(awk)42 b Fz(<)p FB(next-r)o(ecord)p Fz(>)f(<)p +FB(r)o(ecord&\002eld-vars)p Fz(>)791 4799 y FC([)p Fz(<)p +FB(counter)p Fz(>)p FC(])h Fz(<)p FB(state-var-decls)p +Fz(>)660 4898 y(<)p FB(clause)929 4910 y Fv(1)966 4898 +y Fz(>)h Fy(...\))1737 5147 y FC(1)-5 b(19)p eop %%Page: 120 126 -120 125 bop 805 614 a FB(The)24 b(body)f(of)g(the)h(loop)g(is)g(a)f +120 125 bop 805 614 a FC(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 +Fy(p)g FC(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 +Fy(Church-Rosser)p FC(\224)o(:)888 1230 y Fy(\(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 +1521 y FC(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 +Fy(Church-Rosser)p FC(\224.)805 1745 y(The)c Fz(<)p FB(next-r)o(ecord)p +Fz(>)e FC(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 +Fz(<)p FB(r)o(ecord&\002eld-vars)p Fz(>)681 2044 y FC(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 +f(items)i(fr)o(om)f Fy(/etc/password)p FC(,)12 b(and)681 +2368 y(we)20 b(use)g(the)g Fy(field-reader)c FC(pr)o(ocedur)o(e)i(to)i +(de\002ne)g(a)g(r)o(ecor)o(d)f(parser)g(for)h Fy(/etc/passwd)681 +2468 y FC(entries:)888 2607 y Fy(\(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 +2746 y FC(binds)22 b Fy(read-passwd)c FC(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 +(on)681 3045 y Fy(field-reader)16 b FC(and)k Fy(infix-splitter)p +FC(.\))805 3170 y(So)27 b(if)g(the)g Fz(<)p FB(next-r)o(ecord)p +Fz(>)e FC(form)i(in)g(an)g Fy(awk)f FC(expr)o(ession)g(is)i +Fy(\(read-passwd\))p FC(,)23 b(then)681 3270 y Fz(<)p +FB(r)o(ecord&\002eld-vars)p Fz(>)18 b FC(must)k(be)e(a)g(list)i(of)e +(two)i(variables,)d FB(e.g.)o FC(,)888 3409 y Fy(\(record)41 +b(field-vec\))681 3548 y FC(since)21 b Fy(read-passwd)16 +b FC(r)o(eturns)k(two)i(values.)805 3673 y(Note)27 b(that)f +Fy(awk)g FC(allows)h(us)g(to)f(use)h FB(any)f FC(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.) +(loop)g(should)h(terminate.)805 4097 y(The)33 b Fy(awk)f +FC(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 +(by)g(the)g Fz(<)p FB(state-var-decls)p Fz(>)d FC(form,)j(a)888 +4335 y Fy(\(\()p FB(var)43 b(init-exp)o Fy(\))g(\()p +FB(var)g(init-exp)o Fy(\))g(...\))681 4475 y FC(list)26 +b(rather)g(like)g(the)g Fy(let)f FC(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 +b(optional)g Fz(<)p FB(counter)p Fz(>)f FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +4898 y(r)o(ead.)2051 5147 y(120)p eop %%Page: 121 127 -121 126 bop 490 614 a FB(Ther)o(e)28 b(ar)o(e)f(several)h(kinds)h(of)g +121 126 bop 490 614 a FC(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) +714 y(loop,)h Fy(awk)c FC(evaluates)h FB(all)h FC(the)g(clauses)f +(sequentially)-9 b(.)44 b(Unlike)27 b Fy(cond)p FC(,)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 +g(it)g(checks)f(them)i(all.)490 1010 y Fu(\017)41 b Fy(\()p +FB(test)i(body)938 1037 y Fv(1)1019 1010 y FB(body)1177 +1037 y Fv(2)1258 1010 y Fy(...\))573 1110 y FC(If)28 +b FB(test)h FC(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 +1440 y(The)g FB(test)f FC(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 @@ -8223,62 +7933,59 @@ 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 +2234 y Fu(\017)91 b Fy(\(range)128 b FB(start-test)43 +b(stop-test)f(body)1851 2261 y Fv(1)1931 2234 y Fy(...\))623 +2334 y(\(:range)84 b FB(start-test)43 b(stop-test)f(body)1851 +2361 y Fv(1)1931 2334 y Fy(...\))623 2434 y(\(range:)84 +b FB(start-test)43 b(stop-test)f(body)1851 2461 y Fv(1)1931 +2434 y Fy(...\))623 2533 y(\(:range:)e FB(start-test)j(stop-test)f +(body)1851 2560 y Fv(1)1931 2533 y Fy(...\))573 2632 +y FC(These)18 b(clauses)g(become)h(activated)e(when)i +FB(start-test)e FC(is)i(tr)o(ue;)g(they)g(stay)f(active)g(on)573 +2731 y(all)i(further)h(iterations)g(until)g FB(stop-test)f +FC(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 +3001 y Fy(\(:range:)40 b(1)j(10)g(\(display)d(record\)\))573 +3170 y FC(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 +Fy(\(range)129 b(1)43 b(5)87 b(...\))164 b FC(Lines)83 +b(2)20 b(3)h(4)805 3510 y Fy(\(:range)85 b(1)43 b(5)87 +b(...\))164 b FC(Lines)21 b(1)f(2)g(3)h(4)805 3609 y +Fy(\(range:)85 b(1)43 b(5)87 b(...\))164 b FC(Lines)83 +b(2)20 b(3)h(4)f(5)805 3709 y Fy(\(:range:)41 b(1)i(5)87 +b(...\))164 b FC(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 +4239 y Fu(\017)41 b Fy(\(else)g FB(body)993 4266 y Fv(1)1074 +4239 y FB(body)1232 4266 y Fv(2)1313 4239 y Fy(...\))573 +4338 y FC(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) +4438 y Fy(else)c FC(clause,)h(this)i(clause)e(executes.)490 +4599 y Fu(\017)41 b Fy(\()p FB(test)i Fy(=>)g FB(exp)o +Fy(\))573 4699 y FC(If)25 b(evaluating)f Fy(test)g FC(pr)o(oduces)g(a)h +(tr)o(ue)g(value,)h(apply)e FB(exp)h FC(to)h(that)f(value.)38 +b(If)25 b FB(test)573 4799 y FC(is)20 b(a)f(r)o(egular)o(-expr)o +(ession)e(string,)j(then)g FB(exp)f FC(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(31,)g(1997)h -(\226)f(17)13 b(:)f(31)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 +(egexp)f(match)g(r)o(outine.)1735 5147 y(121)p eop %%Page: 122 128 -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 +122 127 bop 805 614 a Fu(\017)41 b Fy(\(after)g FB(body)1352 +641 y Fv(1)1433 614 y Fy(...\))888 714 y FC(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 +g Fy(after)e FC(clause,)h Fy(awk)f FC(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 +1389 y FA(7.2.1)81 b(Examples)681 1572 y FC(Her)o(e)26 +b(ar)o(e)g(some)i(examples)f(of)g Fy(awk)f FC(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 +1858 y Fy(\(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 @@ -8304,12 +8011,10 @@ b(is)43 b(the)f(standard)e(Scheme)i(READ)f(procedure.)888 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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p eop +y(\("Olin")f(\(display)g(line\))i(\(newline\)\)\))2051 +5147 y FC(122)p eop %%Page: 123 129 -123 128 bop 573 614 a Fx(;;;)42 b(Count)g(the)g(number)f(of)i +123 128 bop 573 614 a Fy(;;;)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 @@ -8346,71 +8051,60 @@ 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 +(2's-complement)h(encoding.)573 3138 y Fy(arithmetic-shift)f +FC(shifts)27 b FB(i)f FC(by)h FB(j)g FC(bits.)43 b(A)26 +b(left)g(shift)h(is)g Fz(j)38 b(>)c Fn(0)p FC(;)28 b(a)e(right)h(shift) +g(is)573 3238 y Fz(j)h(<)22 b Fn(0)p FC(.)365 3516 y +Fw(8.2)99 b(List)26 b(procedures)365 3739 y Fy(\(nth)42 +b FB(list)21 b(i)p Fy(\))87 b Fu(\000)-14 b(!)87 b FB(object)1578 +b FC(pr)o(ocedur)o(e)573 3856 y(Returns)22 b(the)h Fz(i)1050 +3826 y Fv(t)p Fo(h)1140 3856 y FC(element)f(of)g FB(list)p +FC(.)29 b(The)22 b(\002rst)g(element)g(\(the)g(car\))f(is)h +Fy(\(nth)42 b FB(list)i Fy(0\))p FC(,)573 3956 y(the)21 +b(second)g(element)g(is)g Fy(\(nth)42 b FB(list)h Fy(1\))p +FC(,)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 +(\(chapter)i(7\).)365 4459 y Fw(8.3)99 b(T)-11 b(op)26 +b(level)365 4682 y Fy(\(repl\))85 b Fu(\000)-14 b(!)87 +b FB(unde\002ned)1590 b FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +(port.)1735 5147 y(125)p eop %%Page: 126 132 -126 131 bop 888 614 a FB(If)25 b(you)h(wish)f(to)h(try)f(something)i +126 131 bop 888 614 a FC(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 +i(with)g(the)e(following)j(form:)1071 853 y Fy(\(run)42 +b(\(begin)f(\(repl\)\)\))888 991 y FC(.)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(31,)g(1997)h(\226) -f(17)13 b(:)f(31)p eop +1130 y Fy(\(wait)42 b(\(fork)f(repl\)\))2051 5147 y FC(126)p +eop %%Page: 127 133 -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 +127 132 bop 365 1266 a Fx(Chapter)45 b(9)365 1709 y FD(Running)53 +b(scsh)365 2194 y FC(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 @@ -8432,7 +8126,7 @@ 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 +Fy(#!/usr/local/bin)o(/s)o(csh)f(-s)p FC(\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 @@ -8445,8 +8139,8 @@ 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 +y(allows)j(for)f(an)h(initial)g Fy(#!/usr/local/li)o(b/s)o(cs)o(h/s)o +(cs)o(hvm)22 b FC(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 @@ -8458,43 +8152,41 @@ y(script.)490 4500 y(Finally)-9 b(,)24 b(scsh's)h(static)e(linker)h 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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +b(,)23 b(do)g(not)g(occupy)g(space)f(in)h(the)g(vm's)h(heap,)e(and)1735 +5147 y(127)p eop %%Page: 128 134 -128 133 bop 681 614 a FB(do)16 b(not)g(need)g(to)g(be)g(loaded)f(and)h +128 133 bop 681 614 a FC(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 +1169 y Fw(9.1)99 b(Scsh)25 b(command-line)f(switches)681 +1403 y FC(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 +Fy(command-line-arg)o(um)o(ent)o(s)p FC(.)681 1992 y +FA(9.1.1)81 b(Scripts)19 b(and)h(programs)681 2194 y +FC(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 +(between)i(a)h FB(script)p FC(,)i(which)e(performs)g(its)g(action)g +FB(as)f(it)h(is)681 2633 y(loaded)p FC(,)d(and)f(a)g +FB(pr)o(ogram)p FC(,)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 +(transferr)o(ed)e(to)i(an)f(entry)h(point)h(\()p FB(e.g.)n +FC(,)g(the)f Fy(main\(\))d FC(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 +(operation.)805 2971 y(A)g FB(script)p FC(,)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 +(top-level)g Fy(main\(\))p FC(-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 @@ -8502,17 +8194,17 @@ y(pr)o(ograms\))20 b(that)g(was)h(de\002ned)f(by)h(the)g(load/link)h 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 +(ogramming.)681 3899 y FA(9.1.2)81 b(Inserting)19 b(interpreter)g +(triggers)h(into)g(scsh)g(programs)681 4101 y FC(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 +Fy(#!)p FC(\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 +(speci\002ed)g(immediately)h(after)e(the)h(\223)p Fy(#!)p +FC(\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 @@ -8520,52 +8212,49 @@ 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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +(the)h Fy(exec)e FC(system)i(call)f(for)g(mor)o(e)h(infor)o(-)681 +4898 y(mation.)2051 5147 y(128)p eop %%Page: 129 135 -129 134 bop 490 614 a FB(Scsh)29 b(allows)h(Scheme)f(pr)o(ograms)g(to)g +129 134 bop 490 614 a FC(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 +(\223)p Fy(#!)p FC(\224)e(as)i(a)f(block-comment)i(sequence,)3192 +684 y Fv(1)365 814 y FC(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 +FB(i.e.)p FC(,)g(the)d(sequence)365 1013 y(\223)p Fy(!#)p +FC(\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 +e(for)i(an)g(initial)573 1341 y Fy(#!/usr/local/bin)o(/s)o(csh)37 +b(-s)573 1441 y(!#)365 1640 y FC(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 +(is)365 1740 y(loaded)20 b(into)i(scsh.)365 2003 y FA(9.1.3)81 +b(Module)20 b(system)365 2193 y FC(Scsh)e(uses)f(the)h(Scheme)f(48)f +(module)i(system,)g(which)h(de\002nes)e FB(packages)p +FC(,)g FB(structur)o(es)p FC(,)h(and)365 2292 y FB(interfaces)p +FC(.)365 2491 y FA(Package)40 b FC(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 +(these)f(sets)g(ar)o(e)e(called)h FB(structur)o(es)p +FC(.)365 2863 y FA(Structure)40 b FC(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 +b(Other)573 2963 y(packages)15 b(can)h FB(open)g FC(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 +3335 y FA(Interface)40 b FC(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) +FB(e.g.)o FC(,)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.) +(\002le)365 3932 y Fy(module.ps)e FC(in)22 b(the)e Fy(doc)g +FC(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 @@ -8579,1476 +8268,1544 @@ b(In)22 b(Scheme)h(48,)e(name-space)g(con\003icts)j(vanish;)g(the)e (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) +4 v 450 4796 a Fq(1)485 4819 y Ft(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(31,)g(1997)h -(\226)f(17)13 b(:)f(31)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 +(on)e(meta-)365 4898 y(ar)o(gs.)1735 5147 y FC(129)p +eop %%Page: 130 136 -130 135 bop 805 614 a FB(It)20 b(may)g(take)f(you)h(a)f(little)h(while) +130 135 bop 805 614 a FC(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(31,)g -(1997)h(\226)f(17)13 b(:)f(31)p eop +b(factorable)g(pr)o(ograms.)681 1384 y FA(Module)f(warning)681 +1680 y FC(Pr)o(ogrammers)34 b(who)i(open)g(both)g(the)f +Fy(scheme)d FC(and)j Fy(scsh)f FC(str)o(uctur)o(es)g(in)i(their)f(own) +681 1780 y(packages)20 b(should)h(make)g(sur)o(e)f(to)h(always)f(put)h +(the)g Fy(scsh)e FC(r)o(efer)o(ence)f(\002rst.)731 2192 +y(Do)j(this:)1184 b(Not)21 b(this:)814 2279 y Fy(\(define-structu)o(re) +37 b(web-server)901 2344 y(\(open)k(scsh)1162 2413 y(scheme)1162 +2464 y(net-hax)1162 2524 y(.)1162 2557 y(.)1162 2590 +y(.\))901 2655 y(\(file)g(web\)\))2283 2279 y(\(define-structur)o(e)d +(web-server)2370 2344 y(\(open)k(scheme)2632 2413 y(scsh)2632 +2464 y(net-hax)2632 2524 y(.)2632 2557 y(.)2632 2590 +y(.)o(\))2370 2655 y(\(file)g(web\)\))731 2755 y FC(Open)21 +b Fy(scsh)e FC(befor)o(e)g Fy(scheme)p FC(.)515 b(Not)21 +b Fy(scsh)e FC(after)h Fy(scheme)p FC(.)681 3088 y(Or)o(dering)j(the)h +(two)h(packages)d(like)j(this)f(is)g(necessary)g(because)f(scsh)h +(overrides)f(some)681 3187 y(of)c(the)g(standar)o(d)f(R4RS)h(Scheme)g +(de\002nitions)h(exported)f(by)g(the)g Fy(scheme)e FC(package)h(with) +681 3287 y(its)30 b(own)h(de\002nitions.)53 b(For)30 +b(example,)h(scsh's)g(versions)f(of)g(the)g(R4RS)g(I/O)g(functions)681 +3387 y(such)25 b(as)f Fy(display)d FC(and)j Fy(write)e +FC(take)i(integer)g(\002le)h(descriptors)f(as)g(ar)o(guments,)h(as)f +(well)681 3486 y(as)i(Scheme)h(ports.)44 b(If)26 b(you)h(open)h(the)f +Fy(scheme)d FC(str)o(uctur)o(e)i(befor)o(e)g(the)h Fy(scsh)e +FC(str)o(uctur)o(e,)681 3586 y(you'll)c(get)g(the)g(standar)o(d)e +(Scheme)i(48)e(de\002nitions,)j(which)g(is)f(not)g(what)g(you)h(want.) +681 4057 y FA(9.1.4)81 b(Switches)681 4353 y FC(The)21 +b(scsh)g(top-level)f(takes)h(command-line)g(switches)g(in)h(the)f +(following)h(format:)888 4626 y Fy(scsh)42 b([)p FB(meta-ar)o(g)n +Fy(])h([)p FB(switch)1797 4638 y Fo(i)1868 4626 y Fy(...])f([)p +FB(end-option)g(ar)o(g)2642 4653 y Fv(1)2723 4626 y Fy(...)g +FB(ar)o(g)3007 4653 y Fo(n)3052 4626 y Fy(])681 4898 +y FC(wher)o(e)2051 5147 y(130)p eop %%Page: 131 137 -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 +131 136 bop 623 692 a FB(meta-ar)o(g:)159 b Fy(\\)20 +b FB(script-\002le-name)623 892 y(switch:)240 b Fy(-e)20 +b FB(entry-point)404 b FC(Specify)20 b(top-level)h(entry-point.)1103 +991 y Fy(-o)f FB(structur)o(e)479 b FC(Open)21 b(str)o(uctur)o(e)f(in)i +(curr)o(ent)e(package.)1103 1091 y Fy(-m)g FB(structur)o(e)479 +b FC(Switch)21 b(to)g(package.)1103 1191 y Fy(-n)f FB(new-package)361 +b FC(Switch)21 b(to)g(new)g(package.)1103 1390 y Fy(-lm)e +FB(module-\002le-name)165 b FC(Load)20 b(module)h(into)h(con\002g)g +(package.)1103 1489 y Fy(-l)e FB(\002le-name)481 b FC(Load)20 +b(\002le)h(into)h(curr)o(ent)e(package.)1103 1589 y Fy(-dm)764 +b FC(Do)22 b(script)e(module.)1103 1689 y Fy(-ds)764 +b FC(Do)22 b(script.)623 1888 y FB(end-option:)98 b Fy(-s)20 +b FB(script)1103 1988 y Fy(-sfd)f FB(num)1103 2087 y +Fy(-c)h FB(exp)1103 2187 y Fy(--)365 2354 y FC(These)29 +b(command-line)h(switches)f(essentially)h(pr)o(ovide)e(a)g(little)i +(linker)f(language)g(for)365 2453 y(linking)35 b(a)d(shell)i(script)f +(or)g(a)g(pr)o(ogram)f(together)h(with)h(Scheme)f(48)f(modules.)63 +b(The)365 2553 y(command-line)23 b(pr)o(ocessor)g(serially)f(opens)h +(str)o(uctur)o(es)g(and)f(loads)g(code)h(into)g(a)f(given)365 +2653 y(package.)30 b(Switches)23 b(that)f(side-ef)o(fect)f(a)h(package) +f(operate)h(on)h(a)f(particular)f(\223curr)o(ent\224)365 +2752 y(package;)29 b(ther)o(e)d(ar)o(e)g(switches)i(to)f(change)g(this) +h(package.)43 b(\(These)27 b(switches)g(pr)o(ovide)365 +2852 y(functionality)38 b(equivalent)e(to)h(the)g(interactive)f +Fy(,open)e(,load)g(,in)i FC(and)g Fy(,new)e FC(com-)365 +2951 y(mands.\))57 b(Except)30 b(wher)o(e)h(indicated,)i(switches)f +(specify)f(actions)h(that)f(ar)o(e)f(executed)365 3051 +y(in)25 b(a)f(left-to-right)h(or)o(der)-6 b(.)36 b(The)24 +b(initial)h(curr)o(ent)f(package)f(is)i(the)g(user)g(package,)f(which) +365 3151 y(is)29 b(completely)g(empty)g(and)f(opens)h(\(imports)g(the)f +(bindings)i(of\))e(the)g(R4RS)h(and)f(scsh)365 3250 y(str)o(uctur)o +(es.)490 3393 y(If)i(the)g(Scheme)g(pr)o(ocess)g(is)g(started)g(up)g +(in)g(an)h(interactive)e(mode,)k(then)d(the)h(cur)o(-)365 +3493 y(r)o(ent)21 b(package)g(in)h(for)o(ce)f(at)g(the)h(end)f(of)h +(switch)g(scanning)h(is)f(the)g(one)g(inside)g(which)g(the)365 +3593 y(interactive)e(r)o(ead-eval-print)e(loop)k(is)f(started.)490 +3736 y(The)f(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 3836 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 3935 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 FB(end-option)f FC(switches.)50 b(The)365 4035 +y FB(ar)o(g)474 4062 y Fo(i)520 4035 y FC(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 +(the)g(scsh)g(pr)o(o-)365 4134 y(gram)j(as)g(the)g(value)g(of)g +Fy(command-line-arg)o(um)o(ent)o(s)15 b FC(and)20 b(the)i(tail)f(of)g +(the)g(list)h(r)o(eturned)365 4234 y(by)i Fy(\(command-line\))p +FC(.)j(That)c(is,)g(an)g FB(end-option)f FC(switch)i(separates)e +(switches)i(that)f(con-)365 4334 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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +(passed)f(to)g(the)h(scsh)365 4433 y(pr)o(ogram)20 b(that)h(r)o(uns)h +(on)f(that)g(machine.)490 4577 y(The)g(following)h(switches)f(and)g +(end)f(options)i(ar)o(e)e(de\002ned:)490 4799 y Fu(\017)41 +b Fy(-o)i FB(struct)573 4898 y FC(Open)21 b(the)g(str)o(uctur)o(e)f(in) +h(the)g(curr)o(ent)f(package.)1735 5147 y(131)p eop %%Page: 132 138 -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 +132 137 bop 805 614 a Fu(\017)41 b Fy(-n)i FB(package)888 +714 y FC(Make)20 b(and)h(enter)g(a)g(new)g(package.)26 +b(The)21 b(package)f(has)h(an)g(associated)g(str)o(uctur)o(e)888 +814 y(named)f FB(package)f FC(with)j(an)e(empty)g(export)g(list.)26 +b(If)20 b FB(package)f FC(is)i(the)f(string)i(\223)p +Fy(#f)p FC(\224,)c(the)888 913 y(new)j(package)f(is)h(anonmyous,)h +(with)g(no)f(associated)f(named)h(str)o(uctur)o(e.)888 +1044 y(The)k(new)h(package)e(initially)i(opens)f(no)h(other)f(str)o +(uctur)o(es,)h(not)g(even)f(the)g(R4RS)888 1143 y(bindings.)h(Y)-8 +b(ou)18 b(must)g(follow)g(a)f(\223)p Fy(-n)42 b(foo)p +FC(\224)15 b(switch)j(with)g(\223)p Fy(-o)43 b(scheme)p +FC(\224)14 b(to)k(access)888 1243 y(the)j(standar)o(d)e(identi\002ers)i +(such)g(as)g Fy(car)e FC(and)i Fy(define)p FC(.)805 1404 +y Fu(\017)41 b Fy(-m)i FB(struct)888 1503 y FC(Change)27 +b(the)g(curr)o(ent)f(package)f(to)i(the)g(package)f(underlying)h(str)o +(uctur)o(e)f FB(struct)p FC(.)888 1603 y(\(The)21 b Fy(-m)f +FC(stands)g(for)h(\223module.\224\))805 1764 y Fu(\017)41 +b Fy(-lm)i FB(module-\002le-name)888 1864 y FC(Load)21 +b(the)g(speci\002ed)g(\002le)h(into)g(scsh's)g(con\002g)g(package)e +(\227)i(the)f(\002le)h(must)f(contain)888 1963 y(sour)o(ce)d(written)g +(in)h(the)f(Scheme)g(48)f(module)i(language)e(\(\223load)g +(module\224\).)24 b(Does)888 2063 y(not)e(alter)e(the)h(curr)o(ent)f +(package.)805 2224 y Fu(\017)41 b Fy(-l)i FB(\002le-name)888 +2323 y FC(Load)20 b(the)h(speci\002ed)g(\002le)g(into)g(the)g(curr)o +(ent)f(package.)805 2484 y Fu(\017)41 b Fy(-c)i FB(exp)888 +2584 y FC(Evaluate)28 b(expr)o(ession)h FB(exp)f FC(in)i(the)f(curr)o +(ent)g(package)f(and)g(exit.)51 b(This)29 b(is)h(called)888 +2684 y Fy(-c)c FC(after)f(a)g(common)j(shell)f(convention)g(\(see)f(sh) +g(and)g(csh\).)42 b(The)26 b(expr)o(ession)g(is)888 2783 +y(evaluated)f(in)i(the)f(the)h(curr)o(ent)f(package)f(\(and)g(hence)i +(is)f(af)o(fected)e(by)j Fy(-m)p FC('s)e(and)888 2883 +y Fy(-n)p FC('s.\))888 3013 y(When)d(the)f(scsh)g(top-level)g(constr)o +(ucts)h(the)f(scsh)h(command-line)f(in)h(this)g(case,)e(it)888 +3113 y(takes)j Fy("scsh")e FC(to)j(be)f(the)g(pr)o(ogram)g(name.)32 +b(This)24 b(switch)g(terminates)g(ar)o(gument)888 3212 +y(scanning;)e(following)g(ar)o(gs)e(become)h(the)f(tail)h(of)g(the)g +(command-line)g(list.)805 3373 y Fu(\017)41 b Fy(-e)i +FB(entry-point)888 3473 y FC(Specify)28 b(an)g(entry)g(point)h(for)f(a) +g(pr)o(ogram.)47 b(The)28 b FB(entry-point)f FC(is)h(a)g(variable)f +(that)888 3573 y(is)i(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 +3672 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 3772 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 +b(top)g(level)g(passes)g(contr)o(ol)h(to)888 3871 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 3971 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 +4071 y(without)26 b(opening)f(the)f Fy(scsh)f FC(package)g(to)i(access) +e(the)i Fy(\(command-line\))18 b FC(pr)o(oce-)888 4170 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 +(by)j(the)f Fy(\(command-line\))13 b FC(pr)o(ocedur)o(e,)888 +4270 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 4370 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 +(not)e(just)h(the)f(ar)o(guments)g(to)g(the)888 4469 +y(pr)o(ogram.)888 4599 y(A)21 b Fy(-e)g FC(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) +FB(last)f FC(action)888 4699 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(31,)g(1997)h(\226) -f(17)13 b(:)f(31)p eop +(as)888 4799 y(the)31 b(shell-script)f Fy(#!)g FC(mechanism)h(pr)o +(events)e(you)i(fr)o(om)f(putting)h(the)f FB(-e)g FC(switch)888 +4898 y(last,)21 b(wher)o(e)f(it)h(belongs.\))2051 5147 +y(132)p eop %%Page: 133 139 -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 +133 138 bop 490 614 a Fu(\017)41 b Fy(-s)i FB(script)573 +714 y FC(Specify)28 b(a)h(\002le)h(to)g(load.)51 b(A)29 +b Fy(-ds)f FC(\(do-script\))h(or)g Fy(-dm)g FC(\(do-module\))f(switch)j +(oc-)573 814 y(curring)26 b(earlier)e(in)j(the)e(switch)i(list)f(gives) +g(the)g(place)f(wher)o(e)g(the)h(script)g(should)573 +913 y(be)h(loaded.)46 b(If)27 b(ther)o(e)g(is)i(no)f +Fy(-ds)e FC(or)i Fy(-dm)f FC(switch,)j(then)e(the)g(script)g(is)g +(loaded)f(at)573 1013 y(the)d(end)f(of)h(switch)g(scanning,)h(into)f +(the)g(module)g(that)g(is)g(curr)o(ent)e(at)h(the)h(end)g(of)573 +1112 y(switch)d(scanning.)573 1243 y(W)-8 b(e)16 b(use)h(the)f +Fy(-ds)g FC(switch)h(to)g(violate)f(left-to-right)g(switch)h(execution) +g(or)o(der)e(as)h(the)573 1343 y Fy(-s)g FC(switch)j(is)e +FB(r)o(equir)o(ed)h FC(to)g(be)f(last)g(\(because)g(of)g(the)g +Fy(#!)g FC(machinery\),)h(independent)573 1443 y(of)j(when/wher)o(e)g +(in)g(the)g(switch-pr)o(ocessing)g(or)o(der)f(it)h(should)g(be)g +(loaded.)573 1574 y(When)29 b(the)f(scsh)h(top-level)f(constr)o(ucts)h +(the)f(scsh)h(command-line)g(in)f(this)h(case,)573 1673 +y(it)j(takes)g FB(script)f FC(to)i(be)e(the)h(pr)o(ogram)g(name.)59 +b(This)32 b(switch)h(terminates)f(switch)573 1773 y(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 1872 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 2035 y Fu(\017)41 b Fy(-sfd)h FB(num)573 2134 y FC(Loads)36 +b(the)g(script)h(fr)o(om)f(\002le)g(descriptor)g FB(num)p +FC(.)72 b(This)37 b(switch)g(is)g(like)g(the)f Fy(-s)573 +2234 y FC(switch,)24 b(except)f(that)g(the)g(script)h(is)f(loaded)g(fr) +o(om)g(one)g(of)h(the)f(pr)o(ocess')g(open)g(in-)573 +2333 y(put)18 b(\002le)f(descriptors.)25 b(For)18 b(example,)f(to)h +(have)f(the)h(script)g(loaded)f(fr)o(om)g(standar)o(d)573 +2433 y(input,)k(specify)f Fy(-sfd)42 b(0)p FC(.)490 2595 +y Fu(\017)f Fy(--)573 2695 y FC(T)-8 b(erminate)39 b(ar)o(gument)f +(scanning)i(and)e(start)h(up)g(scsh)g(in)g(interactive)g(mode.)573 +2794 y(If)c(the)h(ar)o(gument)g(list)g(just)h(r)o(uns)g(out,)i(without) +f(either)d(a)h(terminating)g Fy(-s)f FC(or)573 2894 y +Fy(--)j FC(ar)o(g,)43 b(then)d(scsh)f(also)h(starts)f(up)g(in)h +(interactive)e(mode,)44 b(with)c(an)f(empty)573 2994 +y Fy(command-line-arg)o(um)o(ent)o(s)28 b FC(list)35 +b(\(for)f(example,)j(simply)e(entering)f Fy(scsh)f FC(at)h(a)573 +3093 y(shell)21 b(pr)o(ompt)g(with)g(no)h(ar)o(gs)e(at)g(all\).)573 +3224 y(When)29 b(the)f(scsh)h(top-level)f(constr)o(ucts)h(the)f(scsh)h +(command-line)g(in)f(this)h(case,)573 3324 y(it)e(takes)f +Fy("scsh")e FC(to)j(be)f(the)g(pr)o(ogram)g(name.)43 +b(This)27 b(switch)g(terminates)g(switch)573 3423 y(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 3523 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 3685 y Fu(\017)41 b Fy(-ds)573 3785 y FC(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 3884 y(switch)23 +b(list)f FB(must)g FC(be)g(terminated)f(by)h(a)g Fy(-s)42 +b FB(script)22 b FC(switch.)30 b(The)22 b(script)g(is)g(loaded)573 +3984 y(into)f(the)g(package)f(that)h(is)g(curr)o(ent)f(at)g(the)h +Fy(-ds)f FC(switch.)490 4146 y Fu(\017)41 b Fy(-dm)573 +4246 y FC(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 +4345 y Fy(config)14 b FC(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 +4445 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 4545 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 +(same)f(as)g(as)g(it)h(was)573 4644 y(befor)o(e.)573 +4775 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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +4875 y(48)k(module)h(language.)1735 5147 y(133)p eop %%Page: 134 140 -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 +134 139 bop 681 614 a FA(9.1.5)81 b(The)20 b(meta)f(argument)681 +809 y FC(The)32 b(scsh)i(switch)f(parser)f(takes)g(a)g(special)g +(command-line)h(switch,)j(a)d(single)g(back-)681 908 +y(slash)20 b(called)e(the)i(\223meta-ar)o(gument,\224)d(which)k(is)f +(useful)f(for)g(shell)h(scripts.)26 b(If)19 b(the)h(initial)681 +1008 y(command-line)j(ar)o(gument)g(is)h(a)f(\223)p Fy(\\)p +FC(\224)e(ar)o(gument,)j(followed)f(by)g(a)g(\002lename)h(ar)o(gument) +681 1108 y FB(fname)p FC(,)e(scsh)h(will)h(open)e(the)h(\002le)g +FB(fname)f FC(and)g(r)o(ead)f(mor)o(e)h(ar)o(guments)g(fr)o(om)g(the)h +(second)681 1207 y(line)29 b(of)g(this)h(\002le.)51 b(This)29 +b(list)h(of)f(ar)o(guments)g(will)h(then)f(r)o(eplace)f(the)h(\223)p +Fy(\\)p FC(\224)f(ar)o(gument\227)681 1307 y FB(i.e.)p +FC(,)21 b(the)g(new)h(ar)o(guments)f(ar)o(e)f(inserted)h(in)h(fr)o(ont) +f(of)g FB(fname)p FC(,)g(and)g(the)g(ar)o(gument)g(parser)681 +1407 y(r)o(esumes)27 b(ar)o(gument)g(scanning.)48 b(This)28 +b(is)g(used)g(to)g(over)o(come)f(a)g(limitation)i(of)f(the)g +Fy(#!)681 1506 y FC(featur)o(e:)23 b(the)c Fy(#!)g FC(line)h(can)f +(only)i(specify)e(a)g(single)h(ar)o(gument)f(after)f(the)i(interpr)o +(eter)-6 b(.)24 b(For)681 1606 y(example,)i(we)h(might)g(hope)g(the)f +(following)i(scsh)f(script,)g Fy(ekko)p FC(,)f(would)h(implement)g(a) +681 1705 y(simple-minded)21 b(version)g(of)g(the)g(Unix)f +Fy(echo)f FC(pr)o(ogram:)888 1911 y Fy(#!/usr/local/bin/)o(sc)o(sh)37 +b(-e)43 b(main)f(-s)888 2011 y(!#)888 2110 y(\(define)f(\(main)h +(args\))976 2210 y(\(map)f(\()p Fz(\025)e Fy(\(arg\))j(\(display)e +(arg\))i(\(display)e(")j("\)\))1193 2310 y(\(cdr)f(args\)\))976 +2409 y(\(newline\)\))681 2615 y FC(The)21 b(idea)e(would)j(be)e(that)h +(the)g(command)888 2767 y Fy(ekko)42 b(Hi)h(there.)681 +2919 y FC(would)21 b(by)g(expanded)e(by)i(the)g Fy(exec\(2\))d +FC(kernel)i(call)h(into)888 3125 y Fy(/usr/local/bin/sc)o(sh)37 +b(-e)43 b(main)f(-s)h(ekko)e(Hi)i(there.)681 3331 y FC(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 Fy(ekko)p FC(,)f(call)g(the)h(entry)g(point)681 +3430 y(on)k(the)g(command-line)g(list)888 3583 y Fy(\(main)42 +b('\("ekko")e("Hi")i("there."\)\))681 3735 y FC(and)20 +b(exit.)805 3868 y(Unfortunately)-9 b(,)34 b(the)e(Unix)g +Fy(exec\(2\))d FC(syscall's)j(support)g(for)g(scripts)g(is)g(not)g +(very)681 3968 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 +Fy(#!)f FC(line)681 4068 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 +(ecursive.)681 4167 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) +(accurate)681 4267 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 +(de-)681 4366 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 4500 y(In)k(the)g +Fy(ekko)f FC(example)g(above,)h(our)g Fy(#!)f FC(trigger)h(line)g(has)g +(thr)o(ee)f(ar)o(guments)g(\(\223)p Fy(-e)p FC(\224,)681 +4599 y(\223)p Fy(main)p FC(\224,)j(and)g(\223)p Fy(-s)p +FC(\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 4699 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 +(scsh)g(interpr)o(eter)e(with)j(the)f(sin-)681 4799 y(gle)j +Fy(\\)g FC(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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +4898 y(Her)o(e's)e(the)h(corr)o(ect)e(pr)o(ogram:)2051 +5147 y(134)p eop %%Page: 135 141 -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 +135 140 bop 573 614 a Fy(#!/usr/local/bin)o(/s)o(csh)37 +b(\\)573 714 y(-e)43 b(main)f(-s)573 814 y(!#)573 913 +y(\(define)f(\(main)g(args\))660 1013 y(\(map)h(\()p +Fz(\025)d Fy(\(arg\))i(\(display)g(arg\))g(\(display)g(")i("\)\))878 +1112 y(\(cdr)f(args\)\))660 1212 y(\(newline\)\))365 +1429 y FC(Now)-8 b(,)22 b(the)f(invocation)g(starts)g(as)573 +1591 y Fy(ekko)42 b(Hi)h(there.)365 1754 y FC(and)21 +b(is)g(expanded)e(by)i(exec\(2\))e(into)573 1970 y Fy(/usr/local/bin/s) +o(cs)o(h)38 b(\\)43 b(ekko)f(Hi)g(there.)365 2187 y FC(When)17 +b(scsh)h(starts)e(up,)h(it)g(expands)f(the)h(\223)p Fy(\\)p +FC(\224)e(ar)o(gument)h(into)i(the)f(ar)o(guments)f(r)o(ead)f(fr)o(om) +365 2286 y(line)21 b(two)h(of)f Fy(ekko)p FC(,)d(pr)o(oducing)j(this)g +(ar)o(gument)g(list:)573 2503 y Fy(-e)43 b(main)f(-s)g(ekko)p +573 2516 654 4 v 42 w(Hi)h(there.)922 2603 y Fu(")573 +2702 y FC(Expanded)19 b(fr)o(om)43 b Fy(\\)g(ekko)365 +2919 y FC(W)-5 b(ith)22 b(this)g(ar)o(gument)e(list,)h(pr)o(ocessing)g +(pr)o(oceeds)e(as)i(we)g(intended.)365 3209 y FA(Secondary)f(argument)f +(syntax)365 3412 y FC(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 +3512 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 +3611 y(backslash.)490 3828 y Fu(\017)41 b FC(Each)e(space)g(character)f +(terminates)h(an)h(ar)o(gument.)81 b(This)41 b(means)e(that)h(two)573 +3928 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 4114 y Fu(\017)41 b FC(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 4214 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 +4313 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 4413 +y(acter)-6 b(,)19 b(and)i FB(vice-versa)p FC(.)490 4599 +y Fu(\017)41 b FC(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 +4699 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 4799 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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +(string:)573 4898 y Fy(\(""\))p FC(.)c(The)c(grammar)h(doesn't)g(admit) +f(the)h(empty)g(list.)1735 5147 y(135)p eop %%Page: 136 142 -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(31,)g -(1997)h(\226)f(17)13 b(:)f(31)p eop +136 141 bop 805 614 a Fu(\017)41 b FC(The)35 b(backslash)g(character)e +(is)i(the)g(escape)f(character)-6 b(.)66 b(It)35 b(escapes)f +(backslash,)888 714 y(space,)d(tab,)h(and)d(newline,)j(turning)f(of)o +(f)e(their)h(special)f(functions,)k(and)c(allow-)888 +814 y(ing)k(them)f(to)g(be)f(included)h(in)g(ar)o(guments.)58 +b(The)33 b(A)t Ft(N)t(S)t(I)h FC(C)e(escape)f(sequences)888 +913 y(\()p Fy(\\b)p FC(,)36 b Fy(\\n)p FC(,)g Fy(\\r)d +FC(and)g Fy(\\t)p FC(\))g(ar)o(e)f(also)i(supported;)40 +b(these)34 b(also)g(pr)o(oduce)f(ar)o(gument-)888 1013 +y(constituents\227)p Fy(\\n)28 b FC(doesn't)f(act)g(like)g(a)f +(terminating)i(newline.)45 b(The)26 b(escape)g(se-)888 +1112 y(quence)31 b Fy(\\)p FB(nnn)g FC(for)f FB(exactly)g +FC(thr)o(ee)f(octal)i(digits)g(r)o(eads)e(as)h(the)h(character)e(whose) +890 1212 y(A)t Ft(S)t(C)t(I)t(I)21 b FC(code)d(is)h FB(nnn)p +FC(.)25 b(It)18 b(is)h(an)f(err)o(or)f(if)h(backslash)g(is)h(followed)f +(by)h(just)f(one)h(or)f(two)888 1312 y(octal)26 b(digits:)36 +b Fy(\\3Q)25 b FC(is)h(an)f(err)o(or)-6 b(.)40 b(Octal)26 +b(escapes)f(ar)o(e)f(always)i(constituent)h(chars.)888 +1411 y(Backslash)f(followed)g(by)f(other)h(chars)g(is)g(not)g(allowed)g +(\(so)g(we)f(can)h(extend)f(the)888 1511 y(escape-code)19 +b(space)h(later)g(if)h(we)g(like\).)805 1722 y(Y)-8 b(ou)21 +b(have)e(to)g(constr)o(uct)h(these)g(line-two)g(ar)o(gument)f(lines)h +(car)o(efully)-9 b(.)23 b(In)d(particular)-6 b(,)681 +1822 y(bewar)o(e)22 b(of)h(trailing)h(spaces)e(at)h(the)h(end)f(of)g +(the)h(line\227they'll)g(give)g(you)f(extra)g(trailing)681 +1921 y(empty-string)e(ar)o(guments.)k(Her)o(e's)20 b(an)h(example:)888 +2079 y Fy(#!/bin/interprete)o(r)37 b(\\)888 2178 y(foo)43 +b(bar)86 b(quux\\)41 b(yow)681 2336 y FC(would)21 b(pr)o(oduce)f(the)h +(ar)o(guments)888 2493 y Fy(\("foo")41 b("bar")h("")h("quux)e(yow"\)) +681 2775 y FA(9.1.6)81 b(Examples)805 2974 y Fu(\017)41 +b Fy(scsh)h(-dm)h(-m)f(myprog)f(-e)i(top)g(-s)f(myprog.scm)888 +3074 y FC(Load)19 b Fy(myprog.scm)c FC(into)20 b(the)f +Fy(config)e FC(package,)h(then)i(shift)f(to)h(the)f Fy(myprog)e +FC(pack-)888 3173 y(age)26 b(and)f(call)g Fy(\(top)42 +b('\("myprog.scm"\)\))p FC(,)20 b(then)27 b(exit.)40 +b(This)26 b(sort)g(of)g(invocation)888 3273 y(is)21 b(typically)g(used) +g(in)g Fy(#!)f FC(script)h(lines)g(\(see)f(below\).)805 +3455 y Fu(\017)41 b Fy(scsh)h(-c)h('\(display)d("Hello,)h(world."\)') +888 3555 y FC(A)21 b(simple)g(pr)o(ogram.)805 3737 y +Fu(\017)41 b Fy(scsh)h(-o)h(bigscheme)888 3837 y FC(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 3936 y Fy(bigscheme)p FC(.)805 4118 +y Fu(\017)41 b Fy(scsh)h(-o)h(bigscheme)d(--)j(Three)e(args)h(passed) +888 4218 y FC(Start)24 b(up)g(interactively)g(in)h(the)g(user)f +(package)f(after)g(opening)i Fy(bigscheme)p FC(.)33 b(The)888 +4318 y Fy(command-line-args)e FC(variable)36 b(in)i(the)g(scsh)g +(package)f(is)h(bound)g(to)g(the)f(list)888 4417 y Fy(\("Three")k +("args")g("passed"\))p FC(,)g(and)f(the)g Fy(\(command-line\))35 +b FC(pr)o(ocedur)o(e)j(r)o(e-)888 4517 y(turns)22 b(the)e(list)i +Fy(\("scsh")40 b("Three")h("args")g("passed"\))p FC(.)805 +4699 y Fu(\017)g FC(Pr)o(ogram)21 b Fy(ekko)888 4799 +y FC(This)g(shell)g(script,)f(called)f Fy(ekko)p FC(,)g(implements)i(a) +e(version)i(of)f(the)g(Unix)g Fy(echo)f FC(pr)o(o-)888 +4898 y(gram:)2051 5147 y(136)p eop %%Page: 137 143 -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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +137 142 bop 756 614 a Fy(#!/usr/local/bi)o(n/)o(scs)o(h)37 +b(-s)756 714 y(!#)756 814 y(\(for-each)i(\()p Fz(\025)g +Fy(\(arg\))j(\(display)e(arg\))i(\(display)e(")j("\)\))1191 +913 y(command-line-args)o(\))573 1207 y FC(Note)21 b(this)h(short)g(pr) +o(ogram)e(is)i(an)f(example)f(of)h(a)g FB(script)p FC(\227it)g +(executes)g(as)f(it)i(loads.)573 1307 y(The)f(Unix)f(r)o(ule)h(for)g +(executing)f Fy(#!)g FC(shell)i(scripts)f(causes)756 +1520 y Fy(ekko)41 b(Hello,)h(world.)573 1732 y FC(to)21 +b(expand)f(as)756 1945 y Fy(/usr/local/bin/)o(sc)o(sh)37 +b(-s)43 b(ekko)f(Hello,)f(world.)490 2223 y Fu(\017)g +FC(Pr)o(ogram)20 b Fy(ekko)573 2322 y FC(This)29 b(is)h(the)f(same)f +(pr)o(ogram,)i FB(not)f FC(as)f(a)h(script.)50 b(W)-6 +b(riting)29 b(it)g(this)h(way)f(makes)f(it)573 2422 y(possible)20 +b(to)h(compile)f(the)g(pr)o(ogram)g(\(and)f(then,)h(for)g(instance,)g +(dump)g(it)g(out)g(as)g(a)573 2522 y(heap)g(image\).)756 +2751 y Fy(#!/usr/local/bi)o(n/)o(scs)o(h)37 b(\\)756 +2850 y(-e)42 b(top)h(-s)756 2950 y(!#)756 3050 y(\(define)d(\(top)i +(args\))843 3149 y(\(for-each)e(\()p Fz(\025)e Fy(\(arg\))k(\(display)e +(arg\))i(\(display)e(")j("\)\))1279 3249 y(\(cdr)e(args\)\)\))573 +3478 y FC(The)28 b Fy(exec\(2\))c FC(expansion)k(of)g(the)g +Fy(#!)f FC(line)h(together)g(with)g(the)g(scsh)g(expansion)573 +3578 y(of)33 b(the)h(\223)p Fy(\\)43 b(ekko)p FC(\224)31 +b(meta-ar)o(gument)i(\(see)g(section)h(9.1.5\))d(gives)j(the)g +(following)573 3678 y(command-line)21 b(expansion:)756 +3907 y Fy(ekko)41 b(Hello,)h(world.)930 4006 y Fn(=)-14 +b Fu(\))87 b Fy(/usr/local/bin/s)o(cs)o(h)37 b(\\)44 +b(ekko)390 b(Hello,)41 b(world.)930 4106 y Fn(=)-14 b +Fu(\))87 b Fy(/usr/local/bin/s)o(cs)o(h)37 b(-e)43 b(top)g(-s)f(ekko)g +(Hello,)f(world.)490 4400 y Fu(\017)g FC(Pr)o(ogram)20 +b Fy(sort)573 4500 y FC(This)d(is)f(a)g(pr)o(ogram)f(to)i(r)o(eplace)e +(the)h(Unix)g Fy(sort)f FC(utility\227sorting)j(lines)e(r)o(ead)f(fr)o +(om)573 4599 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 +4699 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 4799 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 4898 y(pr)o(ogram)d(invoked)h(fr)o(om)f(the)h +Fy(top)f FC(pr)o(ocedur)o(e.)1735 5147 y(137)p eop %%Page: 138 144 -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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)p eop +138 143 bop 1071 614 a Fy(#!/usr/local/bin)o(/sc)o(sh)37 +b(\\)1071 714 y(-dm)42 b(-m)h(sort-toplevel)38 b(-e)43 +b(top)f(-s)1071 814 y(!#)1071 1013 y(;;;)g(This)g(is)h(a)g(sorting)e +(module.)g(TOP)h(procedure)e(exports)1071 1112 y(;;;)i(the)h +(functionality)38 b(as)43 b(a)g(Unix)f(program)e(akin)i(to)h +(sort\(1\).)1071 1212 y(\(define-structur)o(es)37 b(\(\(sort-struct)h +(\(export)j(sort-list)2858 1312 y(sort-vector!\)\))1943 +1411 y(\(sort-toplevel)d(\(export)i(top\)\)\))1158 1511 +y(\(open)i(scheme\))1158 1710 y(\(begin)f(\(define)g(\(sort-list)e +(elts)j(<=\))h(...\))1463 1810 y(\(define)e(\(sort-vec!)e(vec)k(<=\))86 +b(...\))1463 2009 y(;;)43 b(Parse)f(the)g(command)f(line)h(and)1463 +2109 y(;;)h(sort)f(stdin)f(to)i(stdout.)1463 2208 y(\(define)e(\(top)h +(args\))1594 2308 y(...\)\)\))888 2491 y FC(The)18 b(expansion)h(below) +g(shows)g(how)g(the)f(command-line)h(scanner)f(\(1\))f(loads)h(the)888 +2583 y(con\002g)i(\002le)g Fy(sort)d FC(\(written)i(in)h(the)f(Scheme)g +(48)f(module)i(language\),)e(\(2\))g(switches)888 2674 +y(to)33 b(the)f(package)f(underlying)i(the)f Fy(sort-toplevel)27 +b FC(str)o(uctur)o(e,)34 b(\(3\))d(calls)h Fy(\(top)888 +2765 y('\("sort")41 b("foo")g("bar"\)\))18 b FC(in)j(the)g(package,)f +(and)g(\002nally)h(\(4\))f(exits.)888 2997 y Fh(sort)40 +b(foo)g(bar)888 3089 y Fc(=)-13 b Fb(\))79 b Fh(/usr/local/bin/scsh)43 +b(\\)d(sort)1177 b(foo)40 b(bar)888 3180 y Fc(=)-13 b +Fb(\))79 b Fh(/usr/local/bin/scsh)43 b(-dm)d(-m)g(sort-toplevel)i(-e)e +(top)f(-s)h(sort)g(foo)g(bar)888 3352 y FC(An)21 b(alternate)f(method)h +(would)g(have)g(used)f(a)1071 3513 y Fy(-n)43 b(#f)g(-o)f +(sort-toplevel)888 3674 y FC(sequence)21 b(of)g(switches)h(to)f +(specify)f(a)g(top-level)h(package.)805 3869 y(Note)d(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 3969 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 +Fy(top)p FC(.)37 b(Even)24 b(if)681 4068 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 4168 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 4267 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 4367 y Fy(#!)d FC(ar)o(gs)g(in)h(the)g(header\))e +(or)i(as)f(a)h(compiled)g(heap)f(image.)681 4616 y FA(9.1.7)81 +b(Process)20 b(exit)f(values)681 4799 y FC(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 4898 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,)2051 5147 y(138)p eop %%Page: 139 145 -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(31,)g -(1997)h(\226)f(17)13 b(:)f(31)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 +139 144 bop 365 614 a FC(scsh)21 b(dies)e(with)i(exit)f(code)f(0.)25 +b(For)20 b(example,)f(a)g(scsh)i(pr)o(ocess)e(whose)i(top-level)e(is)h +(spec-)365 714 y(i\002ed)h(by)f(a)g Fy(-c)43 b FB(exp)20 +b FC(or)g(a)g Fy(-e)43 b FB(entry)20 b FC(entry)h(point)g(ignor)o(es)g +(the)f(value)g(pr)o(oduced)f(by)i(eval-)365 814 y(uating)f +FB(exp)f FC(and)g(calling)g FB(entry)p FC(,)h(r)o(espectively)-9 +b(.)24 b(If)19 b(these)g(computations)i(terminate)e(with)365 +913 y(no)j(err)o(ors,)d(the)i(scsh)h(pr)o(ocess)e(exits)h(with)g(an)g +(exit)f(code)h(of)g(0.)490 1061 y(T)-8 b(o)21 b(r)o(eturn)f(a)g +(speci\002c)h(exit)g(status,)f(use)h(the)g Fy(exit)e +FC(pr)o(ocedur)o(e)g(explicitly)-9 b(,)20 b FB(e.g.)p +FC(,)573 1160 y Fy(scsh)42 b(-c)h(\\)660 1260 y("\(exit)e +(\(status:exit-val)c(\(run)42 b(\(|)h(\(fmt\))e(\(mail)h +(shivers\)\)\)\)\)")365 1596 y Fw(9.2)99 b(The)25 b(scsh)h(virtual)f +(machine)365 1840 y FC(T)-8 b(o)31 b(r)o(un)f(the)g(Scheme)f(48)g +(implementation)i(of)f(scsh,)j(you)d(r)o(un)g(a)g(specially)f +(modi\002ed)365 1940 y(copy)e(of)g(the)g(Scheme)f(48)g(virtual)g +(machine)h(with)h(a)e(scsh)h(heap)g(image.)43 b(The)27 +b(scsh)g(bi-)365 2039 y(nary)22 b(is)h(actually)f(nothing)i(but)e(a)g +(small)h(cover)f(pr)o(ogram)f(that)i(invokes)g(the)f(byte-code)365 +2139 y(interpr)o(eter)28 b(on)j(the)e(scsh)h(heap)f(image)h(for)f(you.) +52 b(This)30 b(allows)h(you)f(to)g(simply)g(start)365 +2238 y(up)23 b(an)g(interactive)g(scsh)h(fr)o(om)e(a)h(command)g(line,) +h(as)f(well)h(as)e(write)i(shell)f(scripts)h(that)365 +2338 y(begin)d(with)h(the)f(simple)g(trigger)573 2512 +y Fy(#!/usr/local/bin)o(/s)o(csh)37 b(-s)490 2734 y FC(Y)-8 +b(ou)26 b(can)f(also)h(dir)o(ectly)e(execute)h(the)g(virtual)g +(machine,)h(which)h(takes)e(its)g(own)i(set)365 2834 +y(of)21 b(command-line)h(switches..)27 b(For)21 b(example,)f(this)i +(command)f(starts)g(the)g(vm)h(up)f(with)365 2934 y(a)g(1Mwor)o(d)e +(heap)h(\(split)h(into)h(two)f(semispaces\):)573 3108 +y Fy(scshvm)41 b(-o)i(scshvm)e(-h)i(1000000)d(-i)j(scsh.image)c(arg1)j +(arg2)g(...)365 3282 y FC(The)34 b(vm)f(peels)g(of)o(f)g(initial)h(vm)f +(ar)o(guments)g(up)h(to)f(the)h Fy(-i)e FC(heap)h(image)g(ar)o(gument,) +365 3382 y(which)46 b(terminates)g(vm)f(ar)o(gument)g(parsing.)99 +b(The)45 b(r)o(est)f(of)i(the)f(ar)o(guments)g(ar)o(e)365 +3481 y(passed)d(of)o(f)g(to)h(the)f(scsh)h(top-level.)91 +b(Scsh's)43 b(top-level)f(r)o(emoves)g(scsh)h(switches,)365 +3581 y(as)k(discussed)h(in)f(the)h(pr)o(evious)f(section;)61 +b(the)47 b(r)o(est)g(show)h(up)f(as)g(the)h(value)f(of)365 +3681 y Fy(command-line-argu)o(me)o(nts)o FC(.)490 3828 +y(Dir)o(ectly)25 b(executing)g(the)g(vm)h(can)e(be)h(useful)g(to)h +(specify)f(non-standar)o(d)f(switches,)365 3928 y(or)g(invoke)g(the)g +(virtual)f(machine)g(on)h(special)f(heap)g(images,)h(which)h(can)e +(contain)h(pr)o(e-)365 4027 y(compiled)d(scsh)h(pr)o(ograms)e(with)h +(their)g(own)h(top-level)e(pr)o(ocedur)o(es.)365 4337 +y FA(9.2.1)81 b(VM)21 b(arguments)365 4550 y FC(The)g(vm)g(takes)f(ar)o +(guments)h(in)g(the)g(following)h(form:)573 4724 y Fy(scshvm)41 +b([)p FB(meta-ar)o(g)n Fy(])i([)p FB(vm-options)1729 +4694 y Fv(+)1784 4724 y Fy(])g([)p FB(end-option)f(scheme-ar)o(gs)o +Fy(])365 4898 y FC(wher)o(e)1735 5147 y(139)p eop %%Page: 140 146 -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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p eop +140 145 bop 938 601 a FB(meta-ar)o(g:)159 b Fy(\\)43 +b FB(\002lename)938 800 y(vm-option)n FC(:)113 b Fy(-h)43 +b FB(heap-size-in-words)1418 900 y Fy(-s)g FB(stack-size-in-words)1418 +1000 y Fy(-o)g FB(object-\002le-name)938 1199 y(end-option:)98 +b Fy(-i)43 b FB(image-\002le-name)1418 1298 y Fy(--)805 +1471 y FC(The)36 b(vm's)g(meta-switch)f(\223)p Fy(\\)43 +b FB(\002lename)p FC(\224)35 b(is)h(handled)f(the)h(same)f(as)g(scsh's) +i(meta-)681 1571 y(switch,)21 b(and)f(serves)h(the)g(same)f(purpose.) +681 1832 y FA(VM)g(options)681 2020 y FC(The)f Fy(-o)42 +b FB(object-\002le-name)19 b FC(switch)h(tells)f(the)g(vm)g(wher)o(e)g +(to)g(\002nd)g(r)o(elocation)g(information)681 2120 y(for)27 +b(its)i(for)o(eign-function)f(calls.)47 b(Scsh)28 b(will)g(use)g(a)g +(pr)o(e-compiled)e(default)h(if)h(it)g(is)g(not)681 2220 +y(speci\002ed.)c(Scsh)19 b FB(must)g FC(have)f(this)i(information)g(to) +f(r)o(un,)h(since)f(scsh's)h(syscall)f(interfaces)681 +2319 y(ar)o(e)g(done)i(with)h(for)o(eign-function)e(calls.)805 +2448 y(The)i Fy(-h)g FC(and)f Fy(-s)h FC(options)h(tell)g(the)f(vm)g +(how)h(much)g(space)e(to)i(allocate)e(for)h(the)h(heap)681 +2547 y(and)i(stack.)39 b(The)25 b(heap)g(size)f(value)h(is)h(the)f +(total)h(number)f(of)g(wor)o(ds)g(allocated)g(for)g(the)681 +2647 y(heap;)30 b(this)f(space)e(is)h(then)g(split)g(into)g(two)h +(semi-spaces)e(for)g(Scheme)h(48's)f(stop-and-)681 2747 +y(copy)21 b(collector)-6 b(.)681 3008 y FA(End)20 b(options)681 +3196 y FC(End)31 b(options)h(terminate)f(ar)o(gument)g(parsing.)57 +b(The)31 b Fy(-i)f FC(switch)i(is)g(followed)g(by)f(the)681 +3295 y(name)23 b(of)h(a)f(heap)g(image)h(for)f(the)h(vm)g(to)g +(execute.)33 b(The)23 b FB(image-\002le-name)g FC(string)h(is)g(also) +681 3395 y(taken)d(to)i(be)e(the)h(name)g(of)g(the)g(pr)o(ogram)f +(being)h(executed)f(by)h(the)g(VM;)f(this)i(name)f(be-)681 +3495 y(comes)e(the)h(head)e(of)h(the)g(ar)o(gument)g(list)g(passed)g +(to)g(the)g(heap)g(image's)g(top-level)g(entry)681 3594 +y(point.)25 b(The)17 b(tail)g(of)g(the)g(ar)o(gument)g(list)g(is)h +(constr)o(ucted)f(fr)o(om)g(all)g(following)i(ar)o(guments.)805 +3723 y(The)k Fy(--)f FC(switch)h(terminates)g(ar)o(gument)f(parsing)h +(without)h(giving)g(a)e(speci\002c)h(heap)681 3822 y(image;)k(the)e(vm) +h(will)g(start)f(up)g(using)h(a)f(default)f(heap)h(\(whose)g(location)h +(is)g(compiled)681 3922 y(into)g(the)f(vm\).)38 b(All)25 +b(the)h(following)g(ar)o(guments)f(comprise)g(the)h(tail)f(of)g(the)g +(list)h(passed)681 4022 y(of)o(f)20 b(to)h(the)g(heap)f(image's)h +(top-level)f(pr)o(ocedur)o(e.)805 4150 y(Notice)g(that)g(you)g(ar)o(e)f +(not)h(allowed)g(to)g(pass)f(ar)o(guments)h(to)g(the)g(heap)f(image's)h +(top-)681 4250 y(level)g(pr)o(ocedur)o(e)f(\()p FB(e.g.)o +FC(,)i(scsh\))g(without)h(delimiting)f(them)g(with)h +Fy(-i)e FC(or)h Fy(--)f FC(\003ags.)681 4511 y FA(9.2.2)81 +b(Inserting)19 b(interpreter)g(triggers)h(into)g(heap)g(images)681 +4699 y FC(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 4799 +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 +4898 y(character)23 b(\()r(A)t Ft(S)t(C)t(I)t(I)k FC(12\).)35 +b(This)26 b(means)e(that)h(you)g(can)f(insert)h(a)f(\223)p +Fy(#!)p FC(\224)f(trigger)h(line)h(into)h(a)2051 5147 +y(140)p eop %%Page: 141 147 -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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +141 146 bop 365 614 a FC(heap)16 b(image,)h(making)g(it)f(a)g(form)g +(of)g(executable)f(\223shell)h(script.\224)24 b(Since)16 +b(the)g(vm)h(r)o(equir)o(es)365 714 y(multiple)23 b(ar)o(guments)e(to)h +(be)g(given)g(on)g(the)g(command)g(line,)h(you)f(must)g(use)g(the)g +(meta-)365 814 y(switch.)27 b(Her)o(e's)20 b(an)g(example)g(heap-image) +g(header:)573 1009 y Fy(#!/usr/local/lib)o(/s)o(csh)o(/s)o(csh)o(vm)37 +b(\\)573 1109 y(-o)43 b(/usr/local/lib/)o(scs)o(h/)o(scs)o(hv)o(m)37 +b(-i)573 1209 y(...)42 b FB(Y)-9 b(our)21 b(heap)f(image)g(goes)h(her)o +(e)44 b Fy(...)365 1535 y FA(9.2.3)81 b(Inserting)20 +b(a)g(double-level)e(trigger)i(into)g(Scheme)f(programs)365 +1722 y FC(If)j(you'r)o(e)f(a)g(ner)o(d,)g(you)h(may)g(enjoy)h(doing)f +(a)f(double-level)h(machine)g(shift)g(in)g(the)g(trig-)365 +1822 y(ger)f(line)g(of)g(your)g(Scheme)f(pr)o(ograms)g(with)i(the)f +(following)h(magic:)573 2009 y Fh(#!/usr/local/lib/scsh/scshvm)45 +b(\\)573 2101 y(-o)40 b(/usr/local/lib/scsh/scshvm)45 +b(-i)39 b(/usr/local/lib/scsh/scsh.ima)q(ge)45 b(-s)573 +2192 y(!#)573 2283 y(...)40 b Fi(Y)-8 b(our)18 b(Scheme)h(pr)o(ogram)h +(goes)f(her)o(e)39 b Fh(...)365 2636 y Fw(9.3)99 b(Compiling)26 +b(scsh)f(programs)365 2854 y FC(Scsh)30 b(allows)h(you)f(to)g(cr)o +(eate)e(a)i(heap)f(image)h(with)g(your)h(own)f(top-level)g(pr)o(ocedur) +o(e.)365 2954 y(Adding)21 b(the)g(pair)f(of)g(lines)573 +3150 y Fy(#!/usr/local/lib)o(/s)o(csh)o(/s)o(csh)o(vm)37 +b(\\)573 3249 y(-o)43 b(/usr/local/lib/)o(scs)o(h/)o(scs)o(hv)o(m)37 +b(-i)365 3445 y FC(to)21 b(the)g(top)g(of)g(the)g(heap)f(image)h(will)g +(turn)g(it)g(into)h(an)f(executable)e(Unix)i(\002le.)490 +3572 y(Y)-8 b(ou)22 b(can)e(cr)o(eate)f(heap)h(images)h(with)h(the)f +(following)h(two)f(pr)o(ocedur)o(es.)365 3724 y Fy(\(dump-scsh-progra)o +(m)37 b FB(main)21 b(fname)p Fy(\))87 b Fu(\000)-15 b(!)88 +b FB(unde\002ned)585 b FC(pr)o(ocedur)o(e)573 3867 y(This)28 +b(pr)o(ocedur)o(e)e(writes)i(out)g(a)f(scsh)i(heap)e(image.)46 +b(When)28 b(the)g(heap)g(image)f(is)573 3967 y(executed)f(by)i(the)g +(Scheme)f(48)g(vm,)i(it)f(will)g(call)g(the)g FB(main)f +FC(pr)o(ocedur)o(e,)g(passing)573 4066 y(it)d(the)h(vm's)g(ar)o(gument) +f(list.)37 b(When)24 b Fy(main)f FC(r)o(eturns)h(an)g(integer)g(value)g +Fz(i)p FC(,)h(the)f(vm)573 4166 y(exits)16 b(with)i(exit)e(status)g +Fz(i)p FC(.)24 b(The)16 b(Scheme)g(vm)h(will)g(parse)f(command-line)h +(switches)573 4265 y(as)30 b(described)f(in)i(section)g(9.2.1;)i(r)o +(emaining)e(ar)o(guments)f(form)g(the)h(tail)f(of)g(the)573 +4365 y(command-line)19 b(list)g(that)g(is)f(passed)g(to)h +Fy(main)p FC(.)k(\(The)c(head)f(of)g(the)h(list)g(is)g(the)g(name)573 +4465 y(of)h(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 4564 +y(described)g(for)g(scsh)h(in)h(section)f(9.1.4\))e(is)i(not)g +(performed.)573 4699 y(The)33 b(heap)g(image)h(cr)o(eated)d(by)i +Fy(dump-scsh-program)27 b FC(has)33 b(unused)h(code)f(and)573 +4799 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 4898 y(ages.)1735 +5147 y(141)p eop %%Page: 142 148 -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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +142 147 bop 681 614 a Fy(\(dump-scsh)39 b FB(fname)p +Fy(\))87 b Fu(\000)-14 b(!)87 b FB(unde\002ned)1125 b +FC(pr)o(ocedur)o(e)888 754 y(This)20 b(pr)o(ocedur)o(e)e(writes)i(out)g +(a)f(heap)g(image)g(with)i(the)f(standar)o(d)d(scsh)k(top-level.)888 +853 y(When)32 b(the)f(image)g(is)g(r)o(esumed)f(by)h(the)g(vm,)j(it)d +(will)h(parse)e(and)g(execute)g(scsh)888 953 y(command-line)22 +b(switches)f(as)g(described)e(in)i(section)h(9.1.4.)888 +1085 y(Y)-8 b(ou)31 b(can)f(use)g(this)g(pr)o(ocedur)o(e)e(to)i(write)g +(out)g(custom)h(scsh)f(heap)f(images)h(that)888 1184 +y(have)21 b(speci\002c)f(packages)g(pr)o(eloaded)f(and)h(start)h(up)f +(in)i(speci\002c)e(packages.)805 1350 y(Unfortunately)-9 +b(,)18 b(Scheme)f(48)f(does)h(not)h(support)g(separate)e(compilation)i +(of)f(Scheme)681 1449 y(\002les)25 b(or)f(Scheme)g(modules.)37 +b(The)25 b(only)g(way)f(to)h(compile)g(is)g(to)g(load)f(sour)o(ce)g +(and)g(then)681 1549 y(dump)30 b(out)h(a)f(heap)g(image.)54 +b(One)31 b(occasionally)g(hears)f(r)o(umours)h(that)g(this)g(is)g +(being)681 1648 y(addr)o(essed)18 b(by)j(the)g(Scheme)g(48)e +(development)i(team.)681 1925 y Fw(9.4)99 b(Statically)26 +b(linking)f(heap)g(images)681 2139 y FC(The)32 b(static)g(heap)g +(linker)h(converts)f(a)g(Scheme)g(48)f(bytecode)h(image)g(contained)h +(in)g(a)681 2239 y(.image)25 b(\002le)h(to)h(a)e(C)h(r)o(epr)o +(esentation.)40 b(This)26 b(C)g(code)g(is)g(then)h(compiled)f(and)f +(linked)i(in)681 2338 y(with)j(a)f(virtual)g(machine,)i(pr)o(oducing)f +(a)e(single)j(executable.)50 b(Some)29 b(of)g(the)h(bene\002ts)681 +2438 y(ar)o(e:)805 2625 y Fu(\017)41 b FC(Instantaneous)22 +b(start-up)e(time.)805 2789 y Fu(\017)41 b FC(Impr)o(oved)16 +b(paging;)h(scsh)g(images)f(can)g(be)f(shar)o(ed)g(between)h(dif)o(fer) +o(ent)e(pr)o(ocesses.)805 2953 y Fu(\017)41 b FC(V)-8 +b(astly)21 b(r)o(educed)d(GC)j(copying\227the)g(whole)g(initial)g +(image)f(is)h(moved)f(out)h(of)f(the)888 3053 y(heap,)g(and)h(neither)g +(traced)e(nor)i(copied.)805 3217 y Fu(\017)41 b FC(Result)22 +b(pr)o(ogram)e(no)h(longer)h(depends)e(on)h(the)g(\002lesystem)h(for)e +(its)h(initial)h(image.)805 3404 y(The)f(static)g(heap)f(linker)h +(takes)f(ar)o(guments)h(in)g(the)g(following)h(form:)888 +3543 y Fy(scsh-hlink)40 b FB(image)j(executable)h Fy([)p +FB(option)e Fy(...])681 3682 y FC(It)20 b(r)o(eads)f(in)h(the)h(heap)e +(image)h FB(image)p FC(,)g(translates)f(it)i(into)g(C)f(code,)f +(compiles)i(the)g(C)f(code,)681 3781 y(and)c(links)i(it)f(against)f +(the)h(scsh)g(vm,)h(pr)o(oducing)e(the)h(standalone)g(binary)f(\002le)h +FB(executable)p FC(.)805 3897 y(Each)27 b(C)g(\002le)g(r)o(epr)o +(esents)e(part)i(of)g(the)g(heap)f(image)h(as)g(a)f(constant)i(C)f +Fy(long)e FC(vector)681 3989 y(that)20 b(looks)i(something)h(like)e +(this:)681 4168 y Fh(const)79 b(long)41 b(p116[]={0x882,0x24,0x19,)1465 +4259 y(0x882,\(long\)\(&p19[785]\)+7,\(l)q(ong\))q(\(&p1)q(19[12)q +(5]\)+)q(7,)1465 4350 y(0x882,\(long\)\(&p119[128]\)+7,\()q(long)q +(\)\(&p)q(119[1)q(31]\))q(+7,)1465 4442 y +(0x882,\(long\)\(&p102[348]\)+7,\()q(long)q(\)\(&p)q(3[114)q(]\)+7)q(,) +1465 4533 y(0xfc2,0x2030200,0x7100209,0x)q(1091)q(002,)q(0x1c0)q(75a,) +1465 4624 y(0x882,\(long\)\(&p29[1562]\)+7,\()q(long)q(\)\(&p)q(119[1)q +(37]\))q(+7,)1465 4716 y(0x882,\(long\)\(&p78[692]\)+7,\(l)q(ong\))q +(\(&p1)q(19[14)q(0]\)+)q(7,)1622 4807 y(.)1622 4898 y(.)2051 +5147 y FC(142)p eop %%Page: 143 149 -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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)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 +143 148 bop 1307 614 a Fh(.)1150 706 y(};)490 893 y FC(T)-7 +b(ranslating)21 b(to)g(a)g(C)g(declaration)f(gives)h(us)g(fr)o(eedom)f +(fr)o(om)h(the)g(various)g(object-\002le)365 993 y(formats.)669 +963 y Fv(2)735 993 y FC(Note)h(that)g(the)f(const)i(declaration)e +(allows)h(the)g(compiler)g(to)g(put)g(this)h(array)365 +1092 y(in)e(the)f(text)f(pages)h(of)g(the)g(executable.)k(The)19 +b(heap)h(is)g(split)g(into)h(parts)f(because)f(many)h(C)365 +1192 y(compilers)i(cannot)f(handle)f(multi-megabyte)h(initialised)g +(vector)g(declarations.)490 1316 y(The)g(allowed)f(options)i(to)f(the)g +(heap)g(linker)g(ar)o(e:)490 1504 y Fu(\017)41 b Fy(--temp)g +FB(dir)573 1603 y FC(The)27 b(temporary)f(dir)o(ectory)g(to)i(hold)f +(.c)g(and)f(.o)h(\002les.)44 b(The)27 b(default)f(is)h(typically)573 +1703 y(con\002gur)o(ed)h(to)h(be)f Fy(/usr/tmp)p FC(,)f(and)h(can)g(be) +g(overridden)g(by)g(the)h(envir)o(onment)573 1803 y(variable)19 +b Fy(TMPDIR)p FC(.)f(Example:)756 1941 y Fy(--temp)41 +b(/tmp)490 2112 y Fu(\017)g Fy(--cc)h FB(command)573 +2212 y FC(The)25 b(command)g(to)h(r)o(un)g(the)f(C)g(compiler)-6 +b(.)38 b(The)25 b(default)g(can)f(be)h(overridden)f(by)573 +2311 y(the)d(envir)o(onment)g(variable)f Fy(CC)p FC(.)f(Example:)756 +2450 y Fy(--cc)41 b("gcc)h(-g)h(-O")490 2621 y Fu(\017)e +Fy(--ld)h FB(command)573 2720 y FC(The)33 b(ar)o(guments)g(to)g(r)o(un) +h(the)g(C)f(compiler)g(as)g(a)g(linker)-6 b(.)63 b(The)33 +b(default)f(can)h(be)573 2820 y(overridden)20 b(by)h(the)g(envir)o +(onment)g(variable)e Fy(LDFLAGS)p FC(.)f(Example:)756 +2959 y Fy(--ld)41 b("-Wl,-E")490 3129 y Fu(\017)g Fy(--libs)g +FB(libs)573 3229 y FC(The)25 b(libraries)f(needed)g(to)h(link)h(the)e +(VM)h(and)f(heap.)37 b(The)25 b(default)f(can)g(be)h(over)o(-)573 +3329 y(ridden)20 b(by)h(the)g(envir)o(onment)g(variable)f +Fy(LIBS)p FC(.)e(Example:)756 3467 y Fy(--libs)41 b("-ldld)g(-lld)h +(-lm")490 3655 y FC(Be)20 b(warned)g(that)h(the)g(curr)o(ent)f(heap)g +(linker)h(has)g(many)g(shortcomings.)490 3842 y Fu(\017)41 +b FC(It)30 b(is)g(extr)o(emely)e(slow)-8 b(.)54 b(Really)-9 +b(,)32 b(r)o(eally)c(slow)-8 b(.)54 b(T)-7 b(ranslating)29 +b(the)h(standar)o(d)e(scsh)573 3941 y(heap)42 b(image)h(into)g(a)f +(standalone)h(binary)f(takes)h(well)g(over)f(an)h(hour)g(on)g(a)573 +4041 y(40Mb/133Mhz)26 b(Pentium)31 b(system.)54 b(A)30 +b(memory-starved)f(486)f(could)i(take)g(all)573 4141 +y(night.)490 4305 y Fu(\017)41 b FC(It)c(cannot)g(be)f(applied)g(to)i +(itself.)73 b(The)37 b(curr)o(ent)f(implementation)i(works)f(by)573 +4405 y(r)o(eplacing)i(some)i(of)f(the)g(heap-dumping)g(code.)83 +b(This)40 b(means)h(you)f(cannot)573 4504 y(load)j(the)g(heap-linker)g +(code)g(into)h(a)f(scsh)g(system)h(and)f(subsequently)i(use)573 +4604 y Fy(dump-scsh-progra)o(m)15 b FC(to)21 b(cr)o(eate)e(a)h +(heap-linker)g(heap)h(image.)490 4768 y Fu(\017)41 b +FC(The)21 b(interface)e(leaves)h(a)h(lot)g(to)g(be)f(desir)o(ed.)p +365 4821 1146 4 v 450 4875 a Fq(2)485 4898 y Ft(This)c(idea)h(is)g(due) +f(to)h(Jonathan)f(Rees.)1735 5147 y FC(143)p eop %%Page: 144 150 -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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)p eop +144 149 bop 988 614 a FA(\226)41 b FC(It)19 b(r)o(equir)o(es)f(the)h +(heap)g(image)g(to)g(be)g(r)o(efer)o(enced)d(by)j(a)f(\002le-name;)i +(the)f(linker)1071 714 y(will)i(not)h(allow)f(you)g(to)h(feed)d(it)i +(the)g(input)g(heap)g(image)f(on)i(a)e(port.)988 848 +y FA(\226)41 b FC(The)21 b(heap-image)f(is)h(linked)g(against)f(the)h +(vm)g(contained)g(in)1226 948 y Fy(/usr/local/lib/sc)o(sh)o(/li)o(bs)o +(cs)o(hvm)o(.a)1071 1048 y FC(This)g(is)g(wir)o(ed)f(in)i(at)e(the)h +(time)g(scsh)g(is)g(installed)g(on)h(your)f(system.)988 +1182 y FA(\226)41 b FC(Ther)o(e)20 b(is)h(no)g(Scheme)g(pr)o(ocedural)e +(interface.)805 1351 y Fu(\017)41 b FC(The)28 b(pr)o(ogram)f(pr)o +(oduced)f(uses)h(the)h(default)e(VM)h(ar)o(gv)g(parser)f +Fy(process_args)888 1451 y FC(fr)o(om)36 b(the)g(scsh)h(sour)o(ce)f +(\002le)g Fy(main.c)e FC(to)i(pr)o(ocess)g(the)g(command)h(line)f +(befor)o(e)888 1550 y(handing)25 b(it)g(of)o(f)e(to)i(the)f(heap)g +(image's)g(top-level)g(pr)o(ocedur)o(e.)34 b(This)25 +b(is)g(not)g(what)888 1650 y(you)d(want)f(for)f(many)h(pr)o(ograms.)888 +1784 y(The)28 b(system)g(needs)f(to)g(be)g(changed)g(to)h(allow)g +(users)f(to)h(override)e(this)i(default)888 1884 y(with)22 +b(their)f(own)g(VM)g(ar)o(gument)f(parsers.)805 2053 +y Fu(\017)41 b FC(A)28 b(possible)i(pr)o(oblem)e(is)h(the)f(Unix)h +(limits)h(on)f(the)f(number)h(of)g(command)g(line)888 +2152 y(ar)o(guments.)58 b(The)32 b(heap-linker)f(calls)g(the)h(C)f +(linker)h(with)h(a)e(lar)o(ge)f(number)i(of)888 2252 +y(object)19 b(\002les.)25 b(Its)19 b(conceivable)f(that)g(on)h(some)g +(Unix)f(systems)i(this)f(could)f(fail)g(now)888 2352 +y(or)32 b(if)g(scsh)h(gr)o(ows)f(in)g(the)g(futur)o(e.)58 +b(The)32 b(solution)h(could)f(be)g(to)g(cr)o(eate)f(library)888 +2451 y(ar)o(chives)26 b(of)h(a)f(few)g(dozen)h(\002les)g(and)f(then)h +(link)h(the)f(r)o(esult)f(few)g(dozen)h(library)888 2551 +y(ar)o(chives)20 b(to)h(make)g(the)g(executable.)805 +2746 y(In)f(spite)g(of)g(these)g(many)g(shortcomings,)i(we)e(ar)o(e)e +(pr)o(oviding)i(the)g(static)f(linker)h(as)g(it)681 2845 +y(stands)h(in)g(this)g(r)o(elease)f(so)h(that)g(people)f(may)h(get)g +(some)g(experience)f(with)h(it.)805 2972 y(Her)o(e)f(is)h(an)g(example) +f(of)g(how)i(one)f(might)h(use)f(the)g(heap)f(linker:)1237 +3167 y Fy(scsh-hlink)39 b(scsh.image)h(fastscsh)805 3389 +y FC(W)-8 b(e'd)21 b(love)g(it)g(if)f(someone)i(would)g(dive)e(into)h +(the)g(sour)o(ce)g(and)f(impr)o(ove)g(it.)681 3672 y +Fw(9.5)99 b(Standard)24 b(\002le)h(locations)681 3889 +y FC(Because)20 b(the)h(scshvm)h(binary)f(is)h(intended)f(to)g(be)g +(used)g(for)g(writing)h(shell)g(scripts,)f(it)h(is)681 +3989 y(important)i(that)f(the)h(binary)f(be)g(installed)h(in)g(a)f +(standar)o(d)e(place,)i(so)h(that)g(shell)g(scripts)681 +4088 y(can)g(dependably)f(r)o(efer)g(to)i(it.)37 b(The)25 +b(standar)o(d)e(dir)o(ectory)g(for)i(the)f(scsh)i(tr)o(ee)d(should)i +(be)681 4188 y Fy(/usr/local/lib/s)o(cs)o(h/)p FC(.)19 +b(Whenever)h(possible,)i(the)e(vm)h(should)h(be)e(located)h(in)888 +4330 y Fy(/usr/local/lib/sc)o(sh)o(/sc)o(sh)o(vm)681 +4472 y FC(and)f(a)g(scsh)i(heap)e(image)h(should)g(be)g(located)f(in) +888 4614 y Fy(/usr/local/lib/sc)o(sh)o(/sc)o(sh)o(.im)o(ag)o(e)681 +4756 y FC(The)h(top-level)f(scsh)h(pr)o(ogram)f(should)i(be)e(located)h +(in)888 4898 y Fy(/usr/local/lib/sc)o(sh)o(/sc)o(sh)2051 +5147 y FC(144)p eop %%Page: 145 151 -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(31,)g -(1997)h(\226)f(17)13 b(:)f(31)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 +145 150 bop 365 614 a FC(with)22 b(a)e(symbolic)i(link)f(to)h(it)f(fr)o +(om)573 753 y Fy(/usr/local/bin/s)o(cs)o(h)490 916 y +FC(The)30 b(Scheme)g(48)f(image)h(format)f(allows)i(heap)e(images)i(to) +f(have)g Fy(#!)f FC(triggers,)j(so)365 1016 y Fy(scsh.image)17 +b FC(should)k(have)g(a)f Fy(#!)g FC(trigger)h(of)f(the)h(following)h +(form:)573 1207 y Fy(#!/usr/local/lib)o(/s)o(csh)o(/s)o(csh)o(vm)37 +b(\\)573 1307 y(-o)43 b(/usr/local/lib/)o(scs)o(h/)o(scs)o(hv)o(m)37 +b(-i)573 1406 y(...)42 b FB(heap)20 b(image)g(goes)h(her)o(e)43 +b Fy(...)1735 5147 y FC(145)p eop %%Page: 146 152 -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(31,)g -(1997)h(\226)f(17)13 b(:)f(31)p eop +146 151 bop 681 1263 a Fx(Chapter)44 b(10)681 1704 y +FD(Changes)52 b(from)g(the)g(previous)681 1953 y(release)681 +2411 y FC(This)30 b(section)h(details)f(changes)g(that)g(have)g(been)f +(made)h(in)g(scsh)h(since)f(the)g(pr)o(evious)681 2511 +y(r)o(elease.)805 2636 y(Scsh)f(is)g(now)h(much)f(mor)o(e)g(r)o(obust.) +49 b(All)29 b(known)h(bugs)f(have)f(been)h(\002xed.)49 +b(Ther)o(e)681 2736 y(have)34 b(been)g(many)g(impr)o(ovements)h(and)f +(extensions)h(made.)65 b(W)-8 b(e)34 b(have)g(also)h(made)681 +2835 y(made)20 b(some)h(incompatible)g(changes.)805 2961 +y(The)32 b(sections)i(below)e(brie\003y)h(describe)e(these)h(new)h +(featur)o(es)d(and)i(changes;)38 b(the)681 3061 y(r)o(elevant)19 +b(sections)j(of)f(the)g(manual)f(give)h(the)g(full)g(details.)681 +3341 y Fw(10.1)99 b(New)24 b(features)681 3556 y FC(This)d(r)o(elease)e +(incorporates)i(several)f(new)h(featur)o(es)e(into)j(scsh.)805 +3766 y Fu(\017)41 b FC(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 Fu(\017)41 b FC(Her)o(e-strings) +888 4233 y(Scsh)26 b(now)h(has)f(a)f(new)i(lexical)e(featur)o(e,)g +Fy(#<<)p FC(,)h(that)g(pr)o(ovides)f(the)h(ability)g(to)g(en-)888 +4332 y(ter)k(long,)j(multi-line)d(string)h(constants)f(in)h(scsh)f(pr)o +(ograms.)52 b(Such)30 b(a)f(string)i(is)888 4432 y(called)21 +b(a)h(\223her)o(e)e(string,\224)i(by)g(analogy)g(to)h(the)f(common)h +(shell)g(\223her)o(e)d(document\224)888 4532 y Fy(<<)g +FC(r)o(edir)o(ection.)805 4699 y Fu(\017)41 b FC(Delimited)21 +b(r)o(eaders)e(and)i(r)o(ead-line)888 4799 y(Scsh)32 +b(now)g(has)f(a)g(powerful)g(set)g(of)h(delimited)f(r)o(eaders.)55 +b(These)31 b(can)g(be)g(used)888 4898 y(to)23 b(r)o(ead)f(input)h +(delimited)f(by)h(a)f(newline)i(character)d(\()p Fy(read-line)p +FC(\),)e(a)j(blank)h(line)2051 5147 y(146)p eop %%Page: 147 153 -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(31,)g(1997)h(\226)f(17) -13 b(:)f(31)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 +147 152 bop 573 614 a FC(\()p Fy(read-paragraph)p FC(\))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 Fy(read-delimited)p FC(\))o(.)573 +855 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 955 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 1055 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 1154 y(faster)20 +b(than)h(the)f(equivalent)h(character)o(-at-a-time)c(Scheme)k(code.)490 +1337 y Fu(\017)41 b FC(New)21 b(system)g(calls)573 1437 +y(W)-5 b(ith)32 b(the)g(sole)g(exception)f(of)g(signal)h(handlers,)i +(scsh)e(now)g(has)g(all)f(of)i(P)t Ft(O)t(S)t(I)t(X)r +FC(.)573 1536 y(This)21 b(r)o(elease)e(intr)o(oduces)672 +1719 y FA(\226)42 b Fy(select)p FC(,)672 1860 y FA(\226)g +FC(full)20 b(terminal)h(device)f(contr)o(ol,)672 2002 +y FA(\226)42 b FC(support)20 b(for)h(pseudo-terminal)f(\223pty\224)g +(devices,)672 2143 y FA(\226)42 b FC(\002le)20 b(locking,)672 +2284 y FA(\226)42 b FC(pr)o(ocess)20 b(timing,)672 2426 +y FA(\226)42 b Fy(set-file-times)p FC(,)672 2567 y FA(\226)g +Fy(seek)19 b FC(and)h Fy(tell)p FC(.)573 2750 y(Note)d(that)g(having)g +Fy(select)p FC(,)e(pseudo-terminals,)i(and)f(tty)h(device)f(contr)o(ol) +h(means)573 2849 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 +2949 y(as)c(telnet)h(servers)f(and)h(clients,)g(dir)o(ectly)f(in)h +(Scheme.)490 3132 y Fu(\017)41 b FC(New)21 b(command-line)g(switches) +573 3232 y(Ther)o(e)32 b(is)h(a)g(new)g(set)g(of)g(command-line)h +(switches)g(that)e(make)h(it)h(possible)f(to)573 3331 +y(write)26 b(shell)h(scripts)f(using)i(the)e(Scheme)g(48)f(module)i +(system.)43 b(Scripts)26 b(can)g(use)573 3431 y(the)j(new)h +(command-line)g(switches)g(to)g(open)f(dependent)g(modules)h(and)f +(load)573 3530 y(dependent)16 b(sour)o(ce)g(code.)23 +b(Scripts)16 b(can)g(also)h(be)f(written)h(in)g(the)f(Scheme)g(48)g +(mod-)573 3630 y(ule)i(language,)h(which)g(allows)h(you)f(to)g(use)g +(it)f(both)i(as)e(a)g(standalone)h(shell)g(script,)573 +3730 y(and)i(as)f(a)h(code)g(module)g(that)g(can)g(be)g(loaded)f(and)h +(used)g(by)g(other)h(Scheme)e(pr)o(o-)573 3829 y(grams.)490 +4012 y Fu(\017)41 b FC(Static)20 b(heap)g(linking)573 +4112 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 Fy(.o)g FC(\002le)573 +4211 y(that)26 b(can)g(be)f(linked)i(with)g(the)f(scsh)h(virtual)e +(machine.)42 b(This)27 b(pr)o(oduces)e(a)h(stan-)573 +4311 y(dalone)33 b(executable)g(binary)-9 b(,)36 b(makes)e(startup)g +(time)g(near)o(-instantaneous,)i(and)573 4411 y(gr)o(eatly)19 +b(impr)o(oves)g(memory)i(performance\227the)e(initial)h(heap)f(image)h +(is)g(placed)573 4510 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 4610 y(and)c(does)h(not)g(occupy)g(space)f(in)i(the)e(r)o(un-time)i +(heap.)756 4805 y Fl(Oops:)79 b Fk(The)26 b(static)g(heap)g(linker)f +(was)h(not)h(documented)e(and)h(installed)g(in)756 4897 +y(time)18 b(for)g(this)h(r)o(elease.)1735 5147 y FC(147)p eop %%Page: 148 154 -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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +148 153 bop 681 614 a Fw(10.2)99 b(Incompatible)24 b(improvements)681 +828 y FC(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 +928 y(compatible)19 b(with)h(pr)o(evious)f(r)o(eleases.)24 +b(These)19 b(changes)h(should)g(not)g(af)o(fect)d(most)k(code;)681 +1028 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 1213 +y Fu(\017)41 b FC(New)21 b(pr)o(ocess-object)f(data-type)g(r)o(eturned) +f(by)i Fy(fork)888 1312 y FC(Pr)o(evious)h(r)o(eleases)e(wer)o(e)g(pr)o +(one)h(to)h(\002ll)g(up)f(the)h(kernel's)f(pr)o(ocess)g(table)g(if)g(a) +g(pr)o(o-)888 1412 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 +1512 y Fy(wait)16 b FC(to)h(r)o(eclaim)g(the)g(entries)g(in)h(the)f +(kernel's)g(pr)o(ocess)g(table.)24 b(\(This)17 b(is)h(a)e(pr)o(oblem) +888 1611 y(in)22 b(standar)o(d)d(C)h(envir)o(onments,)i(as)e(well.\)) +888 1740 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 1839 y(pr)o(ocesses.)36 +b(Pr)o(ocesses)24 b(ar)o(e)e(no)j(longer)g(r)o(epr)o(esented)d(by)i(an) +g(integer)h(pr)o(ocess)e(id,)888 1939 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 2039 y(type)d(that)g(encapsulates)g(the)g(pr)o(ocess)g(id.)41 +b(All)26 b(pr)o(ocesses)g(ar)o(e)e(r)o(epr)o(esented)g(us-)888 +2138 y(ing)31 b(the)f(new)g(data)e(str)o(uctur)o(es;)34 +b(see)29 b(the)h(r)o(elevant)f(section)h(of)g(the)g(manual)f(for)888 +2238 y(further)21 b(details.)805 2395 y Fu(\017)41 b +FC(Better)20 b(stdio/curr)o(ent-port)h(synchr)o(onisation)888 +2495 y(The)i Fy(\(begin)41 b(...\))20 b FC(pr)o(ocess)i(form)g(now)h +(does)g(a)e Fy(stdio->stdports)16 b FC(call)22 b(befor)o(e)888 +2594 y(executing)i(its)g(body)-9 b(.)35 b(This)24 b(means)g(that)g(the) +g(Scheme)f(code)h(in)g(the)g(body)g(\223sees\224)888 +2694 y(any)i(external)e(r)o(edir)o(ections.)38 b(For)25 +b(example,)h(it)f(means)g(that)g(if)g(a)g Fy(begin)e +FC(form)j(in)888 2793 y(the)h(middle)g(of)f(a)g(pipeline)h(performs)f +(I/O)h(on)h(the)f(curr)o(ent)e(input)i(and)g(output)888 +2893 y(ports,)18 b(it)f(will)g(be)f(communicating)i(with)f(its)g(upstr) +o(eam)f(and)g(downstr)o(eam)g(pipes.)888 2993 y FB(E.g.)o +FC(,)j(this)h(code)f(works)g(as)g(intended)g(without)h(the)f(need)g +(for)g(explicit)f(synchr)o(oni-)888 3092 y(sation:)888 +3269 y Fy(\(run)42 b(\(|)h(\(gunzip\))1237 3369 y(;;)g(Kill)f(line)g(1) +h(and)f(insert)f(doubled-sided)1237 3468 y(;;)i(code)f(at)g(head)g(of)h +(Postscript.)1237 3568 y(\(begin)e(\(read-line\))e(;)k(Eat)g(first)e +(line.)1542 3668 y(\(display)f("\045!PS-Adobe-2.0\\\\)o(n"\))1542 +3767 y(\(display)g("statusdict)f(/setduplexmode)f(known)k("\))1542 +3867 y(\(display)e("{statusdict)f(begin)j(true)f("\))1542 +3967 y(\(display)f("setduplexmode)e(end})k(if\\n"\))1542 +4066 y(\(exec-epf)e(\(cat\)\)\))1237 4166 y(\(lpr\)\))1106 +4265 y(\(<)j(paper.ps\)\))888 4442 y FC(Arranging)35 +b(for)f(the)g Fy(begin)f FC(pr)o(ocess)h(form)g(to)h(synchr)o(onise)g +(the)g(curr)o(ent)e(I/O)888 4542 y(ports)d(with)g(stdio)g(means)f(that) +h(all)f(pr)o(ocess)g(forms)g(now)h(see)g(their)f(epf)5 +b('s)28 b(r)o(edi-)888 4642 y(r)o(ections.)805 4799 y +Fu(\017)41 b Fy(file-match)17 b FC(mor)o(e)j(r)o(obust)888 +4898 y(The)h Fy(file-match)16 b FC(pr)o(ocedur)o(e)i(now)k(catches)e +(any)g(err)o(or)g(condition)h(signalled)g(by)2051 5147 +y(148)p eop %%Page: 149 155 -149 154 bop 490 614 a FB(\277)365 5147 y FE(Mar)o(ch)19 -b(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +149 154 bop 573 614 a FC(a)22 b(match)g(pr)o(ocedur)o(e,)e(and)i(tr)o +(eats)f(it)h(as)g(if)g(the)h(pr)o(ocedur)o(e)d(had)i(simply)h(r)o +(eturned)573 714 y Fy(#f)p FC(,)h FB(i.e.)p FC(,)g(match)g(failur)o(e.) +35 b(This)24 b(means)g Fy(file-match)c FC(no)25 b(longer)g(gets)f +(blown)h(out)573 814 y(of)18 b(the)h(water)e(by)i(trying)g(to)f(apply)g +(a)g(function)h(like)g Fy(file-directory?)12 b FC(to)19 +b(a)e(dan-)573 913 y(gling)22 b(symlink,)g(and)e(other)h(r)o(elated)e +(OS)i(err)o(ors.)490 1095 y Fu(\017)41 b FC(Standar)o(d)18 +b(input)k(now)f(unbuf)o(fer)o(ed)573 1194 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 1294 y(ing)24 b(to)h(\002le)f(descriptor)f(0\))g(unbuf)o +(fer)o(ed.)33 b(This)24 b(keeps)g(the)g(shell)h(fr)o(om)e +(\223stealing\224)573 1394 y(input)e(meant)g(for)g(subpr)o(ocesses.)26 +b(However)-6 b(,)20 b(it)h(does)g(slow)h(down)g(character)o(-at-)573 +1493 y(a-time)i(input)h(pr)o(ocessing.)36 b(If)24 b(you)h(ar)o(e)e +(writing)i(a)f(pr)o(ogram)g(that)g(is)h(tolerant)g(of)573 +1593 y(buf)o(fer)o(ed)18 b(input,)j(and)g(wish)h(the)f(ef)o(\002ciency) +f(gains,)h(you)h(can)e(r)o(eset)g(the)i(buf)o(fering)573 +1693 y(policy)f(yourself.)490 1874 y Fu(\017)41 b FC(\223writeable\224) +19 b(now)j(spelled)e(\223writable\224)573 1974 y(W)-8 +b(e)27 b(inconsistently)h(spelled)f Fy(file-writable?)21 +b FC(and)26 b Fy(file-not-writabl)o(e?)20 b FC(in)573 +2073 y(the)25 b(manual)f(and)h(the)g(implementation.)38 +b(W)-8 b(e)25 b(have)f(now)i(standar)o(dised)d(on)i(the)573 +2173 y(common)g(spelling)f(\223writable\224)d(in)j(both.)34 +b(The)23 b(older)g(bindings)h(still)g(exist)f(in)h(r)o(e-)573 +2273 y(lease)c(0.4,)f(but)i(will)h(go)f(away)f(in)h(futur)o(e)f(r)o +(eleases.)490 2454 y Fu(\017)41 b Fy(char-set-member?)14 +b FC(r)o(eplaced)573 2554 y(W)-8 b(e)21 b(have)f(de-r)o(eleased)e(the)j +Fy(char-set-member?)14 b FC(pr)o(ocedur)o(e.)24 b(The)d(scsh)g(0.3)f +(ver)o(-)573 2654 y(sion)i(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 2810 +y Fy(\(char-set-membe)o(r?)37 b FB(char)43 b(char-set)o +Fy(\))573 2967 y FC(This)17 b(ar)o(gument)g(or)o(der)f(is)h(in)h(accor) +o(dance)d(with)j(standar)o(d)d(mathematical)i(useage)573 +3067 y(\()p FB(i.e.)o FC(,)31 b Fz(x)38 b Fu(2)h Fz(S)5 +b FC(\),)30 b(and)e(also)h(consistent)h(with)g(the)f(R4RS)g +Fy(member)p FC(,)f Fy(memq)f FC(and)h Fy(memv)573 3167 +y FC(pr)o(ocedur)o(es.)59 b(It)33 b(is,)j(however)-6 +b(,)35 b(exactly)d(opposite)h(fr)o(om)g(the)f(ar)o(gument)h(or)o(der) +573 3266 y(used)23 b(by)h(the)g Fy(char-set-member?)18 +b FC(in)24 b(MIT)f(Scheme's)h(character)o(-set)e(library)-9 +b(.)34 b(If)573 3366 y(we)27 b(left)g(things)h(as)f(they)g(wer)o(e,)h +(we)f(risked)g(pr)o(oblems)f(with)i(code)f(ported)g(over)573 +3465 y(fr)o(om)j(MIT)g(Scheme.)54 b(On)31 b(the)f(other)h(hand,)h +(changing)g(to)e(conformance)h(with)573 3565 y(MIT)c(Scheme)h(meant)f +(inconsistency)j(with)f(common)g(mathematical)e(notation)573 +3665 y(and)f(other)h(long-standing)h(Scheme)f(pr)o(ocedur)o(es.)42 +b(Either)26 b(way)h(was)g(bound)g(to)573 3764 y(intr)o(oduce)20 +b(confusion.)573 3905 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 Fy(char-set-member?)573 +4005 y FC(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 +4161 y Fy(\(char-set-conta)o(in)o(s?)37 b FB(cset)44 +b(char)o Fy(\))573 4318 y FC(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 4500 +y Fu(\017)41 b Fy(file-attributes)14 b FC(now)22 b Fy(file-info)573 +4599 y FC(In)17 b(keeping)g(with)g(the)g(general)f(convention)i(in)f +(scsh)g(of)f(naming)i(pr)o(ocedur)o(es)d(that)573 4699 +y(r)o(etrieve)33 b(information)i(about)f(system)h(r)o(esour)o(ces)f +Fy(...-info)d FC(\()p FB(e.g.)o FC(,)37 b Fy(tty-info)p +FC(,)573 4799 y Fy(user-info)p FC(,)16 b Fy(group-info)p +FC(\),)f(the)20 b Fy(file-attributes)14 b FC(pr)o(ocedur)o(e)k(is)i +(now)h(named)573 4898 y Fy(file-info)p FC(.)1735 5147 +y(149)p eop %%Page: 150 156 -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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)p eop +150 155 bop 888 614 a FC(W)-8 b(e)17 b(continue)h(to)g(export)e(a)h +Fy(file-attributes)10 b FC(binding)18 b(for)f(the)g(curr)o(ent)f(r)o +(elease,)888 714 y(but)21 b(it)g(will)h(go)f(away)f(in)h(futur)o(e)f(r) +o(eleases.)805 901 y Fu(\017)41 b FC(Renaming)22 b(of)f(I/O)g(synchr)o +(onisation)h(pr)o(ocedur)o(es)888 1000 y(The)108 b Fy(\(stdio->stdport) +o(s)38 b FB(thunk)o Fy(\))107 b FC(pr)o(ocedur)o(e)e(has)i(been)g(r)o +(enamed)888 1100 y Fy(with-stdio-ports*)o FC(;)35 b(ther)o(e)f(is)h +(now)g(a)f(corr)o(esponding)h Fy(with-stdio-port)o(s)888 +1200 y FC(special)54 b(form.)126 b(The)55 b Fy(stdio->stdports)48 +b FC(pr)o(ocedur)o(e)k(is)j(now)g(a)f(nullary)888 1299 +y(pr)o(ocedur)o(e)19 b(that)i(side-ef)o(fects)e(the)h(curr)o(ent)g(set) +h(of)g(curr)o(ent)f(I/O)h(port)g(bindings.)805 1486 y +Fu(\017)41 b FC(New)21 b(meta-ar)o(g)e(line-two)j(syntax)888 +1586 y(Scsh)g(now)h(uses)e(a)h(simpli\002ed)g(grammar)f(for)h +(describing)f(command-line)h(ar)o(gu-)888 1685 y(ments)29 +b(r)o(ead)e(by)h(the)g(\223meta-ar)o(g\224)e(switch)j(fr)o(om)f(line)g +(two)h(of)f(a)g(shell)h(script.)47 b(If)888 1785 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 1885 y(changes)19 +b(of)g(which)h(to)f(be)f(awar)o(e)f(ar)o(e:)23 b(\(1\))18 +b(tab)g(is)h(no)g(longer)h(allowed)e(as)h(an)f(ar)o(gu-)888 +1984 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 +2084 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 2401 y Fw(10.3)99 b +(Backwards-compatible)25 b(improvements)681 2636 y FC(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 2735 y(existing)f(code.)805 +2974 y Fu(\017)41 b FC(Impr)o(oved)20 b(err)o(or)g(r)o(eporting)888 +3074 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 3173 y(their)32 b(messages)g(on)g +(the)g(err)o(or)f(output)h(port,)j(instead)c(of)h(the)g(curr)o(ent)f +(output)888 3273 y(port.)26 b(Pr)o(evious)19 b(r)o(eleases)f(used)i +(the)g(curr)o(ent)f(output)h(port,)f(a)h(pr)o(oblem)f(inherited)888 +3373 y(fr)o(om)i(Scheme)f(48.)888 3516 y(Pr)o(evious)f(scsh)g(r)o +(eleases)e(\003ushed)i(the)g(Scheme)f(48)f(debugging)i(tables)f(when)h +(cr)o(e-)888 3616 y(ating)28 b(the)f(standar)o(d)f(scsh)h(heap)g +(image.)45 b(This)28 b(trimmed)f(the)g(size)g(of)g(the)h(heap)888 +3715 y(image,)23 b(but)f(made)g(err)o(or)f(messages)i(much)g(less)f +(compr)o(ehensible.)31 b(W)-8 b(e)22 b(now)h(r)o(e-)888 +3815 y(tain)c(the)g(debugging)g(tables.)25 b(This)19 +b(bloats)g(the)g(heap)g(image)f(up)h(by)g(about)g(600kb.)888 +3914 y(And)i(worth)g(it,)g(too.)888 4058 y(\(W)-8 b(e)27 +b(also)f(have)h(some)g(new)g(techniques)g(for)g(eliminating)g(the)g(r)o +(un-time)g(mem-)888 4157 y(ory)c(penalty)f(imposed)h(by)g(these)f(lar)o +(ge)g(heap)g(images.)31 b(Scsh's)22 b(new)h(static-heap)888 +4257 y(technology)34 b(allows)f(for)f(this)h(data)e(to)i(be)f(linked)g +(into)h(the)g(text)f(pages)g(of)g(the)888 4357 y(vm's)26 +b(binary)-9 b(,)27 b(wher)o(e)e(it)g(will)i(not)f(be)f(touched)h(by)g +(the)f(GC)h(or)g(otherwise)g(af)o(fect)888 4456 y(the)21 +b(memory)h(system)f(until)h(it)f(is)g(r)o(efer)o(enced.\))888 +4599 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 +4699 y(err)o(ors.)k(For)22 b(example,)f(a)g(\002le-open)h(err)o(or)f +(pr)o(eviously)h(told)g(you)h(what)f(the)g(err)o(or)888 +4799 y(was)29 b(\()p FB(e.g.)o FC(,)g(\223Permission)h(denied,\224)f +(or)f(\223No)g(such)h(\002le)f(or)h(dir)o(ectory\224\),)f(but)g(not)888 +4898 y(which)22 b(\002le)f(you)g(had)g(tried)f(to)h(open.)26 +b(W)-8 b(e've)20 b(impr)o(oved)h(this.)2051 5147 y(150)p +eop %%Page: 151 157 -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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +151 156 bop 490 614 a Fu(\017)41 b FC(Closing)22 b(a)e(port)h(twice)g +(allowed)573 714 y(Scsh)k(used)g(to)h(generate)e(an)h(err)o(or)f(if)h +(you)h(attempted)f(to)g(close)h(a)e(port)i(that)f(had)573 +814 y(alr)o(eady)20 b(been)i(closed.)29 b(This)23 b(is)f(now)h +(allowed.)29 b(The)22 b(close)g(pr)o(ocedur)o(e)f(r)o(eturns)g(a)573 +913 y(boolean)g(to)g(indicate)f(whether)h(the)g(port)g(had)f(alr)o +(eady)f(been)i(closed)g(or)g(not.)490 1079 y Fu(\017)41 +b FC(Better)20 b(time)h(pr)o(ecision)573 1179 y(The)33 +b Fy(time+ticks)d FC(pr)o(ocedur)o(e)h(now)k(r)o(eturns)e(sub-second)h +(pr)o(ecision)f(on)h(OS's)573 1279 y(that)21 b(support)g(it.)490 +1445 y Fu(\017)41 b FC(Nicer)20 b(print-methods)i(for)e(basic)g +(data-types)573 1544 y(Scsh's)e(standar)o(d)f(r)o(ecor)o(d)f(types)j +(now)g(print)f(mor)o(e)g(informatively)-9 b(.)25 b(For)19 +b(example,)573 1644 y(a)j(pr)o(ocess)h(object)g(includes)g(the)g(pr)o +(ocess)f(id)h(in)g(its)g(printed)g(r)o(epr)o(esentation:)28 +b(the)573 1743 y(pr)o(ocess)20 b(object)h(for)g(pr)o(ocess)f(id)h(2653) +e(prints)i(as)f Fy(#{proc)41 b(2653})p FC(.)1735 5147 +y(151)p eop %%Page: 152 158 -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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +152 157 bop 805 614 a FC(\277)2051 5147 y(152)p eop %%Page: 153 159 -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(31,)g(1997)h(\226)f(17)13 -b(:)f(31)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 +153 158 bop 365 1262 a Fx(Chapter)45 b(1)-6 b(1)365 1702 +y FD(T)-23 b(odo)365 2159 y FC(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 Fu(\017)41 +b FC(Mor)o(e)20 b(network)h(pr)o(otocols.)26 b(T)-8 b(elnet)21 +b(and)f(ftp)h(would)g(be)f(the)h(most)h(important.)490 +2612 y Fu(\017)41 b FC(An)21 b(ILU)f(interface.)490 2776 +y Fu(\017)41 b FC(An)21 b(RPC)g(system,)g(with)g(\223tail-r)o +(ecursion.\224)490 2941 y Fu(\017)41 b FC(Interfaces)20 +b(to)h(r)o(elational)f(db's.)25 b(This)c(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 Fu(\017)41 b FC(The)17 b(L)750 3301 y Fa(A)783 +3319 y FC(T)820 3338 y(E)860 3319 y(X)h(hackery)f(needs)h(yet)f +(another)h(serious)g(pass.)24 b(Most)18 b(importantly)-9 +b(,)19 b(long)573 3418 y(pr)o(ocedur)o(e)g(\223declarations\224)g(need) +h(to)h(be)g(br)o(oken)f(acr)o(oss)g(two)i(lines.)490 +3583 y Fu(\017)41 b FC(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 Fu(\017)41 b FC(Parameter)19 b(subscripts)i(need)g(to)g(be)f +(made)g(r)o(eal)g(subscripts.)490 3913 y Fu(\017)41 b +FC(Soup)27 b(up)f(the)h(markup)g(pr)o(ocessor)-6 b(,)27 +b(and)g(r)o(edo)f(manual)g(in)i(markup.)43 b(Generate)573 +4012 y(LaT)-8 b(eX,)17 b(HTML,)f(and)h(info)h(versions.)25 +b(Alternatively)-9 b(,)18 b(persuade)e(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 Fy(jcontrol.scm)365 +4425 y FC(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)h(all)f(coexist)h(with)g(S48)f(thr)o(eads)f(as)h(well) +h(as)g(can)f(be)g(done)h(for)f(Unix.)31 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.)1735 5147 y(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(31,)g(1997)h(\226)f -(17)13 b(:)f(31)p eop +154 159 bop 681 614 a FC(T)-8 b(esting)21 b(br)o(oken)g +(symlinks\227new)i(value)d(for)g FB(chase?)g FC(\003ag?)681 +739 y(Rename)h(and)f(r)o(elease)f Fy(ensure-file-name-)o(is)o(-)p +Fu(f)o Fy(non)o(,)p Fu(g)o Fy(di)o(rec)o(to)o(ry)p FC(.)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)f +(available:)k(hash)d(tables,)e(sort,)i(list)f(utils,)h(pattern)e +(matchers.)681 1088 y(But)g(things)h(start)f(to)h(overload.)27 +b(The)21 b(module)h(system)g(is)f(the)h(appr)o(opriate)d(way)i(to)h +(use)681 1187 y(these.)681 1312 y(Need)c(to)h(do)g(\002le-contr)o(ol)h +(\()p FB(i.e.)o FC(,)f Fy(fcntl\(\))p FC(\).)j Fy(fcntl)17 +b FC(is)i(ugly)-9 b(.)25 b(Better)19 b(to)g(have)g(a)f(pr)o(ocedur)o(e) +681 1411 y(for)i(each)h(dif)o(fer)o(ent)d(operation.)2051 +5147 y(154)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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +155 160 bop 365 1095 a FD(Index)365 1513 y Fy(\045read-delimited!)p +FC(,)14 b(1)-5 b(10)365 1706 y(*temp-\002le-template*,)20 +b(49)365 1899 y Fy(->uid)p FC(,)f(61)365 2000 y Fy(->username)p +FC(,)e(61)365 2193 y Fy(\045exec)p FC(,)i(52)365 2293 +y Fy(\045exit)p FC(,)g(52)365 2393 y Fy(\045fork)p FC(,)g(53)365 +2493 y Fy(\045fork/pipe)p FC(,)e(53)365 2593 y Fy(\045fork/pipe+)p +FC(,)f(54)365 2694 y Fy(&)p FC(,)k(13)365 2794 y Fy(&&)p +FC(,)g(20)365 2894 y Fy(interrupt/alarm)p FC(,)15 b(64)365 +2994 y Fy(interrupt/alrm)p FC(,)g(64)365 3094 y Fy(interrupt/chld)p +FC(,)g(64)365 3195 y Fy(interrupt/cont)p FC(,)g(64)365 +3295 y Fy(interrupt/hup)p FC(,)g(64)365 3395 y Fy(interrupt/info)p +FC(,)g(64)365 3495 y Fy(interrupt/int)p FC(,)g(64)365 +3596 y Fy(interrupt/io)p FC(,)h(64)365 3696 y Fy(interrupt/keyboar)o(d) +p FC(,)e(64)365 3796 y Fy(interrupt/memory-)o(sh)o(ort)o(ag)o(e)p +FC(,)g(64)365 3896 y Fy(interrupt/poll)p FC(,)h(64)365 +3996 y Fy(interrupt/prof)p FC(,)g(64)365 4097 y Fy(interrupt/pwr)p +FC(,)g(64)365 4197 y Fy(interrupt/quit)p FC(,)g(64)365 +4297 y Fy(interrupt/term)p FC(,)g(64)365 4397 y Fy(interrupt/tstp)p +FC(,)g(64)365 4497 y Fy(interrupt/urg)p FC(,)g(64)365 +4598 y Fy(interrupt/usr1)p FC(,)g(64)365 4698 y Fy(interrupt/usr2)p +FC(,)g(64)365 4798 y Fy(interrupt/vtalrm)p FC(,)f(64)365 +4898 y Fy(interrupt/winch)p FC(,)h(64)1943 1513 y Fy(interrupt/xcpu)p +FC(,)f(64)1943 1616 y Fy(interrupt/xfsz)p FC(,)g(64)1943 +1718 y Fy(signal/abrt)p FC(,)i(65)1943 1821 y Fy(signal/alrm)p +FC(,)g(64)1943 1924 y Fy(signal/bus)p FC(,)g(65)1943 +2026 y Fy(signal/chld)p FC(,)g(64)1943 2129 y Fy(signal/cont)p +FC(,)g(64)1943 2231 y Fy(signal/emt)p FC(,)g(65)1943 +2334 y Fy(signal/fpe)p FC(,)g(65)1943 2436 y Fy(signal/hup)p +FC(,)g(64)1943 2539 y Fy(signal/ill)p FC(,)g(65)1943 +2642 y Fy(signal/info)p FC(,)g(64)1943 2744 y Fy(signal/int)p +FC(,)g(64)1943 2847 y Fy(signal/iot)p FC(,)g(65)1943 +2949 y Fy(signal/io)p FC(,)h(64)1943 3052 y Fy(signal/kill)p +FC(,)f(65)1943 3154 y Fy(signal/pipe)p FC(,)g(65)1943 +3257 y Fy(signal/poll)p FC(,)g(64)1943 3360 y Fy(signal/prof)p +FC(,)g(64)1943 3462 y Fy(signal/pwr)p FC(,)g(64)1943 +3565 y Fy(signal/quit)p FC(,)g(64)1943 3667 y Fy(signal/segv)p +FC(,)g(65)1943 3770 y Fy(signal/stop)p FC(,)g(65)1943 +3873 y Fy(signal/sys)p FC(,)g(65)1943 3975 y Fy(signal/term)p +FC(,)g(64)1943 4078 y Fy(signal/trap)p FC(,)g(65)1943 +4180 y Fy(signal/tstp)p FC(,)g(64)1943 4283 y Fy(signal/ttin)p +FC(,)g(65)1943 4385 y Fy(signal/ttou)p FC(,)g(65)1943 +4488 y Fy(signal/urg)p FC(,)g(64)1943 4591 y Fy(signal/usr1)p +FC(,)g(64)1943 4693 y Fy(signal/usr2)p FC(,)g(64)1943 +4796 y Fy(signal/vtalrm)p FC(,)f(64)1943 4898 y Fy(signal/winch)p +FC(,)g(64)1735 5147 y(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +156 161 bop 681 614 a Fy(signal/xcpu)p FC(,)16 b(64)681 +715 y Fy(signal/xfsz)p FC(,)g(64)681 907 y Fy(accept-connectio)o(n)p +FC(,)e(93)681 1007 y Fy(add-after)p FC(,)j(75)681 1107 +y Fy(add-before)p FC(,)f(75)681 1208 y Fy(alist->env)p +FC(,)g(73)681 1308 y Fy(alist-compress)p FC(,)e(74)681 +1408 y Fy(alist-delete)p FC(,)h(74)681 1508 y Fy(alist-update)p +FC(,)g(74)681 1608 y Fy(arg)p FC(,)k(62)681 1709 y Fy(arg*)p +FC(,)g(62)681 1809 y Fy(argv)p FC(,)g(62)681 1909 y Fy +(arithmetic-shift)o FC(,)c(125)681 2009 y Fy(ascii->char)p +FC(,)h(106)681 2109 y Fy(ascii-range->cha)o(r-)o(set)o +FC(,)f(107)681 2210 y Fy(autoreap-policy)p FC(,)f(56)681 +2310 y(awk,)20 b(1)-5 b(19)681 2502 y Fy(become-session-l)o(ea)o(der)o +FC(,)15 b(81)681 2602 y Fy(bind-listen-acce)o(pt)o(-lo)o(op)o +FC(,)g(90)681 2703 y Fy(bind-socket)p FC(,)h(93)681 2803 +y Fy(bitwise-and)p FC(,)g(125)681 2903 y Fy(bitwise-ior)p +FC(,)g(125)681 3003 y Fy(bitwise-not)p FC(,)g(125)681 +3103 y Fy(bitwise-xor)p FC(,)g(125)681 3296 y Fy(call-terminally)p +FC(,)e(52)681 3396 y Fy(call-with-string)o(-o)o(utp)o(ut)o(-p)o(ort)o +FC(,)1013 3496 y(26)681 3596 y Fy(call/fdes)p FC(,)j(30)681 +3696 y Fy(char->ascii)p FC(,)f(106)681 3796 y Fy(char-alphabetic?)o +FC(,)f(108)681 3896 y Fy(char-alphanumeri)o(c?)o FC(,)g(108)681 +3997 y Fy(char-filter)p FC(,)h(20)681 4097 y Fy(char-graphic?)p +FC(,)f(108)681 4197 y Fy(char-lower-case?)o FC(,)g(108)681 +4297 y Fy(char-numeric?)82 b FC(,)20 b(108)681 4397 y +Fy(char-set)p FC(,)d(107)681 4498 y Fy(char-set-contain)o(s?)o +FC(,)e(107)681 4598 y Fy(char-set-differe)o(nc)o(e)p +FC(,)f(108)681 4698 y Fy(char-set-interse)o(ct)o(ion)o +FC(,)h(108)681 4798 y Fy(char-set-invert)p FC(,)f(108)681 +4898 y Fy(char-set-members)o FC(,)h(107)2258 614 y Fy(char-set-union)p +FC(,)g(108)2258 714 y(char)o(-set:alphabetic,)j(108)2258 +814 y(char)o(-set:alphanumeric,)h(108)2258 914 y(char)o(-set:graphic,)g +(108)2258 1014 y(char)o(-set:lower)o(-case,)f(108)2258 +1114 y(char)o(-set:not-whitespace,)h(108)2258 1214 y(char)o +(-set:numeric,)g(108)2258 1314 y(char)o(-set:upper)o(-case,)e(108)2258 +1414 y(char)o(-set:whitespace,)i(108)2258 1514 y Fy(char-set?)p +FC(,)e(107)2258 1613 y Fy(char-upper-case?)p FC(,)d(108)2258 +1713 y Fy(char-whitespace?)p FC(,)g(108)2258 1813 y Fy(chars->char-set) +p FC(,)h(107)2258 1913 y Fy(chdir)p FC(,)k(59)2258 2013 +y Fy(close)p FC(,)g(25)2258 2113 y Fy(close-after)p FC(,)d(24)2258 +2213 y Fy(close-socket)p FC(,)g(90)2258 2313 y Fy(command-line)p +FC(,)g(61)2258 2413 y(command-line-ar)o(guments,)k(61)2258 +2513 y Fy(connect-socket)p FC(,)15 b(93)2258 2613 y Fy +(control-tty-file-)o(na)o(me)p FC(,)f(81)2258 2712 y +Fy(copy-tty-info)p FC(,)h(79)2258 2812 y Fy(cpu-ticks/sec)p +FC(,)g(60)2258 2912 y Fy(create-directory)p FC(,)f(40)2258 +3012 y Fy(create-fifo)p FC(,)i(40)2258 3112 y Fy(create-hard-link)p +FC(,)e(40)2258 3212 y Fy(create-socket)p FC(,)h(90)2258 +3312 y Fy(create-socket-pai)o(r)p FC(,)f(90)2258 3412 +y Fy(create-symlink)p FC(,)h(40)2258 3512 y Fy(create-temp-file)p +FC(,)f(48)2258 3612 y Fy(cwd)p FC(,)19 b(59)2258 3799 +y(date,)h(68,)f(70)2258 3899 y Fy(date->string)p FC(,)d(71)2258 +3999 y Fy(define-record)p FC(,)f(7)2258 4099 y Fy(delete-directory)p +FC(,)f(40)2258 4199 y Fy(delete-file)p FC(,)i(40)2258 +4299 y Fy(delete-filesys-ob)o(je)o(ct)p FC(,)e(40)2258 +4399 y Fy(directory-as-file)o(-n)o(ame)o FC(,)h(102)2258 +4499 y Fy(directory-files)p FC(,)g(44)2258 4599 y Fy(disable-tty-char)p +FC(,)f(78)2258 4698 y Fy(drain-tty)p FC(,)j(80)2258 4798 +y Fy(dump-scsh)p FC(,)g(142)2258 4898 y Fy(dump-scsh-program)o +FC(,)e(141)2051 5147 y(156)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(31,)g(1997)h(\226)f(17)13 b(:)f(31)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 +157 162 bop 365 614 a Fy(dup)p FC(,)20 b(31)365 714 y +Fy(dup->fdes)p FC(,)d(31)365 815 y Fy(dup->inport)p FC(,)f(31)365 +915 y Fy(dup->outport)p FC(,)g(31)365 1105 y Fy(enabled-interrupt)o(s)p +FC(,)e(66)365 1205 y Fy(env->alist)p FC(,)j(73)365 1305 +y Fy(errno-error)p FC(,)f(21)365 1405 y Fy(error-output-port)o +FC(,)f(24)365 1505 y Fy(exec)p FC(,)k(51)365 1605 y(exec-epf,)g(13)365 +1706 y Fy(exec-path)p FC(,)e(51)365 1806 y(exec-path-list,)j(76)365 +1906 y Fy(exec-path-search)p FC(,)14 b(52)365 2006 y +Fy(exec-path/env)p FC(,)h(51)365 2106 y Fy(exec/env)p +FC(,)i(51)365 2206 y Fy(exit)p FC(,)i(52)365 2306 y Fy +(expand-file-name)p FC(,)14 b(106)365 2497 y Fy(fdes->inport)p +FC(,)i(30)365 2597 y Fy(fdes->outport)p FC(,)f(30)365 +2697 y Fy(fdes-flags)p FC(,)i(32)365 2797 y Fy(fdes-status)p +FC(,)f(33)365 2897 y Fy(field-reader)p FC(,)g(1)-5 b(16)365 +2997 y Fy(field-splitter)p FC(,)15 b(1)-5 b(13)365 3097 +y Fy(file-directory?)p FC(,)15 b(43)365 3197 y Fy(file-executable?)p +FC(,)f(44)365 3297 y Fy(file-exists?)p FC(,)i(44)365 +3397 y Fy(file-fifo?)p FC(,)h(43)365 3497 y Fy(file-group)p +FC(,)g(42)365 3597 y Fy(file-info)p FC(,)g(41)365 3697 +y(\002le-info:atime,)k(42)365 3797 y(\002le-info:ctime,)g(42)365 +3898 y(\002le-info:device,)f(42)365 3998 y(\002le-info:gid,)h(42)365 +4098 y(\002le-info:inode,)g(42)365 4198 y(\002le-info:mode,)g(42)365 +4298 y(\002le-info:mtime,)g(42)365 4398 y(\002le-info:nlinks,)h(42)365 +4498 y(\002le-info:size,)e(42)365 4598 y(\002le-info:type,)h(42)365 +4698 y(\002le-info:uid,)g(42)365 4798 y Fy(file-inode)p +FC(,)c(42)365 4898 y Fy(file-last-access)p FC(,)d(42)1943 +614 y Fy(file-last-mod)p FC(,)h(42)1943 714 y Fy(file-last-status)o(-c) +o(ha)o(nge)o FC(,)g(42)1943 814 y Fy(file-match)p FC(,)h(46)1943 +914 y Fy(file-mode)p FC(,)h(42)1943 1014 y Fy(file-name-absolu)o(te)o +(?)p FC(,)d(103)1943 1114 y Fy(file-name-as-dir)o(ec)o(to)o(ry)p +FC(,)g(102)1943 1214 y Fy(file-name-direct)o(or)o(y)p +FC(,)g(103)1943 1314 y Fy(file-name-direct)o(or)o(y?)o +FC(,)h(102)1943 1414 y Fy(file-name-extens)o(io)o(n)p +FC(,)f(104)1943 1514 y Fy(file-name-non-di)o(re)o(ct)o(ory)o(?)p +FC(,)g(102)1943 1613 y Fy(file-name-nondir)o(ec)o(to)o(ry)p +FC(,)g(103)1943 1713 y Fy(file-name-sans-e)o(xt)o(en)o(sio)o(n)p +FC(,)g(104)1943 1813 y Fy(file-nlinks)p FC(,)i(42)1943 +1913 y Fy(file-not-executa)o(bl)o(e?)o FC(,)f(43)1943 +2013 y Fy(file-not-exists?)o FC(,)g(44)1943 2113 y Fy(file-not-readabl) +o(e?)o FC(,)g(43)1943 2213 y Fy(file-not-writabl)o(e?)o +FC(,)g(43)1943 2313 y Fy(file-owner)p FC(,)h(42)1943 +2413 y Fy(file-readable?)p FC(,)e(44)1943 2513 y Fy(file-regular?)p +FC(,)h(43)1943 2613 y Fy(file-size)p FC(,)i(42)1943 2712 +y Fy(file-socket?)p FC(,)e(43)1943 2812 y Fy(file-special?)p +FC(,)g(43)1943 2912 y Fy(file-symlink?)p FC(,)g(43)1943 +3012 y Fy(file-type)p FC(,)i(42)1943 3112 y Fy(file-writable?)p +FC(,)d(44)1943 3212 y Fy(fill-in-date!)p FC(,)h(71)1943 +3312 y Fy(flush-all-ports)p FC(,)f(37)1943 3412 y Fy(flush-tty/both)p +FC(,)g(80)1943 3512 y Fy(flush-tty/input)p FC(,)g(80)1943 +3612 y Fy(flush-tty/output)o FC(,)h(80)1943 3712 y Fy(force-output)p +FC(,)g(37)1943 3811 y Fy(fork)p FC(,)k(53)1943 3911 y +Fy(fork-pty-session)o FC(,)c(82)1943 4011 y Fy(fork/pipe)p +FC(,)i(53)1943 4111 y Fy(fork/pipe+)p FC(,)f(54)1943 +4211 y Fy(format-date)p FC(,)g(71)1943 4399 y Fy(get-lock-region)p +FC(,)e(39)1943 4499 y Fy(getenv)p FC(,)k(73)1943 4599 +y Fy(glob)p FC(,)h(45)1943 4698 y Fy(glob-quote)p FC(,)d(46)1943 +4798 y Fy(group-info)p FC(,)g(61)1943 4898 y(gr)o(oup-info:gid,)k(61) +1735 5147 y(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(31,)g(1997)h(\226)f(17)13 b(:)f(31)p -eop +158 163 bop 681 614 a FC(gr)o(oup-info:members,)20 b(61)681 +715 y(gr)o(oup-info:name,)g(61)681 910 y Fy(home-dir)p +FC(,)d(106)681 1011 y(home-dir)o(ectory)-9 b(,)20 b(76)681 +1111 y Fy(home-file)p FC(,)d(106)681 1211 y Fy(host-info)p +FC(,)g(96)681 1407 y Fy(index)p FC(,)h(100)681 1507 y +Fy(infix-splitter)p FC(,)c(1)-5 b(13)681 1608 y Fy(internet-address)o +(->)o(soc)o(ke)o(t-)o(add)o(re)o(ss)p FC(,)1013 1707 +y(92)681 1808 y Fy(interrupt-handle)o(r)p FC(,)14 b(67)681 +1908 y Fy(interrupt-set)p FC(,)h(66)681 2008 y Fy(itimer)p +FC(,)j(63)681 2204 y Fy(join-strings)p FC(,)d(1)-5 b(16)681 +2400 y Fy(listen-socket)p FC(,)15 b(93)681 2500 y Fy(lock-region)p +FC(,)h(39)681 2600 y Fy(lock-region/no-b)o(lo)o(ck)p +FC(,)e(39)681 2701 y(lock-r)o(egion:end,)20 b(38)681 +2801 y(lock-r)o(egion:exclusive?,)g(38)681 2901 y(lock-r)o(egion:len,)g +(38)681 3002 y(lock-r)o(egion:pr)o(oc,)g(38)681 3102 +y(lock-r)o(egion:start,)g(38)681 3202 y(lock-r)o(egion:whence,)h(38)681 +3303 y(lock-r)o(egion?,)f(38)681 3498 y Fy(make-date)p +FC(,)d(69)681 3599 y Fy(make-lock-region)o FC(,)e(39)681 +3699 y Fy(make-pty-generat)o(or)o FC(,)g(82)681 3799 +y Fy(make-regexp)p FC(,)h(99)681 3900 y Fy(make-string-inpu)o(t-)o(por) +o(t)p FC(,)e(26)681 4000 y Fy(make-string-outp)o(ut)o(-po)o(rt)o +FC(,)h(26)681 4101 y Fy(make-tty-info)p FC(,)g(79)681 +4201 y Fy(match:end)p FC(,)i(99)681 4301 y Fy(match:start)p +FC(,)f(99)681 4402 y Fy(match:substring)p FC(,)e(99)681 +4502 y Fy(move->fdes)p FC(,)i(30)681 4698 y Fy(network-info)p +FC(,)f(96)681 4798 y Fy(nice)p FC(,)k(60)681 4898 y Fy(nth)p +FC(,)g(125)2258 614 y Fy(open-control-tty)p FC(,)14 b(81)2258 +714 y Fy(open-fdes)p FC(,)j(32)2258 815 y Fy(open-file)p +FC(,)g(32)2258 915 y Fy(open-input-file)p FC(,)e(32)2258 +1015 y Fy(open-output-file)p FC(,)f(32)2258 1115 y Fy(open-pty)p +FC(,)j(82)2258 1305 y Fy(parent-pid)p FC(,)g(60)2258 +1405 y Fy(parse-file-name)p FC(,)e(105)2258 1505 y Fy +(path-list->file-n)o(am)o(e)p FC(,)f(104)2258 1605 y +Fy(pause-until-inter)o(ru)o(pt)p FC(,)g(63)2258 1706 +y Fy(pid)p FC(,)19 b(60)2258 1806 y Fy(pid->proc)p FC(,)e(55)2258 +1906 y Fy(pipe)p FC(,)i(33)2258 2006 y Fy(port->fdes)p +FC(,)e(30)2258 2106 y Fy(port->list)p FC(,)g(15)2258 +2206 y Fy(port->sexp-list)p FC(,)e(15)2258 2306 y Fy(port->string)p +FC(,)h(15)2258 2406 y Fy(port->string-list)o FC(,)f(15)2258 +2506 y Fy(port-revealed)p FC(,)g(30)2258 2606 y Fy(predicate->char-s)o +(et)o FC(,)g(107)2258 2706 y Fy(priority)p FC(,)i(60)2258 +2806 y(pr)o(oc,)j(55)2258 2906 y(pr)o(oc:pid,)g(55)2258 +3007 y(pr)o(oc?,)g(55)2258 3107 y Fy(process-group)p +FC(,)15 b(60)2258 3207 y Fy(process-times)p FC(,)g(60)2258 +3307 y Fy(protocol-info)p FC(,)g(96)2258 3407 y Fy(pty-name->tty-nam)o +(e)p FC(,)f(82)2258 3597 y Fy(read-delimited)p FC(,)h(1)-5 +b(10)2258 3697 y Fy(read-delimited!)p FC(,)15 b(1)-5 +b(10)2258 3797 y Fy(read-line)p FC(,)17 b(109)2258 3898 +y Fy(read-paragraph)p FC(,)e(1)-5 b(10)2258 3998 y Fy(read-string)p +FC(,)16 b(33)2258 4098 y Fy(read-string!)p FC(,)g(33)2258 +4198 y Fy(read-string!/part)o(ia)o(l)p FC(,)e(34)2258 +4298 y Fy(read-string/parti)o(al)o FC(,)h(34)2258 4398 +y Fy(read-symlink)p FC(,)h(40)2258 4498 y Fy(reap-zombies)p +FC(,)g(56)2258 4598 y Fy(receive-message)p FC(,)f(94)2258 +4698 y Fy(receive-message!)p FC(,)f(94)2258 4798 y Fy +(receive-message!/)o(pa)o(rti)o(al)o FC(,)h(94)2258 4898 +y Fy(receive-message/p)o(ar)o(tia)o(l)p FC(,)f(94)2051 +5147 y(158)p eop +%%Page: 159 165 +159 164 bop 365 614 a Fy(record-reader)p FC(,)15 b(1)-5 +b(13)365 714 y Fy(reduce-port)p FC(,)16 b(16)365 814 +y Fy(regexp-exec)p FC(,)g(99)365 914 y Fy(regexp-match?)p +FC(,)f(98)365 1014 y Fy(regexp-quote)p FC(,)h(99)365 +1114 y Fy(regexp?)p FC(,)i(99)365 1214 y Fy(release-port-hand)o(le)o +FC(,)d(30)365 1314 y Fy(rename-file)p FC(,)h(40)365 1414 +y Fy(repl)p FC(,)j(125)365 1514 y Fy(replace-extension)o +FC(,)c(105)365 1613 y Fy(resolve-file-name)o FC(,)g(106)365 +1713 y Fy(rindex)p FC(,)j(100)365 1813 y(r)o(un,)j(13)365 +1913 y Fy(run/collecting)p FC(,)15 b(17)365 2013 y Fy(run/collecting*)p +FC(,)g(17)365 2113 y Fy(run/file)p FC(,)i(14)365 2213 +y Fy(run/file*)p FC(,)g(15)365 2313 y Fy(run/port)p FC(,)g(14)365 +2413 y Fy(run/port*)p FC(,)g(15)365 2513 y Fy(run/port+proc)p +FC(,)e(17)365 2613 y Fy(run/port+proc*)p FC(,)g(17)365 +2712 y Fy(run/sexp)p FC(,)i(14)365 2812 y Fy(run/sexp*)p +FC(,)g(15)365 2912 y Fy(run/sexps)p FC(,)g(14)365 3012 +y Fy(run/sexps*)p FC(,)g(15)365 3112 y Fy(run/string)p +FC(,)g(14)365 3212 y Fy(run/string*)p FC(,)f(15)365 3312 +y Fy(run/strings)p FC(,)g(14)365 3412 y Fy(run/strings*)p +FC(,)g(15)365 3599 y Fy(seek)p FC(,)j(31)365 3699 y Fy(select)41 +b FC(,)21 b(34)365 3799 y Fy(send-message)p FC(,)16 b(94)365 +3899 y Fy(send-message/part)o(ia)o(l)p FC(,)f(94)365 +3999 y Fy(send-tty-break)p FC(,)g(80)365 4099 y Fy(service-info)p +FC(,)h(96)365 4199 y Fy(set-enabled-inter)o(ru)o(pts)o +FC(,)f(66)365 4299 y Fy(set-fdes-flags)p FC(,)g(32)365 +4399 y Fy(set-fdes-status)p FC(,)g(33)365 4499 y Fy(set-file-group)p +FC(,)g(41)365 4599 y Fy(set-file-mode)p FC(,)g(41)365 +4698 y Fy(set-file-owner)p FC(,)g(41)365 4798 y Fy(set-file-times)p +FC(,)g(41)365 4898 y Fy(set-gid)p FC(,)j(60)1943 614 +y Fy(set-interrupt-ha)o(nd)o(le)o(r)p FC(,)d(66)1943 +714 y Fy(set-port-bufferi)o(ng)o FC(,)g(37)1943 814 y +Fy(set-priority)p FC(,)g(60)1943 913 y Fy(set-process-grou)o(p)p +FC(,)f(60)1943 1013 y Fy(set-socket-optio)o(n)p FC(,)g(95)1943 +1112 y Fy(set-tty-info/dra)o(in)o FC(,)h(79)1943 1212 +y Fy(set-tty-info/flu)o(sh)o FC(,)g(79)1943 1312 y Fy(set-tty-info/now) +o FC(,)g(79)1943 1411 y Fy(set-tty-process-)o(gr)o(ou)o(p)p +FC(,)g(81)1943 1511 y Fy(set-uid)p FC(,)i(60)1943 1611 +y Fy(set-umask)p FC(,)g(59)1943 1710 y Fy(setenv)p FC(,)h(73)1943 +1810 y Fy(shutdown-socket)p FC(,)c(94)1943 1910 y Fy(signal->interrup)o +(t)p FC(,)g(66)1943 2009 y Fy(signal-process)p FC(,)g(63)1943 +2109 y Fy(signal-process-g)o(ro)o(up)o FC(,)h(63)1943 +2208 y Fy(simplify-file-na)o(me)o FC(,)g(105)1943 2308 +y Fy(skip-char-set)p FC(,)g(1)-5 b(1)g(1)1943 2408 y +Fy(sleep)p FC(,)18 b(63)1943 2507 y Fy(sleep-until)p +FC(,)e(63)1943 2607 y Fy(sloppy-suffix-sp)o(li)o(tt)o(er)p +FC(,)e(1)-5 b(13)1943 2707 y Fy(socket-address->)o(in)o(te)o(rne)o(t-)o +(add)o(re)o(ss)o FC(,)2275 2806 y(92)1943 2906 y Fy(socket-address->)o +(un)o(ix)o(-ad)o(dr)o(ess)o FC(,)2275 3005 y(92)1943 +3105 y Fy(socket-connect)p FC(,)14 b(89)1943 3205 y Fy +(socket-local-add)o(re)o(ss)o FC(,)h(93)1943 3304 y Fy(socket-option)p +FC(,)g(95)1943 3404 y Fy(socket-remote-ad)o(dr)o(es)o(s)p +FC(,)g(93)1943 3504 y Fy(split-file-name)p FC(,)f(103)1943 +3603 y Fy(start-tty-input)p FC(,)g(80)1943 3703 y Fy(start-tty-output)o +FC(,)h(80)1943 3802 y Fy(status:exit-val)p FC(,)f(58)1943 +3902 y Fy(status:stop-sig)p FC(,)g(59)1943 4002 y Fy(status:term-sig)p +FC(,)g(59)1943 4101 y Fy(stdio->stdports)p FC(,)g(25)1943 +4201 y Fy(stdports->stdio)p FC(,)g(25)1943 4301 y Fy(stop-tty-input)p +FC(,)g(80)1943 4400 y Fy(stop-tty-output)p FC(,)g(80)1943 +4500 y Fy(string->char-set)o FC(,)h(107)1943 4599 y Fy(string-filter)p +FC(,)g(20)1943 4699 y Fy(string-match)p FC(,)g(98)1943 +4799 y Fy(string-output-po)o(rt)o(-o)o(utp)o(ut)o FC(,)g(26)1943 +4898 y Fy(substitute-env-v)o(ar)o(s)p FC(,)f(100)1735 +5147 y(159)p eop +%%Page: 160 166 +160 165 bop 681 614 a Fy(suffix-splitter)p FC(,)14 b(1)-5 +b(13)681 714 y Fy(suspend)p FC(,)17 b(53)681 814 y Fy(sync-file)p +FC(,)g(41)681 914 y Fy(sync-file-system)o FC(,)e(41)681 +1014 y Fy(system-name)p FC(,)h(63)681 1202 y Fy(tell)p +FC(,)j(31)681 1302 y Fy(temp-file-channe)o(l)p FC(,)14 +b(50)681 1401 y Fy(temp-file-iterat)o(e)p FC(,)g(49)681 +1501 y Fy(ticks/sec)p FC(,)j(69)681 1601 y(time,)k(68,)e(70)681 +1701 y Fy(time+ticks)p FC(,)d(69)681 1801 y Fy(truncate-file)p +FC(,)f(41)681 1901 y Fy(tty-file-name)p FC(,)g(77)681 +2001 y Fy(tty-info)p FC(,)i(79)681 2101 y(tty-info)k(r)o(ecor)o(d)e +(type,)h(77)681 2201 y Fy(tty-info:control)o(-c)o(har)o(s)p +FC(,)14 b(77)681 2301 y Fy(tty-info:control)o(-f)o(lag)o(s)p +FC(,)g(77)681 2401 y Fy(tty-info:input-f)o(la)o(gs)p +FC(,)g(77)681 2500 y Fy(tty-info:input-s)o(pe)o(ed)p +FC(,)g(77)681 2600 y Fy(tty-info:local-f)o(la)o(gs)p +FC(,)g(77)681 2700 y Fy(tty-info:min)p FC(,)h(77)681 +2800 y Fy(tty-info:output-)o(fl)o(ags)o FC(,)g(77)681 +2900 y Fy(tty-info:output-)o(sp)o(eed)o FC(,)g(77)681 +3000 y Fy(tty-info:time)p FC(,)g(77)681 3100 y Fy(tty-info?)p +FC(,)i(77)681 3200 y Fy(tty-name->pty-na)o(me)o FC(,)e(82)681 +3300 y Fy(tty-process-grou)o(p)p FC(,)f(81)681 3400 y +Fy(tty?)p FC(,)19 b(77)681 3500 y Fy(ttyc/2-stop-bits)o +FC(,)c(87)681 3599 y Fy(ttyc/CTS-output-)o(fl)o(ow-)o(ct)o(l)p +FC(,)f(87)681 3699 y Fy(ttyc/RTS-input-f)o(lo)o(w-c)o(tl)o +FC(,)h(87)681 3799 y Fy(ttyc/carrier-flo)o(w-)o(ctl)o +FC(,)g(87)681 3899 y Fy(ttyc/char-size)p FC(,)f(87)681 +3999 y Fy(ttyc/char-size5)p FC(,)g(87)681 4099 y Fy(ttyc/char-size6)p +FC(,)g(87)681 4199 y Fy(ttyc/char-size7)p FC(,)g(87)681 +4299 y Fy(ttyc/char-size8)p FC(,)g(87)681 4399 y Fy(ttyc/enable-pari)o +(ty)o FC(,)h(87)681 4499 y Fy(ttyc/enable-read)o FC(,)g(87)681 +4599 y Fy(ttyc/hup-on-clos)o(e)p FC(,)f(87)681 4698 y +Fy(ttyc/ignore-flag)o(s)p FC(,)g(87)681 4798 y Fy(ttyc/no-modem-sy)o +(nc)o FC(,)h(87)681 4898 y Fy(ttyc/odd-parity)p FC(,)f(87)2258 +614 y Fy(ttychar/delayed-s)o(us)o(pen)o(d)p FC(,)g(84)2258 +714 y Fy(ttychar/delete-ch)o(ar)o FC(,)h(84)2258 814 +y Fy(ttychar/delete-li)o(ne)o FC(,)g(84)2258 913 y Fy +(ttychar/delete-wo)o(rd)o FC(,)g(84)2258 1013 y Fy(ttychar/discard)p +FC(,)g(84)2258 1112 y Fy(ttychar/eof)p FC(,)h(84)2258 +1212 y Fy(ttychar/eol)p FC(,)g(84)2258 1312 y Fy(ttychar/eol2)p +FC(,)g(84)2258 1411 y Fy(ttychar/interrupt)o FC(,)f(84)2258 +1511 y Fy(ttychar/literal-n)o(ex)o(t)p FC(,)f(84)2258 +1611 y Fy(ttychar/quit)p FC(,)i(84)2258 1710 y Fy(ttychar/reprint)p +FC(,)f(84)2258 1810 y Fy(ttychar/start)p FC(,)g(84)2258 +1910 y Fy(ttychar/status)p FC(,)g(84)2258 2009 y Fy(ttychar/stop)p +FC(,)h(84)2258 2109 y Fy(ttychar/suspend)p FC(,)f(84)2258 +2208 y Fy(ttyin/7bits)p FC(,)h(85)2258 2308 y Fy(ttyin/beep-on-ove)o +(rf)o(low)o FC(,)f(85)2258 2408 y Fy(ttyin/check-parit)o(y)p +FC(,)f(85)2258 2507 y Fy(ttyin/cr->nl)p FC(,)i(85)2258 +2607 y Fy(ttyin/ignore-bad-)o(pa)o(rit)o(y-)o(ch)o(ars)o +FC(,)2590 2707 y(85)2258 2806 y Fy(ttyin/ignore-brea)o(k)p +FC(,)e(85)2258 2906 y Fy(ttyin/ignore-cr)p FC(,)h(85)2258 +3005 y Fy(ttyin/input-flow-)o(ct)o(l)p FC(,)f(85)2258 +3105 y Fy(ttyin/interrupt-o)o(n-)o(bre)o(ak)o FC(,)h(85)2258 +3205 y Fy(ttyin/lowercase)p FC(,)g(85)2258 3304 y Fy(ttyin/mark-parity) +o(-e)o(rro)o(rs)o FC(,)g(85)2258 3404 y Fy(ttyin/nl->cr)p +FC(,)h(85)2258 3504 y Fy(ttyin/output-flow)o(-c)o(tl)p +FC(,)e(85)2258 3603 y Fy(ttyin/xon-any)p FC(,)h(85)2258 +3703 y Fy(ttyl/alt-delete-w)o(or)o(d)p FC(,)f(88)2258 +3802 y Fy(ttyl/canonical)p FC(,)h(88)2258 3902 y Fy(ttyl/case-map)p +FC(,)g(88)2258 4002 y Fy(ttyl/echo)p FC(,)i(88)2258 4101 +y Fy(ttyl/echo-ctl)p FC(,)e(88)2258 4201 y Fy(ttyl/echo-delete-)o(li)o +(ne)p FC(,)f(88)2258 4301 y Fy(ttyl/echo-nl)p FC(,)i(88)2258 +4400 y Fy(ttyl/enable-signa)o(ls)o FC(,)f(88)2258 4500 +y Fy(ttyl/extended)p FC(,)g(88)2258 4599 y Fy(ttyl/flush-output)o +FC(,)g(88)2258 4699 y Fy(ttyl/hardcopy-del)o(et)o(e)p +FC(,)f(88)2258 4799 y Fy(ttyl/no-flush-on-)o(in)o(ter)o(ru)o(pt)o +FC(,)h(88)2258 4898 y Fy(ttyl/no-kernel-st)o(at)o(us)p +FC(,)f(88)2051 5147 y(160)p eop +%%Page: 161 167 +161 166 bop 365 614 a Fy(ttyl/reprint-unre)o(ad)o(-ch)o(ar)o(s)p +FC(,)14 b(88)365 714 y Fy(ttyl/ttou-signal)p FC(,)g(88)365 +814 y Fy(ttyl/visual-delet)o(e)p FC(,)g(88)365 914 y +Fy(ttyl/visual-delet)o(e-)o(lin)o(e)p FC(,)g(88)365 1014 +y Fy(ttyout/all-delay)p FC(,)g(86)365 1114 y Fy(ttyout/bs-delay)p +FC(,)h(86)365 1214 y Fy(ttyout/bs-delay0)p FC(,)f(86)365 +1314 y Fy(ttyout/bs-delay1)p FC(,)g(86)365 1414 y Fy(ttyout/cr->nl)p +FC(,)h(85)365 1514 y Fy(ttyout/cr-delay)p FC(,)g(86)365 +1614 y Fy(ttyout/cr-delay0)p FC(,)f(86)365 1713 y Fy(ttyout/cr-delay1)p +FC(,)g(86)365 1813 y Fy(ttyout/cr-delay2)p FC(,)g(86)365 +1913 y Fy(ttyout/cr-delay3)p FC(,)g(86)365 2013 y Fy(ttyout/delay-w/fi) +o(ll)o(-ch)o(ar)o FC(,)h(85)365 2113 y Fy(ttyout/discard-eo)o(t)p +FC(,)f(85)365 2213 y Fy(ttyout/enable)p FC(,)h(85)365 +2313 y Fy(ttyout/expand-tab)o(s)p FC(,)f(85)365 2413 +y Fy(ttyout/ff-delay)p FC(,)h(86)365 2513 y Fy(ttyout/ff-delay0)p +FC(,)f(86)365 2613 y Fy(ttyout/ff-delay1)p FC(,)g(86)365 +2713 y Fy(ttyout/fill-w/del)o FC(,)h(85)365 2812 y Fy(ttyout/nl->crnl)p +FC(,)g(85)365 2912 y Fy(ttyout/nl-delay)p FC(,)g(86)365 +3012 y Fy(ttyout/nl-delay0)p FC(,)f(86)365 3112 y Fy(ttyout/nl-delay1)p +FC(,)g(86)365 3212 y Fy(ttyout/nl-does-cr)o FC(,)h(85)365 +3312 y Fy(ttyout/no-col0-cr)o FC(,)g(85)365 3412 y Fy(ttyout/tab-delay) +p FC(,)f(86)365 3512 y Fy(ttyout/tab-delay0)o FC(,)h(86)365 +3612 y Fy(ttyout/tab-delay1)o FC(,)g(86)365 3712 y Fy +(ttyout/tab-delay2)o FC(,)g(86)365 3812 y Fy(ttyout/tab-delayx)o +FC(,)g(86)365 3912 y Fy(ttyout/uppercase)p FC(,)f(85)365 +4011 y Fy(ttyout/vtab-delay)o FC(,)h(86)365 4111 y Fy +(ttyout/vtab-delay)o(0)p FC(,)f(86)365 4211 y Fy(ttyout/vtab-delay)o(1) +p FC(,)g(86)365 4399 y Fy(umask)p FC(,)19 b(59)365 4499 +y Fy(unix-address->soc)o(ke)o(t-a)o(dd)o(res)o(s)p FC(,)697 +4599 y(92)365 4698 y Fy(unlock-region)p FC(,)c(39)365 +4798 y Fy(user-effective-gi)o(d)p FC(,)f(60)365 4898 +y Fy(user-effective-ui)o(d)p FC(,)g(60)1943 614 y Fy(user-gid)p +FC(,)j(60)1943 714 y(user)o(-info,)j(61)1943 814 y(user)o(-info:gid,)f +(61)1943 913 y(user)o(-info:home-dir)-6 b(,)19 b(61)1943 +1013 y(user)o(-info:name,)g(61)1943 1112 y(user)o(-info:shell,)h(61) +1943 1212 y(user)o(-info:uid,)f(61)1943 1312 y Fy(user-login-name)p +FC(,)14 b(60)1943 1411 y Fy(user-supplementa)o(ry)o(-g)o(ids)o +FC(,)h(60)1943 1511 y Fy(user-uid)p FC(,)i(60)1943 1694 +y Fy(wait)p FC(,)i(57)1943 1793 y Fy(wait-any)p FC(,)e(57)1943 +1893 y Fy(wait-process-gro)o(up)o FC(,)e(58)1943 1993 +y Fy(with-current-inp)o(ut)o(-p)o(ort)o FC(,)g(24)1943 +2092 y Fy(with-current-inp)o(ut)o(-p)o(ort)o(*)p FC(,)f(24)1943 +2192 y Fy(with-current-out)o(pu)o(t-)o(por)o(t)p FC(,)g(24)1943 +2291 y Fy(with-current-out)o(pu)o(t-)o(por)o(t*)o FC(,)h(24)1943 +2391 y Fy(with-cwd)p FC(,)i(59)1943 2491 y Fy(with-cwd*)p +FC(,)g(59)1943 2590 y Fy(with-enabled-int)o(er)o(ru)o(pts)o +FC(,)e(66)1943 2690 y Fy(with-enabled-int)o(er)o(ru)o(pts)o(*)p +FC(,)f(66)1943 2790 y Fy(with-env)p FC(,)j(74)1943 2889 +y Fy(with-env*)p FC(,)g(74)1943 2989 y Fy(with-errno-handl)o(er)o +FC(,)e(22)1943 3088 y Fy(with-errno-handl)o(er)o(*)p +FC(,)f(22)1943 3188 y Fy(with-error-outpu)o(t-)o(po)o(rt)p +FC(,)g(24)1943 3288 y Fy(with-error-outpu)o(t-)o(po)o(rt*)o +FC(,)h(24)1943 3387 y Fy(with-region-lock)o FC(,)g(39)1943 +3487 y Fy(with-region-lock)o(*)p FC(,)f(39)1943 3587 +y Fy(with-stdio-ports)o FC(,)h(26)1943 3686 y Fy(with-stdio-ports)o(*)p +FC(,)f(26)1943 3786 y Fy(with-total-env)p FC(,)g(74)1943 +3885 y Fy(with-total-env*)p FC(,)g(74)1943 3985 y Fy(with-umask)p +FC(,)i(59)1943 4085 y Fy(with-umask*)p FC(,)g(59)1943 +4184 y Fy(write-string)p FC(,)f(35)1943 4284 y Fy(write-string/par)o +(ti)o(al)o FC(,)g(36)1735 5147 y(161)p eop %%Trailer end userdict /end-hook known{end-hook}if