From 5c5ae4dc99a56e17aa1a5a1c4537e0167b79fc62 Mon Sep 17 00:00:00 2001 From: shivers Date: Sat, 19 Apr 1997 04:01:19 +0000 Subject: [PATCH] Fixed some design and implementation bugs in regexp-substitute/global. --- doc/scsh-manual.ps | 6603 ++++++++++++++++++----------------- doc/scsh-manual/strings.tex | 57 +- scsh/re.scm | 93 +- 3 files changed, 3411 insertions(+), 3342 deletions(-) diff --git a/doc/scsh-manual.ps b/doc/scsh-manual.ps index 9e7a30e..6d46438 100644 --- a/doc/scsh-manual.ps +++ b/doc/scsh-manual.ps @@ -1,7 +1,7 @@ %!PS-Adobe-2.0 %%Creator: dvipsk 5.58f Copyright 1986, 1994 Radical Eye Software %%Title: man.dvi -%%Pages: 168 +%%Pages: 169 %%PageOrder: Ascend %%BoundingBox: 0 0 612 792 %%DocumentFonts: Palatino-Bold Palatino-Roman Palatino-Italic @@ -9,7 +9,7 @@ %%EndComments %DVIPSCommandLine: dvips -o man.ps man.dvi %DVIPSParameters: dpi=600, comments removed -%DVIPSSource: TeX output 1997.04.17:2202 +%DVIPSSource: TeX output 1997.04.18:2358 %%BeginProcSet: tex.pro /TeXDict 250 dict def TeXDict begin /N{def}def /B{bind def}N /S{exch}N /X{S N}B /TR{translate}N /isls false N /vsize 11 72 mul N /hsize 8.5 72 @@ -223,7 +223,7 @@ D E /Fe 157[23 22 97[{ TeXBase1Encoding ReEncodeFont }2 50.000001 /Palatino-Italic rf /Ff 157[27 26 97[{ TeXBase1Encoding ReEncodeFont }2 58.333334 /Palatino-Italic rf /Fg 167[40 4[31 3[47 5[20 73[{ TeXBase1Encoding ReEncodeFont }4 -59.999974 /Palatino-Roman rf /Fh 85 126 df<3C7EFFFFFFFFFFFFFFFFFFFFFFFF +59.999974 /Palatino-Roman rf /Fh 87 126 df<3C7EFFFFFFFFFFFFFFFFFFFFFFFF FFFFFF7E7E7E7E7E7E7E7E7E7E7E7E7E7E3C000000000000003C7EFFFFFFFF7E3C082F71 AE27>33 D<1000207C00F8FE01FCFE01FCFE01FCFE01FCFE01FCFE01FCFE01FCFE01FCFE 01FCFE01FCFC00FC7C00F87C00F87C00F87C00F87C00F87C00F87C00F87C00F87C00F838 @@ -246,279 +246,286 @@ FF81F80003FF01F00001FE01F00001FC03F00001F803E00003F807E00007FC07C0000FFC 07C0001FFE0FC0003FBE0F80003F3F1F80007E1F1F00007E1F9F0000FC0FBF0000FC0FFE 0000FC07FE0000FC07FC0200FC03FC0F80FC01F80F80FC01F80F80FE03FC0F807E07FE0F 807F1FFF9F803FFFFFFF003FFF9FFF001FFF0FFE000FFC03FC0003F000F80022307EAE27 ->38 D<0001C00003E0000FE0001FE0003FC0007F8000FE0001FC0001F80003F80007F000 -07E0000FC0000FC0001F80001F80003F00003F00003F00007E00007E00007E00007E0000 -FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000 -7E00007E00007E00007E00003F00003F00003F00001F80001F80000FC0000FC00007E000 -07F00003F80001F80001FC0000FE00007F80003FC0001FE0000FE00003E00001C0133A73 -B327>40 D<700000F80000FE0000FF00007F80003FC0000FE00007F00003F00003F80001 -FC0000FC00007E00007E00003F00003F00001F80001F80001F80000FC0000FC0000FC000 -0FC00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E000 -07E0000FC0000FC0000FC0000FC0001F80001F80001F80003F00003F00007E00007E0000 -FC0001FC0003F80003F00007F0000FE0003FC0007F8000FF0000FE0000F8000070000013 -3A7AB327>I<000F0000001F8000001F8000001F8000001F8000001F8000001F8000781F -81E0FE1F87F0FF1F8FF0FFDFBFF07FFFFFE03FFFFFC00FFFFF0003FFFC0000FFF00000FF -F00003FFFC000FFFFF003FFFFFC07FFFFFE0FFDFBFF0FF1F8FF0FE1F87F0781F81E0001F -8000001F8000001F8000001F8000001F8000001F8000000F00001C207BA627>I<0003C0 +>38 D<0F001FC03FC03FE03FE03FF01FF00FF001F001F001F001F003F003E007E00FC00F +C03F807F00FF00FE00F80070000C1773AD27>I<0001C00003E0000FE0001FE0003FC000 +7F8000FE0001FC0001F80003F80007F00007E0000FC0000FC0001F80001F80003F00003F +00003F00007E00007E00007E00007E0000FC0000FC0000FC0000FC0000FC0000FC0000FC +0000FC0000FC0000FC0000FC0000FC00007E00007E00007E00007E00003F00003F00003F +00001F80001F80000FC0000FC00007E00007F00003F80001F80001FC0000FE00007F8000 +3FC0001FE0000FE00003E00001C0133A73B327>I<700000F80000FE0000FF00007F8000 +3FC0000FE00007F00003F00003F80001FC0000FC00007E00007E00003F00003F00001F80 +001F80001F80000FC0000FC0000FC0000FC00007E00007E00007E00007E00007E00007E0 +0007E00007E00007E00007E00007E00007E0000FC0000FC0000FC0000FC0001F80001F80 +001F80003F00003F00007E00007E0000FC0001FC0003F80003F00007F0000FE0003FC000 +7F8000FF0000FE0000F80000700000133A7AB327>I<000F0000001F8000001F8000001F +8000001F8000001F8000001F8000781F81E0FE1F87F0FF1F8FF0FFDFBFF07FFFFFE03FFF +FFC00FFFFF0003FFFC0000FFF00000FFF00003FFFC000FFFFF003FFFFFC07FFFFFE0FFDF +BFF0FF1F8FF0FE1F87F0781F81E0001F8000001F8000001F8000001F8000001F8000001F +8000000F00001C207BA627>I<0003C0000007E0000007E0000007E0000007E0000007E0 +000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0007FFFFF +FEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFE0007E0000007E0000007E0000007E0 000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0 -000007E0000007E0000007E0000007E0007FFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -FF7FFFFFFE0007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0 -000007E0000007E0000007E0000007E0000007E0000003C00020227DA727>I<0F003FC0 -3FE07FF07FF07FF87FF83FF83FF80FF801F801F003F007E01FE07FC0FF80FF00FE007000 -0D14738927>I<7FFFFFF8FFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC7FFFFFF81E067C9927> -I<1E007F807F80FFC0FFC0FFC0FFC07F807F801E000A0A728927>I<000000380000007C -000000FC000000FC000001FC000001F8000003F8000003F0000007F0000007E000000FE0 -00000FC000001FC000001F8000003F8000003F0000003F0000007F0000007E000000FE00 -0000FC000001FC000001F8000003F8000003F0000007F0000007E000000FE000000FC000 -000FC000001FC000001F8000003F8000003F0000007F0000007E000000FE000000FC0000 -01FC000001F8000003F8000003F0000003F0000007F0000007E000000FE000000FC00000 -1FC000001F8000003F8000003F0000007F0000007E000000FE000000FC000000FC000000 -F8000000780000001E3A7CB327>I<0007E000003FFC00007FFE0000FFFF0001FFFF8003 -FC3FC007F00FE00FE007F00FC003F01F8001F81F8001F83F0000FC3F0000FC3E00007C7E -00007E7E00007E7E00007E7C00003EFC00003FFC00003FFC00003FFC00003FFC00003FFC -00003FFC00003FFC00003FFC00003FFC00003FFC00003FFC00003F7E00007E7E00007E7E -00007E7E00007E3F0000FC3F0000FC3F8001FC1F8001F81FC003F80FC003F00FE007F007 -F00FE003FC3FC001FFFF8000FFFF00007FFE00003FFC000007E00020307DAE27>I<000E -0000001F0000001F0000003F0000007F0000007F000000FF000001FF000003FF00007FFF -0000FFFF0000FFFF0000FFBF00007E3F0000003F0000003F0000003F0000003F0000003F -0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F -0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F -0000003F0000003F0000003F0000003F0000003F00003FFFFF807FFFFF807FFFFFC07FFF -FF807FFFFF801A2F79AE27>I<003FE00001FFF80003FFFE000FFFFF801FFFFFC03FE07F -E03F800FE07F0007F07E0003F8FE0001F8FC0001F8FE0001FCFE0000FCFE0000FCFE0000 -FC7C0000FC000000FC000000FC000001FC000001F8000001F8000003F8000003F0000007 -F000000FE000001FC000003FC000007F800000FF000001FE000003FC000007F800000FF0 -00001FE000003FC000007F800000FE000001FC000007F800780FF000FC1FE000FC3FC000 -FC7FFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC7FFFFFF81E2F7CAE27>I<001FF80000FFFE00 -03FFFF800FFFFFC00FFFFFE01FF01FF03FC007F83F8001F83F8001FC3F8000FC3F8000FC -1F0000FC040000FC000000FC000001FC000001F8000003F8000007F000000FF000003FE0 -001FFFC0003FFF80003FFF80003FFFE0001FFFF000001FF8000003FC000001FC000000FE -0000007E0000007F0000003F0000003F3800003F7C00003FFE00003FFE00003FFE00007F -FC00007EFE0000FE7F0001FC7F8003FC3FF01FF81FFFFFF00FFFFFE003FFFF8000FFFE00 -001FF80020307DAE27>I<00003F800000007FC00000007FC0000000FFC0000001FFC000 -0001FFC0000003F7C0000007E7C0000007E7C000000FC7C000000F87C000001F87C00000 -3F07C000003F07C000007E07C00000FC07C00000FC07C00001F807C00001F007C00003F0 -07C00007E007C00007E007C0000FC007C0001F8007C0001F8007C0003F0007C0003E0007 -C0007E0007C000FC0007C000FFFFFFFF80FFFFFFFFC0FFFFFFFFC0FFFFFFFFC07FFFFFFF -80000007C000000007C000000007C000000007C000000007C000000007C000000007C000 -000007C0000001FFFF000003FFFF800003FFFF800003FFFF800001FFFF00222F7EAE27> -I<1FFFFFE03FFFFFF03FFFFFF03FFFFFF03FFFFFE03F0000003F0000003F0000003F0000 -003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F1FF0 -003FFFFC003FFFFF003FFFFF803FFFFFC03FF03FE03FC00FF03F0007F03E0003F81C0001 -F8000001F8000001FC000000FC000000FC000000FC7C0000FCFE0000FCFE0000FCFE0001 -FCFE0001F8FC0003F8FE0003F07F000FF07F801FE03FE07FC01FFFFF800FFFFF0007FFFE -0001FFF800007FC0001E2F7CAD27>I<0000FF000007FFC0001FFFF0003FFFF800FFFFF8 -01FF81FC03FE01FC03F801FC07F001FC0FE001FC0FC000F81FC000003F8000003F000000 -3F0000007F0000007E0000007E0FF800FE3FFE00FCFFFF80FFFFFFC0FFFFFFE0FFF80FF0 -FFE007F8FF8001FCFF0000FCFF0000FEFE00007EFE00007FFE00003FFE00003FFE00003F -7E00003F7E00003F7E00003F7F00003F3F00007F3F00007E1F8000FE1FC001FC0FC001FC -0FF007F807F81FF003FFFFE001FFFFC000FFFF80003FFE00000FF80020307DAE27>I<78 -000000FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFC0001FCFC0003F8FC0007F078 -0007E000000FE000001FC000001F8000003F8000007F0000007E000000FE000000FC0000 -01FC000001F8000003F8000003F0000007F0000007E0000007E000000FC000000FC00000 -0FC000001F8000001F8000001F8000003F8000003F0000003F0000003F0000003F000000 -3F0000007F0000007E0000007E0000007E0000007E0000007E0000007E0000007E000000 -7E0000007E0000003C000020307DAE27>I<000FF000007FFE0001FFFF8003FFFFC00FFF -FFF00FF81FF01FE007F83F8001FC3F0000FC7F0000FE7E00007E7E00007E7E00007E7E00 -007E7E00007E3F0000FC3F8001FC1FC003F80FE007F007FC3FE001FFFF80007FFE00003F -FC0000FFFF0003FFFFC00FF00FF01FC003F83F8001FC3F0000FC7E00007E7E00007EFC00 -003FFC00003FFC00003FFC00003FFC00003FFC00003F7E00007E7E00007E7F0000FE3F80 -01FC1FE007F81FF81FF80FFFFFF007FFFFE001FFFF80007FFE00000FF00020307DAE27> -I<000FF000007FFC0001FFFF0003FFFF8007FFFFC00FF81FE01FE007F03FC003F83F8001 -F87F0001FC7E0000FCFE0000FCFC00007EFC00007EFC00007EFC00007EFC00007FFC0000 -7FFC00007FFE00007F7E00007F7F0000FF3F0000FF3F8001FF1FE007FF0FF01FFF07FFFF -FF03FFFFFF01FFFF3F007FFC7F001FF07E0000007E0000007E000000FC000000FC000001 -FC000001F81F0003F83F8007F03F800FE03F801FE03F803FC03FC0FF801FFFFF001FFFFE -000FFFF80003FFE00000FF800020307DAE27>I<1E007F807F80FFC0FFC0FFC0FFC07F80 -7F801E000000000000000000000000000000000000000000000000001E007F807F80FFC0 -FFC0FFC0FFC07F807F801E000A20729F27>I<0F003FC03FC07FE07FE07FE07FE03FC03F -C00F000000000000000000000000000000000000000000000000000F003F803FC07FC07F -E07FE07FE03FE03FE00FE007E007C00FC00FC03F807F00FF00FE00F80070000B2A739F27 ->I<7FFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3FFFFFFE00000000000000000000 -00000000000000000000000000003FFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFF -FFFE20127D9F27>61 D<70000000FC000000FE000000FF800000FFC000007FF000001FF8 -00000FFC000003FF000001FF8000007FE000003FF000001FF8000007FE000003FF000000 -FFC000007FE000003FF800000FFC000007FC000007FC00000FFC00003FF800007FE00000 -FFC00003FF000007FE00001FF800003FF000007FE00001FF800003FF00000FFC00001FF8 -00007FF00000FFC00000FF800000FE000000FC000000700000001E287CAA27>I<00FFF8 -0003FFFF000FFFFFC03FFFFFE07FFFFFF07FC01FF8FF0003FCFE0001FCFE0000FCFE0000 -FCFE0001FC7C0003FC00000FF800001FF000007FE00000FFC00001FF000003FC000007F8 -000007F000000FE000000FC000001FC000001F8000001F8000001F8000001F8000001F80 -00001F8000001F8000000F00000000000000000000000000000000000000000000000000 -0000000000000F0000001F8000003FC000003FC000003FC000003FC000001F8000000F00 -001E2E7CAD27>I<0001FE000007FF80001FFFC0007FFFE000FFFFF001FF03F803FC01F8 -07F000FC0FE01F7C0FC07FFE1F80FFFE1F01FFFE3F03FFFE3E07F1FF7E07E0FF7C0FC07F -7C0F803F7C0F803FFC1F803FF81F001FF81F001FF81F001FF81F001FF81F001FF81F001F -F81F001FF81F001FFC1F803F7C0F803E7C0F803E7C0FC07E7E07E0FC3E07F1FC3F03FFF8 -1F01FFF01F80FFE00FC07FC00FE01F1E07F0003F03FC007F01FF03FF00FFFFFE007FFFFC -001FFFF00007FFC00001FF00202E7DAD27>I<0003F000000007F800000007F80000000F -FC0000000FFC0000000FFC0000000FFC0000000F3C0000001F3E0000001F3E0000001F3E -0000001F3E0000001F3E0000003F3F0000003F3F0000003F3F0000003E1F0000003E1F00 -00007E1F8000007E1F8000007E1F8000007E1F800000FC0FC00000FC0FC00000FC0FC000 -00FC0FC00000FC0FC00001F807E00001F807E00001F807E00001FFFFE00001FFFFE00003 -FFFFF00003FFFFF00003FFFFF00003F003F00003F003F00007E001F80007E001F80007E0 -01F80007E001F8000FE001FC007FFC0FFF80FFFC0FFFC0FFFE1FFFC0FFFC0FFFC07FFC0F -FF80222F7EAE27>I<7FFFFF0000FFFFFFC000FFFFFFE000FFFFFFF8007FFFFFF80007E0 -03FC0007E000FE0007E0007E0007E0007F0007E0003F0007E0003F0007E0003F0007E000 -3F0007E0003F0007E0003F0007E0007E0007E0007E0007E000FC0007E003FC0007E00FF8 -0007FFFFF00007FFFFC00007FFFFF00007FFFFF80007FFFFFC0007E000FE0007E0007F00 -07E0003F8007E0001F8007E0001F8007E0000FC007E0000FC007E0000FC007E0000FC007 -E0000FC007E0000FC007E0001FC007E0001F8007E0003F8007E0007F0007E001FF007FFF -FFFE00FFFFFFFC00FFFFFFF800FFFFFFE0007FFFFF8000222E7FAD27>I<0003F80E001F -FE1F003FFFBF00FFFFFF01FFFFFF03FE0FFF07F803FF07F001FF0FE000FF1FC000FF1F80 -007F1F80007F3F00003F3F00003F7F00003F7E00003F7E00001E7E000000FE000000FC00 -0000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC00 -0000FE0000007E0000007E0000007E00001E7F00003F3F00003F3F00003F1F80003F1F80 -007F1FC0007E0FE000FE07F001FC07F803FC03FE0FF801FFFFF000FFFFE0003FFFC0001F -FF000003F80020307DAE27>I<7FFFFC00007FFFFF0000FFFFFFC0007FFFFFE0007FFFFF -F00007E00FF80007E007F80007E001FC0007E000FE0007E000FE0007E0007E0007E0007F -0007E0003F0007E0003F8007E0001F8007E0001F8007E0001F8007E0001FC007E0000FC0 -07E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007 -E0000FC007E0000FC007E0000FC007E0001F8007E0001F8007E0001F8007E0003F8007E0 -003F0007E0003F0007E0007F0007E000FE0007E000FE0007E001FC0007E003F80007E00F -F8007FFFFFF0007FFFFFE000FFFFFFC0007FFFFF00007FFFFC0000222E7FAD27>I<7FFF -FFFF80FFFFFFFFC0FFFFFFFFC0FFFFFFFFC07FFFFFFFC007E0000FC007E0000FC007E000 -0FC007E0000FC007E0000FC007E0000FC007E000078007E000000007E000000007E00000 -0007E000000007E007800007E00FC00007E00FC00007E00FC00007FFFFC00007FFFFC000 -07FFFFC00007FFFFC00007FFFFC00007E00FC00007E00FC00007E00FC00007E007800007 -E000000007E000000007E000000007E000000007E00003C007E00007E007E00007E007E0 -0007E007E00007E007E00007E007E00007E007E00007E07FFFFFFFE0FFFFFFFFE0FFFFFF -FFE0FFFFFFFFE07FFFFFFFC0232E7FAD27>I<7FFFFFFF80FFFFFFFFC0FFFFFFFFC0FFFF -FFFFC07FFFFFFFC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E000 -0FC007E000078007E000000007E000000007E000000007E000000007E007800007E00FC0 -0007E00FC00007E00FC00007FFFFC00007FFFFC00007FFFFC00007FFFFC00007FFFFC000 -07E00FC00007E00FC00007E00FC00007E007800007E000000007E000000007E000000007 -E000000007E000000007E000000007E000000007E000000007E000000007E000000007E0 -00000007E00000007FFF800000FFFFC00000FFFFC00000FFFFC000007FFF800000222E7E -AD27>I<0007F03800001FFC7C00007FFFFC0000FFFFFC0001FFFFFC0003FC1FFC0007F0 -0FFC000FE007FC000FC003FC001FC001FC001F8001FC003F8001FC003F0000FC003F0000 -FC007E0000FC007E0000FC007E000078007E00000000FC00000000FC00000000FC000000 -00FC00000000FC00000000FC00000000FC00000000FC00000000FC001FFF00FC003FFF80 -FC003FFF80FC003FFF807E001FFF007E0000FC007E0000FC007E0000FC003F0001FC003F -0001FC003F8001FC001F8001FC001FC003FC000FC003FC000FE007FC0007F00FFC0003FC -1FFC0001FFFFFC0000FFFFFC00007FFEFC00001FFC78000007F0000021307DAE27>I<7F -FE07FFE0FFFF0FFFF0FFFF0FFFF0FFFF0FFFF07FFE07FFE007E0007E0007E0007E0007E0 -007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E000 -7E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007FFFFFE0007FFFFFE -0007FFFFFE0007FFFFFE0007FFFFFE0007E0007E0007E0007E0007E0007E0007E0007E00 -07E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007 -E0007E0007E0007E0007E0007E0007E0007E0007E0007E007FFE07FFE0FFFF0FFFF0FFFF -0FFFF0FFFF0FFFF07FFE07FFE0242E7FAD27>I<7FFFFFE0FFFFFFF0FFFFFFF0FFFFFFF0 -7FFFFFE0001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000 -001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000 -001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000 -001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000 -001F80007FFFFFE0FFFFFFF0FFFFFFF0FFFFFFF07FFFFFE01C2E7BAD27>I<7FFC07FF80 -7FFC07FFC0FFFE0FFFC07FFC07FFC07FFC07FF8007C001F80007C003F80007C003F00007 -C007E00007C00FC00007C01FC00007C01F800007C03F000007C07E000007C0FE000007C0 -FC000007C1F8000007C3F0000007C7F0000007C7E0000007CFF0000007DFF8000007FFF8 -000007FFFC000007FEFC000007FC7E000007FC3E000007F83F000007F01F000007E01F80 -0007E00F800007C00FC00007C007C00007C007E00007C003E00007C003F00007C001F800 -07C001F80007C000FC0007C0007C0007C0007E007FFC01FFC07FFC01FFE0FFFE03FFE07F -FC01FFE07FFC01FFC0232E7FAD27>75 D<7FFFC000007FFFE00000FFFFE000007FFFE000 -007FFFC0000003F000000003F000000003F000000003F000000003F000000003F0000000 +000003C00020227DA727>I<0F003FC03FE07FF07FF07FF87FF83FF83FF80FF801F801F0 +03F007E01FE07FC0FF80FF00FE0070000D14738927>I<7FFFFFF8FFFFFFFCFFFFFFFCFF +FFFFFCFFFFFFFC7FFFFFF81E067C9927>I<1E007F807F80FFC0FFC0FFC0FFC07F807F80 +1E000A0A728927>I<000000380000007C000000FC000000FC000001FC000001F8000003 +F8000003F0000007F0000007E000000FE000000FC000001FC000001F8000003F8000003F +0000003F0000007F0000007E000000FE000000FC000001FC000001F8000003F8000003F0 +000007F0000007E000000FE000000FC000000FC000001FC000001F8000003F8000003F00 +00007F0000007E000000FE000000FC000001FC000001F8000003F8000003F0000003F000 +0007F0000007E000000FE000000FC000001FC000001F8000003F8000003F0000007F0000 +007E000000FE000000FC000000FC000000F8000000780000001E3A7CB327>I<0007E000 +003FFC00007FFE0000FFFF0001FFFF8003FC3FC007F00FE00FE007F00FC003F01F8001F8 +1F8001F83F0000FC3F0000FC3E00007C7E00007E7E00007E7E00007E7C00003EFC00003F +FC00003FFC00003FFC00003FFC00003FFC00003FFC00003FFC00003FFC00003FFC00003F +FC00003FFC00003F7E00007E7E00007E7E00007E7E00007E3F0000FC3F0000FC3F8001FC +1F8001F81FC003F80FC003F00FE007F007F00FE003FC3FC001FFFF8000FFFF00007FFE00 +003FFC000007E00020307DAE27>I<000E0000001F0000001F0000003F0000007F000000 +7F000000FF000001FF000003FF00007FFF0000FFFF0000FFFF0000FFBF00007E3F000000 +3F0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F000000 +3F0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F000000 +3F0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F000000 +3F00003FFFFF807FFFFF807FFFFFC07FFFFF807FFFFF801A2F79AE27>I<003FE00001FF +F80003FFFE000FFFFF801FFFFFC03FE07FE03F800FE07F0007F07E0003F8FE0001F8FC00 +01F8FE0001FCFE0000FCFE0000FCFE0000FC7C0000FC000000FC000000FC000001FC0000 +01F8000001F8000003F8000003F0000007F000000FE000001FC000003FC000007F800000 +FF000001FE000003FC000007F800000FF000001FE000003FC000007F800000FE000001FC +000007F800780FF000FC1FE000FC3FC000FC7FFFFFFCFFFFFFFCFFFFFFFCFFFFFFFC7FFF +FFF81E2F7CAE27>I<001FF80000FFFE0003FFFF800FFFFFC00FFFFFE01FF01FF03FC007 +F83F8001F83F8001FC3F8000FC3F8000FC1F0000FC040000FC000000FC000001FC000001 +F8000003F8000007F000000FF000003FE0001FFFC0003FFF80003FFF80003FFFE0001FFF +F000001FF8000003FC000001FC000000FE0000007E0000007F0000003F0000003F380000 +3F7C00003FFE00003FFE00003FFE00007FFC00007EFE0000FE7F0001FC7F8003FC3FF01F +F81FFFFFF00FFFFFE003FFFF8000FFFE00001FF80020307DAE27>I<00003F800000007F +C00000007FC0000000FFC0000001FFC0000001FFC0000003F7C0000007E7C0000007E7C0 +00000FC7C000000F87C000001F87C000003F07C000003F07C000007E07C00000FC07C000 +00FC07C00001F807C00001F007C00003F007C00007E007C00007E007C0000FC007C0001F +8007C0001F8007C0003F0007C0003E0007C0007E0007C000FC0007C000FFFFFFFF80FFFF +FFFFC0FFFFFFFFC0FFFFFFFFC07FFFFFFF80000007C000000007C000000007C000000007 +C000000007C000000007C000000007C000000007C0000001FFFF000003FFFF800003FFFF +800003FFFF800001FFFF00222F7EAE27>I<1FFFFFE03FFFFFF03FFFFFF03FFFFFF03FFF +FFE03F0000003F0000003F0000003F0000003F0000003F0000003F0000003F0000003F00 +00003F0000003F0000003F0000003F1FF0003FFFFC003FFFFF003FFFFF803FFFFFC03FF0 +3FE03FC00FF03F0007F03E0003F81C0001F8000001F8000001FC000000FC000000FC0000 +00FC7C0000FCFE0000FCFE0000FCFE0001FCFE0001F8FC0003F8FE0003F07F000FF07F80 +1FE03FE07FC01FFFFF800FFFFF0007FFFE0001FFF800007FC0001E2F7CAD27>I<0000FF +000007FFC0001FFFF0003FFFF800FFFFF801FF81FC03FE01FC03F801FC07F001FC0FE001 +FC0FC000F81FC000003F8000003F0000003F0000007F0000007E0000007E0FF800FE3FFE +00FCFFFF80FFFFFFC0FFFFFFE0FFF80FF0FFE007F8FF8001FCFF0000FCFF0000FEFE0000 +7EFE00007FFE00003FFE00003FFE00003F7E00003F7E00003F7E00003F7F00003F3F0000 +7F3F00007E1F8000FE1FC001FC0FC001FC0FF007F807F81FF003FFFFE001FFFFC000FFFF +80003FFE00000FF80020307DAE27>I<78000000FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFEFC0001FCFC0003F8FC0007F0780007E000000FE000001FC000001F8000003F80 +00007F0000007E000000FE000000FC000001FC000001F8000003F8000003F0000007F000 +0007E0000007E000000FC000000FC000000FC000001F8000001F8000001F8000003F8000 +003F0000003F0000003F0000003F0000003F0000007F0000007E0000007E0000007E0000 +007E0000007E0000007E0000007E0000007E0000007E0000003C000020307DAE27>I<00 +0FF000007FFE0001FFFF8003FFFFC00FFFFFF00FF81FF01FE007F83F8001FC3F0000FC7F +0000FE7E00007E7E00007E7E00007E7E00007E7E00007E3F0000FC3F8001FC1FC003F80F +E007F007FC3FE001FFFF80007FFE00003FFC0000FFFF0003FFFFC00FF00FF01FC003F83F +8001FC3F0000FC7E00007E7E00007EFC00003FFC00003FFC00003FFC00003FFC00003FFC +00003F7E00007E7E00007E7F0000FE3F8001FC1FE007F81FF81FF80FFFFFF007FFFFE001 +FFFF80007FFE00000FF00020307DAE27>I<000FF000007FFC0001FFFF0003FFFF8007FF +FFC00FF81FE01FE007F03FC003F83F8001F87F0001FC7E0000FCFE0000FCFC00007EFC00 +007EFC00007EFC00007EFC00007FFC00007FFC00007FFE00007F7E00007F7F0000FF3F00 +00FF3F8001FF1FE007FF0FF01FFF07FFFFFF03FFFFFF01FFFF3F007FFC7F001FF07E0000 +007E0000007E000000FC000000FC000001FC000001F81F0003F83F8007F03F800FE03F80 +1FE03F803FC03FC0FF801FFFFF001FFFFE000FFFF80003FFE00000FF800020307DAE27> +I<1E007F807F80FFC0FFC0FFC0FFC07F807F801E00000000000000000000000000000000 +0000000000000000001E007F807F80FFC0FFC0FFC0FFC07F807F801E000A20729F27>I< +0F003FC03FC07FE07FE07FE07FE03FC03FC00F0000000000000000000000000000000000 +00000000000000000F003F803FC07FC07FE07FE07FE03FE03FE00FE007E007C00FC00FC0 +3F807F00FF00FE00F80070000B2A739F27>I<7FFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFF3FFFFFFE0000000000000000000000000000000000000000000000003FFFFFFEFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFE20127D9F27>61 D<70000000FC000000FE +000000FF800000FFC000007FF000001FF800000FFC000003FF000001FF8000007FE00000 +3FF000001FF8000007FE000003FF000000FFC000007FE000003FF800000FFC000007FC00 +0007FC00000FFC00003FF800007FE00000FFC00003FF000007FE00001FF800003FF00000 +7FE00001FF800003FF00000FFC00001FF800007FF00000FFC00000FF800000FE000000FC +000000700000001E287CAA27>I<00FFF80003FFFF000FFFFFC03FFFFFE07FFFFFF07FC0 +1FF8FF0003FCFE0001FCFE0000FCFE0000FCFE0001FC7C0003FC00000FF800001FF00000 +7FE00000FFC00001FF000003FC000007F8000007F000000FE000000FC000001FC000001F +8000001F8000001F8000001F8000001F8000001F8000001F8000000F0000000000000000 +00000000000000000000000000000000000000000000000F0000001F8000003FC000003F +C000003FC000003FC000001F8000000F00001E2E7CAD27>I<0001FE000007FF80001FFF +C0007FFFE000FFFFF001FF03F803FC01F807F000FC0FE01F7C0FC07FFE1F80FFFE1F01FF +FE3F03FFFE3E07F1FF7E07E0FF7C0FC07F7C0F803F7C0F803FFC1F803FF81F001FF81F00 +1FF81F001FF81F001FF81F001FF81F001FF81F001FF81F001FFC1F803F7C0F803E7C0F80 +3E7C0FC07E7E07E0FC3E07F1FC3F03FFF81F01FFF01F80FFE00FC07FC00FE01F1E07F000 +3F03FC007F01FF03FF00FFFFFE007FFFFC001FFFF00007FFC00001FF00202E7DAD27>I< +0003F000000007F800000007F80000000FFC0000000FFC0000000FFC0000000FFC000000 +0F3C0000001F3E0000001F3E0000001F3E0000001F3E0000001F3E0000003F3F0000003F +3F0000003F3F0000003E1F0000003E1F0000007E1F8000007E1F8000007E1F8000007E1F +800000FC0FC00000FC0FC00000FC0FC00000FC0FC00000FC0FC00001F807E00001F807E0 +0001F807E00001FFFFE00001FFFFE00003FFFFF00003FFFFF00003FFFFF00003F003F000 +03F003F00007E001F80007E001F80007E001F80007E001F8000FE001FC007FFC0FFF80FF +FC0FFFC0FFFE1FFFC0FFFC0FFFC07FFC0FFF80222F7EAE27>I<7FFFFF0000FFFFFFC000 +FFFFFFE000FFFFFFF8007FFFFFF80007E003FC0007E000FE0007E0007E0007E0007F0007 +E0003F0007E0003F0007E0003F0007E0003F0007E0003F0007E0003F0007E0007E0007E0 +007E0007E000FC0007E003FC0007E00FF80007FFFFF00007FFFFC00007FFFFF00007FFFF +F80007FFFFFC0007E000FE0007E0007F0007E0003F8007E0001F8007E0001F8007E0000F +C007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0001FC007E0001F80 +07E0003F8007E0007F0007E001FF007FFFFFFE00FFFFFFFC00FFFFFFF800FFFFFFE0007F +FFFF8000222E7FAD27>I<0003F80E001FFE1F003FFFBF00FFFFFF01FFFFFF03FE0FFF07 +F803FF07F001FF0FE000FF1FC000FF1F80007F1F80007F3F00003F3F00003F7F00003F7E +00003F7E00001E7E000000FE000000FC000000FC000000FC000000FC000000FC000000FC +000000FC000000FC000000FC000000FC000000FE0000007E0000007E0000007E00001E7F +00003F3F00003F3F00003F1F80003F1F80007F1FC0007E0FE000FE07F001FC07F803FC03 +FE0FF801FFFFF000FFFFE0003FFFC0001FFF000003F80020307DAE27>I<7FFFFC00007F +FFFF0000FFFFFFC0007FFFFFE0007FFFFFF00007E00FF80007E007F80007E001FC0007E0 +00FE0007E000FE0007E0007E0007E0007F0007E0003F0007E0003F8007E0001F8007E000 +1F8007E0001F8007E0001FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000F +C007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0001F80 +07E0001F8007E0001F8007E0003F8007E0003F0007E0003F0007E0007F0007E000FE0007 +E000FE0007E001FC0007E003F80007E00FF8007FFFFFF0007FFFFFE000FFFFFFC0007FFF +FF00007FFFFC0000222E7FAD27>I<7FFFFFFF80FFFFFFFFC0FFFFFFFFC0FFFFFFFFC07F +FFFFFFC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0 +00078007E000000007E000000007E000000007E000000007E007800007E00FC00007E00F +C00007E00FC00007FFFFC00007FFFFC00007FFFFC00007FFFFC00007FFFFC00007E00FC0 +0007E00FC00007E00FC00007E007800007E000000007E000000007E000000007E0000000 +07E00003C007E00007E007E00007E007E00007E007E00007E007E00007E007E00007E007 +E00007E07FFFFFFFE0FFFFFFFFE0FFFFFFFFE0FFFFFFFFE07FFFFFFFC0232E7FAD27>I< +7FFFFFFF80FFFFFFFFC0FFFFFFFFC0FFFFFFFFC07FFFFFFFC007E0000FC007E0000FC007 +E0000FC007E0000FC007E0000FC007E0000FC007E000078007E000000007E000000007E0 +00000007E000000007E007800007E00FC00007E00FC00007E00FC00007FFFFC00007FFFF +C00007FFFFC00007FFFFC00007FFFFC00007E00FC00007E00FC00007E00FC00007E00780 +0007E000000007E000000007E000000007E000000007E000000007E000000007E0000000 +07E000000007E000000007E000000007E000000007E00000007FFF800000FFFFC00000FF +FFC00000FFFFC000007FFF800000222E7EAD27>I<0007F03800001FFC7C00007FFFFC00 +00FFFFFC0001FFFFFC0003FC1FFC0007F00FFC000FE007FC000FC003FC001FC001FC001F +8001FC003F8001FC003F0000FC003F0000FC007E0000FC007E0000FC007E000078007E00 +000000FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC0000 +0000FC00000000FC001FFF00FC003FFF80FC003FFF80FC003FFF807E001FFF007E0000FC +007E0000FC007E0000FC003F0001FC003F0001FC003F8001FC001F8001FC001FC003FC00 +0FC003FC000FE007FC0007F00FFC0003FC1FFC0001FFFFFC0000FFFFFC00007FFEFC0000 +1FFC78000007F0000021307DAE27>I<7FFE07FFE0FFFF0FFFF0FFFF0FFFF0FFFF0FFFF0 +7FFE07FFE007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007 +E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0 +007E0007E0007E0007FFFFFE0007FFFFFE0007FFFFFE0007FFFFFE0007FFFFFE0007E000 +7E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E +0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E0007E00 +07E0007E007FFE07FFE0FFFF0FFFF0FFFF0FFFF0FFFF0FFFF07FFE07FFE0242E7FAD27> +I<7FFFFFE0FFFFFFF0FFFFFFF0FFFFFFF07FFFFFE0001F8000001F8000001F8000001F80 +00001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F80 +00001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F80 +00001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F80 +00001F8000001F8000001F8000001F8000001F80007FFFFFE0FFFFFFF0FFFFFFF0FFFFFF +F07FFFFFE01C2E7BAD27>I<001FFFF8003FFFFC003FFFFC003FFFFC001FFFF800001F80 +00001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F80 +00001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F80 +00001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F80 +00001F8000001F807C001F807C001F80FE001F80FE001F80FE003F00FE007F007F81FE00 +7FFFFE003FFFFC001FFFF80007FFE00000FF00001E2F7BAD27>I<7FFC07FF807FFC07FF +C0FFFE0FFFC07FFC07FFC07FFC07FF8007C001F80007C003F80007C003F00007C007E000 +07C00FC00007C01FC00007C01F800007C03F000007C07E000007C0FE000007C0FC000007 +C1F8000007C3F0000007C7F0000007C7E0000007CFF0000007DFF8000007FFF8000007FF +FC000007FEFC000007FC7E000007FC3E000007F83F000007F01F000007E01F800007E00F +800007C00FC00007C007C00007C007E00007C003E00007C003F00007C001F80007C001F8 +0007C000FC0007C0007C0007C0007E007FFC01FFC07FFC01FFE0FFFE03FFE07FFC01FFE0 +7FFC01FFC0232E7FAD27>I<7FFFC000007FFFE00000FFFFE000007FFFE000007FFFC000 +0003F000000003F000000003F000000003F000000003F000000003F000000003F0000000 03F000000003F000000003F000000003F000000003F000000003F000000003F000000003 F000000003F000000003F000000003F000000003F000000003F000000003F000000003F0 00000003F000000003F000000003F000000003F000000003F000000003F000000003F000 -000003F000078003F0000FC003F0000FC003F0000FC003F0000FC003F0000FC003F0000F -C003F0000FC07FFFFFFFC07FFFFFFFC0FFFFFFFFC07FFFFFFFC07FFFFFFF80222E7FAD27 ->I<7FE0007FE0FFF000FFF0FFF000FFF0FFF801FFF07FF801FFE00FF801FF000FB801DF -000FBC03DF000FBC03DF000FBC03DF000FBE07DF000F9E079F000F9E079F000F9E079F00 -0F9F0F9F000F9F0F9F000F8F0F1F000F8F0F1F000F8F9F1F000F8F9F1F000F879E1F000F -879E1F000F879E1F000F879E1F000F839C1F000F83FC1F000F83FC1F000F83FC1F000F81 -F81F000F81F81F000F80F01F000F80001F000F80001F000F80001F000F80001F000F8000 -1F000F80001F000F80001F000F80001F000F80001F000F80001F007FF000FFE0FFF801FF -F0FFF801FFF0FFF801FFF07FF000FFE0242E7FAD27>I<7FF003FFE0FFF807FFF0FFF807 -FFF0FFFC07FFF07FFC03FFE007FC003E0007DE003E0007DE003E0007DE003E0007CF003E -0007CF003E0007CF003E0007CF803E0007C7803E0007C7C03E0007C7C03E0007C3C03E00 -07C3E03E0007C3E03E0007C1E03E0007C1F03E0007C1F03E0007C1F03E0007C0F83E0007 -C0F83E0007C0F83E0007C0783E0007C07C3E0007C07C3E0007C03C3E0007C03E3E0007C0 -3E3E0007C01E3E0007C01F3E0007C00F3E0007C00F3E0007C00F3E0007C007BE0007C007 -BE0007C007BE0007C003FE007FFC03FE00FFFE03FE00FFFE01FE00FFFE01FE007FFC00FC -00242E7FAD27>I<00FFFC0007FFFF801FFFFFE01FFFFFE03FFFFFF03FC00FF07F8007F8 -7F0003F87E0001F87E0001F87E0001F8FC0000FCFC0000FCFC0000FCFC0000FCFC0000FC -FC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FC -FC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FC -FC0000FCFC0000FCFE0001FC7E0001F87E0001F87E0001F87F0003F87F8007F83FE01FF0 -3FFFFFF01FFFFFE01FFFFFE007FFFF8000FFFC001E307CAE27>I<7FFFFF0000FFFFFFE0 -00FFFFFFF000FFFFFFF8007FFFFFFC0007E003FE0007E000FF0007E0007F0007E0003F80 -07E0001F8007E0001FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007 -E0000FC007E0001FC007E0001F8007E0003F8007E0007F0007E000FF0007E003FE0007FF -FFFC0007FFFFF80007FFFFF00007FFFFE00007FFFF000007E000000007E000000007E000 +078003F0000FC003F0000FC003F0000FC003F0000FC003F0000FC003F0000FC003F0000F +C07FFFFFFFC07FFFFFFFC0FFFFFFFFC07FFFFFFFC07FFFFFFF80222E7FAD27>I<7FE000 +7FE0FFF000FFF0FFF000FFF0FFF801FFF07FF801FFE00FF801FF000FB801DF000FBC03DF +000FBC03DF000FBC03DF000FBE07DF000F9E079F000F9E079F000F9E079F000F9F0F9F00 +0F9F0F9F000F8F0F1F000F8F0F1F000F8F9F1F000F8F9F1F000F879E1F000F879E1F000F +879E1F000F879E1F000F839C1F000F83FC1F000F83FC1F000F83FC1F000F81F81F000F81 +F81F000F80F01F000F80001F000F80001F000F80001F000F80001F000F80001F000F8000 +1F000F80001F000F80001F000F80001F000F80001F007FF000FFE0FFF801FFF0FFF801FF +F0FFF801FFF07FF000FFE0242E7FAD27>I<7FF003FFE0FFF807FFF0FFF807FFF0FFFC07 +FFF07FFC03FFE007FC003E0007DE003E0007DE003E0007DE003E0007CF003E0007CF003E +0007CF003E0007CF803E0007C7803E0007C7C03E0007C7C03E0007C3C03E0007C3E03E00 +07C3E03E0007C1E03E0007C1F03E0007C1F03E0007C1F03E0007C0F83E0007C0F83E0007 +C0F83E0007C0783E0007C07C3E0007C07C3E0007C03C3E0007C03E3E0007C03E3E0007C0 +1E3E0007C01F3E0007C00F3E0007C00F3E0007C00F3E0007C007BE0007C007BE0007C007 +BE0007C003FE007FFC03FE00FFFE03FE00FFFE01FE00FFFE01FE007FFC00FC00242E7FAD +27>I<00FFFC0007FFFF801FFFFFE01FFFFFE03FFFFFF03FC00FF07F8007F87F0003F87E +0001F87E0001F87E0001F8FC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC +0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC +0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC0000FCFC +0000FCFE0001FC7E0001F87E0001F87E0001F87F0003F87F8007F83FE01FF03FFFFFF01F +FFFFE01FFFFFE007FFFF8000FFFC001E307CAE27>I<7FFFFF0000FFFFFFE000FFFFFFF0 +00FFFFFFF8007FFFFFFC0007E003FE0007E000FF0007E0007F0007E0003F8007E0001F80 +07E0001FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007E0000FC007 +E0001FC007E0001F8007E0003F8007E0007F0007E000FF0007E003FE0007FFFFFC0007FF +FFF80007FFFFF00007FFFFE00007FFFF000007E000000007E000000007E000000007E000 000007E000000007E000000007E000000007E000000007E000000007E000000007E00000 -0007E000000007E000000007E00000007FFE000000FFFF000000FFFF000000FFFF000000 -7FFE000000222E7FAD27>I<7FFFF00000FFFFFE0000FFFFFF8000FFFFFFC0007FFFFFE0 -0007E01FF00007E007F00007E003F80007E001F80007E001FC0007E000FC0007E000FC00 -07E000FC0007E000FC0007E000FC0007E001FC0007E001F80007E003F80007E007F00007 -E01FF00007FFFFE00007FFFFC00007FFFF800007FFFF800007FFFFC00007E01FC00007E0 -0FE00007E007E00007E003F00007E003F00007E003F00007E003F00007E003F00007E003 -F00007E003F00007E003F00007E003F0F007E003F1F807E003F1F807E003F1F807E003F1 -F87FFE01FBF8FFFF01FFF0FFFF00FFF0FFFF00FFE07FFE007FC00000001F00252F7FAD27 ->82 D<007FC0E001FFF1F007FFFFF00FFFFFF01FFFFFF03FE0FFF03F801FF07F000FF07E -0007F0FE0007F0FC0007F0FC0003F0FC0003F0FC0003F0FC0001E0FE0000007E0000007F -0000003FC000003FF800001FFF80000FFFF80007FFFE0003FFFF8000FFFFC0000FFFE000 -00FFF000000FF0000007F8000003F8000001F8000001FC000000FC780000FCFC0000FCFC -0000FCFC0000FCFC0000FCFE0001F8FE0001F8FF0003F8FF8007F0FFF01FE0FFFFFFE0FF -FFFFC0FFFFFF00F8FFFE00701FF8001E307CAE27>I<7FFFFFFF80FFFFFFFFC0FFFFFFFF -C0FFFFFFFFC0FFFFFFFFC0FC03F00FC0FC03F00FC0FC03F00FC0FC03F00FC0FC03F00FC0 -FC03F00FC07803F007800003F000000003F000000003F000000003F000000003F0000000 -03F000000003F000000003F000000003F000000003F000000003F000000003F000000003 -F000000003F000000003F000000003F000000003F000000003F000000003F000000003F0 +0007E000000007E00000007FFE000000FFFF000000FFFF000000FFFF0000007FFE000000 +222E7FAD27>I<7FFFF00000FFFFFE0000FFFFFF8000FFFFFFC0007FFFFFE00007E01FF0 +0007E007F00007E003F80007E001F80007E001FC0007E000FC0007E000FC0007E000FC00 +07E000FC0007E000FC0007E001FC0007E001F80007E003F80007E007F00007E01FF00007 +FFFFE00007FFFFC00007FFFF800007FFFF800007FFFFC00007E01FC00007E00FE00007E0 +07E00007E003F00007E003F00007E003F00007E003F00007E003F00007E003F00007E003 +F00007E003F00007E003F0F007E003F1F807E003F1F807E003F1F807E003F1F87FFE01FB +F8FFFF01FFF0FFFF00FFF0FFFF00FFE07FFE007FC00000001F00252F7FAD27>82 +D<007FC0E001FFF1F007FFFFF00FFFFFF01FFFFFF03FE0FFF03F801FF07F000FF07E0007 +F0FE0007F0FC0007F0FC0003F0FC0003F0FC0003F0FC0001E0FE0000007E0000007F0000 +003FC000003FF800001FFF80000FFFF80007FFFE0003FFFF8000FFFFC0000FFFE00000FF +F000000FF0000007F8000003F8000001F8000001FC000000FC780000FCFC0000FCFC0000 +FCFC0000FCFC0000FCFE0001F8FE0001F8FF0003F8FF8007F0FFF01FE0FFFFFFE0FFFFFF +C0FFFFFF00F8FFFE00701FF8001E307CAE27>I<7FFFFFFF80FFFFFFFFC0FFFFFFFFC0FF +FFFFFFC0FFFFFFFFC0FC03F00FC0FC03F00FC0FC03F00FC0FC03F00FC0FC03F00FC0FC03 +F00FC07803F007800003F000000003F000000003F000000003F000000003F000000003F0 00000003F000000003F000000003F000000003F000000003F000000003F000000003F000 -000003F000000003F0000000FFFFC00001FFFFE00001FFFFE00001FFFFE00000FFFFC000 -222E7EAD27>I<7FFE01FFF8FFFF03FFFCFFFF03FFFCFFFF03FFFC7FFE01FFF807E0001F -8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F80 -07E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007 +000003F000000003F000000003F000000003F000000003F000000003F000000003F00000 +0003F000000003F000000003F000000003F000000003F000000003F000000003F0000000 +03F000000003F0000000FFFFC00001FFFFE00001FFFFE00001FFFFE00000FFFFC000222E +7EAD27>I<7FFE01FFF8FFFF03FFFCFFFF03FFFCFFFF03FFFC7FFE01FFF807E0001F8007 E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0 -001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007F000 -3F8003F0003F0003F0003F0003F8007F0001F8007E0001FC00FE0000FE01FC00007F87F8 -00007FFFF800003FFFF000000FFFC0000007FF80000001FE0000262F80AD27>I<7FFC03 -FFE07FFE07FFE0FFFE07FFF07FFE07FFE07FFC03FFE007E0007E0007E0007E0007E0007E -0007E0007E0003F000FC0003F000FC0003F000FC0003F000FC0003F801FC0001F801F800 -01F801F80001F801F80001F801F80000FC03F00000FC03F00000FC03F00000FC03F00000 -7E07E000007E07E000007E07E000007E07E000007E07E000003F0FC000003F0FC000003F -0FC000003F0FC000001F0F8000001F9F8000001F9F8000001F9F8000000F9F0000000F9F -0000000F9F0000000F9F0000000F9F00000007FE00000007FE00000007FE00000007FE00 -000003FC00000003FC00000001F80000242F7FAD27>I<7FE0007FE0FFF000FFF0FFF000 -FFF0FFF000FFF07FE0007FE01F00000F801F00000F801F00000F801F00000F801F00000F -801F00000F801F00000F800F80001F000F80001F000F80001F000F80001F000F80001F00 -0F80001F000F80F01F000F81F81F0007C3FC3E0007C3FC3E0007C3FC3E0007C3FC3E0007 -C39C3E0007C79E3E0007C79E3E0007C79E3E0003C79E3C0003C79E3C0003C79E3C0003E7 -9E7C0003EF9F7C0003EF9F7C0003EF0F7C0003EF0F7C0001EF0F780001EF0F780001EF0F -780001EF0F780001FE07F80001FE07F80001FE07F80000FE07F00000FE07F00000FC03F0 -00007801E000242F7FAD27>I<3FFC1FFE007FFE3FFE007FFE3FFF007FFE3FFE003FFC1F -FE0003F00FE00003F80FC00001F80FC00001FC1FC00000FC1F800000FE3F8000007E3F00 -00007F7F0000003F7E0000003FFE0000001FFC0000001FFC0000000FF80000000FF80000 -0007F000000007F000000003F000000007F000000007F80000000FF80000000FFC000000 -1FFC0000001FFE0000003F7E0000003F7F0000007F3F0000007E3F8000007E1F800000FC -1FC00000FC0FC00001F80FE00001F807E00003F807E00003F003F00007F003F00007E003 -F8007FFC0FFF80FFFC0FFFC0FFFE1FFFC0FFFC0FFFC07FFC0FFF80222E7EAD27>I<7FFC -03FFE07FFE07FFE0FFFE07FFF07FFE07FFE07FFC03FFE007F000FE0003F000FC0003F801 -FC0001F801F80001F801F80001FC03F80000FC03F00000FE07F000007E07E000007E07E0 -00003F0FC000003F0FC000001F9F8000001F9F8000001F9F8000000F9F0000000F9F0000 -0007FE00000007FE00000003FC00000003FC00000001F800000001F800000001F8000000 -01F800000001F800000001F800000001F800000001F800000001F800000001F800000001 -F800000001F800000001F800000001F800000001F80000001FFF8000003FFFC000003FFF -C000003FFFC000001FFF8000242E7FAD27>I<7FFFF0FFFFF8FFFFF8FFFFF8FFFFF0FC00 -00FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC00 -00FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC00 -00FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC00 -00FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FFFF -F0FFFFF8FFFFF8FFFFF87FFFF0153A71B327>91 D<78000000F8000000FC000000FC0000 -00FE0000007E0000007F0000003F0000003F8000001F8000001FC000000FC000000FE000 -0007E0000007F0000003F0000003F0000003F8000001F8000001FC000000FC000000FE00 -00007E0000007F0000003F0000003F8000001F8000001FC000000FC000000FC000000FE0 -000007E0000007F0000003F0000003F8000001F8000001FC000000FC000000FE0000007E -0000007F0000003F0000003F0000003F8000001F8000001FC000000FC000000FE0000007 -E0000007F0000003F0000003F8000001F8000001FC000000FC000000FC0000007C000000 -381E3A7CB327>I<7FFFF0FFFFF8FFFFF8FFFFF87FFFF80001F80001F80001F80001F800 -01F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F800 -01F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F800 -01F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F800 -01F80001F80001F80001F80001F80001F80001F80001F87FFFF8FFFFF8FFFFF8FFFFF87F -FFF0153A7EB327>I<001C00007E0001FF8007FFE01FFFF83FFFFCFFE7FFFFC3FFFF00FF -FC003F78001E180B79AD27>I<00E001F007F00FF00FE01FC03F003F007E007C00FC00F8 -00F800F800F800FF00FF80FFC07FC07FC03FC03F800F000C1773B227>96 +001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E000 +1F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F +8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007E0001F8007F0003F80 +03F0003F0003F0003F0003F8007F0001F8007E0001FC00FE0000FE01FC00007F87F80000 +7FFFF800003FFFF000000FFFC0000007FF80000001FE0000262F80AD27>I<7FFC03FFE0 +7FFE07FFE0FFFE07FFF07FFE07FFE07FFC03FFE007E0007E0007E0007E0007E0007E0007 +E0007E0003F000FC0003F000FC0003F000FC0003F000FC0003F801FC0001F801F80001F8 +01F80001F801F80001F801F80000FC03F00000FC03F00000FC03F00000FC03F000007E07 +E000007E07E000007E07E000007E07E000007E07E000003F0FC000003F0FC000003F0FC0 +00003F0FC000001F0F8000001F9F8000001F9F8000001F9F8000000F9F0000000F9F0000 +000F9F0000000F9F0000000F9F00000007FE00000007FE00000007FE00000007FE000000 +03FC00000003FC00000001F80000242F7FAD27>I<7FE0007FE0FFF000FFF0FFF000FFF0 +FFF000FFF07FE0007FE01F00000F801F00000F801F00000F801F00000F801F00000F801F +00000F801F00000F800F80001F000F80001F000F80001F000F80001F000F80001F000F80 +001F000F80F01F000F81F81F0007C3FC3E0007C3FC3E0007C3FC3E0007C3FC3E0007C39C +3E0007C79E3E0007C79E3E0007C79E3E0003C79E3C0003C79E3C0003C79E3C0003E79E7C +0003EF9F7C0003EF9F7C0003EF0F7C0003EF0F7C0001EF0F780001EF0F780001EF0F7800 +01EF0F780001FE07F80001FE07F80001FE07F80000FE07F00000FE07F00000FC03F00000 +7801E000242F7FAD27>I<3FFC1FFE007FFE3FFE007FFE3FFF007FFE3FFE003FFC1FFE00 +03F00FE00003F80FC00001F80FC00001FC1FC00000FC1F800000FE3F8000007E3F000000 +7F7F0000003F7E0000003FFE0000001FFC0000001FFC0000000FF80000000FF800000007 +F000000007F000000003F000000007F000000007F80000000FF80000000FFC0000001FFC +0000001FFE0000003F7E0000003F7F0000007F3F0000007E3F8000007E1F800000FC1FC0 +0000FC0FC00001F80FE00001F807E00003F807E00003F003F00007F003F00007E003F800 +7FFC0FFF80FFFC0FFFC0FFFE1FFFC0FFFC0FFFC07FFC0FFF80222E7EAD27>I<7FFC03FF +E07FFE07FFE0FFFE07FFF07FFE07FFE07FFC03FFE007F000FE0003F000FC0003F801FC00 +01F801F80001F801F80001FC03F80000FC03F00000FE07F000007E07E000007E07E00000 +3F0FC000003F0FC000001F9F8000001F9F8000001F9F8000000F9F0000000F9F00000007 +FE00000007FE00000003FC00000003FC00000001F800000001F800000001F800000001F8 +00000001F800000001F800000001F800000001F800000001F800000001F800000001F800 +000001F800000001F800000001F800000001F80000001FFF8000003FFFC000003FFFC000 +003FFFC000001FFF8000242E7FAD27>I<7FFFF0FFFFF8FFFFF8FFFFF8FFFFF0FC0000FC +0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC +0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC +0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC +0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FFFFF0FF +FFF8FFFFF8FFFFF87FFFF0153A71B327>91 D<78000000F8000000FC000000FC000000FE +0000007E0000007F0000003F0000003F8000001F8000001FC000000FC000000FE0000007 +E0000007F0000003F0000003F0000003F8000001F8000001FC000000FC000000FE000000 +7E0000007F0000003F0000003F8000001F8000001FC000000FC000000FC000000FE00000 +07E0000007F0000003F0000003F8000001F8000001FC000000FC000000FE0000007E0000 +007F0000003F0000003F0000003F8000001F8000001FC000000FC000000FE0000007E000 +0007F0000003F0000003F8000001F8000001FC000000FC000000FC0000007C000000381E +3A7CB327>I<7FFFF0FFFFF8FFFFF8FFFFF87FFFF80001F80001F80001F80001F80001F8 +0001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F8 +0001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F8 +0001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F80001F8 +0001F80001F80001F80001F80001F80001F80001F87FFFF8FFFFF8FFFFF8FFFFF87FFFF0 +153A7EB327>I<001C00007E0001FF8007FFE01FFFF83FFFFCFFE7FFFFC3FFFF00FFFC00 +3F78001E180B79AD27>I<00E001F007F00FF00FE01FC03F003F007E007C00FC00F800F8 +00F800F800FF00FF80FFC07FC07FC03FC03F800F000C1773B227>96 D<03FFC000000FFFF000001FFFFC00003FFFFF00003FFFFF80003F80FF80003F801FC000 1F000FC00004000FE000000007E000000007E000000FFFE000007FFFE00003FFFFE0000F FFFFE0001FFFFFE0003FFC07E0007FC007E0007F0007E000FE0007E000FC0007E000FC00 @@ -2064,104 +2071,104 @@ g(.)h(.)f(.)g(.)125 b(98)681 2820 y(5.1.2)97 b(Other)21 b(string)h(manipulation)f(facilities)78 b(.)42 b(.)f(.)g(.)g(.)h(.)f(.) g(.)g(.)h(.)f(.)g(.)83 b(101)681 2947 y(5.1.3)97 b(Manipulating)21 b(\002le-names)29 b(.)42 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h -(.)f(.)g(.)g(.)h(.)f(.)g(.)83 b(101)490 3075 y(5.2)j(ASCII)20 +(.)f(.)g(.)g(.)h(.)f(.)g(.)83 b(102)490 3075 y(5.2)j(ASCII)20 b(encoding)56 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)83 -b(107)490 3202 y(5.3)j(Character)19 b(sets)60 b(.)41 +b(108)490 3202 y(5.3)j(Character)19 b(sets)60 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h -(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)83 b(107)681 +(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)83 b(108)681 3330 y(5.3.1)97 b(Cr)o(eating)20 b(character)g(sets)38 b(.)j(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)83 b(108)681 3457 y(5.3.2)97 b(Querying)22 b(character)d(sets)65 b(.)42 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g -(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)83 b(108)681 3584 y(5.3.3)97 +(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)83 b(109)681 3584 y(5.3.3)97 b(Character)20 b(set)g(algebra)34 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f (.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)83 b(109)681 3712 y(5.3.4)97 b(Standar)o(d)19 b(character)g(sets)83 b(.)42 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.) f(.)g(.)83 b(109)365 3923 y FB(6)g(Reading)19 b(delimited)e(strings) -1631 b(1)m(10)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(13)490 4261 y FD(7.1)86 +1634 b(1)m(1)m(1)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(14)490 4261 y FD(7.1)86 b(Recor)o(d)20 b(I/O)h(and)g(\002eld)f(parsing)68 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f -(.)g(.)88 b(1)-5 b(13)681 4389 y(7.1.1)97 b(Reading)21 +(.)g(.)88 b(1)-5 b(14)681 4389 y(7.1.1)97 b(Reading)21 b(r)o(ecor)o(ds)j(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)88 b(1)-5 -b(14)681 4516 y(7.1.2)97 b(Parsing)21 b(\002elds)62 b(.)41 +b(15)681 4516 y(7.1.2)97 b(Parsing)21 b(\002elds)62 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h -(.)f(.)g(.)g(.)h(.)f(.)g(.)88 b(1)-5 b(14)681 4644 y(7.1.3)97 +(.)f(.)g(.)g(.)h(.)f(.)g(.)88 b(1)-5 b(15)681 4644 y(7.1.3)97 b(Field)21 b(r)o(eaders)f(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.) g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)88 -b(1)-5 b(17)681 4771 y(7.1.4)97 b(Forwar)o(d-pr)o(ogr)o(ess)19 +b(1)-5 b(18)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)99 b(1)-5 -b(18)681 4898 y(7.1.5)97 b(Reader)20 b(limitations)74 +b(19)681 4898 y(7.1.5)97 b(Reader)20 b(limitations)74 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) -g(.)g(.)h(.)f(.)g(.)83 b(120)1774 5147 y(v)p eop +g(.)g(.)h(.)f(.)g(.)83 b(121)1774 5147 y(v)p eop %%Page: 6 6 6 5 bop 805 614 a FD(7.2)86 b(A)-6 b(wk)30 b(.)41 b(.)g(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(120)996 +g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(121)996 739 y(7.2.1)98 b(Examples)78 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.) -83 b(123)681 946 y FB(8)f(Miscellaneous)18 b(routines)1731 -b(126)805 1071 y FD(8.1)86 b(Integer)21 b(bitwise)g(ops)65 +83 b(124)681 946 y FB(8)f(Miscellaneous)18 b(routines)1731 +b(127)805 1071 y FD(8.1)86 b(Integer)21 b(bitwise)g(ops)65 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) -h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(126)805 1196 +h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(127)805 1196 y(8.2)j(List)21 b(pr)o(ocedur)o(es)70 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) -g(.)g(.)h(.)83 b(126)805 1320 y(8.3)j(T)-8 b(op)21 b(level)56 +g(.)g(.)h(.)83 b(127)805 1320 y(8.3)j(T)-8 b(op)21 b(level)56 b(.)42 b(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.) f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 -b(126)681 1528 y FB(9)f(Running)20 b(scsh)2096 b(128)805 +b(127)681 1528 y FB(9)f(Running)20 b(scsh)2096 b(129)805 1652 y FD(9.1)86 b(Scsh)21 b(command-line)g(switches)84 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.) -g(.)g(.)h(.)83 b(129)996 1777 y(9.1.1)98 b(Scripts)20 +g(.)g(.)h(.)83 b(130)996 1777 y(9.1.1)98 b(Scripts)20 b(and)h(pr)o(ograms)g(.)42 b(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.) -h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(129)996 1901 +h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(130)996 1901 y(9.1.2)98 b(Inserting)21 b(interpr)o(eter)f(triggers)h(into)g(scsh)h -(pr)o(ograms)39 b(.)i(.)g(.)g(.)h(.)83 b(129)996 2026 +(pr)o(ograms)39 b(.)i(.)g(.)g(.)h(.)83 b(130)996 2026 y(9.1.3)98 b(Module)20 b(system)58 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h (.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 -b(130)996 2150 y(9.1.4)98 b(Switches)50 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.) +b(131)996 2150 y(9.1.4)98 b(Switches)50 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.) g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f -(.)g(.)g(.)h(.)83 b(131)996 2275 y(9.1.5)98 b(The)21 +(.)g(.)g(.)h(.)83 b(132)996 2275 y(9.1.5)98 b(The)21 b(meta)f(ar)o(gument)27 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(135)996 +g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(136)996 2399 y(9.1.6)98 b(Examples)78 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.) -83 b(137)996 2524 y(9.1.7)98 b(Pr)o(ocess)20 b(exit)h(values)60 +83 b(138)996 2524 y(9.1.7)98 b(Pr)o(ocess)20 b(exit)h(values)60 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.) -h(.)f(.)g(.)g(.)h(.)83 b(139)805 2648 y(9.2)j(The)21 +h(.)f(.)g(.)g(.)h(.)83 b(140)805 2648 y(9.2)j(The)21 b(scsh)g(virtual)g(machine)35 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g (.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 -b(140)996 2773 y(9.2.1)98 b(VM)20 b(ar)o(guments)71 b(.)41 +b(141)996 2773 y(9.2.1)98 b(VM)20 b(ar)o(guments)71 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g -(.)h(.)f(.)g(.)g(.)h(.)83 b(140)996 2897 y(9.2.2)98 b(Inserting)21 +(.)h(.)f(.)g(.)g(.)h(.)83 b(141)996 2897 y(9.2.2)98 b(Inserting)21 b(interpr)o(eter)f(triggers)h(into)g(heap)g(images)48 -b(.)42 b(.)f(.)g(.)g(.)h(.)83 b(141)996 3022 y(9.2.3)98 +b(.)42 b(.)f(.)g(.)g(.)h(.)83 b(142)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)70 b(.)83 b(142)805 3147 y(9.3)j(Compiling)22 +(ograms)70 b(.)83 b(143)805 3147 y(9.3)j(Compiling)22 b(scsh)g(pr)o(ograms)65 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.) -g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(142)805 +g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(143)805 3271 y(9.4)j(Statically)20 b(linking)i(heap)f(images)38 b(.)j(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g -(.)g(.)h(.)83 b(143)805 3396 y(9.5)j(Standar)o(d)19 b(\002le)i +(.)g(.)h(.)83 b(144)805 3396 y(9.5)j(Standar)o(d)19 b(\002le)i (locations)71 b(.)41 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g -(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(145)681 +(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(146)681 3603 y FB(10)40 b(Changes)20 b(from)h(previous)f(releases)1407 -b(147)805 3728 y FD(10.1)44 b(Changes)21 b(fr)o(om)f(the)h(pr)o(evious) +b(148)805 3728 y FD(10.1)44 b(Changes)21 b(fr)o(om)f(the)h(pr)o(evious) g(r)o(elease)54 b(.)42 b(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.) -f(.)g(.)g(.)h(.)83 b(147)805 3852 y(10.2)44 b(Changes)21 +f(.)g(.)g(.)h(.)83 b(148)805 3852 y(10.2)44 b(Changes)21 b(fr)o(om)f(the)h(penultimate)g(r)o(elease)57 b(.)41 b(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 -b(148)996 3977 y(10.2.1)56 b(New)21 b(featur)o(es)67 +b(149)996 3977 y(10.2.1)56 b(New)21 b(featur)o(es)67 b(.)42 b(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)h(.)f(.)g(.)g(.)h(.) -f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(148)996 4101 y(10.2.2)56 +f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(149)996 4101 y(10.2.2)56 b(Incompatible)21 b(impr)o(ovements)82 b(.)41 b(.)g(.)h(.)f(.)g(.)g(.)h -(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(149)996 4226 +(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(150)996 4226 y(10.2.3)56 b(Backwar)o(ds-compatible)19 b(impr)o(ovements)38 -b(.)j(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(152)681 -4433 y FB(1)m(1)43 b(T)-9 b(odo)2427 b(153)2077 5147 +b(.)j(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)83 b(153)681 +4433 y FB(1)m(1)43 b(T)-9 b(odo)2427 b(154)2077 5147 y FD(vi)p eop %%Page: 1 7 1 6 bop 365 1276 a Fz(Chapter)45 b(1)365 1730 y FE(Introduction)365 @@ -7712,3089 +7719,3113 @@ FA(\))86 b Fw(\000)-14 b(!)87 b FC(string)1233 b FD(pr)o(ocedur)o(e) 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 -FC(str)p FD(.)1071 979 y FA(\(regexp-quote)38 b("*Hello*)i(world."\)) -1245 1078 y Fn(=)-14 b Fw(\))44 b FA("\\\\*Hello\\\\*)38 -b(world\\\\.")681 1350 y(\(regexp-substitu)o(te)f FC(port)19 +FC(str)p FD(.)1071 986 y FA(\(regexp-quote)38 b("*Hello*)i(world."\)) +1245 1086 y Fn(=)-14 b Fw(\))44 b FA("\\\\*Hello\\\\*)38 +b(world\\\\.")681 1378 y(\(regexp-substitu)o(te)f FC(port)19 b(match)f(.)h(items)p FA(\))76 b Fw(\000)-14 b(!)77 b FC(string)19 b(or)h(unde\002ned)87 b FD(pr)o(ocedur)o(e)888 -1490 y(This)21 b(pr)o(ocedur)o(e)d(can)i(be)g(used)f(to)i(perform)f -(string)g(substitutions)i(based)d(on)i(r)o(eg-)888 1590 +1523 y(This)21 b(pr)o(ocedur)o(e)d(can)i(be)g(used)f(to)i(perform)f +(string)g(substitutions)i(based)d(on)i(r)o(eg-)888 1622 y(ular)33 b(expr)o(ession)g(matches.)62 b(The)33 b(r)o(esults)g(of)g -(the)g(substitution)i(can)d(be)h(either)888 1690 y(output)22 +(the)g(substitution)i(can)d(be)h(either)888 1722 y(output)22 b(to)f(a)f(port)h(or)g(r)o(eturned)e(as)i(a)f(string.)888 -1822 y(The)h FC(match)d FD(ar)o(gument)i(is)h(a)f(r)o(egular)f(expr)o +1858 y(The)h FC(match)d FD(ar)o(gument)i(is)h(a)f(r)o(egular)f(expr)o (ession)h(match)g(str)o(uctur)o(e)g(that)g(contr)o(ols)888 -1922 y(the)j(substitution.)33 b(If)22 b FC(port)g FD(is)h(an)g(output)g +1958 y(the)j(substitution.)33 b(If)22 b FC(port)g FD(is)h(an)g(output)g (port,)g(the)g FC(items)f FD(ar)o(e)g(written)h(out)g(to)g(the)888 -2021 y(port:)988 2187 y Fw(\017)41 b FD(If)20 b(an)h(item)g(is)g(a)f +2057 y(port:)988 2230 y Fw(\017)41 b FD(If)20 b(an)h(item)g(is)g(a)f (string,)i(it)f(is)g(copied)f(dir)o(ectly)g(to)h(the)g(port.)988 -2318 y Fw(\017)41 b FD(If)26 b(an)h(item)f(is)h(an)g(integer)-6 +2366 y Fw(\017)41 b FD(If)26 b(an)h(item)f(is)h(an)g(integer)-6 b(,)27 b(the)g(corr)o(esponding)g(submatch)g(fr)o(om)f -FC(match)f FD(is)1071 2418 y(written)c(to)g(the)g(port.)988 -2550 y Fw(\017)41 b FD(If)16 b(an)g(item)h(is)g FA('pre)p +FC(match)f FD(is)1071 2466 y(written)c(to)g(the)g(port.)988 +2602 y Fw(\017)41 b FD(If)16 b(an)g(item)h(is)g FA('pre)p FD(,)e(the)i(pr)o(e\002x)e(of)i(the)f(matched)g(string)i(\(the)e(text)g -(pr)o(eceding)1071 2650 y(the)21 b(match\))f(is)h(written)h(to)f(the)g -(port.)988 2782 y Fw(\017)41 b FD(If)20 b(an)h(item)g(is)g +(pr)o(eceding)1071 2702 y(the)21 b(match\))f(is)h(written)h(to)f(the)g +(port.)988 2838 y Fw(\017)41 b FD(If)20 b(an)h(item)g(is)g FA('post)p FD(,)e(the)h(suf)o(\002x)h(of)f(the)h(matched)g(string)g(is) -g(written.)888 2947 y(If)j FC(port)f FD(is)i FA(#f)p +g(written.)888 3010 y(If)j FC(port)f FD(is)i FA(#f)p FD(,)f(nothing)h(is)g(written,)g(and)e(a)h(string)h(is)f(constr)o -(ucted)h(and)e(r)o(eturned)888 3046 y(instead.)681 3236 +(ucted)h(and)e(r)o(eturned)888 3110 y(instead.)681 3311 y FA(\(regexp-substitu)o(te)o(/gl)o(ob)o(al)37 b FC(port)15 b(r)o(egexp)g(string)h(.)f(items)p FA(\))43 b Fw(\000)-14 -b(!)44 b FC(string)15 b(or)h(boolean)88 b FD(pr)o(ocedur)o(e)888 -3376 y(This)23 b(pr)o(ocedur)o(e)d(is)i(similar)h(to)f +b(!)44 b FC(string)15 b(or)h(unde\002ned)87 b FD(pr)o(ocedur)o(e)888 +3455 y(This)23 b(pr)o(ocedur)o(e)d(is)i(similar)h(to)f FA(regexp-substitut)o(e)p FD(,)16 b(but)22 b(can)g(be)f(used)h(to)g -(per)o(-)888 3476 y(form)k(multiple)h(match/substitute)g(operations)f -(over)g(a)g(string.)42 b(It)26 b(has)g(the)g(fol-)888 -3576 y(lowing)c(dif)o(fer)o(ences)d(with)i FA(regexp-substitute)o -FD(:)988 3741 y Fw(\017)41 b FD(It)17 b(takes)g(a)g(r)o(egular)f(expr)o +(per)o(-)888 3555 y(form)k(r)o(epeated)d(match/substitute)j(operations) +g(over)g(a)e(string.)41 b(It)25 b(has)h(the)f(fol-)888 +3655 y(lowing)d(dif)o(fer)o(ences)d(with)i FA(regexp-substitute)o +FD(:)988 3827 y Fw(\017)41 b FD(It)17 b(takes)g(a)g(r)o(egular)f(expr)o (ession)h(and)g(string)g(to)h(be)f(matched)g(as)g(parameters,)1071 -3840 y(instead)j(of)h(a)f(completed)h(match)g(str)o(uctur)o(e.)988 -3972 y Fw(\017)41 b FD(If)25 b(an)g(item)h(is)g FA('post)p -FD(,)e(the)h(pr)o(ocedur)o(e)f(r)o(ecurses)g(on)i(the)f(suf)o(\002x)g -(string)h(\(the)1071 4072 y(text)20 b(fr)o(om)h FC(string)g -FD(following)h(the)f(match\).)988 4204 y Fw(\017)41 b -FD(If)20 b FC(port)g FD(is)i(an)e(output)h(port:)1143 -4336 y FB(\226)41 b FD(Ther)o(e)20 b(was)h(at)f(least)h(one)g(match:)k -(r)o(eturn)20 b(tr)o(ue.)1143 4452 y FB(\226)41 b FD(No)21 -b(match:)26 b(r)o(eturn)20 b(false.)988 4584 y Fw(\017)41 -b FC(port)20 b FD(is)h FA(#f)p FD(:)1143 4716 y FB(\226)41 -b FD(Ther)o(e)20 b(was)h(at)f(least)h(one)g(match:)k(constr)o(uct)d -(and)e(r)o(eturn)g(a)h(string.)1143 4831 y FB(\226)41 -b FD(No)21 b(match:)26 b(r)o(eturn)20 b(false.)2051 5147 -y(100)p eop +3927 y(instead)j(of)h(a)f(completed)h(match)g(str)o(uctur)o(e.)988 +4063 y Fw(\017)41 b FD(If)23 b(the)g(r)o(egular)e(expr)o(ession)i +(doesn't)h(match)f(the)g(string,)h(this)g(pr)o(ocedur)o(e)d(is)1071 +4163 y(the)g(identity)g(transform\227it)g(r)o(eturns)f(or)h(outputs)h +(the)f(string.)988 4299 y Fw(\017)41 b FD(If)25 b(an)g(item)h(is)g +FA('post)p FD(,)e(the)h(pr)o(ocedur)o(e)f(r)o(ecurses)g(on)i(the)f(suf) +o(\002x)g(string)h(\(the)1071 4399 y(text)f(fr)o(om)h +FC(string)f FD(following)i(the)f(match\).)40 b(Including)27 +b(a)e FA('post)e FD(in)k(the)e(list)1071 4498 y(of)c(items)g(is)g(how)h +(one)f(gets)g(multiple)g(match/substitution)i(operations.)988 +4634 y Fw(\017)41 b FD(If)27 b(an)g(item)h(is)g(a)f(pr)o(ocedur)o(e,)g +(it)g(is)h(applied)f(to)g(the)h(match)f(str)o(uctur)o(e)g(for)h(a)1071 +4734 y(given)20 b(match.)25 b(The)19 b(pr)o(ocedur)o(e)e(r)o(eturns)i +(a)g(string)h(to)g(be)e(used)i(in)f(the)h(r)o(esult.)888 +4898 y(Some)h(examples:)2051 5147 y(100)p eop %%Page: 101 107 -101 106 bop 365 614 a FB(5.1.2)81 b(Other)20 b(string)h(manipulation)c -(facilities)365 832 y FA(\(index)41 b FC(string)21 b(char)f([start])p +101 106 bop 573 614 a Fh(;;;)40 b(Replace)h(occurrences)g(of)f +("Cotton")h(with)f("Jin".)573 706 y(\(regexp-substitute/global)45 +b(#f)39 b("Cotton")i(s)1593 797 y('pre)f("Jin")g('post\))573 +980 y(;;;)g(mm/dd/yy)h(->)e(dd/mm/yy)j(date)e(conversion.)573 +1071 y(\(regexp-substitute/global)45 b(#f)39 b +("\([0-9]+\)/\([0-9]+\)/\([0-9]+\))q(")45 b(;)39 b(mm/dd/yy)1593 +1162 y(s)g(;)h(Source)g(string)1593 1254 y('pre)g(2)f("/")h(1)g("/")g +(3)f('post\))573 1436 y(;;;)h("9/29/61")h(->)f("Sep)g(29,)g(1961")g +(date)g(conversion.)573 1528 y(\(regexp-substitute/global)45 +b(#f)39 b("\([0-9]+\)/\([0-9]+\)/\([0-9]+\))q(")45 b(;)39 +b(mm/dd/yy)1593 1619 y(s)g(;)h(Source)g(string)808 1802 +y('pre)808 1893 y(;;)g(Sleazy)g(converter)i(--)d(ignores)i("year)g +(2000")f(issue,)h(and)e(blows)i(up)f(if)808 1984 y(;;)g(month)g(is)g +(out)g(of)g(range.)808 2076 y(\(lambda)h(\(m\))887 2167 +y(\(let)f(\(\(mon)g(\(vector-ref)i('#\("Jan")f("Feb")f("Mar")h("Apr")f +("May")g("Jun")1907 2258 y("Jul")g("Aug")g("Sep")h("Oct")f("Nov")g +("Dec"\))1789 2350 y(\(-)g(\(string->number)i(\(match:substring)h(m)d +(1\)\))f(1\)\)\))1122 2441 y(\(day)h(\(match:substring)j(m)c(2\)\))1122 +2532 y(\(year)h(\(match:substring)j(m)d(3\)\)\))965 2623 +y(\(string-append)j(mon)c(")h(")f(day)h(",)g(19")g(year\)\)\))808 +2715 y('post\))573 2897 y(;;;)g(Remove)g(potentially)i(offensive)f +(substrings)h(from)e(string)h(S.)573 2989 y(\(regexp-substitute/global) +k(#f)39 b("Windows|tcl|Intel")44 b(s)1593 3080 y('pre)c('post\))365 +3466 y FB(5.1.2)81 b(Other)20 b(string)h(manipulation)c(facilities)365 +3664 y FA(\(index)41 b FC(string)21 b(char)f([start])p FA(\))86 b Fw(\000)-14 b(!)87 b FC(\002xnum)20 b(or)h(false)732 -b FD(pr)o(ocedur)o(e)365 932 y FA(\(rindex)41 b FC(string)21 +b FD(pr)o(ocedur)o(e)365 3764 y FA(\(rindex)41 b FC(string)21 b(char)f([start])p FA(\))86 b Fw(\000)-15 b(!)88 b FC(\002xnum)20 -b(or)h(false)688 b FD(pr)o(ocedur)o(e)573 1060 y(These)17 +b(or)h(false)688 b FD(pr)o(ocedur)o(e)573 3884 y(These)17 b(pr)o(ocedur)o(es)e(sear)o(ch)g(thr)o(ough)j FC(string)f FD(looking)h(for)f(an)f(occurr)o(ence)g(of)h(char)o(-)573 -1159 y(acter)j FC(char)o FD(.)26 b FA(index)18 b FD(sear)o(ches)i +3983 y(acter)j FC(char)o FD(.)26 b FA(index)18 b FD(sear)o(ches)i (left-to-right;)g FA(rindex)f FD(sear)o(ches)g(right-to-left.)573 -1299 y FA(index)j FD(r)o(eturns)i(the)g(smallest)h(index)f +4111 y FA(index)j FD(r)o(eturns)i(the)g(smallest)h(index)f Fo(i)g FD(of)g FC(string)g FD(gr)o(eater)f(than)h(or)h(equal)f(to)h -FC(start)573 1399 y FD(such)e(that)g FC(string)p Fn([)p +FC(start)573 4211 y FD(such)e(that)g FC(string)p Fn([)p Fo(i)p Fn(])k(=)f FC(char)p FD(.)31 b(The)23 b(default)f(for)g FC(start)h FD(is)g(zer)o(o.)31 b(If)22 b(ther)o(e)g(is)i(no)f(such)573 -1498 y(match,)d FA(index)f FD(r)o(eturns)h(false.)573 -1638 y FA(rindex)38 b FD(r)o(eturns)i(the)h(lar)o(gest)f(index)h +4310 y(match,)d FA(index)f FD(r)o(eturns)h(false.)573 +4438 y FA(rindex)38 b FD(r)o(eturns)i(the)h(lar)o(gest)f(index)h Fo(i)f FD(of)h FC(string)g FD(less)g(than)g FC(start)f -FD(such)i(that)573 1738 y FC(string)p Fn([)p Fo(i)p Fn(])28 +FD(such)i(that)573 4538 y FC(string)p Fn([)p Fo(i)p Fn(])28 b(=)f FC(char)p FD(.)33 b(The)24 b(default)e(for)h FC(start)h FD(is)f FA(\(string-length)38 b FC(string)p FA(\))p FD(.)33 -b(If)23 b(ther)o(e)573 1837 y(is)e(no)g(such)h(match,)e -FA(rindex)e FD(r)o(eturns)j(false.)490 2027 y(I)d(should)i(pr)o(obably) +b(If)23 b(ther)o(e)573 4638 y(is)e(no)g(such)h(match,)e +FA(rindex)e FD(r)o(eturns)j(false.)490 4799 y(I)d(should)i(pr)o(obably) d(snarf)h(all)h(the)f(MIT)g(Scheme)g(string)h(functions,)h(and)e(stick) -h(them)365 2127 y(in)j(a)e(package.)k(Unix)d(pr)o(ograms)f(need)g(to)i -(mung)f(character)e(strings)j(a)e(lot.)490 2261 y(MIT)g(string)h(match) -g(commands:)573 2361 y FA([sub]string-matc)o(h-)o(for)o(wa)o(rd,)o(ba)o -(ck)o(war)o(d[)o(-ci)o(])573 2461 y([sub]string-pref)o(ix)o(,su)o(ff)o -(ix[)o(-c)o(i])o(?)573 2560 y([sub]string-find)o(-n)o(ext)o(,p)o(rev)o -(io)o(us)o(-ch)o(ar)o([-c)o(i])573 2660 y([sub]string-find)o(-n)o(ext)o -(,p)o(rev)o(io)o(us)o(-ch)o(ar)o(-in)o(-s)o(et)573 2760 -y([sub]string-repl)o(ac)o(e[!)o(])573 2859 y(...)p Fu(etc.)365 -2959 y FD(These)g(ar)o(e)e(not)j(curr)o(ently)e(pr)o(ovided.)365 -3115 y FA(\(substitute-env-v)o(ar)o(s)38 b FC(fname)p -FA(\))86 b Fw(\000)-14 b(!)87 b FC(string)817 b FD(pr)o(ocedur)o(e)573 -3263 y(Replace)24 b(occurr)o(ences)f(of)h(envir)o(onment)h(variables)e -(with)i(their)g(values.)36 b(An)24 b(en-)573 3363 y(vir)o(onment)18 -b(variable)f(is)h(denoted)g(by)g(a)f(dollar)h(sign)h(followed)f(by)g -(alphanumeric)573 3462 y(chars)i(and)h(underscor)o(es,)e(or)i(is)g -(surr)o(ounded)f(by)h(braces.)756 3639 y FA(\(substitute-env)o(-v)o -(ars)37 b("$USER/.login"\))922 3738 y Fn(=)-14 b Fw(\))103 -b FA("shivers/.login")756 3838 y(\(substitute-env)o(-v)o(ars)37 -b("$)p Fw(f)p FA(USER)p Fw(g)p FA(_log"\))77 b Fn(=)-14 -b Fw(\))103 b FA("shivers_log")365 4303 y FB(5.1.3)81 -b(Manipulating)18 b(\002le-names)365 4500 y FD(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 4599 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 4699 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 4799 y(the)23 -b(pathname)f(abstractions)g(of)j(C)t Fv(O)t(M)t(M)t(O)t(N)i -FD(L)t Fv(I)t(S)t(P)e FD(or)d(MIT)g(Scheme.)30 b(However)-6 -b(,)22 b(being)365 4898 y(Unix-speci\002c,)e(we)h(can)g(be)f(a)g -(little)h(less)g(general.)1735 5147 y(101)p eop +h(them)365 4898 y(in)j(a)e(package.)k(Unix)d(pr)o(ograms)f(need)g(to)i +(mung)f(character)e(strings)j(a)e(lot.)1735 5147 y(101)p +eop %%Page: 102 108 -102 107 bop 681 614 a FB(T)-9 b(erminology)681 802 y -FD(These)30 b(pr)o(ocedur)o(es)e(car)o(efully)g(adher)o(e)h(to)h(the)i -(P)t Fv(O)t(S)t(I)t(X)h FD(standar)o(d)c(for)g(\002le-name)h(r)o(eso-) -681 901 y(lution,)f(which)e(occasionally)h(entails)e(some)i(slightly)g -(odd)e(things.)45 b(This)27 b(section)g(will)681 1001 -y(describe)20 b(these)h(r)o(ules,)f(and)h(give)f(some)i(basic)e -(terminology)-9 b(.)805 1129 y(A)17 b FC(\002le-name)g +102 107 bop 805 614 a FD(MIT)20 b(string)i(match)f(commands:)888 +714 y FA([sub]string-match)o(-f)o(orw)o(ar)o(d,b)o(ac)o(kwa)o(rd)o([-)o +(ci])888 814 y([sub]string-prefi)o(x,)o(suf)o(fi)o(x[-)o(ci)o(]?)888 +913 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 1013 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 1112 y([sub]string-repla)o(ce)o([!])888 +1212 y(...)p Fu(etc.)681 1312 y FD(These)f(ar)o(e)g(not)h(curr)o(ently) +g(pr)o(ovided.)681 1473 y FA(\(substitute-env-)o(va)o(rs)37 +b FC(fname)p FA(\))87 b Fw(\000)-14 b(!)87 b FC(string)816 +b FD(pr)o(ocedur)o(e)888 1627 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 1726 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 +1826 y(chars)j(and)f(underscor)o(es,)g(or)h(is)g(surr)o(ounded)f(by)h +(braces.)1071 2018 y FA(\(substitute-env-)o(var)o(s)37 +b("$USER/.login"\))1237 2117 y Fn(=)-14 b Fw(\))104 b +FA("shivers/.login)o(")1071 2217 y(\(substitute-env-)o(var)o(s)37 +b("$)p Fw(f)p FA(USER)p Fw(g)p FA(_log"\))77 b Fn(=)-14 +b Fw(\))104 b FA("shivers_log")681 2732 y FB(5.1.3)81 +b(Manipulating)17 b(\002le-names)681 2939 y FD(These)26 +b(pr)o(ocedur)o(es)f(do)h(not)h(access)f(the)h(\002le-system)g(at)f +(all;)i(they)f(mer)o(ely)f(operate)f(on)681 3039 y(\002le-name)f +(strings.)38 b(Much)25 b(of)g(this)g(str)o(uctur)o(e)f(is)h(patterned)f +(after)f(the)i(gnu)h(emacs)e(de-)681 3139 y(sign.)59 +b(Per)o(haps)31 b(a)g(mor)o(e)g(sophisticated)h(system)h(would)f(be)f +(better)-6 b(,)33 b(something)h(like)681 3238 y(the)22 +b(pathname)g(abstractions)h(of)h(C)t Fv(O)t(M)t(M)t(O)t(N)j +FD(L)t Fv(I)t(S)t(P)e FD(or)e(MIT)e(Scheme.)30 b(However)-6 +b(,)23 b(being)681 3338 y(Unix-speci\002c,)d(we)h(can)f(be)g(a)h +(little)g(less)g(general.)681 3636 y FB(T)-9 b(erminology)681 +3843 y FD(These)30 b(pr)o(ocedur)o(es)e(car)o(efully)g(adher)o(e)h(to)h +(the)i(P)t Fv(O)t(S)t(I)t(X)h FD(standar)o(d)c(for)g(\002le-name)h(r)o +(eso-)681 3943 y(lution,)f(which)e(occasionally)h(entails)e(some)i +(slightly)g(odd)e(things.)45 b(This)27 b(section)g(will)681 +4042 y(describe)20 b(these)h(r)o(ules,)f(and)h(give)f(some)i(basic)e +(terminology)-9 b(.)805 4185 y(A)17 b FC(\002le-name)g FD(is)h(either)f(the)h(\002le-system)g(r)o(oot)f(\(\223/\224\),)g(or)g -(a)g(series)g(of)h(slash-terminated)681 1228 y(dir)o(ectory)27 +(a)g(series)g(of)h(slash-terminated)681 4285 y(dir)o(ectory)27 b(components,)k(followed)d(by)g(a)f(a)h(\002le)g(component.)48 -b(Root)29 b(is)f(the)g(only)h(\002le-)681 1328 y(name)20 +b(Root)29 b(is)f(the)g(only)h(\002le-)681 4384 y(name)20 b(that)h(may)g(end)f(in)i(slash.)k(Some)20 b(examples:)1053 -1526 y(File)h(name)396 b(Dir)20 b(components)208 b(File)21 -b(component)p 1003 1560 2220 4 v 1053 1629 a FA(src/des/main.c)138 -b(\("src")41 b("des"\))228 b("main.c")1053 1729 y(/src/des/main.c)94 -b(\("")42 b("src")f("des"\))98 b("main.c")1053 1829 y(main.c)490 -b(\(\))709 b("main.c")805 2024 y FD(Note)24 b(that)g(the)h(r)o(elative) -d(\002lename)i FA(src/des/main.c)18 b FD(and)24 b(the)g(absolute)g -(\002lename)681 2124 y FA(/src/des/main.c)16 b FD(ar)o(e)22 -b(distinguished)h(by)g(the)g(pr)o(esence)f(of)g(the)h(r)o(oot)g -(component)h FA("")681 2223 y FD(in)d(the)g(absolute)g(path.)805 -2351 y(Multiple)h(embedded)f(slashes)i(within)g(a)f(path)g(have)f(the)i -(same)f(meaning)g(as)g(a)g(sin-)681 2451 y(gle)k(slash.)43 -b(Mor)o(e)25 b(than)i(two)g(leading)f(slashes)h(at)f(the)g(beginning)i -(of)e(a)g(path)g(have)g(the)681 2550 y(same)c(meaning)h(as)f(a)g -(single)h(leading)f(slash\227they)h(indicate)f(that)g(the)h -(\002le-name)f(is)g(an)681 2650 y(absolute)d(one,)h(with)g(the)g(path)f -(leading)h(fr)o(om)f(r)o(oot.)25 b(However)-6 b(,)21 -b(P)t Fv(O)t(S)t(I)t(X)i FD(permits)d(the)f(OS)681 2750 -y(to)k(give)f(special)g(meaning)h(to)g FC(two)f FD(leading)g(slashes.) -31 b(For)22 b(this)h(r)o(eason,)f(the)h(r)o(outines)g(in)681 -2849 y(this)e(section)h(do)f(not)g(simplify)g(two)h(leading)e(slashes)i -(to)f(a)f(single)h(slash.)805 2977 y(A)f(\002le-name)g(in)h -FC(dir)o(ectory)e(form)h FD(is)h(either)f(a)g(\002le-name)g(terminated) -g(by)h(a)e(slash,)i FC(e.g.)o FD(,)681 3077 y(\223)p -FA(/src/des/)p FD(\224,)14 b(or)k(the)h(empty)f(string,)h(\223\224.)24 -b(The)18 b(empty)h(string)g(corr)o(esponds)f(to)h(the)f(cur)o(-)681 -3176 y(r)o(ent)g(working)j(dir)o(ectory)-9 b(,)18 b(whose)i -(\002le-name)f(is)g(dot)h(\(\223)p FA(.)p FD(\224\).)i(W)-8 -b(orking)21 b(backwar)o(ds)c(fr)o(om)681 3276 y(the)h(append-a-slash)e -(r)o(ule,)i(we)g(extend)f(the)h(syntax)g(of)h(P)t Fv(O)t(S)t(I)t(X)j -FD(\002le-names)17 b(to)h(de\002ne)g(the)681 3376 y(empty)j(string)h -(to)f(be)g(a)g(\002le-name)g(form)g(of)g(the)g(r)o(oot)g(dir)o(ectory)f -(\223)p FA(/)p FD(\224.)26 b(\(However)-6 b(,)20 b(\223)p -FA(/)p FD(\224)g(is)681 3475 y(also)25 b(acceptable)f(as)h(a)g -(\002le-name)g(form)g(for)g(r)o(oot.\))39 b(So)26 b(the)f(empty)h -(string)g(has)f(two)h(in-)681 3575 y(terpr)o(etations:)e(as)c(a)f -(\002le-name)h(form,)g(it)g(is)g(the)g(\002le-system)h(r)o(oot;)f(as)g -(a)f(dir)o(ectory)g(form,)681 3675 y(it)k(is)h(the)g(curr)o(ent)e -(working)j(dir)o(ectory)-9 b(.)32 b(Slash)23 b(is)h(also)g(an)f -(ambiguous)h(form:)31 b FA(/)23 b FD(is)g(both)681 3774 -y(a)d(dir)o(ectory-form)g(and)g(a)g(\002le-name)h(form.)805 -3902 y(The)52 b(dir)o(ectory)e(form)i(of)f(a)g(\002le-name)g(is)h(very) -f(rar)o(ely)f(used.)117 b(Almost)52 b(all)681 4002 y(of)60 -b(the)h(pr)o(ocedur)o(es)d(in)j(scsh)g(name)f(dir)o(ectories)f(by)i -(giving)g(their)f(\002le-name)681 4101 y(form)44 b(\(without)h(the)f -(trailing)h(slash\),)50 b(not)44 b(their)h(dir)o(ectory)e(form.)96 -b(So,)49 b(you)c(say)681 4201 y(\223)p FA(/usr/include)p -FD(\224,)22 b(and)k(\223)p FA(.)p FD(\224,)h(not)h(\223)p -FA(/usr/include/)p FD(\224)20 b(and)27 b(\223\224.)43 -b(The)27 b(sole)g(exceptions)681 4301 y(ar)o(e)g FA(file-name-as-dire)o -(cto)o(ry)22 b FD(and)29 b FA(directory-as-fil)o(e-)o(nam)o(e)p -FD(,)c(whose)30 b(jobs)f(ar)o(e)681 4400 y(to)34 b(convert)h -(back-and-forth)d(between)i(these)h(forms,)i(and)d FA -(file-name-directo)o(ry)o FD(,)681 4500 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 4599 -y(pr)o(ocedur)o(es)k(that)i(expect)g(a)g(dir)o(ectory)f(ar)o(gument)h -(will)h(coer)o(ce)e(a)h(\002le-name)g(in)h(dir)o(ec-)681 -4699 y(tory)f(form)g(to)g(\002le-name)f(form)h(if)f(it)h(does)g(not)h -(have)e(a)g(trailing)h(slash.)44 b(Bear)25 b(in)j(mind)681 -4799 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 4898 y -FC(i.e.)p FD(,)20 b(as)h(r)o(oot.)2051 5147 y(102)p eop +4608 y(File)h(name)396 b(Dir)20 b(components)208 b(File)21 +b(component)p 1003 4641 2220 4 v 1053 4711 a FA(src/des/main.c)138 +b(\("src")41 b("des"\))228 b("main.c")1053 4810 y(/src/des/main.c)94 +b(\("")42 b("src")f("des"\))98 b("main.c")1053 4910 y(main.c)490 +b(\(\))709 b("main.c")2051 5147 y FD(102)p eop %%Page: 103 109 -103 108 bop 365 614 a FB(Procedures)365 835 y FA(\(file-name-direct)o -(or)o(y?)37 b FC(fname)p FA(\))87 b Fw(\000)-14 b(!)87 -b FC(boolean)726 b FD(pr)o(ocedur)o(e)365 935 y FA(\(file-name-non-di)o -(re)o(cto)o(ry)o(?)38 b FC(fname)p FA(\))86 b Fw(\000)-14 -b(!)87 b FC(boolean)552 b FD(pr)o(ocedur)o(e)573 1064 -y(These)18 b(pr)o(edicates)e(r)o(eturn)i(tr)o(ue)g(if)g(the)h(string)f -(is)h(in)g(dir)o(ectory)e(form,)i(or)f(\002le-name)573 -1163 y(form)24 b(\(see)f(the)h(above)f(discussion)i(of)e(these)h(two)g -(forms\).)34 b(Note)24 b(that)g(they)g(both)573 1263 -y(r)o(eturn)19 b(tr)o(ue)h(on)g(the)g(ambiguous)g(case)f(of)h(empty)g -(string,)g(which)h(is)f(both)g(a)f(dir)o(ec-)573 1363 -y(tory)i(\(curr)o(ent)f(working)h(dir)o(ectory\),)f(and)g(a)g(\002le)h -(name)g(\(the)f(\002le-system)i(r)o(oot\).)886 1506 y(File)f(name)178 -b FA(...-directory?)94 b(...-non-directo)o(ry?)p 836 -1539 2130 4 v 886 1609 a("src/des")140 b(#f)622 b(#t)886 -1709 y("src/des/")96 b(#t)622 b(#f)886 1808 y("/")404 -b(#t)622 b(#f)886 1908 y(".")404 b(#f)622 b(#t)886 2007 -y("")448 b(#t)622 b(#t)365 2224 y(\(file-name-as-dir)o(ec)o(tor)o(y)37 -b FC(fname)p FA(\))87 b Fw(\000)-14 b(!)87 b FC(string)686 -b FD(pr)o(ocedur)o(e)573 2374 y(Convert)29 b(a)f(\002le-name)h(to)g -(dir)o(ectory)f(form.)49 b(Basically)-9 b(,)30 b(add)e(a)g(trailing)i -(slash)f(if)573 2474 y(needed:)756 2613 y FA(\(file-name-as-d)o(ir)o -(ect)o(or)o(y)38 b("src/des"\))122 b Fn(=)-14 b Fw(\))104 -b FA("src/des/")756 2713 y(\(file-name-as-d)o(ir)o(ect)o(or)o(y)38 -b("src/des/"\))78 b Fn(=)-14 b Fw(\))104 b FA("src/des/")756 -2890 y(.)p FD(,)20 b FA(/)p FD(,)g(and)g FA("")g FD(ar)o(e)f(special:) -756 2990 y FA(\(file-name-as-d)o(ir)o(ect)o(or)o(y)38 -b("."\))386 b Fn(=)-14 b Fw(\))104 b FA("")756 3090 y(\(file-name-as-d) -o(ir)o(ect)o(or)o(y)38 b("/"\))386 b Fn(=)-14 b Fw(\))104 -b FA("/")756 3189 y(\(file-name-as-d)o(ir)o(ect)o(or)o(y)38 -b(""\))430 b Fn(=)-14 b Fw(\))104 b FA("/")365 3525 y -(\(directory-as-fil)o(e-)o(nam)o(e)37 b FC(fname)p FA(\))87 -b Fw(\000)-14 b(!)87 b FC(string)686 b FD(pr)o(ocedur)o(e)573 -3675 y(Convert)21 b(a)f(dir)o(ectory)g(to)h(a)g(simple)g(\002le-name.) -26 b(Basically)-9 b(,)19 b(kill)j(a)e(trailing)i(slash)f(if)573 -3775 y(one)g(is)g(pr)o(esent:)756 3936 y FA(\(directory-as-f)o(il)o -(e-n)o(am)o(e)38 b("foo/bar/"\))78 b Fn(=)-14 b Fw(\))104 -b FA("foo/bar")756 4113 y(/)20 b FD(and)g FA("")g FD(ar)o(e)f(special:) -756 4213 y FA(\(directory-as-f)o(il)o(e-n)o(am)o(e)38 -b("/"\))386 b Fn(=)-14 b Fw(\))104 b FA("/")756 4313 -y(\(directory-as-f)o(il)o(e-n)o(am)o(e)38 b(""\))430 -b Fn(=)-14 b Fw(\))104 b FA(".")19 b FD(\()p FC(i.e.)p -FD(,)h(the)h(cwd\))365 4649 y FA(\(file-name-absolu)o(te)o(?)38 -b FC(fname)p FA(\))86 b Fw(\000)-14 b(!)87 b FC(boolean)770 -b FD(pr)o(ocedur)o(e)573 4799 y(Does)20 b FC(fname)f -FD(begin)h(with)g(a)f(r)o(oot)h(or)f FA(~)h FD(component?)26 -b(\(Recognising)21 b FA(~)e FD(as)g(a)g(home-)573 4898 -y(dir)o(ectory)h(speci\002cation)h(is)g(an)g(extension)g(of)i(P)t -Fv(O)t(S)t(I)t(X)h FD(r)o(ules.\))1735 5147 y(103)p eop +103 108 bop 490 614 a FD(Note)24 b(that)g(the)g(r)o(elative)f +(\002lename)h FA(src/des/main.c)18 b FD(and)23 b(the)i(absolute)e +(\002lename)365 714 y FA(/src/des/main.c)17 b FD(ar)o(e)k +(distinguished)j(by)f(the)g(pr)o(esence)e(of)i(the)g(r)o(oot)f +(component)i FA("")365 814 y FD(in)e(the)e(absolute)h(path.)490 +1002 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 1101 y(gle)27 b(slash.)42 +b(Mor)o(e)26 b(than)g(two)h(leading)f(slashes)h(at)f(the)h(beginning)g +(of)g(a)e(path)i(have)e(the)365 1201 y(same)d(meaning)h(as)f(a)g +(single)h(leading)f(slash\227they)h(indicate)f(that)h(the)f +(\002le-name)g(is)h(an)365 1301 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 Fv(O)t(S)t(I)t(X)i FD(permits)d(the)g(OS)365 1400 +y(to)j(give)f(special)g(meaning)h(to)g FC(two)f FD(leading)g(slashes.) +31 b(For)23 b(this)g(r)o(eason,)f(the)g(r)o(outines)h(in)365 +1500 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 1688 y(A)e(\002le-name)g(in)h +FC(dir)o(ectory)e(form)h FD(is)h(either)f(a)g(\002le-name)g(terminated) +g(by)g(a)g(slash,)g FC(e.g.)p FD(,)365 1788 y(\223)p +FA(/src/des/)p FD(\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 +1887 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 FA(.)p FD(\224\).)k(W)-8 +b(orking)20 b(backwar)o(ds)e(fr)o(om)365 1987 y(the)g(append-a-slash)e +(r)o(ule,)i(we)g(extend)f(the)h(syntax)g(of)i(P)t Fv(O)t(S)t(I)t(X)h +FD(\002le-names)d(to)g(de\002ne)f(the)365 2087 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 FA(/)p FD(\224.)25 b(\(However)-6 b(,)20 +b(\223)p FA(/)p FD(\224)g(is)365 2186 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 2286 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 2386 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 FA(/)23 b FD(is)h(both)365 2485 +y(a)d(dir)o(ectory-form)e(and)i(a)f(\002le-name)g(form.)490 +2673 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 2773 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 2873 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 2972 y(\223)p FA(/usr/include)p +FD(\224,)23 b(and)j(\223)p FA(.)p FD(\224,)h(not)g(\223)p +FA(/usr/include/)p FD(\224)21 b(and)26 b(\223\224.)43 +b(The)27 b(sole)g(exceptions)365 3072 y(ar)o(e)h FA(file-name-as-dir)o +(ec)o(tor)o(y)23 b FD(and)28 b FA(directory-as-file)o(-na)o(me)o +FD(,)d(whose)30 b(jobs)g(ar)o(e)365 3171 y(to)35 b(convert)f +(back-and-forth)f(between)h(these)g(forms,)k(and)c FA(file-name-direc)o +(tor)o(y)p FD(,)365 3271 y(whose)23 b(job)f(it)g(is)g(to)g(split)g(out) +g(the)g(dir)o(ectory)e(portion)j(of)f(a)f(\002le-name.)27 +b(However)-6 b(,)22 b(most)365 3371 y(pr)o(ocedur)o(es)k(that)h(expect) +f(a)h(dir)o(ectory)g(ar)o(gument)f(will)i(coer)o(ce)f(a)f(\002le-name)h +(in)h(dir)o(ec-)365 3470 y(tory)f(form)g(to)g(\002le-name)g(form)f(if)h +(it)g(does)g(not)g(have)f(a)h(trailing)g(slash.)43 b(Bear)26 +b(in)h(mind)365 3570 y(that)g(the)f(ambiguous)h(case,)g(empty)g +(string,)h(will)f(be)g(interpr)o(eted)e(in)i(\002le-name)f(form,)365 +3670 y FC(i.e.)p FD(,)21 b(as)f(r)o(oot.)365 4084 y FB(Procedures)365 +4354 y FA(\(file-name-direct)o(or)o(y?)37 b FC(fname)p +FA(\))87 b Fw(\000)-14 b(!)87 b FC(boolean)726 b FD(pr)o(ocedur)o(e)365 +4454 y FA(\(file-name-non-di)o(re)o(cto)o(ry)o(?)38 b +FC(fname)p FA(\))86 b Fw(\000)-14 b(!)87 b FC(boolean)552 +b FD(pr)o(ocedur)o(e)573 4599 y(These)18 b(pr)o(edicates)e(r)o(eturn)i +(tr)o(ue)g(if)g(the)h(string)f(is)h(in)g(dir)o(ectory)e(form,)i(or)f +(\002le-name)573 4699 y(form)24 b(\(see)f(the)h(above)f(discussion)i +(of)e(these)h(two)g(forms\).)34 b(Note)24 b(that)g(they)g(both)573 +4799 y(r)o(eturn)19 b(tr)o(ue)h(on)g(the)g(ambiguous)g(case)f(of)h +(empty)g(string,)g(which)h(is)f(both)g(a)f(dir)o(ec-)573 +4898 y(tory)i(\(curr)o(ent)f(working)h(dir)o(ectory\),)f(and)g(a)g +(\002le)h(name)g(\(the)f(\002le-system)i(r)o(oot\).)1735 +5147 y(103)p eop %%Page: 104 110 -104 109 bop 1071 601 a FA(\(file-name-absol)o(ute)o(?)37 -b("/usr/shivers"\))77 b Fn(=)-14 b Fw(\))104 b FA(#t)1071 -701 y(\(file-name-absol)o(ute)o(?)37 b("src/des"\))297 -b Fn(=)-14 b Fw(\))104 b FA(#f)1071 800 y(\(file-name-absol)o(ute)o(?) +104 109 bop 1202 601 a FD(File)21 b(name)177 b FA(...-directory?)94 +b(...-non-director)o(y?)p 1152 634 2130 4 v 1202 704 +a("src/des")139 b(#f)622 b(#t)1202 804 y("src/des/")95 +b(#t)622 b(#f)1202 903 y("/")403 b(#t)622 b(#f)1202 1003 +y(".")403 b(#f)622 b(#t)1202 1103 y("")447 b(#t)622 b(#t)681 +1287 y(\(file-name-as-di)o(re)o(cto)o(ry)37 b FC(fname)p +FA(\))87 b Fw(\000)-15 b(!)88 b FC(string)685 b FD(pr)o(ocedur)o(e)888 +1424 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 +1524 y(needed:)1071 1642 y FA(\(file-name-as-di)o(rec)o(to)o(ry)37 +b("src/des"\))123 b Fn(=)-14 b Fw(\))103 b FA("src/des/")1071 +1742 y(\(file-name-as-di)o(rec)o(to)o(ry)37 b("src/des/"\))79 +b Fn(=)-14 b Fw(\))103 b FA("src/des/")1071 1919 y(.)p +FD(,)20 b FA(/)p FD(,)g(and)g FA("")g FD(ar)o(e)g(special:)1071 +2019 y FA(\(file-name-as-di)o(rec)o(to)o(ry)37 b("."\))387 +b Fn(=)-14 b Fw(\))103 b FA("")1071 2119 y(\(file-name-as-di)o(rec)o +(to)o(ry)37 b("/"\))387 b Fn(=)-14 b Fw(\))103 b FA("/")1071 +2218 y(\(file-name-as-di)o(rec)o(to)o(ry)37 b(""\))431 +b Fn(=)-14 b Fw(\))103 b FA("/")681 2497 y(\(directory-as-fi)o(le)o +(-na)o(me)37 b FC(fname)p FA(\))87 b Fw(\000)-15 b(!)88 +b FC(string)685 b FD(pr)o(ocedur)o(e)888 2634 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 2734 y(one)h(is)f(pr)o +(esent:)1071 2874 y FA(\(directory-as-fi)o(le-)o(na)o(me)37 +b("foo/bar/"\))79 b Fn(=)-14 b Fw(\))103 b FA("foo/bar")1071 +3052 y(/)20 b FD(and)h FA("")f FD(ar)o(e)f(special:)1071 +3151 y FA(\(directory-as-fi)o(le-)o(na)o(me)37 b("/"\))387 +b Fn(=)-14 b Fw(\))103 b FA("/")1071 3251 y(\(directory-as-fi)o(le-)o +(na)o(me)37 b(""\))431 b Fn(=)-14 b Fw(\))103 b FA(".")20 +b FD(\()p FC(i.e.)o FD(,)h(the)g(cwd\))681 3529 y FA(\(file-name-absol) +o(ut)o(e?)37 b FC(fname)p FA(\))87 b Fw(\000)-14 b(!)87 +b FC(boolean)769 b FD(pr)o(ocedur)o(e)888 3667 y(Does)20 +b FC(fname)g FD(begin)g(with)g(a)f(r)o(oot)g(or)h FA(~)f +FD(component?)26 b(\(Recognising)21 b FA(~)e FD(as)h(a)f(home-)888 +3766 y(dir)o(ectory)h(speci\002cation)h(is)g(an)g(extension)h(of)g(P)t +Fv(O)t(S)t(I)t(X)j FD(r)o(ules.\))1071 3907 y FA(\(file-name-absol)o +(ute)o(?)37 b("/usr/shivers"\))77 b Fn(=)-14 b Fw(\))104 +b FA(#t)1071 4006 y(\(file-name-absol)o(ute)o(?)37 b("src/des"\))297 +b Fn(=)-14 b Fw(\))104 b FA(#f)1071 4106 y(\(file-name-absol)o(ute)o(?) 37 b("~/src/des"\))209 b Fn(=)-14 b Fw(\))104 b FA(#t)1071 -978 y FD(Non-obvious)22 b(case:)1071 1077 y FA(\(file-name-absol)o(ute) -o(?)37 b(""\))605 b Fn(=)-14 b Fw(\))104 b FA(#t)20 b -FD(\()p FC(i.e.)o FD(,)h(r)o(oot\))681 1360 y FA(\(file-name-direc)o +4283 y FD(Non-obvious)22 b(case:)1071 4383 y FA(\(file-name-absol)o +(ute)o(?)37 b(""\))605 b Fn(=)-14 b Fw(\))104 b FA(#t)20 +b FD(\()p FC(i.e.)o FD(,)h(r)o(oot\))681 4662 y FA(\(file-name-direc)o (to)o(ry)37 b FC(fname)p FA(\))87 b Fw(\000)-14 b(!)87 b FC(string)21 b(or)f(false)559 b FD(pr)o(ocedur)o(e)888 -1499 y(Return)30 b(the)g(dir)o(ectory)e(component)j(of)e +4799 y(Return)30 b(the)g(dir)o(ectory)e(component)j(of)e FC(fname)g FD(in)h(dir)o(ectory)f(form.)51 b(If)29 b(the)g(\002le-)888 -1599 y(name)21 b(is)g(alr)o(eady)e(in)i(dir)o(ectory)f(form,)h(r)o -(eturn)f(it)h(as-is.)1071 1739 y FA(\(file-name-direc)o(tor)o(y)37 -b("/usr/bdc"\))166 b Fn(=)-14 b Fw(\))103 b FA("/usr/")1071 -1839 y(\(file-name-direc)o(tor)o(y)37 b("/usr/bdc/"\))122 -b Fn(=)-14 b Fw(\))103 b FA("/usr/bdc/")1071 1938 y(\(file-name-direc)o -(tor)o(y)37 b("bdc/.login"\))78 b Fn(=)-14 b Fw(\))103 -b FA("bdc/")1071 2038 y(\(file-name-direc)o(tor)o(y)37 -b("main.c"\))254 b Fn(=)-14 b Fw(\))103 b FA("")1071 -2216 y FD(Root)22 b(has)f(no)g(dir)o(ectory)f(component:)1071 -2315 y FA(\(file-name-direc)o(tor)o(y)37 b("/"\))474 -b Fn(=)-14 b Fw(\))103 b FA("")1071 2415 y(\(file-name-direc)o(tor)o(y) -37 b(""\))518 b Fn(=)-14 b Fw(\))103 b FA("")681 2697 -y(\(file-name-nondi)o(re)o(cto)o(ry)37 b FC(fname)p FA(\))87 -b Fw(\000)-15 b(!)88 b FC(string)685 b FD(pr)o(ocedur)o(e)888 -2837 y(Return)22 b(non-dir)o(ectory)e(component)i(of)f(fname.)1071 -2977 y FA(\(file-name-nondi)o(rec)o(to)o(ry)37 b("/usr/ian"\))166 -b Fn(=)-14 b Fw(\))103 b FA("ian")1071 3077 y(\(file-name-nondi)o(rec)o -(to)o(ry)37 b("/usr/ian/"\))122 b Fn(=)-14 b Fw(\))103 -b FA("")1071 3176 y(\(file-name-nondi)o(rec)o(to)o(ry)37 -b("ian/.login"\))78 b Fn(=)-14 b Fw(\))103 b FA(".login")1071 -3276 y(\(file-name-nondi)o(rec)o(to)o(ry)37 b("main.c"\))254 -b Fn(=)-14 b Fw(\))103 b FA("main.c")1071 3376 y(\(file-name-nondi)o -(rec)o(to)o(ry)37 b(""\))518 b Fn(=)-14 b Fw(\))103 b -FA("")1071 3475 y(\(file-name-nondi)o(rec)o(to)o(ry)37 -b("/"\))474 b Fn(=)-14 b Fw(\))103 b FA("/")681 3757 -y(\(split-file-name)37 b FC(fname)p FA(\))86 b Fw(\000)-14 -b(!)87 b FC(string)21 b(list)864 b FD(pr)o(ocedur)o(e)888 -3897 y(Split)21 b(a)f(\002le-name)h(into)g(its)g(components.)1071 -4037 y FA(\(split-file-name)37 b("src/des/main.c")o(\))1237 -4137 y Fn(=)-14 b Fw(\))267 b FA(\("src")41 b("des")g("main.c"\))1071 -4295 y(\(split-file-name)c("/src/des/main.c)o("\))1237 -4395 y Fn(=)-14 b Fw(\))136 b FA(\("")42 b("src")g("des")f("main.c"\)) -1071 4553 y(\(split-file-name)c("main.c"\))1237 4652 -y Fn(=)-14 b Fw(\))790 b FA(\("main.c"\))1071 4810 y(\(split-file-name) -37 b("/"\))1237 4910 y Fn(=)-14 b Fw(\))104 b FA(\(""\))2051 -5147 y FD(104)p eop +4898 y(name)21 b(is)g(alr)o(eady)e(in)i(dir)o(ectory)f(form,)h(r)o +(eturn)f(it)h(as-is.)2051 5147 y(104)p eop %%Page: 105 111 -105 110 bop 365 756 a FA(\(path-list->file-)o(na)o(me)37 -b FC(path-list)19 b([dir])p FA(\))86 b Fw(\000)-14 b(!)87 -b FC(string)522 b FD(pr)o(ocedur)o(e)573 890 y(Inverse)20 -b(of)h FA(split-file-name)p FD(.)756 1049 y FA(\(path-list->fil)o(e-)o -(nam)o(e)37 b('\("src")k("des")h("main.c"\)\))930 1148 -y Fn(=)-14 b Fw(\))87 b FA("src/des/main.c")756 1248 -y(\(path-list->fil)o(e-)o(nam)o(e)37 b('\("")42 b("src")g("des")f -("main.c"\)\))930 1348 y Fn(=)-14 b Fw(\))87 b FA("/src/des/main.c)o(") -756 1547 y FD(Optional)21 b FC(dir)g FD(ar)o(g)e(anchors)i(r)o(elative) -f(path-lists:)756 1646 y FA(\(path-list->fil)o(e-)o(nam)o(e)37 -b('\("src")k("des")h("main.c"\))1714 1746 y("/usr/shivers"\))930 -1846 y Fn(=)-14 b Fw(\))87 b FA("/usr/shivers/sr)o(c/)o(de)o(s/m)o(ai)o -(n.c)o(")573 2004 y FD(The)21 b(optional)g FC(dir)g FD(ar)o(gument)f -(is)h(usefully)g FA(\(cwd\))p FD(.)365 2284 y FA(\(file-name-extens)o -(io)o(n)38 b FC(fname)p FA(\))86 b Fw(\000)-14 b(!)87 -b FC(string)817 b FD(pr)o(ocedur)o(e)573 2417 y(Return)21 -b(the)g(\002le-name's)g(extension.)756 2536 y FA(\(file-name-exte)o(ns) -o(ion)37 b("main.c"\))341 b Fn(=)-14 b Fw(\))103 b FA(".c")756 -2636 y(\(file-name-exte)o(ns)o(ion)37 b("main.c.old"\))165 -b Fn(=)-14 b Fw(\))103 b FA(".old")756 2735 y(\(file-name-exte)o(ns)o -(ion)37 b("/usr/shivers"\))77 b Fn(=)-14 b Fw(\))103 -b FA("")756 2882 y FD(W)-8 b(eir)o(d)20 b(cases:)756 -2982 y FA(\(file-name-exte)o(ns)o(ion)37 b("foo."\))124 -b Fn(=)-14 b Fw(\))103 b FA(".")756 3082 y(\(file-name-exte)o(ns)o(ion) -37 b("foo.."\))80 b Fn(=)-14 b Fw(\))103 b FA(".")756 -3228 y FD(Dot)21 b(\002les)g(ar)o(e)e(not)j(extensions:)756 -3328 y FA(\(file-name-exte)o(ns)o(ion)37 b("/usr/shivers/.l)o(og)o(in") -o(\))77 b Fn(=)-14 b Fw(\))103 b FA("")365 3614 y(\(file-name-sans-e)o -(xt)o(ens)o(io)o(n)38 b FC(fname)p FA(\))86 b Fw(\000)-14 -b(!)87 b FC(string)599 b FD(pr)o(ocedur)o(e)573 3748 -y(Return)21 b(everything)g(but)g(the)g(extension.)756 -3888 y FA(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 b("main.c"\))253 -b Fn(=)-14 b Fw(\))104 b FA("main")756 3988 y(\(file-name-sans)o(-e)o -(xte)o(ns)o(ion)37 b("main.c.old"\))77 b Fn(=)-14 b Fw(\))104 -b FA("main.c"")756 4087 y(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 -b("/usr/shivers"\))922 4187 y Fn(=)-14 b Fw(\))103 b -FA("/usr/shivers")756 4334 y FD(W)-8 b(eir)o(d)20 b(cases:)756 -4434 y FA(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 b("foo."\))123 -b Fn(=)-14 b Fw(\))104 b FA("foo")756 4533 y(\(file-name-sans)o(-e)o -(xte)o(ns)o(ion)37 b("foo.."\))79 b Fn(=)-14 b Fw(\))104 -b FA("foo.")756 4711 y FD(Dot)21 b(\002les)g(ar)o(e)e(not)j -(extensions:)756 4810 y FA(\(file-name-sans)o(-e)o(xte)o(ns)o(ion)37 -b("/usr/shivers/.l)o(og)o(in)o("\))922 4910 y Fn(=)-14 -b Fw(\))103 b FA("/usr/shivers/.l)o(ogi)o(n)1735 5147 -y FD(105)p eop +105 110 bop 756 601 a FA(\(file-name-dire)o(ct)o(ory)37 +b("/usr/bdc"\))165 b Fn(=)-14 b Fw(\))104 b FA("/usr/")756 +701 y(\(file-name-dire)o(ct)o(ory)37 b("/usr/bdc/"\))121 +b Fn(=)-14 b Fw(\))104 b FA("/usr/bdc/")756 800 y(\(file-name-dire)o +(ct)o(ory)37 b("bdc/.login"\))77 b Fn(=)-14 b Fw(\))104 +b FA("bdc/")756 900 y(\(file-name-dire)o(ct)o(ory)37 +b("main.c"\))253 b Fn(=)-14 b Fw(\))104 b FA("")756 1077 +y FD(Root)21 b(has)g(no)h(dir)o(ectory)e(component:)756 +1177 y FA(\(file-name-dire)o(ct)o(ory)37 b("/"\))473 +b Fn(=)-14 b Fw(\))104 b FA("")756 1277 y(\(file-name-dire)o(ct)o(ory) +37 b(""\))517 b Fn(=)-14 b Fw(\))104 b FA("")365 1589 +y(\(file-name-nondir)o(ec)o(tor)o(y)37 b FC(fname)p FA(\))87 +b Fw(\000)-14 b(!)87 b FC(string)686 b FD(pr)o(ocedur)o(e)573 +1735 y(Return)21 b(non-dir)o(ectory)g(component)h(of)e(fname.)756 +1886 y FA(\(file-name-nond)o(ir)o(ect)o(or)o(y)38 b("/usr/ian"\))165 +b Fn(=)-14 b Fw(\))104 b FA("ian")756 1986 y(\(file-name-nond)o(ir)o +(ect)o(or)o(y)38 b("/usr/ian/"\))121 b Fn(=)-14 b Fw(\))104 +b FA("")756 2085 y(\(file-name-nond)o(ir)o(ect)o(or)o(y)38 +b("ian/.login"\))77 b Fn(=)-14 b Fw(\))104 b FA(".login")756 +2185 y(\(file-name-nond)o(ir)o(ect)o(or)o(y)38 b("main.c"\))253 +b Fn(=)-14 b Fw(\))104 b FA("main.c")756 2285 y(\(file-name-nond)o(ir)o +(ect)o(or)o(y)38 b(""\))517 b Fn(=)-14 b Fw(\))104 b +FA("")756 2384 y(\(file-name-nond)o(ir)o(ect)o(or)o(y)38 +b("/"\))473 b Fn(=)-14 b Fw(\))104 b FA("/")365 2696 +y(\(split-file-name)37 b FC(fname)p FA(\))87 b Fw(\000)-14 +b(!)87 b FC(string)21 b(list)864 b FD(pr)o(ocedur)o(e)573 +2842 y(Split)20 b(a)h(\002le-name)f(into)i(its)f(components.)756 +2994 y FA(\(split-file-nam)o(e)37 b("src/des/main.c"\))922 +3093 y Fn(=)-14 b Fw(\))266 b FA(\("src")41 b("des")h("main.c"\))756 +3251 y(\(split-file-nam)o(e)37 b("/src/des/main.c")o(\))922 +3351 y Fn(=)-14 b Fw(\))135 b FA(\("")43 b("src")e("des")h("main.c"\)) +756 3509 y(\(split-file-nam)o(e)37 b("main.c"\))922 3609 +y Fn(=)-14 b Fw(\))789 b FA(\("main.c"\))756 3767 y(\(split-file-nam)o +(e)37 b("/"\))922 3866 y Fn(=)-14 b Fw(\))103 b FA(\(""\))365 +4178 y(\(path-list->file-)o(na)o(me)37 b FC(path-list)19 +b([dir])p FA(\))86 b Fw(\000)-14 b(!)87 b FC(string)522 +b FD(pr)o(ocedur)o(e)573 4324 y(Inverse)20 b(of)h FA(split-file-name)p +FD(.)756 4500 y FA(\(path-list->fil)o(e-)o(nam)o(e)37 +b('\("src")k("des")h("main.c"\)\))930 4599 y Fn(=)-14 +b Fw(\))87 b FA("src/des/main.c")756 4699 y(\(path-list->fil)o(e-)o +(nam)o(e)37 b('\("")42 b("src")g("des")f("main.c"\)\))930 +4799 y Fn(=)-14 b Fw(\))87 b FA("/src/des/main.c)o(")1735 +5147 y FD(105)p eop %%Page: 106 112 -106 111 bop 888 752 a FD(Note)40 b(that)f(appending)g(the)h(r)o(esults) -f(of)h FA(file-name-exten)o(sio)o(n)33 b FD(and)39 b -FA(file-)888 852 y(name-sans-extensi)o(on)14 b FD(in)21 -b(all)g(cases)f(pr)o(oduces)g(the)h(original)g(\002le-name.)681 -1158 y FA(\(parse-file-name)37 b FC(fname)p FA(\))86 -b Fw(\000)-14 b(!)87 b FC([dir)21 b(name)f(extension])502 -b FD(pr)o(ocedur)o(e)888 1304 y(Let)31 b Fo(f)40 b FD(be)31 -b FA(\(file-name-nondi)o(re)o(cto)o(ry)37 b FC(fname)p -FA(\))p FD(.)56 b(This)32 b(function)g(r)o(eturns)f(the)888 -1404 y(thr)o(ee)20 b(values:)988 1580 y Fw(\017)41 b -FA(\(file-name-direc)o(tor)o(y)c FC(fname)p FA(\))988 -1718 y Fw(\017)k FA(\(file-name-sans-)o(ext)o(en)o(si)o(on)c -FC(f)p FA(\)\))988 1856 y Fw(\017)k FA(\(file-name-exten)o(sio)o(n)c -FC(f)p FA(\))888 2033 y FD(The)d(inverse)h(of)f FA(parse-file-name)o -FD(,)e(in)i(all)g(cases,)j(is)e FA(string-append)p FD(.)60 -b(The)888 2132 y(boundary)21 b(case)f(of)h FA(/)f FD(was)h(chosen)g(to) -g(pr)o(eserve)f(this)h(inverse.)681 2438 y FA(\(replace-extensi)o(on)37 -b FC(fname)21 b(ext)p FA(\))86 b Fw(\000)-14 b(!)87 b -FC(string)781 b FD(pr)o(ocedur)o(e)888 2585 y(This)27 -b(pr)o(ocedur)o(e)c(r)o(eplaces)i FC(fname)p FD('s)h(extension)g(with)h -FC(ext)o FD(.)41 b(It)25 b(is)h(exactly)f(equiva-)888 -2684 y(lent)c(to)1071 2835 y FA(\(string-append)38 b(\(file-name-sans-) -o(ex)o(ten)o(si)o(on)f FC(fname)p FA(\))43 b FC(ext)p -FA(\))681 3211 y(\(simplify-file-n)o(am)o(e)38 b FC(fname)p -FA(\))86 b Fw(\000)-14 b(!)87 b FC(string)860 b FD(pr)o(ocedur)o(e)888 -3357 y(Removes)30 b(leading)e(and)g(internal)h(occurr)o(ences)f(of)g -(dot.)50 b(A)28 b(trailing)h(dot)f(is)h(left)888 3457 -y(alone,)g(as)f(the)g(par)o(ent)e(could)i(be)f(a)g(symlink.)48 -b(Removes)28 b(internal)g(and)f(trailing)888 3557 y(double-slashes.)38 -b(A)24 b(leading)h(double-slash)g(is)g(left)f(alone,)i(in)f(accor)o -(dance)e(with)890 3656 y(P)t Fv(O)t(S)t(I)t(X)r FD(.)31 -b(However)-6 b(,)21 b(triple)h(and)g(mor)o(e)f(leading)h(slashes)g(ar)o -(e)f(r)o(educed)f(to)i(a)f(single)888 3756 y(slash,)27 -b(in)f(accor)o(dance)d(with)28 b(P)t Fv(O)t(S)t(I)t(X)r -FD(.)40 b(Double-dots)26 b(\(par)o(ent)e(dir)o(ectory\))g(ar)o(e)f -(left)888 3856 y(alone,)k(in)e(case)g(they)g(come)h(after)e(symlinks)j -(or)e(appear)f(in)h(a)g FA(/../)p FC(machine)n FA(/...)888 -3955 y FD(\223super)o(-r)o(oot\224)19 b(form)i(\(which)i(P)t -Fv(O)t(S)t(I)t(X)h FD(permits\).)681 4162 y FA(\(resolve-file-na)o(me) -37 b FC(fname)21 b([dir])p FA(\))86 b Fw(\000)-15 b(!)88 -b FC(string)730 b FD(pr)o(ocedur)o(e)988 4308 y Fw(\017)41 -b FD(Do)21 b FA(~)g FD(expansion.)988 4446 y Fw(\017)41 -b FD(If)23 b FC(dir)h FD(is)g(given,)g(convert)g(a)f(r)o(elative)g -(\002le-name)g(to)h(an)g(absolute)g(\002le-name,)1071 -4546 y(r)o(elative)19 b(to)j(dir)o(ectory)d FC(dir)p -FD(.)681 4752 y FA(\(expand-file-nam)o(e)37 b FC(fname)21 -b([dir])p FA(\))86 b Fw(\000)-14 b(!)87 b FC(string)774 -b FD(pr)o(ocedur)o(e)888 4898 y(Resolve)22 b(and)e(simplify)h(the)g -(\002le-name.)2051 5147 y(106)p eop +106 111 bop 1071 614 a FD(Optional)21 b FC(dir)g FD(ar)o(g)f(anchors)h +(r)o(elative)e(path-lists:)1071 714 y FA(\(path-list->file)o(-na)o(me) +37 b('\("src")k("des")g("main.c"\))2030 814 y("/usr/shivers"\))1245 +913 y Fn(=)-14 b Fw(\))87 b FA("/usr/shivers/src)o(/d)o(es/)o(ma)o(in)o +(.c")888 1082 y FD(The)21 b(optional)h FC(dir)e FD(ar)o(gument)g(is)i +(usefully)f FA(\(cwd\))p FD(.)681 1375 y FA(\(file-name-exten)o(si)o +(on)37 b FC(fname)p FA(\))87 b Fw(\000)-14 b(!)87 b FC(string)816 +b FD(pr)o(ocedur)o(e)888 1518 y(Return)22 b(the)e(\002le-name's)h +(extension.)1071 1639 y FA(\(file-name-exten)o(sio)o(n)37 +b("main.c"\))341 b Fn(=)-14 b Fw(\))104 b FA(".c")1071 +1739 y(\(file-name-exten)o(sio)o(n)37 b("main.c.old"\))165 +b Fn(=)-14 b Fw(\))104 b FA(".old")1071 1838 y(\(file-name-exten)o(sio) +o(n)37 b("/usr/shivers"\))77 b Fn(=)-14 b Fw(\))104 b +FA("")1071 1988 y FD(W)-8 b(eir)o(d)20 b(cases:)1071 +2087 y FA(\(file-name-exten)o(sio)o(n)37 b("foo."\))124 +b Fn(=)-14 b Fw(\))104 b FA(".")1071 2187 y(\(file-name-exten)o(sio)o +(n)37 b("foo.."\))80 b Fn(=)-14 b Fw(\))104 b FA(".")1071 +2336 y FD(Dot)21 b(\002les)h(ar)o(e)d(not)i(extensions:)1071 +2436 y FA(\(file-name-exten)o(sio)o(n)37 b("/usr/shivers/.lo)o(gi)o +(n"\))76 b Fn(=)-14 b Fw(\))104 b FA("")681 2740 y(\(file-name-sans-)o +(ex)o(ten)o(si)o(on)37 b FC(fname)p FA(\))87 b Fw(\000)-14 +b(!)87 b FC(string)598 b FD(pr)o(ocedur)o(e)888 2882 +y(Return)22 b(everything)f(but)g(the)f(extension.)1071 +3025 y FA(\(file-name-sans-)o(ext)o(en)o(si)o(on)37 b("main.c"\))254 +b Fn(=)-14 b Fw(\))103 b FA("main")1071 3125 y(\(file-name-sans-)o(ext) +o(en)o(si)o(on)37 b("main.c.old"\))78 b Fn(=)-14 b Fw(\))103 +b FA("main.c"")1071 3224 y(\(file-name-sans-)o(ext)o(en)o(si)o(on)37 +b("/usr/shivers"\))1237 3324 y Fn(=)-14 b Fw(\))104 b +FA("/usr/shivers")1071 3473 y FD(W)-8 b(eir)o(d)20 b(cases:)1071 +3573 y FA(\(file-name-sans-)o(ext)o(en)o(si)o(on)37 b("foo."\))124 +b Fn(=)-14 b Fw(\))103 b FA("foo")1071 3672 y(\(file-name-sans-)o(ext)o +(en)o(si)o(on)37 b("foo.."\))80 b Fn(=)-14 b Fw(\))103 +b FA("foo.")1071 3850 y FD(Dot)21 b(\002les)h(ar)o(e)d(not)i +(extensions:)1071 3950 y FA(\(file-name-sans-)o(ext)o(en)o(si)o(on)37 +b("/usr/shivers/.lo)o(gi)o(n"\))1237 4049 y Fn(=)-14 +b Fw(\))104 b FA("/usr/shivers/.)o(log)o(in)888 4263 +y FD(Note)40 b(that)f(appending)g(the)h(r)o(esults)f(of)h +FA(file-name-exten)o(sio)o(n)33 b FD(and)39 b FA(file-)888 +4363 y(name-sans-extensi)o(on)14 b FD(in)21 b(all)g(cases)f(pr)o +(oduces)g(the)h(original)g(\002le-name.)681 4656 y FA +(\(parse-file-name)37 b FC(fname)p FA(\))86 b Fw(\000)-14 +b(!)87 b FC([dir)21 b(name)f(extension])502 b FD(pr)o(ocedur)o(e)888 +4799 y(Let)31 b Fo(f)40 b FD(be)31 b FA(\(file-name-nondi)o(re)o(cto)o +(ry)37 b FC(fname)p FA(\))p FD(.)56 b(This)32 b(function)g(r)o(eturns)f +(the)888 4898 y(thr)o(ee)20 b(values:)2051 5147 y(106)p +eop %%Page: 107 113 -107 112 bop 365 784 a FA(\(home-dir)40 b FC([user])p +107 112 bop 672 614 a Fw(\017)42 b FA(\(file-name-dire)o(ct)o(ory)37 +b FC(fname)p FA(\))672 748 y Fw(\017)42 b FA(\(file-name-sans)o(-e)o +(xte)o(ns)o(ion)37 b FC(f)p FA(\)\))672 883 y Fw(\017)42 +b FA(\(file-name-exte)o(ns)o(ion)37 b FC(f)p FA(\))573 +1051 y FD(The)d(inverse)g(of)g FA(parse-file-name)p FD(,)d(in)k(all)f +(cases,)j(is)d FA(string-append)p FD(.)61 b(The)573 1151 +y(boundary)20 b(case)h(of)f FA(/)h FD(was)f(chosen)i(to)f(pr)o(eserve)e +(this)j(inverse.)365 1445 y FA(\(replace-extensio)o(n)37 +b FC(fname)21 b(ext)p FA(\))86 b Fw(\000)-14 b(!)87 b +FC(string)782 b FD(pr)o(ocedur)o(e)573 1588 y(This)26 +b(pr)o(ocedur)o(e)e(r)o(eplaces)g FC(fname)p FD('s)i(extension)h(with)f +FC(ext)p FD(.)40 b(It)26 b(is)g(exactly)f(equiva-)573 +1687 y(lent)c(to)756 1829 y FA(\(string-append)37 b(\(file-name-sans-e) +o(xt)o(ens)o(io)o(n)h FC(fname)p FA(\))43 b FC(ext)o +FA(\))365 2182 y(\(simplify-file-na)o(me)37 b FC(fname)p +FA(\))87 b Fw(\000)-15 b(!)88 b FC(string)860 b FD(pr)o(ocedur)o(e)573 +2325 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 2424 +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 2524 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 2624 y(P)t Fv(O)t(S)t(I)t(X)r FD(.)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 2723 y(slash,)k(in)g(accor)o +(dance)d(with)28 b(P)t Fv(O)t(S)t(I)t(X)r FD(.)41 b(Double-dots)25 +b(\(par)o(ent)f(dir)o(ectory\))g(ar)o(e)g(left)573 2823 +y(alone,)i(in)g(case)e(they)i(come)f(after)f(symlinks)j(or)f(appear)d +(in)j(a)f FA(/../)p FC(machine)m FA(/...)573 2922 y FD(\223super)o(-r)o +(oot\224)19 b(form)h(\(which)k(P)t Fv(O)t(S)t(I)t(X)g +FD(permits\).)365 3117 y FA(\(resolve-file-nam)o(e)37 +b FC(fname)21 b([dir])p FA(\))86 b Fw(\000)-14 b(!)87 +b FC(string)731 b FD(pr)o(ocedur)o(e)672 3260 y Fw(\017)42 +b FD(Do)21 b FA(~)f FD(expansion.)672 3394 y Fw(\017)42 +b FD(If)23 b FC(dir)g FD(is)h(given,)h(convert)f(a)f(r)o(elative)f +(\002le-name)i(to)g(an)f(absolute)h(\002le-name,)756 +3493 y(r)o(elative)19 b(to)i(dir)o(ectory)f FC(dir)p +FD(.)365 3688 y FA(\(expand-file-name)37 b FC(fname)21 +b([dir])p FA(\))86 b Fw(\000)-15 b(!)87 b FC(string)775 +b FD(pr)o(ocedur)o(e)573 3831 y(Resolve)21 b(and)g(simplify)g(the)g +(\002le-name.)365 4125 y FA(\(home-dir)40 b FC([user])p FA(\))87 b Fw(\000)-14 b(!)87 b FC(string)1301 b FD(pr)o(ocedur)o(e)573 -945 y FA(home-dir)17 b FD(r)o(eturns)i FC(user)q FD('s)i(home)f(dir)o +4267 y FA(home-dir)17 b FD(r)o(eturns)i FC(user)q FD('s)i(home)f(dir)o (ectory)-9 b(.)25 b FC(User)20 b FD(defaults)f(to)i(the)f(curr)o(ent)f -(user)-6 b(.)756 1159 y FA(\(home-dir\))471 b Fn(=)-14 +(user)-6 b(.)756 4428 y FA(\(home-dir\))471 b Fn(=)-14 b Fw(\))103 b FA("/user1/lecturer/)o(sh)o(ive)o(rs)o(")756 -1259 y(\(home-dir)39 b("ctkwan"\))80 b Fn(=)-14 b Fw(\))103 -b FA("/user0/research/)o(ct)o(kwa)o(n")365 1700 y(\(home-file)40 +4528 y(\(home-dir)39 b("ctkwan"\))80 b Fn(=)-14 b Fw(\))103 +b FA("/user0/research/)o(ct)o(kwa)o(n")365 4849 y(\(home-file)40 b FC([user])21 b(fname)p FA(\))87 b Fw(\000)-15 b(!)88 -b FC(string)1033 b FD(pr)o(ocedur)o(e)573 1862 y(Returns)20 -b(\002le-name)g FC(fname)g FD(r)o(elative)e(to)i FC(user)r -FD('s)g(home)g(dir)o(ectory;)f FC(user)i FD(defaults)e(to)573 -1961 y(the)i(curr)o(ent)f(user)-6 b(.)756 2127 y FA(\(home-file)39 -b("man"\))473 b Fn(=)-14 b Fw(\))103 b FA("/usr/shivers/man)o(")756 -2227 y(\(home-file)39 b("fcmlau")h("man"\))81 b Fn(=)-14 -b Fw(\))103 b FA("/usr/fcmlau/man")490 2626 y FD(The)25 -b(general)g FA(substitute-env-v)o(ars)18 b FD(string)26 -b(pr)o(ocedur)o(e,)f(de\002ned)g(in)g(the)h(pr)o(evi-)365 -2726 y(ous)c(section,)f(is)g(also)g(fr)o(equently)f(useful)h(for)g -(expanding)f(\002le-names.)365 3081 y Fy(5.2)99 b(ASCII)24 -b(encoding)365 3349 y FA(\(char->ascii)39 b FC(character)p -FA(\))86 b Fw(\000)-14 b(!)87 b FC(integer)1029 b FD(pr)o(ocedur)o(e) -365 3449 y FA(\(ascii->char)39 b FC(integer)p FA(\))87 -b Fw(\000)-14 b(!)87 b FC(character)1028 b FD(pr)o(ocedur)o(e)573 -3584 y(These)36 b(ar)o(e)e(identical)i(to)g FA(char->integer)31 -b FD(and)k FA(integer->char)c FD(except)k(that)573 3683 -y(they)21 b(use)g(the)i(A)t Fv(S)t(C)t(I)t(I)g FD(encoding.)365 -4065 y Fy(5.3)99 b(Character)25 b(sets)365 4318 y FD(Scsh)c(pr)o -(ovides)g(a)f FA(char-set)e FD(type)j(for)g(expr)o(essing)f(sets)i(of)f -(characters.)k(These)c(sets)g(ar)o(e)365 4418 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 4517 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 -4687 y FA(\(char-set?)40 b FC(x)p FA(\))86 b Fw(\000)-14 -b(!)87 b FC(boolean)1367 b FD(pr)o(ocedur)o(e)573 4848 -y(Returns)21 b(tr)o(ue)g(if)g(the)g(object)g FC(x)f FD(is)h(a)f -(character)g(set.)1735 5147 y(107)p eop +b FC(string)1033 b FD(pr)o(ocedur)o(e)1735 5147 y(107)p +eop %%Page: 108 114 -108 113 bop 681 614 a FB(5.3.1)81 b(Creating)19 b(character)g(sets)681 -848 y FA(\(char-set)40 b FC(char)1261 860 y Fx(1)1298 -848 y FC(.)12 b(.)g(.)g FA(\))88 b Fw(\000)-15 b(!)88 -b FC(char-set)1155 b FD(pr)o(ocedur)o(e)888 981 y(Return)22 -b(a)e(character)f(set)i(containing)h(the)f(given)g(characters.)681 -1225 y FA(\(chars->char-set)37 b FC(chars)p FA(\))86 -b Fw(\000)-14 b(!)87 b FC(char-set)955 b FD(pr)o(ocedur)o(e)888 -1384 y(Return)22 b(a)e(character)f(set)i(containing)h(the)f(characters) -e(in)i(the)g(list)h FC(chars)o FD(.)681 1627 y FA(\(string->char-se)o -(t)37 b FC(s)p FA(\))87 b Fw(\000)-14 b(!)87 b FC(char-set)1056 -b FD(pr)o(ocedur)o(e)888 1786 y(Return)22 b(a)e(character)f(set)i -(containing)h(the)f(characters)e(in)i(the)g(string)h -FC(s)p FD(.)681 2029 y FA(\(predicate->char)o(-s)o(et)37 -b FC(pr)o(ed)p FA(\))86 b Fw(\000)-14 b(!)87 b FC(char-set)811 -b FD(pr)o(ocedur)o(e)888 2188 y(Returns)31 b(a)e(character)f(set)h +108 113 bop 888 614 a FD(Returns)21 b(\002le-name)e FC(fname)h +FD(r)o(elative)f(to)h FC(user)q FD('s)g(home)h(dir)o(ectory;)e +FC(user)i FD(defaults)e(to)888 714 y(the)i(curr)o(ent)f(user)-6 +b(.)1071 836 y FA(\(home-file)39 b("man"\))473 b Fn(=)-14 +b Fw(\))104 b FA("/usr/shivers/ma)o(n")1071 936 y(\(home-file)39 +b("fcmlau")i("man"\))80 b Fn(=)-14 b Fw(\))104 b FA("/usr/fcmlau/man)o +(")805 1217 y FD(The)26 b(general)e FA(substitute-env-va)o(rs)19 +b FD(string)26 b(pr)o(ocedur)o(e,)e(de\002ned)h(in)h(the)f(pr)o(evi-) +681 1317 y(ous)c(section,)g(is)g(also)g(fr)o(equently)g(useful)g(for)f +(expanding)h(\002le-names.)681 1600 y Fy(5.2)99 b(ASCII)24 +b(encoding)681 1841 y FA(\(char->ascii)38 b FC(character)p +FA(\))87 b Fw(\000)-15 b(!)87 b FC(integer)1029 b FD(pr)o(ocedur)o(e) +681 1941 y FA(\(ascii->char)38 b FC(integer)p FA(\))87 +b Fw(\000)-14 b(!)87 b FC(character)1028 b FD(pr)o(ocedur)o(e)888 +2066 y(These)36 b(ar)o(e)f(identical)g(to)i FA(char->integer)30 +b FD(and)35 b FA(integer->char)c FD(except)k(that)888 +2166 y(they)21 b(use)g(the)i(A)t Fv(S)t(C)t(I)t(I)h FD(encoding.)681 +2466 y Fy(5.3)99 b(Character)24 b(sets)681 2683 y FD(Scsh)d(pr)o +(ovides)f(a)h FA(char-set)c FD(type)k(for)g(expr)o(essing)g(sets)g(of)g +(characters.)k(These)c(sets)g(ar)o(e)681 2783 y(used)d(by)g(some)h(of)g +(the)f(delimited-input)g(pr)o(ocedur)o(es)f(\(section)i(7.1\).)k(The)18 +b(character)f(set)681 2882 y(package)i(that)i(scsh)g(uses)g(was)g +(taken)g(fr)o(om)f(Pr)o(oject)h(Mac's)f(MIT)g(Scheme.)681 +3033 y FA(\(char-set?)39 b FC(x)p FA(\))86 b Fw(\000)-14 +b(!)87 b FC(boolean)1367 b FD(pr)o(ocedur)o(e)888 3176 +y(Returns)22 b(tr)o(ue)f(if)f(the)h(object)g FC(x)f FD(is)h(a)g +(character)e(set.)681 3450 y FB(5.3.1)81 b(Creating)19 +b(character)g(sets)681 3660 y FA(\(char-set)40 b FC(char)1261 +3672 y Fx(1)1298 3660 y FC(.)12 b(.)g(.)g FA(\))88 b +Fw(\000)-15 b(!)88 b FC(char-set)1155 b FD(pr)o(ocedur)o(e)888 +3785 y(Return)22 b(a)e(character)f(set)i(containing)h(the)f(given)g +(characters.)681 3980 y FA(\(chars->char-set)37 b FC(chars)p +FA(\))86 b Fw(\000)-14 b(!)87 b FC(char-set)955 b FD(pr)o(ocedur)o(e) +888 4123 y(Return)22 b(a)e(character)f(set)i(containing)h(the)f +(characters)e(in)i(the)g(list)h FC(chars)o FD(.)681 4318 +y FA(\(string->char-se)o(t)37 b FC(s)p FA(\))87 b Fw(\000)-14 +b(!)87 b FC(char-set)1056 b FD(pr)o(ocedur)o(e)888 4461 +y(Return)22 b(a)e(character)f(set)i(containing)h(the)f(characters)e(in) +i(the)g(string)h FC(s)p FD(.)681 4656 y FA(\(predicate->char)o(-s)o(et) +37 b FC(pr)o(ed)p FA(\))86 b Fw(\000)-14 b(!)87 b FC(char-set)811 +b FD(pr)o(ocedur)o(e)888 4799 y(Returns)31 b(a)e(character)f(set)h (containing)i(every)e(character)f FC(c)h FD(such)h(that)f -FA(\()p FC(pr)o(ed)43 b(c)o FA(\))888 2288 y FD(r)o(eturns)21 -b(tr)o(ue.)681 2531 y FA(\(ascii-range->ch)o(ar)o(-se)o(t)37 -b FC(lower)21 b(upper)p FA(\))87 b Fw(\000)-14 b(!)87 -b FC(char-set)471 b FD(pr)o(ocedur)o(e)888 2690 y(Returns)22 -b(a)e(character)f(set)i(containing)h(every)f(character)e(whose)k(A)t -Fv(S)t(C)t(I)t(I)h FD(code)d(lies)888 2790 y(in)h(the)e(half-open)h -(range)f Fn([)p FC(lower)q Fo(;)14 b FC(upper)o Fn(\))p -FD(.)681 3133 y FB(5.3.2)81 b(Querying)20 b(character)f(sets)681 -3367 y FA(\(char-set-member)o(s)37 b FC(char-set)p FA(\))86 -b Fw(\000)-14 b(!)87 b FC(character-list)647 b FD(pr)o(ocedur)o(e)888 -3500 y(This)22 b(pr)o(ocedur)o(e)c(r)o(eturns)j(a)f(list)h(of)g(the)g -(members)g(of)f FC(char-set)p FD(.)681 3677 y FA(\(char-set-contai)o -(ns)o(?)38 b FC(char-set)20 b(char)p FA(\))86 b Fw(\000)-14 -b(!)87 b FC(boolean)586 b FD(pr)o(ocedur)o(e)888 3827 -y(This)22 b(pr)o(ocedur)o(e)c(tests)j FC(char)g FD(for)f(membership)h -(in)h(set)e FC(char-set)p FD(.)1071 4020 y Fl(Remark:)227 -b Fk(Pr)o(evious)61 b(r)o(eleases)g(of)h(scsh)h(called)f(this)h(pr)o -(ocedur)o(e)1071 4111 y Fh(char-set-member?)p Fk(,)25 -b(r)o(eversing)20 b(the)i(or)o(der)d(of)j(the)g(ar)o(guments.)30 -b(This)22 b(made)1071 4202 y(sense,)34 b(but)f(was)f(unfortunately)g -(the)h(r)o(everse)d(or)o(der)g(in)i(which)h(the)f(ar)o(gu-)1071 -4294 y(ments)i(appear)f(in)h(MIT)f(Scheme.)68 b(A)34 -b(r)o(easonable)f(ar)o(gument)h(or)o(der)d(was)1071 4385 -y(not)24 b(backwar)o(ds-compatible)f(with)h(MIT)f(Scheme;)i(on)f(the)g -(other)f(hand,)i(the)1071 4476 y(MIT)d(Scheme)h(ar)o(gument)g(or)o(der) -d(was)j(counter)o(-intuitive)g(and)g(at)g(odds)e(with)1071 -4568 y(common)j(mathematical)i(notation)f(and)g(the)g -Fh(member)g Fk(family)e(of)h(R4RS)h(pr)o(o-)1071 4659 -y(cedur)o(es.)1071 4776 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.)2051 -5147 y FD(108)p eop +FA(\()p FC(pr)o(ed)43 b(c)o FA(\))888 4898 y FD(r)o(eturns)21 +b(tr)o(ue.)2051 5147 y(108)p eop %%Page: 109 115 -109 114 bop 365 614 a FB(5.3.3)81 b(Character)19 b(set)h(algebra)365 -822 y FA(\(char-set-invert)37 b FC(char-set)p FA(\))86 -b Fw(\000)-14 b(!)87 b FC(char-set)868 b FD(pr)o(ocedur)o(e)365 -922 y FA(\(char-set-union)38 b FC(char-set)1327 934 y -Fx(1)1385 922 y FC(char-set)1649 934 y Fx(2)1687 922 -y FA(\))86 b Fw(\000)-14 b(!)87 b FC(char-set)552 b FD(pr)o(ocedur)o(e) -365 1021 y FA(\(char-set-interse)o(ct)o(ion)37 b FC(char-set)1632 -1033 y Fx(1)1690 1021 y FC(char-set)1954 1033 y Fx(2)1992 -1021 y FA(\))86 b Fw(\000)-14 b(!)87 b FC(char-set)247 -b FD(pr)o(ocedur)o(e)365 1121 y FA(\(char-set-differe)o(nc)o(e)38 -b FC(char-set)1545 1133 y Fx(1)1603 1121 y FC(char-set)1867 -1133 y Fx(2)1905 1121 y FA(\))86 b Fw(\000)-14 b(!)87 -b FC(char-set)334 b FD(pr)o(ocedur)o(e)573 1246 y(These)31 -b(pr)o(ocedur)o(es)e(implement)j(set)f(complement,)j(union,)h -(intersection,)f(and)573 1345 y(dif)o(fer)o(ence)18 b(for)j(character)e -(sets.)365 1613 y FB(5.3.4)81 b(Standard)19 b(character)g(sets)365 -1796 y FD(Several)h(character)f(sets)i(ar)o(e)e(pr)o(ede\002ned)g(for)i -(convenience:)p 433 1939 2729 4 v 433 2038 4 100 v 486 -2009 a FA(char-set:upper-ca)o(se)268 b FD(A\226Z)p 3158 -2038 V 433 2138 V 486 2108 a FA(char-set:lower-ca)o(se)g -FD(a\226z)p 3158 2138 V 433 2238 V 486 2208 a FA(char-set:numeric)399 -b FD(0\2269)p 3158 2238 V 433 2337 V 486 2307 a FA(char-set:whitespa)o +109 114 bop 365 614 a FA(\(ascii-range->cha)o(r-)o(set)37 +b FC(lower)21 b(upper)p FA(\))87 b Fw(\000)-15 b(!)87 +b FC(char-set)472 b FD(pr)o(ocedur)o(e)573 745 y(Returns)21 +b(a)g(character)e(set)i(containing)h(every)e(character)f(whose)24 +b(A)t Fv(S)t(C)t(I)t(I)g FD(code)c(lies)573 845 y(in)h(the)g(half-open) +f(range)h Fn([)p FC(lower)p Fo(;)14 b FC(upper)p Fn(\))p +FD(.)365 1102 y FB(5.3.2)81 b(Querying)20 b(character)f(sets)365 +1299 y FA(\(char-set-members)37 b FC(char-set)p FA(\))86 +b Fw(\000)-14 b(!)87 b FC(character-list)647 b FD(pr)o(ocedur)o(e)573 +1418 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 FC(char-set)o FD(.)365 1554 y FA(\(char-set-contain)o +(s?)37 b FC(char-set)20 b(char)p FA(\))86 b Fw(\000)-14 +b(!)87 b FC(boolean)587 b FD(pr)o(ocedur)o(e)573 1677 +y(This)21 b(pr)o(ocedur)o(e)e(tests)i FC(char)f FD(for)h(membership)g +(in)g(set)g FC(char-set)o FD(.)756 1824 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 1915 y Fh(char-set-member?)p Fk(,)25 +b(r)o(eversing)19 b(the)k(or)o(der)c(of)i(the)h(ar)o(guments.)31 +b(This)21 b(made)756 2006 y(sense,)34 b(but)e(was)h(unfortunately)f +(the)h(r)o(everse)c(or)o(der)h(in)i(which)h(the)g(ar)o(gu-)756 +2098 y(ments)g(appear)h(in)g(MIT)f(Scheme.)68 b(A)34 +b(r)o(easonable)f(ar)o(gument)g(or)o(der)f(was)756 2189 +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 2280 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)756 +2372 y(common)j(mathematical)i(notation)f(and)g(the)f +Fh(member)i Fk(family)d(of)h(R4RS)g(pr)o(o-)756 2463 +y(cedur)o(es.)756 2566 y(W)-7 b(e)18 b(sought)g(to)h(escape)g(the)g +(dilemma)f(by)g(shifting)h(to)g(a)g(new)g(name.)365 2868 +y FB(5.3.3)81 b(Character)19 b(set)h(algebra)365 3065 +y FA(\(char-set-invert)37 b FC(char-set)p FA(\))86 b +Fw(\000)-14 b(!)87 b FC(char-set)868 b FD(pr)o(ocedur)o(e)365 +3164 y FA(\(char-set-union)38 b FC(char-set)1327 3176 +y Fx(1)1385 3164 y FC(char-set)1649 3176 y Fx(2)1687 +3164 y FA(\))86 b Fw(\000)-14 b(!)87 b FC(char-set)552 +b FD(pr)o(ocedur)o(e)365 3264 y FA(\(char-set-interse)o(ct)o(ion)37 +b FC(char-set)1632 3276 y Fx(1)1690 3264 y FC(char-set)1954 +3276 y Fx(2)1992 3264 y FA(\))86 b Fw(\000)-14 b(!)87 +b FC(char-set)247 b FD(pr)o(ocedur)o(e)365 3364 y FA +(\(char-set-differe)o(nc)o(e)38 b FC(char-set)1545 3376 +y Fx(1)1603 3364 y FC(char-set)1867 3376 y Fx(2)1905 +3364 y FA(\))86 b Fw(\000)-14 b(!)87 b FC(char-set)334 +b FD(pr)o(ocedur)o(e)573 3483 y(These)31 b(pr)o(ocedur)o(es)e +(implement)j(set)f(complement,)j(union,)h(intersection,)f(and)573 +3583 y(dif)o(fer)o(ence)18 b(for)j(character)e(sets.)365 +3840 y FB(5.3.4)81 b(Standard)19 b(character)g(sets)365 +4023 y FD(Several)h(character)f(sets)i(ar)o(e)e(pr)o(ede\002ned)g(for)i +(convenience:)p 433 4139 2729 4 v 433 4239 4 100 v 486 +4209 a FA(char-set:upper-ca)o(se)268 b FD(A\226Z)p 3158 +4239 V 433 4339 V 486 4309 a FA(char-set:lower-ca)o(se)g +FD(a\226z)p 3158 4339 V 433 4438 V 486 4408 a FA(char-set:numeric)399 +b FD(0\2269)p 3158 4438 V 433 4538 V 486 4508 a FA(char-set:whitespa)o (ce)268 b FD(space,)19 b(newline,)i(tab,)f(linefeed,)g(page,)g(r)o -(eturn)p 3158 2337 V 433 2437 V 486 2407 a FA(char-set:not-whit)o(esp)o +(eturn)p 3158 4538 V 433 4638 V 486 4608 a FA(char-set:not-whit)o(esp)o (ac)o(e)94 b FD(Complement)21 b(of)g FA(char-set:whitesp)o(ac)o(e)p -3158 2437 V 433 2537 V 486 2507 a(char-set:alphabet)o(ic)268 -b FD(A\226Z)20 b(and)g(a\226z)p 3158 2537 V 433 2636 -V 486 2606 a FA(char-set:alphanum)o(eri)o(c)181 b FD(Alphabetic)19 -b(or)i(numeric)p 3158 2636 V 433 2736 V 486 2706 a FA(char-set:graphic) +3158 4638 V 433 4737 V 486 4707 a(char-set:alphabet)o(ic)268 +b FD(A\226Z)20 b(and)g(a\226z)p 3158 4737 V 433 4837 +V 486 4807 a FA(char-set:alphanum)o(eri)o(c)181 b FD(Alphabetic)19 +b(or)i(numeric)p 3158 4837 V 433 4936 V 486 4907 a FA(char-set:graphic) 399 b FD(Printing)21 b(characters)f(and)g(space)p 3158 -2736 V 433 2739 2729 4 v 365 2941 a FA(\(char-upper-case?)37 -b FC(character)p FA(\))86 b Fw(\000)-14 b(!)87 b FC(boolean)796 -b FD(pr)o(ocedur)o(e)365 3041 y FA(\(char-lower-case?)37 -b FC(character)p FA(\))86 b Fw(\000)-14 b(!)87 b FC(boolean)796 -b FD(pr)o(ocedur)o(e)365 3140 y FA(\(char-numeric?)82 -b FC(character)p FA(\))k Fw(\000)-14 b(!)87 b FC(boolean)883 -b FD(pr)o(ocedur)o(e)365 3240 y FA(\(char-whitespace?)37 -b FC(character)p FA(\))86 b Fw(\000)-14 b(!)87 b FC(boolean)796 -b FD(pr)o(ocedur)o(e)365 3340 y FA(\(char-alphabetic?)37 -b FC(character)p FA(\))86 b Fw(\000)-14 b(!)87 b FC(boolean)796 -b FD(pr)o(ocedur)o(e)365 3439 y FA(\(char-alphanumeri)o(c?)37 -b FC(character)p FA(\))86 b Fw(\000)-14 b(!)87 b FC(boolean)709 -b FD(pr)o(ocedur)o(e)365 3539 y FA(\(char-graphic?)38 -b FC(character)p FA(\))86 b Fw(\000)-14 b(!)87 b FC(boolean)927 -b FD(pr)o(ocedur)o(e)573 3680 y(These)21 b(pr)o(edicates)e(ar)o(e)g -(de\002ned)h(in)h(terms)g(of)g(the)g(above)f(character)f(sets.)1735 -5147 y(109)p eop +4936 V 433 4940 2729 4 v 1735 5147 a(109)p eop %%Page: 110 116 -110 115 bop 681 1272 a Fz(Chapter)44 b(6)681 1723 y FE(Reading)52 -b(delimited)g(strings)681 2214 y FD(Scsh)21 b(pr)o(ovides)f(a)h(set)g -(of)g(pr)o(ocedur)o(es)e(that)i(r)o(ead)e(delimited)i(strings)h(fr)o -(om)e(input)i(ports.)681 2314 y(Ther)o(e)16 b(ar)o(e)g(pr)o(ocedur)o -(es)g(to)i(r)o(ead)e(a)h(single)h(line)g(of)g(text)f(\(terminated)g(by) -g(a)g(newline)h(char)o(-)681 2414 y(acter\),)24 b(a)g(single)h -(paragraph)e(\(terminated)g(by)i(a)f(blank)g(line\),)h(and)f(general)g -(delimited)681 2513 y(strings)d(\(terminated)f(by)h(a)f(character)g -(belonging)i(to)f(an)f(arbitrary)g(character)f(set\).)805 -2648 y(These)25 b(pr)o(ocedur)o(es)e(can)h(be)h(applied)e(to)i(any)g -(Scheme)f(input)h(port.)38 b(However)-6 b(,)25 b(the)681 -2748 y(scsh)h(virtual)f(machine)g(has)h(native-code)e(support)i(for)f -(performing)g(delimited)h(r)o(eads)681 2848 y(on)h(Unix)f(ports,)i(and) -e(these)h(input)g(operations)g(should)g(be)f(particularly)g -(fast\227much)681 2947 y(faster)33 b(than)h(doing)g(the)g(equivalent)g -(character)o(-at-a-time)c(operation)k(fr)o(om)f(Scheme)681 -3047 y(code.)805 3182 y(All)20 b(of)g(the)f(delimited)h(input)g -(operations)g(described)f(below)h(take)f(a)g FA(handle-delim)681 -3281 y FD(parameter)-6 b(,)30 b(which)g(determines)g(what)g(the)g(pr)o -(ocedur)o(e)d(does)j(with)h(the)e(terminating)681 3381 -y(delimiter)19 b(character)-6 b(.)23 b(Ther)o(e)18 b(ar)o(e)f(four)i -(possible)g(choices)h(for)e(a)g FA(handle-delim)c FD(param-)681 -3481 y(eter:)p 888 3550 2428 4 v 888 3649 4 100 v 941 -3619 a FA(handle-delim)p 1514 3649 V 98 w FD(Meaning)p -3313 3649 V 888 3653 2428 4 v 888 3669 V 888 3769 4 100 -v 941 3739 a FA('trim)p 1514 3769 V 406 w FD(Ignor)o(e)21 -b(delimiter)g(character)-6 b(.)p 3313 3769 V 888 3868 -V 941 3838 a FA('peek)p 1514 3868 V 406 w FD(Leave)20 -b(delimiter)h(character)e(in)i(input)g(str)o(eam.)p 3313 -3868 V 888 3968 V 941 3938 a FA('concat)p 1514 3968 V -318 w FD(Append)f(delimiter)h(character)e(to)i(r)o(eturned)f(value.)p -3313 3968 V 888 4068 V 941 4038 a FA('split)p 1514 4068 -V 362 w FD(Return)i(delimiter)e(as)h(second)g(value.)p -3313 4068 V 888 4071 2428 4 v 681 4195 a(The)28 b(\002rst)g(case,)g -FA('trim)p FD(,)g(is)g(the)g(standar)o(d)e(default)h(for)g(all)h(the)g -(r)o(outines)g(described)f(in)681 4295 y(this)21 b(section.)26 -b(The)20 b(last)g(thr)o(ee)g(cases)g(allow)h(the)f(pr)o(ogrammer)g(to)g -(distinguish)i(between)681 4394 y(strings)g(that)g(ar)o(e)f(terminated) -g(by)h(a)f(delimiter)h(character)-6 b(,)20 b(and)h(strings)i(that)f(ar) -o(e)e(termi-)681 4494 y(nated)g(by)h(an)f(end-of-\002le.)681 -4651 y FA(\(read-line)39 b FC([port)20 b(handle-newline])p -FA(\))86 b Fw(\000)-14 b(!)87 b FC(string)21 b(or)g(eof-object)306 -b FD(pr)o(ocedur)o(e)888 4799 y(Reads)21 b(and)f(r)o(eturns)g(one)h -(line)g(of)f(text;)g(on)i(eof,)e(r)o(eturns)g(the)g(eof)h(object.)26 -b(A)20 b(line)h(is)888 4898 y(terminated)g(by)f(newline)i(or)f(eof.) -2053 5147 y(1)-5 b(10)p eop +110 115 bop 681 614 a FA(\(char-upper-case)o(?)37 b FC(character)p +FA(\))86 b Fw(\000)-14 b(!)87 b FC(boolean)796 b FD(pr)o(ocedur)o(e)681 +714 y FA(\(char-lower-case)o(?)37 b FC(character)p FA(\))86 +b Fw(\000)-14 b(!)87 b FC(boolean)796 b FD(pr)o(ocedur)o(e)681 +814 y FA(\(char-numeric?)81 b FC(character)p FA(\))86 +b Fw(\000)-14 b(!)87 b FC(boolean)883 b FD(pr)o(ocedur)o(e)681 +913 y FA(\(char-whitespace)o(?)37 b FC(character)p FA(\))86 +b Fw(\000)-14 b(!)87 b FC(boolean)796 b FD(pr)o(ocedur)o(e)681 +1013 y FA(\(char-alphabetic)o(?)37 b FC(character)p FA(\))86 +b Fw(\000)-14 b(!)87 b FC(boolean)796 b FD(pr)o(ocedur)o(e)681 +1112 y FA(\(char-alphanumer)o(ic)o(?)38 b FC(character)p +FA(\))86 b Fw(\000)-15 b(!)88 b FC(boolean)708 b FD(pr)o(ocedur)o(e)681 +1212 y FA(\(char-graphic?)38 b FC(character)p FA(\))86 +b Fw(\000)-15 b(!)88 b FC(boolean)926 b FD(pr)o(ocedur)o(e)888 +1353 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.)2053 5147 y(1)-5 b(10)p +eop %%Page: 111 117 -111 116 bop 573 614 a FC(handle-newline)18 b FD(determines)h(what)f -FA(read-line)d FD(does)k(with)g(the)g(newline)g(or)f(EOF)573 -714 y(that)29 b(terminates)f(the)h(line;)k(it)c(takes)f(the)h(general)f -(set)h(of)g(values)f(described)g(for)573 814 y(the)21 -b(general)g FA(handle-delim)16 b FD(case)21 b(above,)f(and)h(defaults)f -(to)i FA('trim)d FD(\(discar)o(d)g(the)573 913 y(newline\).)35 -b(Using)24 b(this)g(ar)o(gument)g(allows)g(one)g(to)g(tell)g(whether)g -(or)g(not)h(the)f(last)573 1013 y(line)d(of)g(input)g(in)g(a)f(\002le)h -(is)h(newline)f(terminated.)365 1305 y FA(\(read-paragraph)38 -b FC([port)19 b(handle-delim])p FA(\))85 b Fw(\000)-14 -b(!)87 b FC(string)21 b(or)g(eof)387 b FD(pr)o(ocedur)o(e)573 -1446 y(This)19 b(pr)o(ocedur)o(e)d(skips)j(blank)g(lines,)g(then)g(r)o -(eads)e(text)h(fr)o(om)g(a)g(port)g(until)i(a)d(blank)573 -1546 y(line)24 b(or)h(eof)f(is)g(found.)36 b(A)24 b(\223blank)f -(line\224)i(is)f(a)g(\(possibly)h(empty\))f(line)g(composed)573 -1645 y(only)e(of)g(white)g(space.)27 b(The)21 b FC(handle-delim)f -FD(parameter)g(determines)i(how)g(the)g(ter)o(-)573 1745 -y(minating)33 b(blank)e(line)h(is)g(handled.)58 b(It)32 -b(is)g(described)f(above,)i(and)e(defaults)g(to)573 1845 -y FA('trim)p FD(.)23 b(The)e FA('peek)e FD(option)j(is)f(not)g -(available.)490 2012 y(The)16 b(following)i(pr)o(ocedur)o(es)d(r)o(ead) -g(in)i(strings)g(fr)o(om)f(ports)h(delimited)f(by)h(characters)365 -2112 y(belonging)35 b(to)e(a)g(speci\002c)g(set.)62 b(See)32 -b(section)i(5.3)e(for)g(information)i(on)g(character)e(set)365 -2211 y(manipulation.)365 2361 y FA(\(read-delimited)38 -b FC(char-set)20 b([port)f(handle-delim])p FA(\))86 b -Fw(\000)-15 b(!)87 b FC(string)21 b(or)g(eof)102 b FD(pr)o(ocedur)o(e) -573 2503 y(Read)46 b(until)h(we)g(encounter)f(one)h(of)g(the)f(chars)h -(in)g FC(char-set)e FD(or)i(eof.)103 b(The)573 2602 y -FC(handle-delim)19 b FD(parameter)f(determines)i(how)h(the)f -(terminating)h(character)d(is)j(han-)573 2702 y(dled.)k(It)c(is)g -(described)e(above,)h(and)h(defaults)e(to)j FA('trim)p -FD(.)573 2835 y(The)f FC(char-set)f FD(ar)o(gument)g(may)h(be)f(a)h -(charset,)f(a)g(string,)i(a)e(character)-6 b(,)19 b(or)i(a)f(charac-) -573 2935 y(ter)g(pr)o(edicate;)f(it)i(is)g(coer)o(ced)e(to)i(a)g -(charset.)365 3127 y FA(\(read-delimited!)37 b FC(char-set)15 -b(buf)i([port)e(handle-delim)f(start)h(end])p FA(\))43 -b Fw(\000)-14 b(!)44 b FC(nchars)15 b(or)h(eof)g(or)g(#f)87 -b FD(pr)o(ocedur)o(e)573 3268 y(A)20 b(side-ef)o(fecting)f(variant)h -(of)h FA(read-delimited)p FD(.)573 3402 y(The)26 b(data)f(is)h(written) -h(into)f(the)h(string)f FC(buf)h FD(at)f(the)g(indices)g(in)h(the)f -(half-open)f(in-)573 3501 y(terval)h Fn([)p FC(start)p -Fo(;)14 b FC(end)p Fn(\))p FD(;)30 b(the)d(default)f(interval)h(is)h -(the)f(whole)h(string:)39 b FC(start)34 b Fn(=)g(0)27 -b FD(and)573 3601 y FC(end)j Fn(=)f FA(\(string-length)38 -b FC(buf)q FA(\))o FD(.)f(The)25 b(values)f(of)g FC(start)g -FD(and)g FC(end)h FD(must)g(specify)f(a)573 3700 y(well-de\002ned)c -(interval)h(in)g FC(str)p FD(,)g FC(i.e.)o FD(,)g Fn(0)h -Fw(\024)h FC(start)g Fw(\024)g FC(end)g Fw(\024)f FA(\(string-length)38 -b FC(buf)q FA(\))o FD(.)573 3834 y(It)20 b(r)o(eturns)g -FC(nbytes)p FD(,)g(the)h(number)f(of)g(bytes)h(r)o(ead.)i(If)d(the)g -(buf)o(fer)f(\002lled)h(up)g(without)573 3933 y(a)31 -b(delimiter)h(character)e(being)i(found,)i FA(#f)d FD(is)h(r)o -(eturned.)57 b(If)31 b(the)h(port)g(is)g(at)f(eof)573 -4033 y(when)21 b(the)g(r)o(ead)e(starts,)i(the)f(eof)h(object)g(is)g(r) -o(eturned.)573 4166 y(If)g(an)h(integer)g(is)g(r)o(eturned)f(\()p -FC(i.e.)o FD(,)h(the)g(r)o(ead)e(is)i(successfully)g(terminated)g(by)g -(r)o(ead-)573 4266 y(ing)34 b(a)g(delimiter)f(character\),)i(then)f -(the)g FC(handle-delim)f FD(parameter)f(determines)573 -4365 y(how)23 b(the)g(terminating)g(character)e(is)i(handled.)30 -b(It)22 b(is)h(described)e(above,)h(and)g(de-)573 4465 -y(faults)e(to)h FA('trim)p FD(.)365 4657 y FA(\(\045read-delimited!)37 -b FC(char-set)15 b(buf)h(gobble?)g([port)f(start)h(end])p -FA(\))42 b Fw(\000)-14 b(!)44 b FC([char-or-eof-or-#f)13 -b(integer])87 b FD(pr)o(ocedur)o(e)573 4799 y(This)19 -b(low-level)g(delimited)g(r)o(eader)e(uses)i(an)g(alternate)f -(interface.)24 b(It)18 b(r)o(eturns)h(two)573 4898 y(values:)25 -b FC(terminator)20 b FD(and)h FC(num-r)o(ead)o FD(.)1740 -5147 y(1)-5 b(1)g(1)p eop +111 116 bop 365 1272 a Fz(Chapter)45 b(6)365 1723 y FE(Reading)53 +b(delimited)e(strings)365 2214 y FD(Scsh)21 b(pr)o(ovides)g(a)f(set)h +(of)g(pr)o(ocedur)o(es)e(that)i(r)o(ead)f(delimited)g(strings)i(fr)o +(om)f(input)h(ports.)365 2314 y(Ther)o(e)17 b(ar)o(e)f(pr)o(ocedur)o +(es)g(to)i(r)o(ead)d(a)i(single)i(line)f(of)f(text)g(\(terminated)g(by) +h(a)f(newline)h(char)o(-)365 2414 y(acter\),)24 b(a)g(single)h +(paragraph)e(\(terminated)h(by)g(a)g(blank)h(line\),)g(and)f(general)g +(delimited)365 2513 y(strings)e(\(terminated)e(by)h(a)f(character)f +(belonging)j(to)f(an)g(arbitrary)e(character)h(set\).)490 +2648 y(These)k(pr)o(ocedur)o(es)f(can)i(be)f(applied)g(to)h(any)g +(Scheme)f(input)h(port.)37 b(However)-6 b(,)25 b(the)365 +2748 y(scsh)h(virtual)f(machine)h(has)f(native-code)g(support)g(for)g +(performing)h(delimited)f(r)o(eads)365 2848 y(on)i(Unix)g(ports,)h(and) +e(these)h(input)g(operations)f(should)i(be)e(particularly)g +(fast\227much)365 2947 y(faster)33 b(than)h(doing)h(the)f(equivalent)g +(character)o(-at-a-time)c(operation)k(fr)o(om)f(Scheme)365 +3047 y(code.)490 3182 y(All)19 b(of)h(the)g(delimited)f(input)i +(operations)f(described)e(below)i(take)f(a)h FA(handle-delim)365 +3281 y FD(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 FA(handle-delim)c FD(param-)365 +3481 y(eter:)p 573 3550 2428 4 v 573 3649 4 100 v 626 +3619 a FA(handle-delim)p 1199 3649 V 98 w FD(Meaning)p +2997 3649 V 573 3653 2428 4 v 573 3669 V 573 3769 4 100 +v 626 3739 a FA('trim)p 1199 3769 V 406 w FD(Ignor)o(e)21 +b(delimiter)f(character)-6 b(.)p 2997 3769 V 573 3868 +V 626 3838 a FA('peek)p 1199 3868 V 406 w FD(Leave)19 +b(delimiter)i(character)e(in)j(input)f(str)o(eam.)p 2997 +3868 V 573 3968 V 626 3938 a FA('concat)p 1199 3968 V +318 w FD(Append)f(delimiter)h(character)e(to)i(r)o(eturned)f(value.)p +2997 3968 V 573 4068 V 626 4038 a FA('split)p 1199 4068 +V 362 w FD(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 +FA('trim)p FD(,)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 FA(\(read-line)40 b FC([port)19 b(handle-newline])p +FA(\))87 b Fw(\000)-14 b(!)87 b FC(string)21 b(or)g(eof-object)306 +b FD(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.) +1740 5147 y(1)-5 b(1)g(1)p eop %%Page: 112 118 -112 117 bop 888 614 a FB(terminator)40 b FD(A)20 b(value)h(describing)f -(why)i(the)f(r)o(ead)e(was)i(terminated:)1121 842 y(Character)e(or)i -(eof-object)166 b Fw(\))g FD(Read)20 b(terminated)g(by)h(this)h(value.) -1121 941 y FA(#f)912 b Fw(\))166 b FD(Filled)21 b(buf)o(fer)e(without)j -(\002nding)f(a)g(delimiter)-6 b(.)888 1090 y FB(num-read)40 -b FD(Number)20 b(of)h(characters)f(r)o(ead)f(into)i FC(buf)q -FD(.)888 1256 y(If)31 b(the)h(r)o(ead)e(is)h(successfully)h(terminated) -f(by)g(r)o(eading)g(a)g(delimiter)g(character)-6 b(,)888 -1356 y(then)27 b(the)g FC(gobble?)g FD(parameter)e(determines)h(what)h -(to)g(do)f(with)i(the)e(terminating)888 1456 y(character)-6 -b(.)24 b(If)19 b(tr)o(ue,)g(the)g(character)f(is)i(r)o(emoved)e(fr)o -(om)h(the)g(input)h(str)o(eam;)f(if)g(false,)888 1555 -y(the)29 b(character)f(is)h(left)f(in)i(the)e(input)i(str)o(eam)e(wher) -o(e)g(a)g(subsequent)i(r)o(ead)d(oper)o(-)888 1655 y(ation)i(will)g(r)o -(etrieve)e(it.)49 b(In)29 b(either)f(case,)h(the)g(character)e(is)i -(also)f(the)h(\002rst)g(value)888 1755 y(r)o(eturned)20 -b(by)h(the)g(pr)o(ocedur)o(e)d(call.)681 1945 y FA(\(skip-char-set)38 -b FC(skip-chars)19 b([port])p FA(\))86 b Fw(\000)-14 -b(!)87 b FC(integer)696 b FD(pr)o(ocedur)o(e)888 2087 -y(Skip)21 b(characters)e(occurring)i(in)f(the)h(set)g -FC(skip-chars)o FD(;)f(r)o(eturn)g(the)g(number)h(of)f(char)o(-)888 -2186 y(acters)d(skipped.)24 b(The)18 b FC(skip-chars)e -FD(ar)o(gument)h(may)h(be)f(a)g(charset,)h(a)f(string,)h(a)f(char)o(-) -888 2286 y(acter)-6 b(,)20 b(or)h(a)f(character)f(pr)o(edicate;)g(it)i -(is)g(coer)o(ced)e(to)i(a)g(charset.)2053 5147 y(1)-5 -b(12)p eop +112 117 bop 888 614 a FC(handle-newline)19 b FD(determines)f(what)h +FA(read-line)c FD(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 FA(handle-delim)d FD(case)j(above,)h(and)f(defaults)h(to)g +FA('trim)f FD(\(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 FA(\(read-paragraph)37 +b FC([port)20 b(handle-delim])p FA(\))85 b Fw(\000)-14 +b(!)87 b FC(string)21 b(or)f(eof)387 b FD(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 FC(handle-delim)e +FD(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 FA('trim)p FD(.)24 b(The)c FA('peek)f FD(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 FA(\(read-delimited)37 +b FC(char-set)20 b([port)g(handle-delim])p FA(\))85 b +Fw(\000)-14 b(!)87 b FC(string)21 b(or)g(eof)101 b FD(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 FC(char-set)f FD(or)h(eof.)102 b(The)888 2602 y +FC(handle-delim)19 b FD(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 +FA('trim)p FD(.)888 2835 y(The)g FC(char-set)f FD(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 FA(\(read-delimited!)37 +b FC(char-set)15 b(buf)h([port)f(handle-delim)f(start)i(end])p +FA(\))43 b Fw(\000)-15 b(!)44 b FC(nchars)16 b(or)g(eof)g(or)g(#f)86 +b FD(pr)o(ocedur)o(e)888 3268 y(A)21 b(side-ef)o(fecting)e(variant)h +(of)h FA(read-delimited)p FD(.)888 3402 y(The)26 b(data)f(is)i(written) +f(into)h(the)f(string)h FC(buf)g FD(at)e(the)h(indices)h(in)f(the)g +(half-open)g(in-)888 3501 y(terval)h Fn([)p FC(start)o +Fo(;)14 b FC(end)p Fn(\))p FD(;)31 b(the)c(default)f(interval)h(is)g +(the)g(whole)h(string:)39 b FC(start)c Fn(=)f(0)26 b +FD(and)888 3601 y FC(end)k Fn(=)g FA(\(string-length)38 +b FC(buf)p FA(\))p FD(.)f(The)24 b(values)g(of)h FC(start)f +FD(and)g FC(end)g FD(must)h(specify)g(a)888 3700 y(well-de\002ned)c +(interval)f(in)h FC(str)p FD(,)g FC(i.e.)p FD(,)f Fn(0)j +Fw(\024)g FC(start)f Fw(\024)h FC(end)g Fw(\024)g FA(\(string-length)37 +b FC(buf)q FA(\))p FD(.)888 3834 y(It)21 b(r)o(eturns)e +FC(nbytes)q FD(,)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 FA(#f)d +FD(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 +FC(i.e.)p FD(,)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 FC(handle-delim)e FD(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 FA('trim)p FD(.)681 4657 y FA(\(\045read-delimited)o(!) +37 b FC(char-set)15 b(buf)i(gobble?)f([port)f(start)g(end])p +FA(\))43 b Fw(\000)-14 b(!)43 b FC([char-or-eof-or-#f)14 +b(integer])87 b FD(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 FC(terminator)c FD(and)f FC(num-r)o(ead)o FD(.)2053 +5147 y(1)-5 b(12)p eop %%Page: 113 119 -113 118 bop 365 1307 a Fz(Chapter)45 b(7)365 1792 y FE(A)-14 -b(wk,)51 b(record)h(I/O,)g(and)h(\002eld)365 2041 y(parsing)365 -2567 y FD(Unix)34 b(pr)o(ograms)f(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)f(r)o(ecor)o(d)g(is)365 -2667 y(delimited)c(by)g(a)f(newline,)j(and)d(r)o(ecor)o(ds)g(ar)o(e)f -(br)o(oken)i(into)g(\002elds)g(with)h(other)f(delim-)365 -2767 y(iters)f(\(for)f(example,)i(the)f(colon)h(character)d(in)j -FA(/etc/passwd)p FD(\).)39 b(Scsh)26 b(has)h(pr)o(ocedur)o(es)365 -2866 y(that)j(allow)g(the)g(pr)o(ogrammer)e(to)i(easily)g(do)g(this)g -(kind)g(of)g(pr)o(ocessing.)52 b(Scsh's)30 b(\002eld)365 -2966 y(parsers)k(can)g(also)g(be)g(used)g(to)h(parse)f(other)g(kinds)h -(of)g(delimited)f(strings,)k(such)d(as)365 3066 y(colon-separated)26 -b FA($PATH)f FD(lists.)44 b(These)27 b(r)o(outines)g(can)g(be)f(used)h -(with)h(scsh's)f FA(awk)f FD(loop)365 3165 y(constr)o(uct)f(to)f -(conveniently)g(perform)f(pattern-dir)o(ected)e(computation)k(over)e -(str)o(eams)365 3265 y(of)e(r)o(ecor)o(ds.)365 3658 y -Fy(7.1)99 b(Record)25 b(I/O)g(and)g(\002eld)g(parsing)365 -3932 y FD(The)f(pr)o(ocedur)o(es)e(in)j(this)g(section)f(ar)o(e)f(used) -h(to)g(r)o(ead)e(r)o(ecor)o(ds)h(fr)o(om)g(I/O)i(str)o(eams)e(and)365 -4031 y(parse)17 b(them)h(into)g(\002elds.)24 b(A)17 b(r)o(ecor)o(d)f -(is)h(de\002ned)g(as)g(text)g(terminated)g(by)h(some)g(delimiter)365 -4131 y(\(usually)25 b(a)f(newline\).)38 b(A)25 b(r)o(ecor)o(d)e(can)i -(be)f(split)h(into)h(\002elds)f(by)g(using)h(r)o(egular)d(expr)o(es-) -365 4230 y(sions)28 b(in)f(one)h(of)e(several)g(ways:)38 -b(to)27 b FC(match)e FD(\002elds,)j(to)f FC(separate)g -FD(\002elds,)h(or)f(to)g FC(terminate)365 4330 y FD(\002elds.)41 -b(The)26 b(\002eld)g(parsers)f(can)g(be)h(applied)f(to)h(arbitrary)f -(strings)h(\(one)g(common)i(use)365 4430 y(is)e(splitting)h(envir)o -(onment)f(variables)e(such)i(as)f FA($PATH)f FD(at)h(colons)h(into)g -(its)g(component)365 4529 y(elements\).)490 4699 y(The)18 -b(general)f(delimited-input)h(pr)o(ocedur)o(es)e(described)h(in)i -(chapter)e(6)g(ar)o(e)g(also)h(use-)365 4799 y(ful)37 -b(for)f(r)o(eading)g(simple)h(r)o(ecor)o(ds,)i(such)e(as)f(single)i -(lines,)j(paragraphs)35 b(of)h(text,)k(or)365 4898 y(strings)22 -b(terminated)e(by)h(speci\002c)g(characters.)1737 5147 -y(1)-5 b(13)p eop +113 118 bop 573 614 a FB(terminator)40 b FD(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 Fw(\))g FD(Read)21 b(terminated)f(by)h(this)g(value.) +805 941 y FA(#f)912 b Fw(\))166 b FD(Filled)21 b(buf)o(fer)e(without)j +(\002nding)g(a)e(delimiter)-6 b(.)573 1090 y FB(num-read)39 +b FD(Number)21 b(of)g(characters)e(r)o(ead)g(into)j FC(buf)p +FD(.)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 FC(gobble?)f FD(parameter)f(determines)i(what)f +(to)h(do)g(with)g(the)g(terminating)573 1456 y(character)-6 +b(.)23 b(If)c(tr)o(ue,)g(the)h(character)e(is)h(r)o(emoved)g(fr)o(om)g +(the)g(input)h(str)o(eam;)e(if)i(false,)573 1555 y(the)29 +b(character)e(is)i(left)g(in)g(the)g(input)g(str)o(eam)f(wher)o(e)h(a)f +(subsequent)h(r)o(ead)f(oper)o(-)573 1655 y(ation)h(will)g(r)o(etrieve) +e(it.)48 b(In)29 b(either)g(case,)g(the)g(character)d(is)j(also)g(the)f +(\002rst)h(value)573 1755 y(r)o(eturned)19 b(by)i(the)g(pr)o(ocedur)o +(e)e(call.)365 1945 y FA(\(skip-char-set)38 b FC(skip-chars)20 +b([port])p FA(\))85 b Fw(\000)-14 b(!)87 b FC(integer)697 +b FD(pr)o(ocedur)o(e)573 2087 y(Skip)20 b(characters)f(occurring)i(in)g +(the)g(set)f FC(skip-chars)o FD(;)h(r)o(eturn)e(the)i(number)f(of)h +(char)o(-)573 2186 y(acters)c(skipped.)24 b(The)17 b +FC(skip-chars)g FD(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.)1737 +5147 y(1)-5 b(13)p eop %%Page: 114 120 -114 119 bop 681 614 a FB(7.1.1)81 b(Reading)19 b(records)681 -821 y FA(\(record-reader)38 b FC([delims)15 b(elide-delims?)g -(handle-delim])p FA(\))41 b Fw(\000)-14 b(!)44 b FC(pr)o(ocedur)o(e)86 -b FD(pr)o(ocedur)o(e)888 946 y(Returns)32 b(a)f(pr)o(ocedur)o(e)e(that) -j(r)o(eads)d(r)o(ecor)o(ds)h(fr)o(om)h(a)g(port.)57 b(The)31 -b(pr)o(ocedur)o(e)f(is)888 1045 y(invoked)21 b(as)g(follows:)1071 -1184 y FA(\()p FC(r)o(eader)43 b([port])o FA(\))g Fw(\000)-14 -b(!)43 b FC(string)21 b(or)g(eof)888 1322 y FD(A)j(r)o(ecor)o(d)d(is)j -(a)g(sequence)f(of)h(characters)e(terminated)h(by)h(one)g(of)g(the)f -(characters)888 1422 y(in)33 b FC(delims)e FD(or)h(eof.)58 -b(If)31 b FC(elide-delims?)g FD(is)h(tr)o(ue,)j(then)d(a)f(contiguous)i -(sequence)f(of)888 1522 y(delimiter)d(chars)f(ar)o(e)f(taken)i(as)f(a)g -(single)i(r)o(ecor)o(d)d(delimiter)-6 b(.)49 b(If)28 -b FC(elide-delims?)g FD(is)888 1621 y(false,)34 b(then)f(a)e(delimiter) -h(char)g(coming)h(immediately)f(after)f(a)h(delimiter)g(char)888 -1721 y(pr)o(oduces)d(an)g(empty-string)h(r)o(ecor)o(d.)50 -b(The)30 b(r)o(eader)d(consumes)j(the)g(delimiting)888 -1820 y(char\(s\))20 b(befor)o(e)g(r)o(eturning)g(fr)o(om)h(a)f(r)o -(ead.)888 1953 y(The)26 b FC(delims)g FD(set)g(defaults)g(to)g(the)g -(set)g Fw(f)p FD(newline)q Fw(g)p FD(.)40 b(It)27 b(may)f(be)f(a)h -(charset,)h(string,)888 2053 y(character)-6 b(,)49 b(or)c(character)e -(pr)o(edicate,)48 b(and)d(is)g(coer)o(ced)e(to)i(a)f(charset.)97 -b(The)888 2152 y FC(elide-delims?)20 b FD(\003ag)h(defaults)f(to)h -FA(#f)p FD(.)888 2285 y(The)f FC(handle-delim)f FD(ar)o(gument)h(contr) -o(ols)g(what)h(is)f(done)g(with)h(the)g(r)o(ecor)o(d's)d(termi-)888 -2384 y(nating)k(delimiter)-6 b(.)1121 2525 y FA('trim)185 -b FD(Delimiters)19 b(ar)o(e)e(trimmed.)25 b(\(The)18 -b(default\))1121 2624 y FA('split)141 b FD(Reader)35 -b(r)o(eturns)h(delimiter)g(string)i(as)e(a)1526 2724 -y(second)29 b(ar)o(gument.)49 b(If)28 b(r)o(ecor)o(d)f(is)j(termi-)1526 -2824 y(nated)i(by)i(EOF)-8 b(,)34 b(then)g(the)g(eof)f(object)h(is)1526 -2923 y(r)o(eturned)19 b(as)i(this)g(second)g(ar)o(gument.)1121 -3023 y FA('concat)97 b FD(The)37 b(r)o(ecor)o(d)f(and)i(its)g -(delimiter)f(ar)o(e)g(r)o(e-)1526 3122 y(turned)20 b(as)g(a)h(single)g -(string.)888 3293 y(The)34 b(r)o(eader)e(pr)o(ocedur)o(e)g(r)o(eturned) -h(takes)h(one)g(optional)h(ar)o(gument,)i(the)d(port)888 -3392 y(fr)o(om)21 b(which)h(to)g(r)o(ead,)d(which)k(defaults)d(to)i -(the)f(curr)o(ent)g(input)g(port.)27 b(It)22 b(r)o(eturns)f(a)888 -3492 y(string)h(or)f(eof.)681 3759 y FB(7.1.2)81 b(Parsing)20 -b(\002elds)681 3966 y FA(\(field-splitter)37 b FC([r)o(egexp)19 -b(num-\002elds])p FA(\))86 b Fw(\000)-14 b(!)87 b FC(pr)o(ocedur)o(e) -460 b FD(pr)o(ocedur)o(e)681 4066 y FA(\(infix-splitter)37 -b FC([delim)18 b(num-\002elds)g(handle-delim])p FA(\))64 -b Fw(\000)-14 b(!)67 b FC(pr)o(ocedur)o(e)86 b FD(pr)o(ocedur)o(e)681 -4165 y FA(\(suffix-splitter)37 b FC([delim)15 b(num-\002elds)h -(handle-delim])p FA(\))45 b Fw(\000)-14 b(!)47 b FC(pr)o(ocedur)o(e)86 -b FD(pr)o(ocedur)o(e)681 4265 y FA(\(sloppy-suffix-s)o(pl)o(itt)o(er)37 -b FC([delim)15 b(num-\002elds)g(handle-delim])p FA(\))42 -b Fw(\000)-15 b(!)44 b FC(pr)o(ocedur)o(e)86 b FD(pr)o(ocedur)o(e)888 -4389 y(These)21 b(functions)h(r)o(eturn)e(a)g(parser)g(function)h(that) -g(can)f(be)h(used)f(as)h(follows:)1071 4528 y FA(\()p -FC(parser)44 b(string)f([start])o FA(\))g Fw(\000)-14 -b(!)44 b FC(string-list)888 4699 y FD(The)28 b(r)o(eturned)e(parsers)g -(split)i(strings)g(into)g(\002elds)f(de\002ned)g(by)h(r)o(egular)e -(expr)o(es-)888 4799 y(sions.)g(Y)-8 b(ou)19 b(can)f(parse)f(by)h -(specifying)g(a)g(pattern)f(that)h FC(separates)h FD(\002elds,)f(a)g -(pattern)888 4898 y(that)j FC(terminates)g FD(\002elds,)g(or)f(a)h -(pattern)f(that)h FC(matches)e FD(\002elds:)2053 5147 -y(1)-5 b(14)p eop +114 119 bop 681 1307 a Fz(Chapter)44 b(7)681 1792 y FE(A)-14 +b(wk,)51 b(record)h(I/O,)g(and)g(\002eld)681 2041 y(parsing)681 +2567 y FD(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 +FA(/etc/passwd)p FD(\).)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 FA($PATH)e FD(lists.)45 b(These)27 +b(r)o(outines)g(can)f(be)h(used)f(with)i(scsh's)g FA(awk)d +FD(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 Fy(7.1)99 b(Record)25 +b(I/O)g(and)f(\002eld)h(parsing)681 3932 y FD(The)f(pr)o(ocedur)o(es)e +(in)i(this)h(section)g(ar)o(e)d(used)i(to)g(r)o(ead)f(r)o(ecor)o(ds)f +(fr)o(om)i(I/O)g(str)o(eams)f(and)681 4031 y(parse)16 +b(them)i(into)g(\002elds.)25 b(A)17 b(r)o(ecor)o(d)e(is)j(de\002ned)f +(as)g(text)g(terminated)g(by)g(some)h(delimiter)681 4131 +y(\(usually)25 b(a)f(newline\).)38 b(A)24 b(r)o(ecor)o(d)g(can)g(be)h +(split)g(into)h(\002elds)e(by)h(using)h(r)o(egular)e(expr)o(es-)681 +4230 y(sions)k(in)f(one)g(of)g(several)f(ways:)37 b(to)27 +b FC(match)e FD(\002elds,)j(to)f FC(separate)g FD(\002elds,)h(or)f(to)g +FC(terminate)681 4330 y FD(\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 +FA($PATH)d FD(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.)2053 +5147 y(1)-5 b(14)p eop %%Page: 115 121 -115 120 bop 805 601 a FD(Pr)o(ocedur)o(e)748 b(Pattern)p -756 634 1835 4 v 805 704 a FA(field-splitter)509 b FD(matches)21 -b(\002elds)805 804 y FA(infix-splitter)509 b FD(separates)20 -b(\002elds)805 903 y FA(suffix-splitter)465 b FD(terminates)21 -b(\002elds)805 1003 y FA(sloppy-suffix-spl)o(it)o(ter)159 -b FD(terminates)21 b(\002elds)573 1189 y(These)g(parser)g(generators)g -(ar)o(e)f(contr)o(olled)i(by)g(a)f(range)g(of)g(options,)i(so)f(that)g -(you)573 1288 y(can)31 b(pr)o(ecisely)f(specify)h(what)g(kind)h(of)f -(parsing)g(you)h(want.)57 b(However)-6 b(,)33 b(these)573 -1388 y(options)22 b(default)e(to)h(r)o(easonable)e(values)i(for)f -(general)g(use.)573 1525 y(Defaults:)805 1605 y FC(delim)332 -b FD(=)83 b FA("[)43 b(\\t\\n]+|$")96 b FD(\(suf)o(\002x)20 -b(delimiter:)25 b(white)d(space)e(or)g(eos\))1455 1705 -y FA("[)43 b(\\t\\n]+")184 b FD(\(in\002x)21 b(delimiter:)k(white)d -(space\))805 1805 y FC(r)o(e)454 b FD(=)83 b FA("[^)43 -b(\\t\\n]+")140 b FD(\(non-white-space\))805 1904 y FC(num-\002elds)159 -b FD(=)83 b FA(#f)535 b FD(\(as)20 b(many)h(\002elds)g(as)f(possible\)) -805 2004 y FC(handle-delim)82 b FD(=)h FA('trim)403 b -FD(\(discar)o(d)19 b(delimiter)h(chars\))573 2102 y(.)12 -b(.)g(.)g(which)32 b(means:)45 b(br)o(eak)30 b(the)h(string)g(at)f -(white)h(space,)h(discar)o(ding)e(the)h(white)573 2202 -y(space,)20 b(and)g(parse)g(as)g(many)h(\002elds)g(as)g(possible.)573 -2339 y(The)k(r)o(egular)f(expr)o(ession)h FC(delim)g -FD(is)h(used)f(to)g(match)g(\002eld)h(delimiters.)39 -b(It)25 b(can)g(be)573 2439 y(either)16 b(a)g(string)h(or)f(a)g -(compiled)g(r)o(egexp)f(str)o(uctur)o(e)h(\(see)g(the)g -FA(make-regexp)c FD(pr)o(oce-)573 2539 y(dur)o(e\).)30 -b(In)23 b(the)g(separator)f(case,)g(it)h(defaults)f(to)h(a)g(r)o -(egular)e(expr)o(ession)i(matching)573 2638 y(white)i(space;)g(in)f -(the)h(terminator)f(case,)g(it)h(defaults)e(to)i(white)g(space)e(or)h -(end-of-)573 2738 y(string.)573 2875 y(The)f(r)o(egular)f(expr)o -(ession)h FC(r)o(e)g FD(is)h(a)e(r)o(egular)g(expr)o(ession)h(used)g -(to)h(match)f(\002elds.)33 b(It)573 2975 y(defaults)20 -b(to)h(non-white-space.)573 3112 y(The)g(boolean)g FC(handle-delim)e -FD(determines)i(what)g(to)g(do)g(with)g(delimiters.)805 -3192 y FA('trim)185 b FD(Delimiters)21 b(ar)o(e)f(thr)o(own)h(away)f -(after)g(parsing.)25 b(\(default\))805 3292 y FA('concat)97 -b FD(Delimiters)21 b(ar)o(e)f(appended)f(to)i(the)g(\002eld)g(pr)o -(eceding)f(them.)805 3391 y FA('split)141 b FD(Delimiters)21 -b(ar)o(e)f(r)o(eturned)f(as)i(separate)e(elements)i(in)g(the)g(\002eld) -g(list.)573 3528 y(The)31 b FC(num-\002elds)f FD(ar)o(gument)g(used)h -(to)g(cr)o(eate)e(the)i(parser)f(speci\002es)h(how)g(many)573 -3628 y(\002elds)20 b(to)g(parse.)25 b(If)19 b FA(#f)g -FD(\(the)h(default\),)f(the)h(pr)o(ocedur)o(e)e(parses)h(them)h(all.)25 -b(If)20 b(a)f(pos-)573 3727 y(itive)25 b(integer)g Fo(n)p -FD(,)g(exactly)f(that)h(many)g(\002elds)g(ar)o(e)e(parsed;)j(it)f(is)g -(an)g(err)o(or)f(if)g(ther)o(e)573 3827 y(ar)o(e)g(mor)o(e)i(or)g -(fewer)g(than)g Fo(n)g FD(\002elds)g(in)h(the)f(r)o(ecor)o(d.)40 -b(If)25 b FC(num-\002elds)h FD(is)g(a)g(negative)573 -3927 y(integer)20 b(or)g(zer)o(o,)f(then)h Fw(j)p Fo(n)p -Fw(j)g FD(\002elds)g(ar)o(e)f(parsed,)g(and)g(the)h(r)o(emainder)f(of)h -(the)g(string)573 4026 y(is)k(r)o(eturned)e(in)i(the)g(last)f(element)h -(of)f(the)h(\002eld)f(list;)i(it)f(is)g(an)f(err)o(or)f(if)i(fewer)e -(than)573 4126 y Fw(j)p Fo(n)p Fw(j)f FD(\002elds)f(can)h(be)f(parsed.) -573 4263 y(The)c(\002eld)g(parser)g(pr)o(oduced)f(is)i(a)e(pr)o(ocedur) -o(e)g(that)h(can)g(be)g(employed)h(as)f(follows:)756 -4412 y FA(\()p FC(parse)43 b(string)h([start])o FA(\))f -Fn(=)-14 b Fw(\))43 b FC(string-list)573 4562 y FD(The)30 -b(optional)g FC(start)f FD(ar)o(gument)h(\(default)e(0\))h(speci\002es) -h(wher)o(e)f(in)h(the)g(string)g(to)573 4661 y(begin)21 -b(the)g(parse.)j(It)d(is)g(an)g(err)o(or)f(if)g FC(start)j -Fo(>)g FA(\(string-length)38 b FC(string)o FA(\))p FD(.)573 -4799 y(The)26 b(parsers)f(r)o(eturned)f(by)i(the)g(four)g(parser)f -(generators)g(implement)i(dif)o(fer)o(ent)573 4898 y(kinds)21 -b(of)g(\002eld)g(parsing:)1737 5147 y(1)-5 b(15)p eop +115 120 bop 365 614 a FB(7.1.1)81 b(Reading)19 b(records)365 +821 y FA(\(record-reader)38 b FC([delims)15 b(elide-delims?)g +(handle-delim])p FA(\))42 b Fw(\000)-14 b(!)43 b FC(pr)o(ocedur)o(e)86 +b FD(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 FA(\()p FC(r)o(eader)43 b([port])n FA(\))h Fw(\000)-15 +b(!)44 b FC(string)21 b(or)g(eof)573 1322 y FD(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 FC(delims)g FD(or)f(eof.)58 +b(If)32 b FC(elide-delims?)f FD(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 FC(elide-delims?)g FD(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 FC(delims)g FD(set)g(defaults)f(to)i(the)f +(set)g Fw(f)p FD(newline)p Fw(g)p FD(.)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 FC(elide-delims?)20 b FD(\003ag)h +(defaults)f(to)h FA(#f)p FD(.)573 2285 y(The)f FC(handle-delim)f +FD(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 FA('trim)185 b FD(Delimiters)19 b(ar)o(e)e(trimmed.)25 +b(\(The)18 b(default\))805 2624 y FA('split)141 b FD(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 FA('concat)97 b FD(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 FB(7.1.2)81 b(Parsing)20 +b(\002elds)365 3966 y FA(\(field-splitter)38 b FC([r)o(egexp)19 +b(num-\002elds])p FA(\))86 b Fw(\000)-14 b(!)87 b FC(pr)o(ocedur)o(e) +460 b FD(pr)o(ocedur)o(e)365 4066 y FA(\(infix-splitter)38 +b FC([delim)17 b(num-\002elds)h(handle-delim])p FA(\))65 +b Fw(\000)-14 b(!)66 b FC(pr)o(ocedur)o(e)87 b FD(pr)o(ocedur)o(e)365 +4165 y FA(\(suffix-splitter)37 b FC([delim)16 b(num-\002elds)f +(handle-delim])p FA(\))45 b Fw(\000)-14 b(!)47 b FC(pr)o(ocedur)o(e)87 +b FD(pr)o(ocedur)o(e)365 4265 y FA(\(sloppy-suffix-sp)o(li)o(tte)o(r)37 +b FC([delim)15 b(num-\002elds)h(handle-delim])p FA(\))41 +b Fw(\000)-14 b(!)43 b FC(pr)o(ocedur)o(e)87 b FD(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 FA(\()p +FC(parser)43 b(string)h([start])o FA(\))f Fw(\000)-14 +b(!)43 b FC(string-list)573 4699 y FD(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 FC(separates)g FD(\002elds,)h(a)e +(pattern)573 4898 y(that)k FC(terminates)f FD(\002elds,)h(or)g(a)f +(pattern)g(that)h FC(matches)f FD(\002elds:)1737 5147 +y(1)-5 b(15)p eop %%Page: 116 122 -116 121 bop 888 614 a FA(field-splitter)36 b FD(The)21 -b(r)o(egular)e(expr)o(ession)i(speci\002es)g(the)g(actual)e(\002eld.) -888 759 y FA(suffix-splitter)36 b FD(Delimiters)c(ar)o(e)e(interpr)o -(eted)g(as)i(element)f FC(terminators)p FD(.)58 b(If)1071 -859 y(vertical-bar)36 b(is)i(the)h(the)f(delimiter)-6 -b(,)42 b(then)c(the)g(string)h FA("")e FD(is)i(the)f(empty)1071 -958 y(r)o(ecor)o(d)25 b FA(\(\))p FD(,)i FA("foo|")d -FD(pr)o(oduces)i(a)g(one-\002eld)h(r)o(ecor)o(d)e FA(\("foo"\))p -FD(,)g(and)h FA("foo")1071 1058 y FD(is)21 b(an)g(err)o(or)-6 -b(.)1071 1180 y(The)21 b(syntax)g(of)f(suf)o(\002x-delimited)g(r)o -(ecor)o(ds)f(is:)1276 1349 y Fo(<)p FC(r)o(ecord)p Fo(>)98 -b FD(::=)i FA("")186 b FD(\(Empty)20 b(r)o(ecor)o(d\))1747 -1448 y Fw(j)134 b Fo(<)p FC(element)p Fo(>)20 b(<)p FC(delim)p -Fo(>)g(<)p FC(r)o(ecord)p Fo(>)1071 1637 y FD(It)28 b(is)g(an)g(err)o -(or)f(if)g(a)h(non-empty)g(r)o(ecor)o(d)e(does)i(not)h(end)f(with)g(a)g -(delimiter)-6 b(.)1071 1736 y(T)e(o)23 b(make)f(the)g(last)g(delimiter) -g(optional,)h(make)f(sur)o(e)f(the)h(delimiter)g(r)o(egexp)1071 -1836 y(matches)f(the)g(end-of-string)f(\(r)o(egexp)f -FA("$")p FD(\).)888 1981 y FA(infix-splitter)36 b FD(Delimiters)44 -b(ar)o(e)e(interpr)o(eted)g(as)h(element)h FC(separators)p -FD(.)93 b(If)1071 2080 y(comma)21 b(is)h(the)f(delimiter)-6 -b(,)20 b(then)i(the)f(string)h FA("foo,")c FD(pr)o(oduces)i(a)h -(two-\002eld)1071 2180 y(r)o(ecor)o(d)e FA(\("foo")41 -b(""\))p FD(.)1071 2302 y(The)21 b(syntax)g(of)f(in\002x-delimited)h(r) -o(ecor)o(ds)e(is:)1276 2471 y Fo(<)p FC(r)o(ecord)p Fo(>)431 -b FD(::=)100 b FA("")186 b FD(\(For)o(ced)19 b(to)i(be)g(empty)g(r)o -(ecor)o(d\))2080 2570 y Fw(j)134 b Fo(<)p FC(r)o(eal-in\002x-r)o(ecord) -p Fo(>)1276 2769 y(<)p FC(r)o(eal-in\002x-r)o(ecord)p -Fo(>)97 b FD(::=)j Fo(<)p FC(element)p Fo(>)20 b(<)p -FC(delim)p Fo(>)f(<)p FC(r)o(eal-in\002x-r)o(ecord)p -Fo(>)2080 2869 y Fw(j)134 b Fo(<)p FC(element)p Fo(>)1071 -3057 y FD(Note)52 b(that)h(separator)e(semantics)i(doesn't)g(r)o(eally) -e(allow)i(for)f(empty)1071 3157 y(r)o(ecor)o(ds\227the)k -(straightforwar)o(d)h(grammar)g(\()p FC(i.e.)p FD(,)67 -b Fo(<)p FC(r)o(eal-in\002x-r)o(ecord)p Fo(>)p FD(\))1071 -3257 y(parses)35 b(an)g(empty)g(string)h(as)f(a)f(singleton)j(list)f -(whose)g(one)f(\002eld)g(is)h(the)1071 3356 y(empty)21 -b(string,)h FA(\(""\))p FD(,)e(not)i(as)f(the)g(empty)g(r)o(ecor)o(d)f -FA(\(\))p FD(.)26 b(This)c(is)f(unfortunate,)1071 3456 -y(since)d(it)h(means)f(that)g(in\002x)g(string)h(parsing)f(doesn't)h -(make)e FA(string-append)1071 3555 y FD(and)j FA(append)f -FD(isomorphic.)26 b(For)21 b(example,)1226 3722 y FA -(\(\(infix-splitter)37 b(":"\))42 b(\(string-append)c -FC(x)43 b FA(":")f FC(y)p FA(\)\))1071 3889 y FD(doesn't)21 -b(always)g(equal)1226 4034 y FA(\(append)41 b(\(\(infix-splitter)c -(":"\))42 b FC(x)o FA(\))1575 4133 y(\(\(infix-splitter)37 -b(":"\))42 b FC(y)o FA(\)\))1071 4278 y FD(It)23 b(fails)g(when)h -FC(x)f FD(or)g FC(y)g FD(ar)o(e)f(the)h(empty)g(string.)34 -b(T)-8 b(erminator)23 b(semantics)h FC(does)1071 4378 -y FD(pr)o(eserve)19 b(a)h(similar)h(isomorphism.)1071 -4500 y(However)-6 b(,)32 b(separator)e(semantics)h(is)g(fr)o(equently)f -(what)h(other)g(Unix)f(soft-)1071 4599 y(war)o(e)21 b(uses,)j(so)f(to)g -(parse)f(their)g(strings,)i(we)f(need)f(to)h(use)g(it.)31 -b(For)23 b(example,)1071 4699 y(Unix)g FA($PATH)f FD(lists)i(have)f -(separator)f(semantics.)34 b(The)24 b(path)f(list)h FA("/bin:")d -FD(is)1071 4799 y(br)o(oken)g(up)h(into)g FA(\("/bin")41 -b(""\))p FD(,)20 b(not)j FA(\("/bin"\))p FD(.)h(Comma-separated)c -(lists)1071 4898 y(should)i(also)e(be)h(parsed)f(this)h(way)-9 -b(.)2053 5147 y(1)k(16)p eop +116 121 bop 1121 601 a FD(Pr)o(ocedur)o(e)748 b(Pattern)p +1071 634 1835 4 v 1121 704 a FA(field-splitter)509 b +FD(matches)21 b(\002elds)1121 804 y FA(infix-splitter)509 +b FD(separates)19 b(\002elds)1121 903 y FA(suffix-splitter)465 +b FD(terminates)20 b(\002elds)1121 1003 y FA(sloppy-suffix-sp)o(li)o +(tte)o(r)160 b FD(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 FC(delim)331 b FD(=)84 b FA("[)43 b(\\t\\n]+|$")95 +b FD(\(suf)o(\002x)20 b(delimiter:)26 b(white)21 b(space)f(or)h(eos\)) +1771 1705 y FA("[)43 b(\\t\\n]+")183 b FD(\(in\002x)21 +b(delimiter:)26 b(white)21 b(space\))1121 1805 y FC(r)o(e)453 +b FD(=)84 b FA("[^)42 b(\\t\\n]+")140 b FD(\(non-white-space\))1121 +1904 y FC(num-\002elds)158 b FD(=)84 b FA(#f)534 b FD(\(as)21 +b(many)g(\002elds)f(as)h(possible\))1121 2004 y FC(handle-delim)81 +b FD(=)j FA('trim)402 b FD(\(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 FC(delim)f +FD(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 +FA(make-regexp)11 b FD(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 FC(r)o(e)h FD(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 FC(handle-delim)f +FD(determines)g(what)h(to)g(do)g(with)h(delimiters.)1121 +3192 y FA('trim)185 b FD(Delimiters)21 b(ar)o(e)e(thr)o(own)j(away)e +(after)f(parsing.)26 b(\(default\))1121 3292 y FA('concat)97 +b FD(Delimiters)21 b(ar)o(e)e(appended)h(to)h(the)g(\002eld)f(pr)o +(eceding)g(them.)1121 3391 y FA('split)141 b FD(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 FC(num-\002elds)f FD(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 FA(#f)f FD(\(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 Fo(n)p FD(,)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 +Fo(n)e FD(\002elds)i(in)f(the)g(r)o(ecor)o(d.)40 b(If)26 +b FC(num-\002elds)f FD(is)i(a)e(negative)888 3927 y(integer)20 +b(or)g(zer)o(o,)f(then)i Fw(j)p Fo(n)p Fw(j)f FD(\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 Fw(j)p Fo(n)p Fw(j)e FD(\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 FA(\()p FC(parse)43 b(string)h([start])o FA(\))f Fn(=)-14 +b Fw(\))44 b FC(string-list)888 4562 y FD(The)30 b(optional)g +FC(start)g FD(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 FC(start)i Fo(>)f FA(\(string-length)38 +b FC(string)p FA(\))p FD(.)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:)2053 5147 +y(1)-5 b(16)p eop %%Page: 117 123 -117 122 bop 365 535 2865 4 v 365 1403 4 868 v 519 657 -a Fk(Recor)o(d)218 b(:)23 b(suf)o(\002x)147 b Fh(:|$)20 -b Fk(suf)o(\002x)288 b(:)23 b(in\002x)418 b(non-:)24 -b(\002eld)p 470 688 2656 4 v 519 752 a Fh("")375 b(\(\))296 -b(\(\))532 b(\(\))f(\(\))519 843 y(":")336 b(\(""\))218 -b(\(""\))454 b(\("")40 b(""\))335 b(\(\))519 934 y("foo:")219 -b(\("foo"\))101 b(\("foo"\))337 b(\("foo")40 b(""\))218 -b(\("foo"\))519 1026 y(":foo")h Fi(err)o(or)226 b Fh(\("")40 -b("foo"\))219 b(\("")40 b("foo"\))218 b(\("foo"\))519 -1117 y("foo:bar")102 b Fi(err)o(or)226 b Fh(\("foo")41 -b("bar"\))101 b(\("foo")40 b("bar"\))101 b(\("foo")41 -b("bar"\))631 1379 y FD(Figur)o(e)20 b(7.1:)25 b(Using)c(dif)o(fer)o -(ent)d(grammars)j(to)g(split)g(r)o(ecor)o(ds)e(into)j(\002elds.)p -3226 1403 4 868 v 365 1406 2865 4 v 573 1654 a FA(sloppy-suffix)36 -b FD(The)22 b(same)g(as)g(the)h FA(suffix)d FD(case,)h(except)h(that)g -(the)h(parser)e(will)756 1754 y(skip)k(an)g(initial)h(delimiter)f -(string)h(if)f(the)g(string)h(begins)f(with)h(one)g(instead)756 -1853 y(of)32 b(parsing)h(an)g(initial)g(empty)g(\002eld.)61 -b(This)34 b(can)e(be)h(used,)i(for)e(example,)756 1953 -y(to)27 b(\002eld-split)g(a)f(sequence)h(of)g(English)h(text)e(at)h -(white-space)f(boundaries,)756 2053 y(wher)o(e)19 b(the)h(string)g(may) -g(begin)g(or)g(end)f(with)i(white)f(space,)f(by)h(using)h(r)o(egex)756 -2152 y FA("[)42 b(\\t]+|$")p FD(.)24 b(\(But)d(you)h(would)g(be)f -(better)f(of)o(f)g(using)j FA(field-splitter)15 b FD(in)756 -2252 y(this)21 b(case.\))490 2467 y(Figur)o(e)27 b(7.1)g(shows)i(how)f -(the)g(dif)o(fer)o(ent)e(parser)h(grammars)g(split)h(apart)f(the)h -(same)365 2567 y(strings.)104 b(Having)29 b(to)h(choose)g(between)f -(the)h(dif)o(fer)o(ent)d(grammars)i(r)o(equir)o(es)f(you)i(to)365 -2666 y(decide)i(what)i(you)f(want,)k(but)c(at)g(least)f(you)i(can)f(be) -g(pr)o(ecise)f(about)h(what)g(you)h(ar)o(e)365 2766 y(parsing.)26 -b(T)-8 b(ake)19 b(\002fteen)h(seconds)g(and)g(think)g(it)h(out.)k(Say) -19 b(what)h(you)h(mean;)f(mean)f(what)365 2866 y(you)j(say)-9 -b(.)365 3015 y FA(\(join-strings)39 b FC(string-list)20 -b([delimiter)g(grammar])p FA(\))86 b Fw(\000)-15 b(!)88 -b FC(string)282 b FD(pr)o(ocedur)o(e)573 3155 y(This)21 -b(pr)o(ocedur)o(e)e(is)j(a)e(simple)i(unparser)o(\227it)e(pastes)g -(strings)i(together)g(using)f(the)573 3255 y(delimiter)g(string.)573 -3388 y(The)40 b FC(grammar)e FD(ar)o(gument)i(is)g(one)g(of)g(the)g -(symbols)h FA(infix)c FD(\(the)j(default\))e(or)573 3487 -y FA(suffix)p FD(;)30 b(it)f(determines)g(whether)g(the)g(delimiter)f -(string)i(is)f(used)f(as)h(a)f(separa-)573 3587 y(tor)21 -b(or)g(as)f(a)g(terminator)-6 b(.)573 3719 y(The)19 b(delimiter)h(is)g -(the)g(string)g(used)f(to)h(delimit)g(elements;)g(it)g(defaults)f(to)h -(a)f(single)573 3819 y(space)h FA(")43 b(")p FD(.)573 -3952 y(Example:)756 4117 y FA(\(join-strings)38 b('\("foo")i("bar")i -("baz"\))f(":"\))930 4217 y Fn(=)-14 b Fw(\))87 b FA("foo:bar:baz")365 -4567 y FB(7.1.3)81 b(Field)20 b(readers)365 4774 y FA(\(field-reader)39 -b FC([\002eld-parser)20 b(r)o(ec-r)o(eader])p FA(\))86 -b Fw(\000)-14 b(!)87 b FC(pr)o(ocedur)o(e)418 b FD(pr)o(ocedur)o(e)573 -4898 y(This)32 b(utility)h(r)o(eturns)e(a)h(pr)o(ocedur)o(e)d(that)j(r) -o(eads)e(r)o(ecor)o(ds)h(with)h(\002eld)g(str)o(uctur)o(e)1737 -5147 y(1)-5 b(17)p eop +117 122 bop 573 614 a FA(field-splitter)36 b FD(The)20 +b(r)o(egular)g(expr)o(ession)g(speci\002es)h(the)g(actual)f(\002eld.) +573 759 y FA(suffix-splitter)35 b FD(Delimiters)d(ar)o(e)f(interpr)o +(eted)f(as)h(element)h FC(terminators)p FD(.)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 FA("")e FD(is)h(the)g(empty)756 +958 y(r)o(ecor)o(d)24 b FA(\(\))p FD(,)k FA("foo|")c +FD(pr)o(oduces)i(a)g(one-\002eld)g(r)o(ecor)o(d)f FA(\("foo"\))p +FD(,)g(and)i FA("foo")756 1058 y FD(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 Fo(<)p FC(r)o(ecord)p Fo(>)98 b +FD(::=)h FA("")186 b FD(\(Empty)21 b(r)o(ecor)o(d\))1431 +1448 y Fw(j)134 b Fo(<)p FC(element)p Fo(>)21 b(<)p FC(delim)p +Fo(>)e(<)p FC(r)o(ecord)p Fo(>)756 1637 y FD(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 +FA("$")p FD(\).)573 1981 y FA(infix-splitter)36 b FD(Delimiters)44 +b(ar)o(e)e(interpr)o(eted)g(as)h(element)g FC(separators)p +FD(.)94 b(If)756 2080 y(comma)21 b(is)g(the)g(delimiter)-6 +b(,)21 b(then)g(the)h(string)f FA("foo,")e FD(pr)o(oduces)h(a)g +(two-\002eld)756 2180 y(r)o(ecor)o(d)f FA(\("foo")41 +b(""\))p FD(.)756 2302 y(The)20 b(syntax)h(of)g(in\002x-delimited)g(r)o +(ecor)o(ds)e(is:)961 2471 y Fo(<)p FC(r)o(ecord)p Fo(>)431 +b FD(::=)99 b FA("")186 b FD(\(For)o(ced)20 b(to)h(be)f(empty)h(r)o +(ecor)o(d\))1764 2570 y Fw(j)134 b Fo(<)p FC(r)o(eal-in\002x-r)o(ecord) +p Fo(>)961 2769 y(<)p FC(r)o(eal-in\002x-r)o(ecord)p +Fo(>)97 b FD(::=)i Fo(<)p FC(element)p Fo(>)21 b(<)p +FC(delim)p Fo(>)e(<)p FC(r)o(eal-in\002x-r)o(ecord)p +Fo(>)1764 2869 y Fw(j)134 b Fo(<)p FC(element)p Fo(>)756 +3057 y FD(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 FC(i.e.)o FD(,)67 b Fo(<)p FC(r)o(eal-in\002x-r)o +(ecord)p Fo(>)p FD(\))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 FA(\(""\))p FD(,)d(not)j(as)f(the)g(empty)h +(r)o(ecor)o(d)d FA(\(\))p FD(.)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 FA(string-append)756 3555 y FD(and)i +FA(append)e FD(isomorphic.)27 b(For)21 b(example,)911 +3722 y FA(\(\(infix-splitter)37 b(":"\))42 b(\(string-append)37 +b FC(x)44 b FA(":")e FC(y)o FA(\)\))756 3889 y FD(doesn't)21 +b(always)f(equal)911 4034 y FA(\(append)40 b(\(\(infix-splitter)d +(":"\))42 b FC(x)p FA(\))1259 4133 y(\(\(infix-splitter)37 +b(":"\))42 b FC(y)p FA(\)\))756 4278 y FD(It)23 b(fails)g(when)h +FC(x)e FD(or)i FC(y)e FD(ar)o(e)g(the)h(empty)h(string.)33 +b(T)-8 b(erminator)24 b(semantics)g FC(does)756 4378 +y FD(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 FA($PATH)e FD(lists)k(have)e +(separator)f(semantics.)34 b(The)23 b(path)h(list)g FA("/bin:")c +FD(is)756 4799 y(br)o(oken)h(up)g(into)i FA(\("/bin")41 +b(""\))p FD(,)20 b(not)i FA(\("/bin"\))p FD(.)j(Comma-separated)20 +b(lists)756 4898 y(should)h(also)g(be)f(parsed)g(this)i(way)-9 +b(.)1737 5147 y(1)k(17)p eop %%Page: 118 124 -118 123 bop 888 614 a FD(fr)o(om)27 b(a)g(port.)45 b(The)27 -b(r)o(eader)6 b('s)25 b(interface)i(is)g(designed)g(to)h(make)f(it)g -(useful)g(in)h(the)888 714 y FA(awk)20 b FD(loop)h(macr)o(o)f -(\(section)h(7.2\).)j(The)d(r)o(eader)e(is)i(used)f(as)h(follows:)1071 -865 y FA(\()p FC(r)o(eader)43 b([port])o FA(\))g Fn(=)-14 -b Fw(\))87 b FC([raw-r)o(ecord)20 b(parsed-r)o(ecord])42 -b FA(or)h FC([eof)20 b(\(\)])888 1054 y FD(When)28 b(the)g(r)o(eader)d -(is)j(applied)e(to)i(an)f(input)h(port)f(\(default:)38 -b(the)27 b(curr)o(ent)g(input)888 1154 y(port\),)19 b(it)h(r)o(eads)d -(a)i(r)o(ecor)o(d)e(using)j FC(r)o(ec-r)o(eader)p FD(.)25 -b(If)18 b(this)i(r)o(ecor)o(d)d(isn't)j(the)f(eof)g(object,)h(it)888 -1254 y(is)25 b(parsed)e(with)j FC(\002eld-parser)p FD(.)36 -b(These)25 b(two)g(values\227the)f(r)o(ecor)o(d,)f(and)h(its)h(parsed) -888 1353 y(r)o(epr)o(esentation\227ar)o(e)18 b(r)o(eturned)i(as)g -(multiple)i(values)e(fr)o(om)g(the)h(r)o(eader)-6 b(.)888 -1491 y(When)22 b(called)d(at)i(eof,)f(the)h(r)o(eader)e(r)o(eturns)h -([eof-object)g FA(\(\))p FD(].)888 1629 y(Although)f(the)e(r)o(ecor)o -(d)f(r)o(eader)g(typically)h(r)o(eturns)g(a)g(string,)i(and)e(the)h -(\002eld-parser)888 1729 y(typically)23 b(takes)f(a)g(string)h(ar)o -(gument,)f(this)h(is)f(not)h(r)o(equir)o(ed.)29 b(The)23 -b(r)o(ecor)o(d)d(r)o(eader)888 1829 y(can)e(pr)o(oduce,)f(and)h(the)g -(\002eld-parser)e(consume,)k(values)d(of)h(any)g(type.)25 -b(However)-6 b(,)888 1928 y(the)25 b(empty)g(list)g(r)o(eturned)e(as)h -(the)h(parsed)e(value)h(on)h(eof)f(is)h(har)o(dwir)o(ed)e(into)i(the) -888 2028 y(\002eld)c(r)o(eader)-6 b(.)888 2166 y(For)21 -b(example,)f(if)h(port)g FA(p)f FD(is)h(open)g(on)g FA(/etc/passwd)p -FD(,)16 b(then)1071 2317 y FA(\(\(field-reader)38 b(\(infix-splitter)f -(":")43 b(7\)\))f(p\))888 2459 y FD(r)o(eturns)21 b(two)g(values:)888 -2589 y Fh("dalbertz:mx3Uaqq0:107:22:Da)q(vid)46 b -(Albertz:/users/dalbertz:/bin/cs)q(h")888 2681 y(\("dalbertz")c -("mx3Uaqq0")g("107")e("22")g("David)h(Albertz")g("/users/dalbertz")1359 -2772 y("/bin/csh"\))911 2910 y FD(The)22 b FC(\002eld-parser)h -FD(defaults)e(to)i(the)g(value)e(of)i FA(\(field-splitter\))o -FD(,)17 b(a)22 b(parser)f(that)888 3010 y(picks)g(out)h(sequences)f(of) -g(non-white-space)f(strings.)888 3148 y(The)h FC(r)o(ec-r)o(eader)f -FD(defaults)g(to)h FA(read-line)p FD(.)888 3286 y(Figur)o(e)35 -b(7.2)f(shows)i FA(field-reader)30 b FD(being)36 b(used)f(to)g(r)o(ead) -e(dif)o(fer)o(ent)g(kinds)j(of)888 3385 y(Unix)21 b(r)o(ecor)o(ds.)681 -3676 y FB(7.1.4)81 b(Forward-progress)20 b(guarantees)f(and)g -(empty-string)g(matches)681 3869 y FD(A)h(loop)h(that)g(pulls)g(text)g -(of)o(f)e(a)i(string)g(by)g(r)o(epeatedly)e(matching)i(a)f(r)o(egexp)f -(against)i(that)681 3969 y(string)28 b(can)f(conceivably)g(get)h(stuck) -g(in)g(an)f(in\002nite)h(loop)g(if)g(the)f(r)o(egexp)f(matches)i(the) -681 4068 y(empty)c(string.)35 b(For)24 b(example,)g(the)g(r)o(egexps)f -FA(^)p FD(,)h FA($)p FD(,)g FA(.*)p FD(,)f(and)h FA(foo|[^f]*)c -FD(can)j(all)h(match)681 4168 y(the)d(empty)g(string.)805 -4301 y(The)30 b(r)o(outines)f(in)h(this)h(package)d(that)h(iterate)g -(thr)o(ough)h(strings)g(with)h(r)o(egular)d(ex-)681 4400 -y(pr)o(essions)23 b(ar)o(e)e(car)o(eful)g(to)i(handle)f(this)i -(empty-string)f(case.)30 b(If)23 b(a)f(r)o(egexp)f(matches)i(the)681 -4500 y(empty)j(string,)j(the)d(next)h(sear)o(ch)e(starts,)j(not)f(fr)o -(om)f(the)h(end)f(of)g(the)h(match)g(\(which)g(in)681 -4599 y(the)c(empty)h(string)g(case)e(is)i(also)f(the)h -(beginning\227that's)g(the)g(pr)o(oblem\),)f(but)g(fr)o(om)g(the)681 -4699 y(next)i(character)e(over)-6 b(.)37 b(This)26 b(is)f(the)g(corr)o -(ect)f(behaviour)-6 b(.)37 b(Regexps)25 b(match)g(the)g(longest)681 -4799 y(possible)i(string)g(at)e(a)h(given)h(location,)h(so)e(if)g(the)h -(r)o(egexp)e(matched)h(the)g(empty)g(string)681 4898 -y(at)e(location)h Fo(i)p FD(,)g(then)g(it)g(is)g(guaranteed)e(it)i -(could)f(not)h(have)f(matched)h(a)f(longer)h(pattern)2053 +118 123 bop 681 535 2865 4 v 681 1403 4 868 v 835 657 +a Fk(Recor)o(d)218 b(:)22 b(suf)o(\002x)148 b Fh(:|$)19 +b Fk(suf)o(\002x)288 b(:)23 b(in\002x)419 b(non-:)23 +b(\002eld)p 785 688 2656 4 v 835 752 a Fh("")375 b(\(\))296 +b(\(\))531 b(\(\))h(\(\))835 843 y(":")336 b(\(""\))218 +b(\(""\))453 b(\("")40 b(""\))336 b(\(\))835 934 y("foo:")219 +b(\("foo"\))101 b(\("foo"\))336 b(\("foo")41 b(""\))218 +b(\("foo"\))835 1026 y(":foo")h Fi(err)o(or)226 b Fh(\("")40 +b("foo"\))218 b(\("")40 b("foo"\))219 b(\("foo"\))835 +1117 y("foo:bar")102 b Fi(err)o(or)226 b Fh(\("foo")40 +b("bar"\))101 b(\("foo")41 b("bar"\))101 b(\("foo")41 +b("bar"\))946 1379 y FD(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 FA(sloppy-suffix)36 +b FD(The)23 b(same)f(as)g(the)g FA(suffix)e FD(case,)i(except)f(that)i +(the)f(parser)f(will)1071 1754 y(skip)26 b(an)f(initial)g(delimiter)g +(string)h(if)f(the)g(string)h(begins)g(with)g(one)f(instead)1071 +1853 y(of)33 b(parsing)g(an)f(initial)h(empty)g(\002eld.)62 +b(This)33 b(can)g(be)f(used,)j(for)e(example,)1071 1953 +y(to)27 b(\002eld-split)g(a)f(sequence)i(of)e(English)i(text)f(at)f +(white-space)h(boundaries,)1071 2053 y(wher)o(e)19 b(the)h(string)h +(may)e(begin)h(or)g(end)g(with)g(white)h(space,)e(by)h(using)g(r)o +(egex)1071 2152 y FA("[)43 b(\\t]+|$")p FD(.)24 b(\(But)d(you)g(would)h +(be)f(better)g(of)o(f)f(using)i FA(field-splitter)16 +b FD(in)1071 2252 y(this)21 b(case.\))805 2467 y(Figur)o(e)28 +b(7.1)e(shows)j(how)g(the)f(dif)o(fer)o(ent)d(parser)i(grammars)h +(split)g(apart)e(the)i(same)681 2567 y(strings.)103 b(Having)30 +b(to)f(choose)i(between)e(the)g(dif)o(fer)o(ent)e(grammars)i(r)o(equir) +o(es)g(you)h(to)681 2666 y(decide)i(what)h(you)h(want,)i(but)d(at)g +(least)g(you)h(can)e(be)h(pr)o(ecise)f(about)h(what)h(you)f(ar)o(e)681 +2766 y(parsing.)25 b(T)-8 b(ake)20 b(\002fteen)f(seconds)i(and)e(think) +i(it)f(out.)26 b(Say)19 b(what)h(you)g(mean;)g(mean)g(what)681 +2866 y(you)h(say)-9 b(.)681 3015 y FA(\(join-strings)38 +b FC(string-list)20 b([delimiter)h(grammar])p FA(\))85 +b Fw(\000)-14 b(!)87 b FC(string)282 b FD(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 FC(grammar)f +FD(ar)o(gument)g(is)h(one)h(of)e(the)h(symbols)h FA(infix)d +FD(\(the)i(default\))e(or)888 3487 y FA(suffix)p FD(;)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 FA(")43 b(")p FD(.)888 3952 y(Example:)1071 +4117 y FA(\(join-strings)38 b('\("foo")j("bar")g("baz"\))h(":"\))1245 +4217 y Fn(=)-14 b Fw(\))87 b FA("foo:bar:baz")681 4567 +y FB(7.1.3)81 b(Field)19 b(readers)681 4774 y FA(\(field-reader)38 +b FC([\002eld-parser)20 b(r)o(ec-r)o(eader])p FA(\))86 +b Fw(\000)-14 b(!)87 b FC(pr)o(ocedur)o(e)418 b FD(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)2053 5147 y(1)-5 b(18)p eop %%Page: 119 125 -119 124 bop 365 1310 2865 4 v 365 4120 4 2811 v 403 1426 -a FA(;;;)42 b(/etc/passwd)d(reader)403 1525 y(\(field-reader)f -(\(infix-splitter)f(":")43 b(7\)\))577 1625 y(;)g(wandy:3xuncWdpKhR)o -(.:)o(73)o(:22)o(:W)o(and)o(y)37 b(Saetan:/usr/wandy)o(:/)o(bin)o(/c)o -(sh)403 1824 y(;;;)42 b(Two)g(ls)h(-l)g(output)e(readers)403 -1924 y(\(field-reader)d(\(infix-splitter)f("[)43 b(\\t]+")f(8\)\))403 -2024 y(\(field-reader)c(\(infix-splitter)f("[)43 b(\\t]+")f(-7\)\))577 -2123 y(;)h(-rw-r--r--)83 b(1)43 b(shivers)172 b(22880)41 -b(Sep)i(24)f(12:45)g(scsh.scm)403 2322 y(;;;)g(Internet)e(hostname)h -(reader)403 2422 y(\(field-reader)d(\(field-splitter)f("[^.]+"\)\))577 -2522 y(;)43 b(stat.sinica.edu.t)o(w)403 2721 y(;;;)f(Internet)e(IP)j -(address)e(reader)403 2821 y(\(field-reader)d(\(field-splitter)f -("[^.]+")k(4\)\))577 2920 y(;)i(18.24.0.241)403 3119 -y(;;;)f(Line)g(of)h(integers)403 3219 y(\(let)f(\(\(parser)e -(\(field-splitter)d("[+-]?[0-9]+"\)\)\))490 3319 y(\(field-reader)h(\() -p Fo(\025)h FA(\(s\))j(\(map)g(string->number)c(\(parser)j(s\)\)\)\)) -577 3418 y(;)i(18)g(24)g(0)g(241)403 3618 y(;;;)f(Same)g(as)h(above.) -403 3717 y(\(let)f(\(\(reader)e(\(field-reader)e(\(field-splitter)f -("[+-]?[0-9]+"\)\)\)\))490 3817 y(\()p Fo(\025)i FA(maybe-port)g(\(map) -j(string->number)c(\(apply)j(reader)g(maybe-port\)\)\)\))577 -3917 y(;)i(Yale)f(beat)g(harvard)f(26)h(to)h(7.)990 4096 -y FD(Figur)o(e)20 b(7.2:)k(Some)d(examples)f(of)h FA(field-reader)p -3226 4120 V 365 4123 2865 4 v 1737 5147 a FD(1)-5 b(19)p -eop +119 124 bop 573 614 a FD(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 FA(awk)19 b FD(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 FA(\()p FC(r)o(eader)43 b([port])n FA(\))h Fn(=)-14 +b Fw(\))86 b FC([raw-r)o(ecord)20 b(parsed-r)o(ecord])42 +b FA(or)h FC([eof)21 b(\(\)])573 1054 y FD(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 FC(r)o(ec-r)o(eader)o FD(.)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 FC(\002eld-parser)p FD(.)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 FA(\(\))p FD(].)573 1629 y(Although)e(the)g(r)o(ecor)o +(d)e(r)o(eader)f(typically)j(r)o(eturns)f(a)g(string,)h(and)f(the)h +(\002eld-parser)573 1729 y(typically)k(takes)g(a)g(string)h(ar)o +(gument,)f(this)h(is)g(not)g(r)o(equir)o(ed.)29 b(The)22 +b(r)o(ecor)o(d)f(r)o(eader)573 1829 y(can)d(pr)o(oduce,)f(and)g(the)h +(\002eld-parser)f(consume,)i(values)f(of)g(any)g(type.)24 +b(However)-6 b(,)573 1928 y(the)24 b(empty)h(list)g(r)o(eturned)e(as)i +(the)f(parsed)g(value)f(on)j(eof)e(is)h(har)o(dwir)o(ed)d(into)j(the) +573 2028 y(\002eld)20 b(r)o(eader)-6 b(.)573 2166 y(For)21 +b(example,)f(if)g(port)h FA(p)f FD(is)i(open)f(on)g FA(/etc/passwd)p +FD(,)16 b(then)756 2317 y FA(\(\(field-reader)37 b(\(infix-splitter)h +(":")k(7\)\))g(p\))573 2459 y FD(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 FD(The)23 b FC(\002eld-parser)f +FD(defaults)g(to)g(the)h(value)f(of)g FA(\(field-splitter\))p +FD(,)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 FC(r)o(ec-r)o(eader)f +FD(defaults)g(to)h FA(read-line)p FD(.)573 3286 y(Figur)o(e)35 +b(7.2)e(shows)k FA(field-reader)30 b FD(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 FB(7.1.4)81 b(Forward-progress)21 b(guarantees)d(and)i +(empty-string)e(matches)365 3869 y FD(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 +FA(^)p FD(,)i FA($)p FD(,)g FA(.*)p FD(,)g(and)f FA(foo|[^f]*)d +FD(can)k(all)f(match)365 4168 y(the)e(empty)g(string.)490 +4301 y(The)29 b(r)o(outines)h(in)g(this)g(package)e(that)i(iterate)e +(thr)o(ough)i(strings)h(with)f(r)o(egular)e(ex-)365 4400 +y(pr)o(essions)23 b(ar)o(e)f(car)o(eful)e(to)j(handle)g(this)g +(empty-string)g(case.)31 b(If)22 b(a)g(r)o(egexp)g(matches)g(the)365 +4500 y(empty)27 b(string,)h(the)f(next)f(sear)o(ch)g(starts,)h(not)h +(fr)o(om)e(the)g(end)g(of)h(the)g(match)f(\(which)h(in)365 +4599 y(the)d(empty)f(string)h(case)f(is)g(also)h(the)f +(beginning\227that's)i(the)e(pr)o(oblem\),)g(but)h(fr)o(om)e(the)365 +4699 y(next)j(character)e(over)-6 b(.)38 b(This)25 b(is)h(the)f(corr)o +(ect)e(behaviour)-6 b(.)38 b(Regexps)25 b(match)g(the)g(longest)365 +4799 y(possible)i(string)g(at)f(a)g(given)g(location,)i(so)f(if)f(the)g +(r)o(egexp)f(matched)h(the)g(empty)h(string)365 4898 +y(at)d(location)i Fo(i)p FD(,)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(19)p eop %%Page: 120 126 -120 125 bop 681 614 a FD(starting)22 b(with)h(character)d -Fo(i)p FD(.)29 b(So)22 b(we)g(can)g(safely)f(begin)i(our)f(sear)o(ch)f -(for)h(the)g(next)g(match)681 714 y(at)e(char)g Fo(i)e -Fn(+)g(1)p FD(.)805 854 y(W)-5 b(ith)25 b(this)f(pr)o(ovision,)h(every) -d(iteration)i(thr)o(ough)g(the)g(loop)g(makes)f(some)h(forwar)o(d)681 -953 y(pr)o(ogr)o(ess,)19 b(and)i(the)g(loop)g(is)g(guaranteed)f(to)h -(terminate.)805 1093 y(This)j(has)f(the)g(ef)o(fect)e(you)j(want)f -(with)h(\002eld)f(parsing.)32 b(For)23 b(example,)g(if)g(you)g(split)h -(a)681 1193 y(string)j(with)h(the)f(empty)g(pattern,)g(you)g(will)h -(explode)e(the)h(string)g(into)h(its)f(individual)681 -1292 y(characters:)888 1455 y FA(\(\(suffix-splitter)37 -b(""\))42 b("foo"\))f Fn(=)-14 b Fw(\))87 b FA(\("")43 -b("f")f("o")g("o"\))681 1617 y FD(However)-6 b(,)26 b(even)f(though)i -(this)g(boundary)e(case)g(is)h(handled)f(corr)o(ectly)-9 -b(,)26 b(we)f(don't)h(r)o(ec-)681 1717 y(ommend)21 b(using)h(it.)k(Say) -20 b(what)h(you)g(mean\227just)g(use)g(a)f(\002eld)h(splitter:)888 -1879 y FA(\(\(field-splitter)37 b("."\))42 b("foo"\))f -Fn(=)-14 b Fw(\))87 b FA(\("f")42 b("o")h("o"\))681 2041 -y FD(Or)-6 b(,)20 b(mor)o(e)h(ef)o(\002ciently)-9 b(,)888 -2204 y FA(\(\()p Fo(\025)39 b FA(\(s\))j(\(map)g(string)f -(\(string->list)d(s\)\)\))k("foo"\))681 2494 y FB(7.1.5)81 -b(Reader)19 b(limitations)681 2697 y FD(Since)28 b(all)g(of)h(the)f(r)o -(eaders)f(in)i(this)g(package)f(r)o(equir)o(e)f(the)i(ability)f(to)h -(peek)f(ahead)g(one)681 2796 y(char)19 b(in)h(the)g(input)g(str)o(eam,) -f(they)h(cannot)g(be)f(applied)g(to)h(raw)f(integer)h(\002le)f -(descriptors,)681 2896 y(only)j(Scheme)g(input)g(ports.)29 -b(This)22 b(is)g(because)f(Unix)g(doesn't)h(support)g(peeking)g(ahead) -681 2996 y(into)f(input)h(str)o(eams.)681 3312 y Fy(7.2)99 -b(A)-7 b(wk)681 3546 y FD(Scsh)25 b(pr)o(ovides)f(a)h(loop)g(macr)o(o)g -(and)f(a)h(set)g(of)g(\002eld)g(parsers)f(that)h(can)g(be)f(used)h(to)g -(per)o(-)681 3646 y(form)33 b(text)g(pr)o(ocessing)h(very)f(similar)h -(to)g(the)f(A)-6 b(wk)33 b(pr)o(ogramming)h(language.)63 -b(The)681 3745 y(basic)29 b(functionality)i(of)f(A)-6 -b(wk)30 b(is)g(factor)o(ed)f(in)h(scsh)h(into)g(its)f(component)h -(parts.)53 b(The)681 3845 y(contr)o(ol)25 b(str)o(uctur)o(e)f(is)h(pr)o -(ovided)f(by)g(the)h FA(awk)f FD(loop)h(macr)o(o;)h(the)f(text)f(I/O)i -(and)e(parsers)681 3944 y(ar)o(e)19 b(pr)o(ovided)g(by)h(the)g -(\002eld-r)o(eader)e(subr)o(outine)i(library)g(\(section)h(7.1\).)i -(This)e(factoring)681 4044 y(allows)f(the)g(pr)o(ogrammer)f(to)h -(compose)h(the)f(basic)f(loop)i(str)o(uctur)o(e)e(with)h(any)g(parser)f -(or)681 4144 y(input)h(mechanism)g(at)f(all.)24 b(If)19 -b(the)h(parsers)e(pr)o(ovided)h(by)g(the)h(\002eld-r)o(eader)c(package) -i(ar)o(e)681 4243 y(insuf)o(\002cient,)28 b(the)f(pr)o(ogrammer)e(can)h -(write)h(a)f(custom)h(parser)f(in)h(Scheme)f(and)g(use)h(it)681 -4343 y(with)21 b(equal)g(ease)f(in)h(the)g(awk)g(framework.)805 -4483 y(A)-6 b(wk-in-scheme)21 b(is)g(given)g(by)g(a)f(loop)i(macr)o(o)e -(called)g FA(awk)p FD(.)k(It)d(looks)h(like)f(this:)888 -4699 y FA(\(awk)42 b Fo(<)p FC(next-r)o(ecord)p Fo(>)g(<)p -FC(r)o(ecord&\002eld-vars)p Fo(>)1106 4799 y FD([)p Fo(<)p -FC(counter)p Fo(>)p FD(])g Fo(<)p FC(state-var-decls)p -Fo(>)976 4898 y(<)p FC(clause)1245 4910 y Fx(1)1282 4898 -y Fo(>)h FA(...\))2051 5147 y FD(120)p eop +120 125 bop 681 1310 2865 4 v 681 4120 4 2811 v 718 1426 +a FA(;;;)42 b(/etc/passwd)e(reader)718 1525 y(\(field-reader)e +(\(infix-splitter)g(":")k(7\)\))892 1625 y(;)i(wandy:3xuncWdpK)o(hR.)o +(:7)o(3:2)o(2:)o(Wa)o(ndy)37 b(Saetan:/usr/wand)o(y:)o(/bi)o(n/)o(cs)o +(h)718 1824 y(;;;)42 b(Two)h(ls)g(-l)f(output)f(readers)718 +1924 y(\(field-reader)d(\(infix-splitter)g("[)k(\\t]+")g(8\)\))718 +2024 y(\(field-reader)c(\(infix-splitter)g("[)k(\\t]+")g(-7\)\))892 +2123 y(;)i(-rw-r--r--)83 b(1)43 b(shivers)171 b(22880)42 +b(Sep)g(24)h(12:45)e(scsh.scm)718 2322 y(;;;)h(Internet)f(hostname)f +(reader)718 2422 y(\(field-reader)e(\(field-splitter)g("[^.]+"\)\))892 +2522 y(;)44 b(stat.sinica.edu)o(.tw)718 2721 y(;;;)e(Internet)f(IP)i +(address)d(reader)718 2821 y(\(field-reader)e(\(field-splitter)g +("[^.]+")i(4\)\))892 2920 y(;)k(18.24.0.241)718 3119 +y(;;;)e(Line)g(of)h(integers)718 3219 y(\(let)f(\(\(parser)e +(\(field-splitter)e("[+-]?[0-9]+"\)\)\))805 3319 y(\(field-reader)h(\() +p Fo(\025)f FA(\(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 Fo(\025)i FA(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 FD(Figur)o(e)21 b(7.2:)j(Some)d(examples)f +(of)h FA(field-reader)p 3542 4120 V 681 4123 2865 4 v +2051 5147 a FD(120)p eop %%Page: 121 127 -121 126 bop 490 614 a FD(The)23 b(body)h(of)f(the)g(loop)h(is)g(a)f -(series)g(of)h(clauses,)f(each)g(one)h(r)o(epr)o(esenting)e(a)h(kind)h -(of)365 714 y(condition/action)k(pair)-6 b(.)39 b(The)26 -b(loop)g(r)o(epeatedly)e(r)o(eads)g(a)h(r)o(ecor)o(d,)g(and)g(then)h -(executes)365 814 y(each)21 b(clause)f(whose)h(condition)h(is)g -(satis\002ed)e(by)h(the)g(r)o(ecor)o(d.)490 939 y(Her)o(e's)i(an)h -(example)f(that)h(r)o(eads)e(lines)i(fr)o(om)g(port)g -FA(p)f FD(and)h(prints)g(the)g(line)g(number)365 1038 -y(and)d(line)g(of)f(every)h(line)g(containing)h(the)f(string)g(\223)p -FA(Church-Rosser)p FD(\224:)573 1230 y FA(\(awk)42 b(\(read-line\))d -(\(ln\))j(lineno)f(\(\))660 1329 y(\("Church-Rosser")c(\(format)k(#t)h -("~d:)g(~s~\045")g(lineno)f(ln\)\)\))365 1521 y FD(This)18 -b(example)f(has)g(just)h(one)g(clause)f(in)g(the)h(loop)g(body)-9 -b(,)17 b(the)h(one)g(that)f(tests)g(for)h(matches)365 -1620 y(against)j(the)g(r)o(egular)e(expr)o(ession)i(\223)p -FA(Church-Rosser)p FD(\224.)490 1745 y(The)16 b Fo(<)p -FC(next-r)o(ecord)p Fo(>)e FD(form)i(is)g(an)g(expr)o(ession)g(that)g -(is)h(evaluated)d(each)i(time)g(thr)o(ough)365 1845 y(the)28 -b(loop)g(to)f(pr)o(oduce)g(a)f(r)o(ecor)o(d)g(to)i(pr)o(ocess.)44 -b(This)28 b(expr)o(ession)f(can)g(r)o(eturn)g(multiple)365 -1945 y(values;)19 b(these)f(values)g(ar)o(e)e(bound)j(to)f(the)h -(variables)e(given)h(in)h(the)f Fo(<)p FC(r)o(ecord&\002eld-vars)p -Fo(>)365 2044 y FD(list)25 b(of)f(variables.)34 b(The)24 -b(\002rst)h(value)e(r)o(eturned)g(is)i(assumed)e(to)i(be)f(the)g(r)o -(ecor)o(d;)g(when)g(it)365 2144 y(is)d(the)g(end-of-\002le)f(object,)h -(the)g(loop)h(terminates.)490 2269 y(For)c(example,)f(let's)g(suppose)h -(we)g(want)f(to)h(r)o(ead)e(items)i(fr)o(om)f FA(/etc/password)p -FD(,)12 b(and)365 2368 y(we)20 b(use)h(the)f FA(field-reader)15 -b FD(pr)o(ocedur)o(e)j(to)j(de\002ne)f(a)g(r)o(ecor)o(d)e(parser)h(for) -h FA(/etc/passwd)365 2468 y FD(entries:)573 2607 y FA(\(define)41 -b(read-passwd)e(\(field-reader)f(\(infix-splitter)f(":")43 -b(7\)\)\))365 2746 y FD(binds)23 b FA(read-passwd)18 -b FD(to)k(a)g(pr)o(ocedur)o(e)f(that)h(r)o(eads)f(in)i(a)e(line)i(of)f -(text)g(when)h(it)g(is)g(called,)365 2846 y(and)40 b(splits)g(the)g -(text)g(at)f(colons.)85 b(It)40 b(r)o(eturns)f(two)h(values:)64 -b(the)40 b(entir)o(e)f(line)h(r)o(ead,)365 2946 y(and)30 -b(a)g(seven-element)h(list)g(of)g(the)f(split-out)h(\002elds.)55 -b(\(See)30 b(section)h(7.1)e(for)i(mor)o(e)f(on)365 3045 -y FA(field-reader)16 b FD(and)k FA(infix-splitter)p FD(.\))490 -3170 y(So)27 b(if)f(the)h Fo(<)p FC(next-r)o(ecord)p -Fo(>)e FD(form)i(in)h(an)f FA(awk)e FD(expr)o(ession)i(is)g -FA(\(read-passwd\))p FD(,)c(then)365 3270 y Fo(<)p FC(r)o -(ecord&\002eld-vars)p Fo(>)c FD(must)i(be)f(a)h(list)g(of)g(two)g -(variables,)f FC(e.g.)o FD(,)573 3409 y FA(\(record)41 -b(field-vec\))365 3548 y FD(since)21 b FA(read-passwd)c -FD(r)o(eturns)j(two)h(values.)490 3673 y(Note)26 b(that)h -FA(awk)e FD(allows)i(us)g(to)g(use)f FC(any)h FD(r)o(ecor)o(d)d(r)o -(eader)h(we)h(want)h(in)g(the)f(loop,)j(r)o(e-)365 3772 -y(turning)j(whatever)e(number)i(of)e(values)h(we)g(like.)56 -b(These)31 b(values)g(don't)g(have)g(to)g(be)365 3872 -y(strings)21 b(or)g(string)g(lists.)26 b(The)20 b(only)h(r)o(equir)o -(ement)f(is)h(that)f(the)g(r)o(ecor)o(d)f(r)o(eader)f(r)o(eturn)h(the) -365 3972 y(eof)i(object)g(as)f(its)i(\002rst)f(value)f(when)h(the)g -(loop)h(should)f(terminate.)490 4097 y(The)33 b FA(awk)e -FD(loop)j(allows)g(the)f(pr)o(ogrammer)f(to)h(have)g(loop)g(variables.) -61 b(These)33 b(ar)o(e)365 4196 y(declar)o(ed)19 b(and)h(initialised)h -(by)g(the)g Fo(<)p FC(state-var-decls)p Fo(>)e FD(form,)h(a)573 -4335 y FA(\(\()p FC(var)42 b(init-exp)o FA(\))h(\()p -FC(var)g(init-exp)o FA(\))g(...\))365 4475 y FD(list)27 -b(rather)e(like)h(the)g FA(let)f FD(form.)41 b(Whenever)26 -b(a)f(clause)h(in)g(the)g(loop)h(body)f(executes,)g(it)365 -4574 y(evaluates)20 b(to)h(as)g(many)g(values)f(as)g(ther)o(e)g(ar)o(e) -g(state)g(variables,)g(updating)g(them.)490 4699 y(The)30 -b(optional)i Fo(<)p FC(counter)p Fo(>)e FD(variable)f(is)i(an)f -(iteration)h(counter)-6 b(.)55 b(It)30 b(is)h(bound)g(to)g(0)365 -4799 y(when)21 b(the)g(loop)g(starts.)26 b(The)20 b(counter)h(is)g -(incr)o(emented)f(each)g(time)g(a)h(non-eof)f(r)o(ecor)o(d)f(is)365 -4898 y(r)o(ead.)1735 5147 y(121)p eop +121 126 bop 365 614 a FD(starting)23 b(with)f(character)f +Fo(i)p FD(.)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 Fo(i)e +Fn(+)g(1)p FD(.)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 FA(\(\(suffix-splitte)o(r)37 +b(""\))43 b("foo"\))e Fn(=)-14 b Fw(\))87 b FA(\("")42 +b("f")g("o")h("o"\))365 1617 y FD(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 FA(\(\(field-splitter)37 b("."\))42 b("foo"\))f +Fn(=)-14 b Fw(\))87 b FA(\("f")42 b("o")g("o"\))365 2041 +y FD(Or)-6 b(,)21 b(mor)o(e)f(ef)o(\002ciently)-9 b(,)573 +2204 y FA(\(\()p Fo(\025)38 b FA(\(s\))43 b(\(map)e(string)h +(\(string->list)c(s\)\)\))k("foo"\))365 2494 y FB(7.1.5)81 +b(Reader)20 b(limitations)365 2697 y FD(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 Fy(7.2)99 +b(A)-7 b(wk)365 3546 y FD(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 FA(awk)e FD(loop)j(macr)o(o;)g(the)e(text)h(I/O)g +(and)f(parsers)365 3944 y(ar)o(e)19 b(pr)o(ovided)g(by)h(the)h +(\002eld-r)o(eader)c(subr)o(outine)k(library)f(\(section)g(7.1\).)k +(This)d(factoring)365 4044 y(allows)g(the)f(pr)o(ogrammer)f(to)h +(compose)g(the)g(basic)g(loop)g(str)o(uctur)o(e)f(with)i(any)f(parser)e +(or)365 4144 y(input)i(mechanism)g(at)f(all.)25 b(If)19 +b(the)g(parsers)g(pr)o(ovided)f(by)i(the)f(\002eld-r)o(eader)e(package) +h(ar)o(e)365 4243 y(insuf)o(\002cient,)28 b(the)f(pr)o(ogrammer)f(can)g +(write)h(a)f(custom)h(parser)e(in)j(Scheme)e(and)g(use)g(it)365 +4343 y(with)c(equal)f(ease)f(in)h(the)g(awk)f(framework.)490 +4483 y(A)-6 b(wk-in-scheme)20 b(is)i(given)f(by)f(a)h(loop)g(macr)o(o)f +(called)g FA(awk)p FD(.)k(It)d(looks)h(like)f(this:)573 +4699 y FA(\(awk)42 b Fo(<)p FC(next-r)o(ecord)p Fo(>)f(<)p +FC(r)o(ecord&\002eld-vars)p Fo(>)791 4799 y FD([)p Fo(<)p +FC(counter)p Fo(>)p FD(])h Fo(<)p FC(state-var-decls)p +Fo(>)660 4898 y(<)p FC(clause)929 4910 y Fx(1)966 4898 +y Fo(>)h FA(...\))1735 5147 y FD(121)p eop %%Page: 122 128 -122 127 bop 805 614 a FD(Ther)o(e)28 b(ar)o(e)f(several)h(kinds)i(of)e -(loop)i(clause.)49 b(When)29 b(evaluating)f(the)h(body)g(of)g(the)681 -714 y(loop,)f FA(awk)e FD(evaluates)g FC(all)g FD(the)h(clauses)g -(sequentially)-9 b(.)43 b(Unlike)27 b FA(cond)p FD(,)g(it)f(does)h(not) -h(stop)681 814 y(after)19 b(the)i(\002rst)g(clause)g(is)g(satis\002ed;) -f(it)h(checks)g(them)g(all.)805 1010 y Fw(\017)41 b FA(\()p -FC(test)i(body)1254 1037 y Fx(1)1335 1010 y FC(body)1493 -1037 y Fx(2)1574 1010 y FA(...\))888 1110 y FD(If)29 -b FC(test)f FD(is)i(tr)o(ue,)g(execute)e(the)h(body)g(forms.)50 -b(The)29 b(last)g(body)g(form)f(is)i(the)f(value)888 -1209 y(of)c(the)f(clause.)36 b(The)24 b(test)g(and)g(body)h(forms)f(ar) -o(e)f(evaluated)g(in)i(the)f(scope)h(of)f(the)888 1309 -y(r)o(ecor)o(d)19 b(and)i(state)f(variables.)888 1440 -y(The)h FC(test)g FD(form)g(can)f(be)g(one)i(of:)1121 -1558 y(integer:)212 b(The)27 b(test)g(is)g(tr)o(ue)g(for)f(that)h -(iteration)g(of)f(the)h(loop.)44 b(The)1612 1658 y(\002rst)21 -b(iteration)g(is)g(#1.)1121 1758 y(string:)257 b(The)24 -b(string)g(is)h(a)e(r)o(egular)f(expr)o(ession.)35 b(The)23 -b(test)h(is)g(tr)o(ue)1612 1857 y(if)d(the)g(r)o(egexp)e(matches)i(the) -g(r)o(ecor)o(d.)1121 1957 y(expr)o(ession)99 b(If)39 -b(not)g(an)g(integer)f(or)h(a)f(string,)44 b(the)39 b(test)g(form)g(is) -g(a)1612 2056 y(Scheme)21 b(expr)o(ession)f(that)h(is)g(evaluated.)805 -2234 y Fw(\017)91 b FA(\(range)128 b FC(start-test)43 -b(stop-test)g(body)2166 2261 y Fx(1)2247 2234 y FA(...\))938 -2334 y(\(:range)84 b FC(start-test)43 b(stop-test)g(body)2166 -2361 y Fx(1)2247 2334 y FA(...\))938 2434 y(\(range:)84 -b FC(start-test)43 b(stop-test)g(body)2166 2461 y Fx(1)2247 -2434 y FA(...\))938 2533 y(\(:range:)d FC(start-test)j(stop-test)g -(body)2166 2560 y Fx(1)2247 2533 y FA(...\))888 2632 -y FD(These)19 b(clauses)f(become)g(activated)f(when)i -FC(start-test)f FD(is)h(tr)o(ue;)g(they)f(stay)h(active)e(on)888 -2731 y(all)k(further)f(iterations)h(until)h FC(stop-test)d -FD(is)i(tr)o(ue.)888 2862 y(So,)g(to)g(print)g(out)g(the)g(\002rst)g -(ten)g(lines)g(of)g(a)f(\002le,)h(we)g(use)g(the)f(clause:)1071 -3001 y FA(\(:range:)40 b(1)j(10)g(\(display)d(record\)\))888 -3170 y FD(The)25 b(colons)h(contr)o(ol)f(whether)f(or)h(not)g(the)g -(start)f(and)h(stop)g(lines)g(ar)o(e)e(pr)o(ocessed)888 -3270 y(by)e(the)g(clause.)k(For)c(example:)1121 3410 -y FA(\(range)128 b(1)43 b(5)87 b(...\))164 b FD(Lines)84 -b(2)20 b(3)g(4)1121 3510 y FA(\(:range)84 b(1)43 b(5)87 -b(...\))164 b FD(Lines)21 b(1)g(2)f(3)g(4)1121 3609 y -FA(\(range:)84 b(1)43 b(5)87 b(...\))164 b FD(Lines)84 -b(2)20 b(3)g(4)g(5)1121 3709 y FA(\(:range:)40 b(1)j(5)87 -b(...\))164 b FD(Lines)21 b(1)g(2)f(3)g(4)g(5)888 3878 -y(A)g(line)h(can)f(trigger)g(both)h(tests,)g(either)f(simultaneously)i -(starting)e(and)g(stopping)888 3977 y(an)g(active)f(r)o(egion,)h(or)f -(simultaneously)j(stopping)e(one)g(and)g(starting)g(a)f(new)h(one,)888 -4077 y(so)i(ranges)e(can)h(abut)f(seamlessly)-9 b(.)805 -4239 y Fw(\017)41 b FA(\(else)h FC(body)1308 4266 y Fx(1)1389 -4239 y FC(body)1547 4266 y Fx(2)1628 4239 y FA(...\))888 -4338 y FD(If)22 b(no)h(other)g(clause)e(has)i(executed)e(since)h(the)h -(top)f(of)g(the)h(loop,)g(or)f(since)h(the)f(last)888 -4438 y FA(else)d FD(clause,)i(this)g(clause)f(executes.)805 -4599 y Fw(\017)41 b FA(\()p FC(test)i FA(=>)g FC(exp)o -FA(\))888 4699 y FD(If)25 b(evaluating)g FA(test)e FD(pr)o(oduces)i(a)f -(tr)o(ue)i(value,)f(apply)g FC(exp)f FD(to)i(that)f(value.)38 -b(If)25 b FC(test)888 4799 y FD(is)20 b(a)f(r)o(egular)o(-expr)o -(ession)f(string,)i(then)g FC(exp)f FD(is)h(applied)e(to)i(the)g(match) -g(data)e(str)o(uc-)888 4898 y(tur)o(e)i(r)o(eturned)g(by)h(the)g(r)o -(egexp)e(match)i(r)o(outine.)2051 5147 y(122)p eop +122 127 bop 805 614 a FD(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 +FA(p)g FD(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 +FA(Church-Rosser)p FD(\224)o(:)888 1230 y FA(\(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 FD(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 +FA(Church-Rosser)p FD(\224.)805 1745 y(The)c Fo(<)p FC(next-r)o(ecord)p +Fo(>)e FD(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 +Fo(<)p FC(r)o(ecord&\002eld-vars)p Fo(>)681 2044 y FD(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 FA(/etc/password)p FD(,)12 b(and)681 +2368 y(we)20 b(use)g(the)g FA(field-reader)c FD(pr)o(ocedur)o(e)i(to)i +(de\002ne)g(a)g(r)o(ecor)o(d)f(parser)g(for)h FA(/etc/passwd)681 +2468 y FD(entries:)888 2607 y FA(\(define)41 b(read-passwd)e +(\(field-reader)f(\(infix-splitter)g(":")k(7\)\)\))681 +2746 y FD(binds)22 b FA(read-passwd)c FD(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 FA(field-reader)16 b FD(and)k FA(infix-splitter)p +FD(.\))805 3170 y(So)27 b(if)g(the)g Fo(<)p FC(next-r)o(ecord)p +Fo(>)e FD(form)i(in)g(an)g FA(awk)f FD(expr)o(ession)g(is)i +FA(\(read-passwd\))p FD(,)23 b(then)681 3270 y Fo(<)p +FC(r)o(ecord&\002eld-vars)p Fo(>)18 b FD(must)k(be)e(a)g(list)i(of)e +(two)i(variables,)d FC(e.g.)o FD(,)888 3409 y FA(\(record)41 +b(field-vec\))681 3548 y FD(since)21 b FA(read-passwd)16 +b FD(r)o(eturns)k(two)i(values.)805 3673 y(Note)27 b(that)f +FA(awk)g FD(allows)h(us)g(to)f(use)h FC(any)f FD(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 FA(awk)f +FD(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 Fo(<)p FC(state-var-decls)p Fo(>)d FD(form,)j(a)888 +4335 y FA(\(\()p FC(var)43 b(init-exp)o FA(\))g(\()p +FC(var)g(init-exp)o FA(\))g(...\))681 4475 y FD(list)26 +b(rather)g(like)g(the)g FA(let)f FD(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 Fo(<)p FC(counter)p Fo(>)f FD(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.)2051 5147 y(122)p eop %%Page: 123 129 -123 128 bop 490 614 a Fw(\017)41 b FA(\(after)g FC(body)1036 -641 y Fx(1)1117 614 y FA(...\))573 714 y FD(This)23 b(clause)e -(executes)h(when)g(the)h(loop)g(encounters)f(EOF)-8 b(.)23 -b(The)f(body)g(forms)g(ex-)573 814 y(ecute)i(in)g(the)h(scope)f(of)g -(the)h(state)f(vars)f(and)h(the)h(r)o(ecor)o(d-count)d(var)-6 -b(,)24 b(if)g(ther)o(e)g(ar)o(e)573 913 y(any)-9 b(.)25 -b(The)c(value)f(of)h(the)g(last)f(body)h(form)g(is)g(the)g(value)f(of)h -(the)g(entir)o(e)f(awk)h(form.)573 1042 y(If)e(ther)o(e)g(is)h(no)h -FA(after)c FD(clause,)i FA(awk)g FD(r)o(eturns)g(the)h(loop's)h(state)e -(variables)g(as)g(multi-)573 1142 y(ple)h(values.)365 -1389 y FB(7.2.1)81 b(Examples)365 1572 y FD(Her)o(e)27 -b(ar)o(e)e(some)j(examples)f(of)h FA(awk)e FD(being)h(used)g(to)h(pr)o -(ocess)f(various)g(types)h(of)f(input)365 1671 y(str)o(eam.)573 -1858 y FA(\(define)41 b($)i(nth\))347 b(;)43 b(Saves)e(typing.)573 -2058 y(;;;)h(Print)g(out)g(the)g(name)g(and)h(home-directory)37 -b(of)43 b(everyone)e(in)h(/etc/passwd:)573 2157 y(\(let)g -(\(\(read-passwd)c(\(field-reader)g(\(infix-splitter)g(":")k(7\)\)\)\)) -660 2257 y(\(call-with-input)o(-fi)o(le)37 b("/etc/passwd")747 -2357 y(\(lambda)k(\(port\))834 2456 y(\(awk)h(\(read-passwd)d(port\))i -(\(record)g(fields\))g(\(\))922 2556 y(\(#t)h(\(format)f(#t)h("~a's)g -(home)g(directory)e(is)i(~a~\045")1445 2655 y(\($)g(fields)f(0\))1445 -2755 y(\($)h(fields)f(5\)\)\)\)\)\)\))573 3005 y(;;;)h(Print)g(out)g -(the)g(user-name)e(and)j(home-directory)37 b(of)43 b(everyone)d(whose) -573 3104 y(;;;)i(name)g(begins)f(with)h("S")573 3204 -y(\(let)g(\(\(read-passwd)c(\(field-reader)g(\(infix-splitter)g(":")k -(7\)\)\)\))660 3303 y(\(call-with-input)o(-fi)o(le)37 -b("/etc/passwd")747 3403 y(\(lambda)k(\(port\))834 3503 -y(\(awk)h(\(read-passwd)d(port\))i(\(record)g(fields\))g(\(\))922 -3602 y(\("^S")g(\(format)g(#t)i("~a's)e(home)h(directory)e(is)j -(~a~\045")1532 3702 y(\($)g(fields)e(0\))1532 3802 y(\($)i(fields)e -(5\)\)\)\)\)\)\))573 4051 y(;;;)h(Read)g(a)h(series)e(of)i(integers)d -(from)i(stdin.)f(This)h(expression)e(evaluates)573 4151 -y(;;;)i(to)h(the)f(number)f(of)i(positive)d(numbers)h(that)h(were)g -(read.)g(Note)f(our)573 4250 y(;;;)h("record-reader")c(is)k(the)h -(standard)d(Scheme)h(READ)h(procedure.)573 4350 y(\(awk)g(\(read\))f -(\(i\))129 b(\(\(npos)42 b(0\)\))660 4450 y(\(\(>)g(i)i(0\))e(\(+)h -(npos)f(1\)\)\))573 4699 y(;;;)g(Filter)f(--)i(pass)f(only)g(lines)f -(containing)f(my)j(name.)573 4799 y(\(awk)f(\(read-line\))d(\(line\))i -(\(\))660 4898 y(\("Olin")g(\(display)f(line\))i(\(newline\)\)\))1735 -5147 y FD(123)p eop +123 128 bop 490 614 a FD(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 FA(awk)c FD(evaluates)h FC(all)h FD(the)g(clauses)f +(sequentially)-9 b(.)44 b(Unlike)27 b FA(cond)p FD(,)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 Fw(\017)41 b FA(\()p +FC(test)i(body)938 1037 y Fx(1)1019 1010 y FC(body)1177 +1037 y Fx(2)1258 1010 y FA(...\))573 1110 y FD(If)28 +b FC(test)h FD(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 FC(test)f FD(form)h(can)f(be)h(one)g(of:)805 +1558 y(integer:)213 b(The)26 b(test)h(is)g(tr)o(ue)g(for)g(that)f +(iteration)h(of)g(the)g(loop.)44 b(The)1297 1658 y(\002rst)21 +b(iteration)g(is)g(#1.)805 1758 y(string:)258 b(The)23 +b(string)i(is)f(a)f(r)o(egular)g(expr)o(ession.)34 b(The)24 +b(test)g(is)g(tr)o(ue)1297 1857 y(if)c(the)h(r)o(egexp)f(matches)g(the) +h(r)o(ecor)o(d.)805 1957 y(expr)o(ession)100 b(If)38 +b(not)i(an)e(integer)h(or)g(a)f(string,)44 b(the)39 b(test)f(form)h(is) +g(a)1297 2056 y(Scheme)20 b(expr)o(ession)h(that)f(is)h(evaluated.)490 +2234 y Fw(\017)91 b FA(\(range)128 b FC(start-test)43 +b(stop-test)f(body)1851 2261 y Fx(1)1931 2234 y FA(...\))623 +2334 y(\(:range)84 b FC(start-test)43 b(stop-test)f(body)1851 +2361 y Fx(1)1931 2334 y FA(...\))623 2434 y(\(range:)84 +b FC(start-test)43 b(stop-test)f(body)1851 2461 y Fx(1)1931 +2434 y FA(...\))623 2533 y(\(:range:)e FC(start-test)j(stop-test)f +(body)1851 2560 y Fx(1)1931 2533 y FA(...\))573 2632 +y FD(These)18 b(clauses)g(become)h(activated)e(when)i +FC(start-test)e FD(is)i(tr)o(ue;)g(they)g(stay)f(active)g(on)573 +2731 y(all)i(further)h(iterations)g(until)g FC(stop-test)f +FD(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 FA(\(:range:)40 b(1)j(10)g(\(display)d(record\)\))573 +3170 y FD(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 +FA(\(range)129 b(1)43 b(5)87 b(...\))164 b FD(Lines)83 +b(2)20 b(3)h(4)805 3510 y FA(\(:range)85 b(1)43 b(5)87 +b(...\))164 b FD(Lines)21 b(1)f(2)g(3)h(4)805 3609 y +FA(\(range:)85 b(1)43 b(5)87 b(...\))164 b FD(Lines)83 +b(2)20 b(3)h(4)f(5)805 3709 y FA(\(:range:)41 b(1)i(5)87 +b(...\))164 b FD(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 Fw(\017)41 b FA(\(else)g FC(body)993 4266 y Fx(1)1074 +4239 y FC(body)1232 4266 y Fx(2)1313 4239 y FA(...\))573 +4338 y FD(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 FA(else)c FD(clause,)h(this)i(clause)e(executes.)490 +4599 y Fw(\017)41 b FA(\()p FC(test)i FA(=>)g FC(exp)o +FA(\))573 4699 y FD(If)25 b(evaluating)f FA(test)g FD(pr)o(oduces)g(a)h +(tr)o(ue)g(value,)h(apply)e FC(exp)h FD(to)h(that)f(value.)38 +b(If)25 b FC(test)573 4799 y FD(is)20 b(a)f(r)o(egular)o(-expr)o +(ession)e(string,)j(then)g FC(exp)f FD(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.)1735 5147 y(123)p eop %%Page: 124 130 -124 129 bop 888 614 a FA(;;;)43 b(Count)e(the)i(number)e(of)h -(non-comment)d(lines)j(of)h(code)f(in)g(my)h(Scheme)e(source.)888 -714 y(\(awk)h(\(read-line\))d(\(line\))i(\(\(nlines)g(0\)\))976 -814 y(\("^[)g(\\t]*;")h(nlines\))650 b(;)44 b(A)f(comment)d(line.)976 -913 y(\(else)303 b(\(+)42 b(nlines)f(1\)\)\))347 b(;)44 -b(Not)e(a)h(comment)e(line.)888 1196 y(;;;)i(Read)f(numbers,)e -(counting)g(the)j(evens)e(and)h(odds.)888 1295 y(\(awk)g(\(read\))f -(\(val\))h(\(\(evens)f(0\))h(\(odds)g(0\)\))976 1395 -y(\(\(>)g(val)g(0\))h(\(display)d("pos)i("\))87 b(\(values)40 -b(evens)i(odds\)\))f(;)i(Tell)f(me)h(about)976 1494 y(\(\(<)f(val)g -(0\))h(\(display)d("neg)i("\))87 b(\(values)40 b(evens)i(odds\)\))f(;)i -(sign,)f(too.)976 1594 y(\(else)259 b(\(display)40 b("zero)i("\))h -(\(values)d(evens)i(odds\)\))976 1793 y(\(\(even?)e(val\))i(\(values)f -(\(+)i(evens)e(1\))i(odds\)\))976 1893 y(\(else)346 b(\(values)41 -b(evens)303 b(\(+)43 b(odds)f(1\)\)\)\))888 2175 y(;;;)h(Determine)d -(the)i(max)g(length)f(of)i(all)f(the)h(lines)e(in)i(the)f(file.)888 -2275 y(\(awk)g(\(read-line\))d(\(line\))i(\(\(max-len)f(0\)\))976 -2374 y(\(#t)i(\(max)g(max-len)e(\(string-length)e(line\)\)\)\))888 -2657 y(;;;)43 b(\(This)e(could)h(also)g(be)g(done)g(with)g -(REDUCE-PORT:\))888 2756 y(\(reduce-port)d(\(current-input-p)o(ort)o -(\))e(read-line)1455 2856 y(\(lambda)k(\(line)g(maxlen\))g(\(max)h -(\(string-length)c(line\))j(maxlen\)\))1455 2956 y(0\))888 -3238 y(;;;)i(Print)e(every)h(line)g(longer)f(than)h(80)g(chars.)888 -3337 y(;;;)h(Prefix)e(each)h(line)g(with)g(its)g(line)g(#.)888 -3437 y(\(awk)g(\(read-line\))d(\(line\))i(lineno)h(\(\))976 -3537 y(\(\(>)g(\(string-length)c(line\))j(80\))1019 3636 -y(\(format)g(#t)i("~d:)e(~s~\045")h(lineno)f(line\)\)\))888 -3919 y(;;;)i(Strip)e(blank)h(lines)f(from)h(input.)888 -4018 y(\(awk)g(\(read-line\))d(\(line\))i(\(\))976 4118 -y(\(".")g(\(display)g(line\))g(\(newline\)\)\))888 4400 -y(;;;)i(Sort)f(the)g(entries)f(in)h(/etc/passwd)d(by)k(login)f(name.) -888 4500 y(\(for-each)e(\(lambda)h(\(entry\))g(\(display)f(\(cdr)i -(entry\)\))e(\(newline\)\))432 b(;)43 b(Out)1324 4599 -y(\(sort)f(\(lambda)e(\(x)j(y\))g(\(string)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\)\)\))2051 +5147 y FD(124)p eop %%Page: 125 131 -125 130 bop 573 614 a FA(;;;)42 b(Prefix)f(line)h(numbers)f(to)i(the)f -(input)g(stream.)573 714 y(\(awk)g(\(read-line\))d(\(line\))i(lineno)g -(\(\))660 814 y(\(#t)h(\(format)f(#t)i("~d:\\t~a~\045")c(lineno)i -(line\)\)\))1735 5147 y FD(125)p eop +125 130 bop 573 614 a FA(;;;)42 b(Count)g(the)g(number)f(of)i +(non-comment)c(lines)i(of)i(code)f(in)h(my)g(Scheme)e(source.)573 +714 y(\(awk)h(\(read-line\))d(\(line\))i(\(\(nlines)f(0\)\))660 +814 y(\("^[)i(\\t]*;")f(nlines\))651 b(;)43 b(A)g(comment)e(line.)660 +913 y(\(else)303 b(\(+)43 b(nlines)e(1\)\)\))347 b(;)43 +b(Not)f(a)i(comment)c(line.)573 1196 y(;;;)i(Read)g(numbers,)e +(counting)h(the)h(evens)g(and)g(odds.)573 1295 y(\(awk)g(\(read\))f +(\(val\))g(\(\(evens)g(0\))i(\(odds)e(0\)\))660 1395 +y(\(\(>)h(val)h(0\))f(\(display)f("pos)h("\))86 b(\(values)41 +b(evens)g(odds\)\))g(;)j(Tell)d(me)i(about)660 1494 y(\(\(<)f(val)h +(0\))f(\(display)f("neg)h("\))86 b(\(values)41 b(evens)g(odds\)\))g(;)j +(sign,)d(too.)660 1594 y(\(else)259 b(\(display)41 b("zero)g("\))i +(\(values)e(evens)g(odds\)\))660 1793 y(\(\(even?)g(val\))h(\(values)e +(\(+)j(evens)f(1\))g(odds\)\))660 1893 y(\(else)347 b(\(values)40 +b(evens)303 b(\(+)43 b(odds)f(1\)\)\)\))573 2175 y(;;;)g(Determine)e +(the)i(max)h(length)e(of)i(all)f(the)g(lines)g(in)h(the)f(file.)573 +2275 y(\(awk)g(\(read-line\))d(\(line\))i(\(\(max-len)f(0\)\))660 +2374 y(\(#t)i(\(max)g(max-len)f(\(string-length)d(line\)\)\)\))573 +2657 y(;;;)k(\(This)g(could)f(also)h(be)h(done)f(with)g(REDUCE-PORT:\)) +573 2756 y(\(reduce-port)c(\(current-input-po)o(rt\))f(read-line)1139 +2856 y(\(lambda)k(\(line)h(maxlen\))e(\(max)i(\(string-length)c(line\)) +k(maxlen\)\))1139 2956 y(0\))573 3238 y(;;;)g(Print)g(every)f(line)h +(longer)f(than)h(80)h(chars.)573 3337 y(;;;)f(Prefix)f(each)h(line)g +(with)g(its)g(line)g(#.)573 3437 y(\(awk)g(\(read-line\))d(\(line\))i +(lineno)g(\(\))660 3537 y(\(\(>)h(\(string-length)c(line\))k(80\))704 +3636 y(\(format)e(#t)j("~d:)f(~s~\045")g(lineno)f(line\)\)\))573 +3919 y(;;;)h(Strip)g(blank)f(lines)h(from)g(input.)573 +4018 y(\(awk)g(\(read-line\))d(\(line\))i(\(\))660 4118 +y(\(".")h(\(display)e(line\))i(\(newline\)\)\))573 4400 +y(;;;)g(Sort)g(the)g(entries)f(in)i(/etc/passwd)c(by)k(login)e(name.) +573 4500 y(\(for-each)f(\(lambda)g(\(entry\))h(\(display)f(\(cdr)i +(entry\)\))f(\(newline\)\))432 b(;)43 b(Out)1009 4599 +y(\(sort)e(\(lambda)g(\(x)i(y\))f(\(string)33 b Fn(0)p FD(;)c(a)d(right)h(shift) -g(is)888 3238 y Fo(j)h(<)23 b Fn(0)p FD(.)681 3516 y -Fy(8.2)99 b(List)25 b(procedures)681 3739 y FA(\(nth)42 -b FC(list)21 b(i)p FA(\))86 b Fw(\000)-14 b(!)87 b FC(object)1578 -b FD(pr)o(ocedur)o(e)888 3856 y(Returns)23 b(the)f Fo(i)1365 -3826 y Fx(t)p Fp(h)1455 3856 y FD(element)h(of)e FC(list)q -FD(.)29 b(The)21 b(\002rst)i(element)f(\(the)f(car\))g(is)h -FA(\(nth)42 b FC(list)i FA(0\))p FD(,)888 3956 y(the)21 -b(second)g(element)g(is)g FA(\(nth)42 b FC(list)i FA(1\))p -FD(,)20 b(and)g(so)h(on.)888 4081 y(This)g(pr)o(ocedur)o(e)d(is)i(pr)o -(ovided)f(as)h(it)g(is)h(useful)f(for)g(accessing)g(elements)g(fr)o(om) -g(the)888 4180 y(lists)i(r)o(eturned)d(by)i(the)g(\002eld-r)o(eaders)e -(\(chapter)g(7\).)681 4459 y Fy(8.3)99 b(T)-11 b(op)26 -b(level)681 4682 y FA(\(repl\))84 b Fw(\000)-14 b(!)87 -b FC(unde\002ned)1590 b FD(pr)o(ocedur)o(e)888 4799 y(This)24 -b(r)o(uns)f(a)g(Scheme)f(48)g(r)o(ead-eval-print)f(loop,)i(r)o(eading)f -(forms)i(fr)o(om)e(the)h(cur)o(-)888 4898 y(r)o(ent)e(input)g(port,)f -(and)h(writing)g(their)g(values)g(to)g(the)g(curr)o(ent)f(output)h -(port.)2051 5147 y(126)p eop +126 131 bop 888 614 a FA(;;;)43 b(Prefix)e(line)h(numbers)e(to)j(the)g +(input)e(stream.)888 714 y(\(awk)h(\(read-line\))d(\(line\))i(lineno)h +(\(\))976 814 y(\(#t)g(\(format)f(#t)h("~d:\\t~a~\045")d(lineno)i +(line\)\)\))2051 5147 y FD(126)p eop %%Page: 127 133 -127 132 bop 573 614 a FD(If)24 b(you)i(wish)g(to)f(try)g(something)i -(danger)o(ous,)e(and)g(want)g(to)g(be)g(able)f(to)i(r)o(ecover)573 -714 y(your)21 b(shell)g(state,)f(you)i(can)e(fork)h(of)o(f)f(a)g -(subshell)i(with)f(the)g(following)h(form:)756 853 y -FA(\(run)41 b(\(begin)h(\(repl\)\)\))573 991 y FD(.)12 -b(.)g(.)g(or)-6 b(,)21 b(r)o(ephrased)e(for)i(the)f(pr)o(oceduralists:) -756 1130 y FA(\(wait)41 b(\(fork)h(repl\)\))1735 5147 -y FD(127)p eop +127 132 bop 365 1262 a Fz(Chapter)45 b(8)365 1702 y FE(Miscellaneous)51 +b(routines)365 2175 y Fy(8.1)99 b(Integer)25 b(bitwise)g(ops)365 +2398 y FA(\(arithmetic-shift)37 b FC(i)21 b(j)p FA(\))87 +b Fw(\000)-15 b(!)87 b FC(integer)1052 b FD(pr)o(ocedur)o(e)365 +2498 y FA(\(bitwise-and)39 b FC(i)21 b(j)p FA(\))87 b +Fw(\000)-15 b(!)88 b FC(integer)1269 b FD(pr)o(ocedur)o(e)365 +2598 y FA(\(bitwise-ior)39 b FC(i)21 b(j)p FA(\))87 b +Fw(\000)-15 b(!)88 b FC(integer)1269 b FD(pr)o(ocedur)o(e)365 +2697 y FA(\(bitwise-not)39 b FC(i)p FA(\))87 b Fw(\000)-15 +b(!)88 b FC(integer)1313 b FD(pr)o(ocedur)o(e)365 2797 +y FA(\(bitwise-xor)39 b FC(i)21 b(j)p FA(\))87 b Fw(\000)-15 +b(!)88 b FC(integer)1269 b FD(pr)o(ocedur)o(e)573 2913 +y(These)53 b(operations)g(operate)f(on)h(integers)h(r)o(epr)o(esenting) +d(semi-in\002nite)j(bit)573 3013 y(strings,)21 b(using)h(a)e +(2's-complement)h(encoding.)573 3138 y FA(arithmetic-shift)f +FD(shifts)27 b FC(i)f FD(by)h FC(j)g FD(bits.)43 b(A)26 +b(left)g(shift)h(is)g Fo(j)38 b(>)c Fn(0)p FD(;)28 b(a)e(right)h(shift) +g(is)573 3238 y Fo(j)h(<)22 b Fn(0)p FD(.)365 3516 y +Fy(8.2)99 b(List)26 b(procedures)365 3739 y FA(\(nth)42 +b FC(list)21 b(i)p FA(\))87 b Fw(\000)-14 b(!)87 b FC(object)1578 +b FD(pr)o(ocedur)o(e)573 3856 y(Returns)22 b(the)h Fo(i)1050 +3826 y Fx(t)p Fp(h)1140 3856 y FD(element)f(of)g FC(list)p +FD(.)29 b(The)22 b(\002rst)g(element)g(\(the)g(car\))f(is)h +FA(\(nth)42 b FC(list)i FA(0\))p FD(,)573 3956 y(the)21 +b(second)g(element)g(is)g FA(\(nth)42 b FC(list)h FA(1\))p +FD(,)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 Fy(8.3)99 b(T)-11 b(op)26 +b(level)365 4682 y FA(\(repl\))85 b Fw(\000)-14 b(!)87 +b FC(unde\002ned)1590 b FD(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.)1735 5147 y(127)p eop %%Page: 128 134 -128 133 bop 681 1266 a Fz(Chapter)44 b(9)681 1709 y FE(Running)52 -b(scsh)681 2194 y FD(Scsh)22 b(is)i(curr)o(ently)e(implemented)h(on)g -(top)g(of)g(Scheme)f(48,)g(a)h(fr)o(eely-available)c(Scheme)681 -2293 y(implementation)i(written)g(by)f(Jonathan)h(Rees)f(and)g(Richar)o -(d)g(Kelsey)-9 b(.)25 b(Scheme)20 b(48)g(uses)681 2393 -y(a)33 b(byte-code)f(interpr)o(eter)h(for)g(good)h(code)f(density)-9 -b(,)37 b(portability)c(and)g(medium)h(ef)o(\002-)681 -2493 y(ciency)-9 b(.)25 b(It)c(is)g(R4RS.)g(It)f(also)h(has)g(a)f -(module)i(system)f(designed)g(by)f(Jonathan)h(Rees.)805 -2621 y(Scsh's)26 b(design)f(is)h(not)g(Scheme)f(48)f(speci\002c,)i -(although)g(the)g(curr)o(ent)e(implementa-)681 2720 y(tion)k(is)g -(necessarily)f(so.)46 b(Scsh)27 b(is)h(intended)f(to)h(be)f -(implementable)g(in)h(other)f(Scheme)681 2820 y(implementations.)37 -b(The)24 b(Scheme)g(48)f(virtual)h(machine)g(that)g(scsh)h(uses)f(is)h -(a)e(specially)681 2920 y(modi\002ed)k(version;)k(standar)o(d)25 -b(Scheme)i(48)f(virtual)h(machines)g(cannot)h(be)e(used)h(with)681 -3019 y(the)21 b(scsh)g(heap)f(image.)805 3147 y(Ther)o(e)37 -b(ar)o(e)g(several)g(dif)o(fer)o(ent)f(ways)i(to)g(invoke)h(scsh.)77 -b(Y)-8 b(ou)39 b(can)f(r)o(un)g(it)h(as)e(an)681 3247 -y(interactive)30 b(Scheme)g(system,)j(with)e(a)f(standar)o(d)f(r)o -(ead-eval-print)f(interaction)j(loop.)681 3347 y(Scsh)37 -b(can)g(also)h(be)f(invoked)h(as)f(the)h(interpr)o(eter)e(for)h(a)g -(shell)h(script)g(by)f(putting)i(a)681 3446 y(\223)p -FA(#!/usr/local/b)o(in/)o(sc)o(sh)e(-s)p FD(\224)20 b(line)h(at)f(the)h -(top)g(of)g(the)g(shell)g(script.)805 3575 y(Descending)j(a)e(level,)h -(it)g(is)g(also)g(possible)h(to)f(invoke)h(the)f(underlying)g(virtual)g -(ma-)681 3674 y(chine)j(byte-code)f(interpr)o(eter)f(dir)o(ectly)h(on)i -(dumped)e(heap)g(images.)41 b(Scsh)26 b(pr)o(ograms)681 -3774 y(can)h(be)g(pr)o(e-compiled)g(to)h(byte-codes)e(and)i(dumped)f -(as)g(raw)-8 b(,)29 b(binary)e(heap)g(images.)681 3873 -y(W)-6 b(riting)27 b(heap)g(images)g(strips)g(out)g(unused)g(portions)h -(of)f(the)g(scsh)h(r)o(untime)f(\(such)g(as)681 3973 -y(the)19 b(compiler)-6 b(,)19 b(the)g(debugger)-6 b(,)18 -b(and)h(other)g(complex)g(subsystems\),)h(r)o(educing)e(memory)681 -4073 y(demands)25 b(and)g(saving)h(loading)g(and)f(compilation)h -(times.)40 b(The)26 b(heap)f(image)g(format)681 4172 -y(allows)k(for)f(an)g(initial)h FA(#!/usr/local/lib/)o(sc)o(sh)o(/sc)o -(sh)o(vm)22 b FD(trigger)28 b(on)h(the)g(\002rst)g(line)681 -4272 y(of)22 b(the)h(image,)f(making)h(heap)f(images)h(dir)o(ectly)e -(executable)h(as)g(another)g(kind)h(of)f(shell)681 4372 -y(script.)805 4500 y(Finally)-9 b(,)25 b(scsh's)f(static)g(linker)g -(system)g(allows)g(dumped)g(heap)f(images)h(to)g(be)f(com-)681 -4599 y(piled)c(to)g(a)g(raw)g(Unix)g(a.out\(5\))f(format,)h(which)h -(can)f(be)g(linked)h(into)g(the)f(text)g(section)h(of)681 -4699 y(the)h(vm)g(binary)-9 b(.)25 b(This)d(pr)o(oduces)e(a)g(tr)o(ue)h -(Unix)g(executable)f(binary)g(\002le.)27 b(Since)20 b(the)h(byte)681 -4799 y(codes)h(comprising)i(the)f(pr)o(ogram)f(ar)o(e)f(in)i(the)g -(\002le's)g(text)f(section,)i(they)f(ar)o(e)e(not)i(traced)681 -4898 y(or)g(copied)f(by)h(the)g(garbage)e(collector)-6 -b(,)24 b(do)e(not)i(occupy)f(space)f(in)h(the)g(vm's)g(heap,)f(and)2051 -5147 y(128)p eop -%%Page: 129 135 -129 134 bop 365 614 a FD(do)16 b(not)h(need)f(to)g(be)g(loaded)f(and)g -(linked)h(at)g(startup)g(time.)24 b(This)16 b(r)o(educes)f(the)h(pr)o -(ogram's)365 714 y(startup)21 b(time,)f(memory)i(r)o(equir)o(ements,)e -(and)g(paging)h(over)o(head.)490 854 y(This)g(chapter)f(will)i(cover)e -(these)h(various)g(ways)f(of)h(invoking)h(scsh)g(pr)o(ograms.)365 -1169 y Fy(9.1)99 b(Scsh)26 b(command-line)e(switches)365 -1403 y FD(When)f(the)g(scsh)g(top-level)g(starts)f(up,)h(it)g(scans)g -(the)g(command)g(line)g(for)f(switches)i(that)365 1503 -y(contr)o(ol)i(its)f(behaviour)-6 b(.)38 b(These)25 b(ar)o(guments)g -(ar)o(e)f(r)o(emoved)g(fr)o(om)h(the)g(command)g(line;)365 -1602 y(the)35 b(r)o(emaining)g(ar)o(guments)f(can)h(be)f(accessed)g(as) -g(the)h(value)f(of)h(the)g(scsh)g(variable)365 1702 y -FA(command-line-argu)o(me)o(nts)o FD(.)365 1992 y FB(9.1.1)81 -b(Scripts)20 b(and)g(programs)365 2194 y FD(The)e(scsh)f(command-line)h -(switches)g(pr)o(ovide)f(sophisticated)g(support)h(for)f(the)g(authors) -365 2294 y(of)29 b(shell)g(scripts)g(and)g(pr)o(ograms;)j(they)d(also)g -(allow)g(the)g(pr)o(ogrammer)e(to)j(write)e(pr)o(o-)365 -2393 y(grams)21 b(that)g(use)g(the)f(Scheme)h(48)f(module)h(system.)490 -2533 y(Ther)o(e)33 b(is)i(a)g(dif)o(fer)o(ence)d(between)i(a)g -FC(script)p FD(,)j(which)f(performs)e(its)h(action)g -FC(as)g(it)f(is)365 2633 y(loaded)p FD(,)f(and)e(a)f -FC(pr)o(ogram)p FD(,)i(which)g(is)g(loaded/linked,)h(and)e(then)h -(performs)f(its)g(action)365 2732 y(by)25 b(having)g(contr)o(ol)g -(transferr)o(ed)d(to)j(an)g(entry)g(point)g(\()p FC(e.g.)o -FD(,)g(the)g FA(main\(\))d FD(function)k(in)f(C)365 2832 -y(pr)o(ograms\))20 b(that)h(was)g(de\002ned)f(by)h(the)g(load/link)g -(operation.)490 2971 y(A)g FC(script)p FD(,)g(by)h(the)g(above)f -(de\002nition,)h(cannot)g(be)g(compiled)g(by)f(the)h(simple)g(mecha-) -365 3071 y(nism)j(of)e(loading)h(it)f(into)i(a)e(scsh)h(pr)o(ocess)e -(and)h(dumping)h(out)g(a)f(heap)g(image\227it)h(exe-)365 -3171 y(cutes)d(as)f(it)h(loads.)26 b(It)21 b(does)f(not)i(have)e(a)g -(top-level)h FA(main\(\))p FD(-type)d(entry)j(point.)490 -3310 y(It)f(is)h(mor)o(e)g(\003exible)f(and)g(useful)h(to)g(implement)g -(a)f(system)i(as)e(a)g(pr)o(ogram)g(than)h(as)f(a)365 -3410 y(script.)29 b(Pr)o(ograms)22 b(can)g(be)f(compiled)h -(straightforwar)o(dly;)g(they)g(can)g(also)g(export)f(pr)o(o-)365 -3509 y(cedural)h(interfaces)g(for)h(use)g(by)h(other)f(Scheme)g -(packages.)31 b(However)-6 b(,)23 b(scsh)h(supports)365 -3609 y(both)e(the)f(script)f(and)h(the)g(pr)o(ogram)f(style)h(of)f(pr)o -(ogramming.)365 3899 y FB(9.1.2)81 b(Inserting)20 b(interpreter)f -(triggers)h(into)g(scsh)g(programs)365 4101 y FD(When)g(Unix)g(tries)f -(to)h(execute)f(an)g(executable)g(\002le)g(whose)i(\002rst)f(16)e(bits) -i(ar)o(e)e(the)i(charac-)365 4201 y(ter)d(pair)g(\223)p -FA(#!)p FD(\224,)f(it)h(tr)o(eats)g(the)g(\002le)h(not)g(as)f -(machine-code)g(to)g(be)g(dir)o(ectly)g(executed)f(by)h(the)365 -4301 y(native)27 b(pr)o(ocessor)-6 b(,)28 b(but)f(as)f(sour)o(ce)h -(code)g(to)g(be)g(executed)e(by)i(some)h(interpr)o(eter)-6 -b(.)43 b(The)365 4400 y(interpr)o(eter)22 b(to)i(use)f(is)h -(speci\002ed)f(immediately)g(after)f(the)i(\223)p FA(#!)p -FD(\224)d(sequence)j(on)g(the)f(\002rst)365 4500 y(line)29 -b(of)f(the)g(sour)o(ce)g(\002le)g(\(along)g(with)h(one)f(optional)h -(initial)g(ar)o(gument\).)47 b(The)28 b(kernel)365 4599 -y(r)o(eads)20 b(in)i(the)g(name)f(of)h(the)g(interpr)o(eter)-6 -b(,)20 b(and)h(executes)f(that)i(instead.)27 b(The)22 -b(interpr)o(eter)365 4699 y(is)e(passed)f(the)g(sour)o(ce)g(\002lename) -g(as)g(its)h(\002rst)g(ar)o(gument,)e(with)j(the)e(original)h(ar)o -(guments)365 4799 y(following.)30 b(Consult)22 b(the)g(Unix)f(man)h -(page)f(for)g(the)g FA(exec)f FD(system)i(call)g(for)f(mor)o(e)g(infor) -o(-)365 4898 y(mation.)1735 5147 y(129)p eop -%%Page: 130 136 -130 135 bop 805 614 a FD(Scsh)30 b(allows)f(Scheme)g(pr)o(ograms)g(to)h -(have)f(these)g(triggers)g(placed)f(on)i(their)g(\002rst)681 -714 y(line.)48 b(Scsh)29 b(tr)o(eats)e(the)i(character)d(sequence)j -(\223)p FA(#!)p FD(\224)e(as)h(a)f(block-comment)j(sequence,)3512 -684 y Fs(1)681 814 y FD(and)41 b(skips)h(all)f(following)i(characters)d -(until)j(it)e(r)o(eads)f(the)i(comment-terminating)681 -913 y(sequence)33 b(newline/exclamation-point/sharp-sign/newline)k(\()p -FC(i.e.)o FD(,)f(the)e(sequence)681 1013 y(\223)p FA(!#)p -FD(\224)19 b(occurring)i(on)g(its)g(own)h(line\).)805 -1142 y(In)f(this)h(way)-9 b(,)20 b(the)h(pr)o(ogrammer)f(can)g(arrange) -g(for)g(an)h(initial)888 1341 y FA(#!/usr/local/bin/)o(sc)o(sh)37 -b(-s)888 1441 y(!#)681 1639 y FD(header)30 b(appearing)h(in)g(a)g -(Scheme)g(pr)o(ogram)g(to)h(be)f(ignor)o(ed)g(when)h(the)g(pr)o(ogram)f -(is)681 1739 y(loaded)20 b(into)h(scsh.)681 2002 y FB(9.1.3)81 -b(Module)19 b(system)681 2191 y FD(Scsh)e(uses)h(the)f(Scheme)g(48)g -(module)g(system,)i(which)f(de\002nes)g FC(packages)p -FD(,)e FC(structur)o(es)p FD(,)i(and)681 2291 y FC(interfaces)p -FD(.)681 2490 y FB(Package)39 b FD(A)25 b(package)g(is)g(an)h(envir)o -(onment\227that)g(is,)h(a)d(set)i(of)f(variable/value)f(bind-)888 -2589 y(ings.)h(Y)-8 b(ou)18 b(can)e(evaluate)f(Scheme)h(forms)g(inside) -h(a)f(package,)g(or)g(load)g(a)g(\002le)g(into)i(a)888 -2689 y(package.)24 b(Packages)17 b(export)g(sets)h(of)g(bindings;)i -(these)e(sets)g(ar)o(e)e(called)h FC(structur)o(es)p -FD(.)681 2861 y FB(Structure)40 b FD(A)20 b(str)o(uctur)o(e)g(is)g(a)g -(named)g(view)h(on)g(a)f(package\227a)f(set)h(of)h(bindings.)26 -b(Other)888 2961 y(packages)15 b(can)h FC(open)g FD(the)g(str)o(uctur)o -(e,)h(importing)g(its)f(bindings)h(into)g(their)f(envir)o(on-)888 -3061 y(ment.)28 b(Packages)21 b(can)g(pr)o(ovide)g(mor)o(e)g(than)h -(one)g(str)o(uctur)o(e,)f(r)o(evealing)f(dif)o(fer)o(ent)888 -3160 y(portions)i(of)f(the)g(package's)f(envir)o(onment.)681 -3332 y FB(Interface)40 b FD(An)28 b(interface)g(is)g(the)h -(\223type\224)e(of)i(a)f(str)o(uctur)o(e.)48 b(An)28 -b(interface)f(is)i(the)g(set)f(of)888 3432 y(names)i(exported)e(by)h(a) -g(str)o(uctur)o(e.)50 b(These)29 b(names)h(can)f(also)g(be)g(marked)f -(with)888 3532 y(other)22 b(static)f(information)h(\()p -FC(e.g.)o FD(,)g(advisory)f(type)g(declarations,)g(or)g(syntax)h(infor) -o(-)888 3631 y(mation\).)681 3830 y(Mor)o(e)c(information)i(on)f(the)h -(the)f(Scheme)f(48)g(module)i(system)g(can)e(be)h(found)g(in)h(the)f -(\002le)681 3930 y FA(module.ps)e FD(in)k(the)g FA(doc)e -FD(dir)o(ectory)h(of)h(the)g(Scheme)f(48)g(and)g(scsh)i(r)o(eleases.) -805 4059 y(Pr)o(ogramming)34 b(Scheme)e(with)i(a)e(module)h(system)h -(is)f(dif)o(fer)o(ent)e(fr)o(om)h(pr)o(ogram-)681 4159 -y(ming)19 b(in)g(older)f(Scheme)g(implementations,)i(and)e(the)g -(associated)g(development)g(pr)o(ob-)681 4258 y(lems)35 -b(ar)o(e)e(consequently)k(dif)o(fer)o(ent.)65 b(In)36 -b(Schemes)e(that)h(lack)g(modular)f(abstraction)681 4358 -y(mechanisms,)25 b(everything)g(is)g(accessible;)g(the)f(major)g(pr)o -(oblem)g(is)h(pr)o(eventing)e(name-)681 4458 y(space)e(con\003icts.)32 -b(In)23 b(Scheme)f(48,)g(name-space)f(con\003icts)j(vanish;)f(the)g -(major)f(pr)o(oblem)681 4557 y(is)29 b(that)g(not)g(all)g(bindings)g -(ar)o(e)e(accessible)i(fr)o(om)f(every)g(place.)49 b(It)28 -b(takes)h(a)f(little)h(extra)681 4657 y(work)21 b(to)g(specify)g(what)g -(packages)e(export)i(which)g(values.)p 681 4740 1146 -4 v 771 4796 a Fr(1)800 4819 y Fv(Why)c(a)g(block-comment)g(instead)f -(of)h(an)f(end-of-line)h(delimited)f(comment?)k(See)c(the)g(section)h -(on)g(meta-)681 4898 y(ar)o(gs.)2051 5147 y FD(130)p +128 133 bop 888 614 a FD(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 FA(\(run)42 +b(\(begin)f(\(repl\)\)\))888 991 y FD(.)12 b(.)g(.)g(or)-6 +b(,)21 b(r)o(ephrased)e(for)i(the)g(pr)o(oceduralists:)1071 +1130 y FA(\(wait)42 b(\(fork)f(repl\)\))2051 5147 y FD(128)p eop +%%Page: 129 135 +129 134 bop 365 1266 a Fz(Chapter)45 b(9)365 1709 y FE(Running)53 +b(scsh)365 2194 y FD(Scsh)23 b(is)g(curr)o(ently)f(implemented)h(on)h +(top)f(of)g(Scheme)f(48,)g(a)g(fr)o(eely-available)e(Scheme)365 +2293 y(implementation)i(written)f(by)f(Jonathan)g(Rees)h(and)f(Richar)o +(d)g(Kelsey)-9 b(.)25 b(Scheme)20 b(48)f(uses)365 2393 +y(a)33 b(byte-code)g(interpr)o(eter)f(for)h(good)h(code)g(density)-9 +b(,)36 b(portability)e(and)f(medium)h(ef)o(\002-)365 +2493 y(ciency)-9 b(.)26 b(It)20 b(is)i(R4RS.)e(It)h(also)g(has)g(a)f +(module)h(system)h(designed)e(by)h(Jonathan)g(Rees.)490 +2621 y(Scsh's)k(design)h(is)g(not)f(Scheme)g(48)g(speci\002c,)h +(although)g(the)f(curr)o(ent)g(implementa-)365 2720 y(tion)k(is)e +(necessarily)g(so.)46 b(Scsh)27 b(is)h(intended)f(to)h(be)f +(implementable)h(in)f(other)h(Scheme)365 2820 y(implementations.)37 +b(The)24 b(Scheme)g(48)f(virtual)h(machine)g(that)g(scsh)h(uses)g(is)f +(a)g(specially)365 2920 y(modi\002ed)k(version;)i(standar)o(d)c(Scheme) +g(48)g(virtual)h(machines)h(cannot)f(be)g(used)g(with)365 +3019 y(the)21 b(scsh)h(heap)e(image.)490 3147 y(Ther)o(e)37 +b(ar)o(e)f(several)h(dif)o(fer)o(ent)f(ways)i(to)h(invoke)f(scsh.)78 +b(Y)-8 b(ou)39 b(can)e(r)o(un)i(it)f(as)g(an)365 3247 +y(interactive)30 b(Scheme)g(system,)k(with)d(a)f(standar)o(d)f(r)o +(ead-eval-print)e(interaction)k(loop.)365 3347 y(Scsh)38 +b(can)f(also)h(be)f(invoked)h(as)f(the)g(interpr)o(eter)g(for)g(a)g +(shell)h(script)f(by)h(putting)g(a)365 3446 y(\223)p +FA(#!/usr/local/bin)o(/s)o(csh)f(-s)p FD(\224)19 b(line)i(at)g(the)g +(top)g(of)f(the)h(shell)h(script.)490 3575 y(Descending)h(a)g(level,)f +(it)i(is)f(also)g(possible)g(to)h(invoke)f(the)g(underlying)h(virtual)e +(ma-)365 3674 y(chine)k(byte-code)f(interpr)o(eter)g(dir)o(ectly)g(on)h +(dumped)f(heap)h(images.)40 b(Scsh)26 b(pr)o(ograms)365 +3774 y(can)i(be)f(pr)o(e-compiled)f(to)i(byte-codes)f(and)g(dumped)g +(as)g(raw)-8 b(,)29 b(binary)f(heap)f(images.)365 3873 +y(W)-6 b(riting)28 b(heap)e(images)h(strips)g(out)h(unused)f(portions)h +(of)f(the)g(scsh)g(r)o(untime)h(\(such)f(as)365 3973 +y(the)19 b(compiler)-6 b(,)20 b(the)f(debugger)-6 b(,)18 +b(and)g(other)i(complex)f(subsystems\),)h(r)o(educing)e(memory)365 +4073 y(demands)25 b(and)g(saving)h(loading)g(and)f(compilation)i +(times.)40 b(The)25 b(heap)g(image)h(format)365 4172 +y(allows)j(for)f(an)h(initial)g FA(#!/usr/local/li)o(b/s)o(cs)o(h/s)o +(cs)o(hvm)22 b FD(trigger)28 b(on)h(the)f(\002rst)h(line)365 +4272 y(of)23 b(the)f(image,)h(making)g(heap)f(images)g(dir)o(ectly)g +(executable)f(as)h(another)h(kind)g(of)f(shell)365 4372 +y(script.)490 4500 y(Finally)-9 b(,)24 b(scsh's)h(static)e(linker)h +(system)h(allows)f(dumped)f(heap)g(images)h(to)g(be)f(com-)365 +4599 y(piled)c(to)h(a)f(raw)g(Unix)g(a.out\(5\))e(format,)i(which)i +(can)e(be)g(linked)g(into)h(the)g(text)f(section)h(of)365 +4699 y(the)h(vm)g(binary)-9 b(.)26 b(This)21 b(pr)o(oduces)f(a)h(tr)o +(ue)g(Unix)g(executable)e(binary)i(\002le.)26 b(Since)21 +b(the)g(byte)365 4799 y(codes)i(comprising)h(the)e(pr)o(ogram)g(ar)o(e) +g(in)h(the)f(\002le's)h(text)g(section,)g(they)g(ar)o(e)e(not)j(traced) +365 4898 y(or)f(copied)g(by)f(the)h(garbage)f(collector)-6 +b(,)23 b(do)g(not)g(occupy)g(space)f(in)h(the)g(vm's)h(heap,)e(and)1735 +5147 y(129)p eop +%%Page: 130 136 +130 135 bop 681 614 a FD(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 Fy(9.1)99 b(Scsh)25 b(command-line)f(switches)681 +1403 y FD(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 +FA(command-line-arg)o(um)o(ent)o(s)p FD(.)681 1992 y +FB(9.1.1)81 b(Scripts)19 b(and)h(programs)681 2194 y +FD(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 FC(script)p FD(,)i(which)e(performs)g(its)g(action)g +FC(as)f(it)h(is)681 2633 y(loaded)p FD(,)d(and)f(a)g +FC(pr)o(ogram)p FD(,)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 FC(e.g.)n +FD(,)g(the)f FA(main\(\))d FD(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 FC(script)p FD(,)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 FA(main\(\))p FD(-type)e(entry)j(point.)805 +3310 y(It)g(is)g(mor)o(e)f(\003exible)h(and)f(useful)g(to)h(implement)h +(a)e(system)h(as)f(a)h(pr)o(ogram)e(than)i(as)g(a)681 +3410 y(script.)29 b(Pr)o(ograms)21 b(can)h(be)g(compiled)g +(straightforwar)o(dly;)f(they)h(can)g(also)g(export)g(pr)o(o-)681 +3509 y(cedural)g(interfaces)g(for)h(use)g(by)g(other)g(Scheme)g +(packages.)32 b(However)-6 b(,)23 b(scsh)h(supports)681 +3609 y(both)d(the)g(script)g(and)f(the)h(pr)o(ogram)f(style)h(of)g(pr)o +(ogramming.)681 3899 y FB(9.1.2)81 b(Inserting)19 b(interpreter)g +(triggers)h(into)g(scsh)g(programs)681 4101 y FD(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 +FA(#!)p FD(\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 FA(#!)p +FD(\224)f(sequence)h(on)h(the)g(\002rst)681 4500 y(line)k(of)g(the)h +(sour)o(ce)e(\002le)h(\(along)h(with)f(one)h(optional)g(initial)f(ar)o +(gument\).)47 b(The)28 b(kernel)681 4599 y(r)o(eads)20 +b(in)i(the)f(name)h(of)f(the)h(interpr)o(eter)-6 b(,)20 +b(and)h(executes)g(that)g(instead.)28 b(The)21 b(interpr)o(eter)681 +4699 y(is)e(passed)g(the)h(sour)o(ce)e(\002lename)i(as)f(its)g(\002rst) +h(ar)o(gument,)f(with)h(the)f(original)h(ar)o(guments)681 +4799 y(following.)29 b(Consult)22 b(the)g(Unix)g(man)f(page)g(for)g +(the)h FA(exec)e FD(system)i(call)f(for)g(mor)o(e)h(infor)o(-)681 +4898 y(mation.)2051 5147 y(130)p eop %%Page: 131 137 -131 136 bop 490 614 a FD(It)19 b(may)h(take)f(you)h(a)f(little)h(while) -h(to)f(get)f(used)h(to)g(the)f(new)h(style)g(of)g(pr)o(ogram)f(devel-) -365 714 y(opment.)26 b(Although)c(scsh)f(can)f(be)h(used)f(without)i(r) -o(eferring)d(to)i(the)g(module)g(system)g(at)365 814 -y(all,)k(we)g(r)o(ecommend)f(taking)h(the)f(time)h(to)g(learn)f(and)g -(use)h(it.)37 b(The)24 b(ef)o(fort)f(will)i(pay)f(of)o(f)365 -913 y(in)e(the)e(constr)o(uction)j(of)e(modular)-6 b(,)20 -b(factorable)f(pr)o(ograms.)365 1384 y FB(Module)h(warning)365 -1680 y FD(Pr)o(ogrammers)35 b(who)h(open)f(both)h(the)f -FA(scheme)e FD(and)i FA(scsh)e FD(str)o(uctur)o(es)i(in)g(their)h(own) -365 1780 y(packages)20 b(should)i(make)e(sur)o(e)g(to)h(always)g(put)g -(the)g FA(scsh)e FD(r)o(efer)o(ence)f(\002rst.)415 2192 -y(Do)j(this:)1185 b(Not)21 b(this:)498 2279 y FA(\(define-structure)37 -b(web-server)585 2344 y(\(open)42 b(scsh)847 2413 y(scheme)847 -2464 y(net-hax)847 2524 y(.)847 2557 y(.)847 2590 y(.)o(\))585 -2655 y(\(file)g(web\)\))1968 2279 y(\(define-structu)o(re)37 -b(web-server)2055 2344 y(\(open)k(scheme)2316 2413 y(scsh)2316 -2464 y(net-hax)2316 2524 y(.)2316 2557 y(.)2316 2590 -y(.\))2055 2655 y(\(file)g(web\)\))415 2755 y FD(Open)21 -b FA(scsh)e FD(befor)o(e)h FA(scheme)p FD(.)515 b(Not)21 -b FA(scsh)e FD(after)g FA(scheme)p FD(.)365 3088 y(Or)o(dering)24 -b(the)g(two)g(packages)f(like)h(this)h(is)f(necessary)f(because)g(scsh) -i(overrides)e(some)365 3187 y(of)c(the)h(standar)o(d)d(R4RS)j(Scheme)e -(de\002nitions)j(exported)d(by)i(the)f FA(scheme)e FD(package)h(with) -365 3287 y(its)30 b(own)h(de\002nitions.)54 b(For)30 -b(example,)h(scsh's)g(versions)f(of)g(the)g(R4RS)f(I/O)i(functions)365 -3387 y(such)25 b(as)f FA(display)e FD(and)h FA(write)g -FD(take)h(integer)g(\002le)g(descriptors)g(as)h(ar)o(guments,)f(as)g -(well)365 3486 y(as)j(Scheme)f(ports.)44 b(If)27 b(you)g(open)g(the)g -FA(scheme)d FD(str)o(uctur)o(e)j(befor)o(e)e(the)i FA(scsh)e -FD(str)o(uctur)o(e,)365 3586 y(you'll)d(get)f(the)g(standar)o(d)e -(Scheme)h(48)g(de\002nitions,)i(which)f(is)g(not)h(what)f(you)g(want.) -365 4057 y FB(9.1.4)81 b(Switches)365 4353 y FD(The)21 -b(scsh)g(top-level)g(takes)f(command-line)h(switches)h(in)f(the)g -(following)h(format:)573 4626 y FA(scsh)42 b([)p FC(meta-ar)o(g)n -FA(])h([)p FC(switch)1482 4638 y Fp(i)1553 4626 y FA(...])f([)p -FC(end-option)g(ar)o(g)2327 4653 y Fx(1)2408 4626 y FA(...)g -FC(ar)o(g)2691 4653 y Fp(n)2736 4626 y FA(])365 4898 -y FD(wher)o(e)1735 5147 y(131)p eop +131 136 bop 490 614 a FD(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.)49 b(Scsh)28 b(tr)o(eats)g(the)g(character)f(sequence)h +(\223)p FA(#!)p FD(\224)f(as)h(a)g(block-comment)h(sequence,)3196 +684 y Fs(1)365 814 y FD(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 +FC(i.e.)p FD(,)g(the)d(sequence)365 1013 y(\223)p FA(!#)p +FD(\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 FA(#!/usr/local/bin)o(/s)o(csh)37 +b(-s)573 1441 y(!#)365 1639 y FD(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 1739 y(loaded)20 b(into)i(scsh.)365 2002 y FB(9.1.3)81 +b(Module)20 b(system)365 2191 y FD(Scsh)e(uses)f(the)h(Scheme)f(48)f +(module)i(system,)g(which)h(de\002nes)e FC(packages)p +FD(,)g FC(structur)o(es)p FD(,)h(and)365 2291 y FC(interfaces)p +FD(.)365 2490 y FB(Package)40 b FD(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 +2589 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 +2689 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 FC(structur)o(es)p +FD(.)365 2861 y FB(Structure)40 b FD(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 2961 y(packages)15 b(can)h FC(open)g FD(the)g(str)o(uctur)o +(e,)g(importing)h(its)g(bindings)g(into)g(their)f(envir)o(on-)573 +3061 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 +3160 y(portions)h(of)e(the)h(package's)f(envir)o(onment.)365 +3332 y FB(Interface)40 b FD(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 3432 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 3532 y(other)21 b(static)h(information)g(\()p +FC(e.g.)o FD(,)f(advisory)g(type)h(declarations,)e(or)i(syntax)f(infor) +o(-)573 3631 y(mation\).)365 3830 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 3930 y FA(module.ps)e FD(in)22 b(the)e FA(doc)g +FD(dir)o(ectory)g(of)h(the)g(Scheme)f(48)g(and)g(scsh)h(r)o(eleases.) +490 4059 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 4159 +y(ming)20 b(in)e(older)g(Scheme)g(implementations,)i(and)e(the)h +(associated)e(development)h(pr)o(ob-)365 4258 y(lems)36 +b(ar)o(e)d(consequently)j(dif)o(fer)o(ent.)66 b(In)35 +b(Schemes)g(that)g(lack)f(modular)h(abstraction)365 4358 +y(mechanisms,)26 b(everything)f(is)f(accessible;)h(the)f(major)h(pr)o +(oblem)f(is)g(pr)o(eventing)g(name-)365 4458 y(space)e(con\003icts.)32 +b(In)22 b(Scheme)h(48,)e(name-space)g(con\003icts)j(vanish;)g(the)e +(major)h(pr)o(oblem)365 4557 y(is)29 b(that)g(not)g(all)g(bindings)h +(ar)o(e)d(accessible)h(fr)o(om)g(every)h(place.)48 b(It)29 +b(takes)f(a)g(little)i(extra)365 4657 y(work)22 b(to)f(specify)f(what)h +(packages)f(export)g(which)i(values.)p 365 4740 1146 +4 v 456 4796 a Fr(1)485 4819 y Fv(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.)1735 5147 y FD(131)p +eop %%Page: 132 138 -132 137 bop 938 692 a FC(meta-ar)o(g:)159 b FA(\\)21 -b FC(script-\002le-name)938 892 y(switch:)240 b FA(-e)20 -b FC(entry-point)405 b FD(Specify)20 b(top-level)g(entry-point.)1418 -991 y FA(-o)g FC(structur)o(e)480 b FD(Open)21 b(str)o(uctur)o(e)f(in)h -(curr)o(ent)f(package.)1418 1091 y FA(-m)g FC(structur)o(e)480 -b FD(Switch)21 b(to)g(package.)1418 1191 y FA(-n)f FC(new-package)362 -b FD(Switch)21 b(to)g(new)g(package.)1418 1390 y FA(-lm)f -FC(module-\002le-name)165 b FD(Load)20 b(module)h(into)h(con\002g)f -(package.)1418 1489 y FA(-l)f FC(\002le-name)482 b FD(Load)20 -b(\002le)h(into)g(curr)o(ent)f(package.)1418 1589 y FA(-dm)765 -b FD(Do)21 b(script)g(module.)1418 1689 y FA(-ds)765 -b FD(Do)21 b(script.)938 1888 y FC(end-option:)98 b FA(-s)20 -b FC(script)1418 1988 y FA(-sfd)f FC(num)1418 2087 y -FA(-c)h FC(exp)1418 2187 y FA(--)681 2354 y FD(These)29 -b(command-line)g(switches)h(essentially)f(pr)o(ovide)f(a)h(little)g -(linker)h(language)e(for)681 2453 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 2553 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 -2653 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 -2752 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 -2852 y(functionality)37 b(equivalent)g(to)g(the)f(interactive)g -FA(,open)e(,load)h(,in)g FD(and)h FA(,new)f FD(com-)681 -2951 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 3051 -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 3151 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 3250 y(str)o(uctur)o -(es.)805 3393 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 -3493 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 -3593 y(interactive)d(r)o(ead-eval-print)e(loop)j(is)g(started.)805 -3736 y(The)g(command-line)f(switch)h(pr)o(ocessor)f(works)h(in)g(two)g -(passes:)k(it)c(\002rst)f(parses)g(the)681 3836 y(switches,)26 -b(building)f(a)f(list)g(of)h(actions)g(to)f(perform,)h(then)g(the)f -(actions)h(ar)o(e)e(performed)681 3935 y(serially)-9 -b(.)48 b(The)28 b(switch)i(list)f(is)f(terminated)g(by)h(one)g(of)f -(the)h FC(end-option)e FD(switches.)49 b(The)681 4035 -y FC(ar)o(g)790 4062 y Fp(i)835 4035 y FD(ar)o(guments)18 -b(occurring)g(after)e(an)i(end-option)g(switch)h(ar)o(e)d(passed)h(to)i -(the)f(scsh)g(pr)o(o-)681 4134 y(gram)j(as)f(the)i(value)e(of)h -FA(command-line-argu)o(me)o(nts)14 b FD(and)21 b(the)g(tail)g(of)g(the) -h(list)f(r)o(eturned)681 4234 y(by)i FA(\(command-line\))p -FD(.)k(That)c(is,)h(an)f FC(end-option)f FD(switch)i(separates)e -(switches)i(that)f(con-)681 4334 y(tr)o(ol)30 b(the)g(scsh)h -(\223machine\224)f(fr)o(om)g(the)g(actual)g(ar)o(guments)g(being)h -(passed)e(to)i(the)f(scsh)681 4433 y(pr)o(ogram)20 b(that)h(r)o(uns)g -(on)g(that)g(machine.)805 4577 y(The)g(following)h(switches)g(and)e -(end)h(options)h(ar)o(e)d(de\002ned:)805 4799 y Fw(\017)41 -b FA(-o)i FC(struct)888 4898 y FD(Open)21 b(the)g(str)o(uctur)o(e)f(in) -i(the)f(curr)o(ent)f(package.)2051 5147 y(132)p eop +132 137 bop 805 614 a FD(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 1384 y FB(Module)f(warning)681 +1680 y FD(Pr)o(ogrammers)34 b(who)i(open)g(both)g(the)f +FA(scheme)d FD(and)j FA(scsh)f FD(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 FA(scsh)e FD(r)o(efer)o(ence)f(\002rst.)731 2192 +y(Do)j(this:)1184 b(Not)21 b(this:)814 2279 y FA(\(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 FD(Open)21 +b FA(scsh)e FD(befor)o(e)g FA(scheme)p FD(.)515 b(Not)21 +b FA(scsh)e FD(after)h FA(scheme)p FD(.)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 FA(scheme)e FD(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 FA(display)d FD(and)j FA(write)e +FD(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 +FA(scheme)d FD(str)o(uctur)o(e)i(befor)o(e)g(the)h FA(scsh)e +FD(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 FB(9.1.4)81 b(Switches)681 4353 y FD(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 FA(scsh)42 b([)p FC(meta-ar)o(g)n +FA(])h([)p FC(switch)1797 4638 y Fp(i)1868 4626 y FA(...])f([)p +FC(end-option)g(ar)o(g)2642 4653 y Fx(1)2723 4626 y FA(...)g +FC(ar)o(g)3007 4653 y Fp(n)3052 4626 y FA(])681 4898 +y FD(wher)o(e)2051 5147 y(132)p eop %%Page: 133 139 -133 138 bop 490 614 a Fw(\017)41 b FA(-n)i FC(package)573 -714 y FD(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 814 y(named)g -FC(package)f FD(with)i(an)f(empty)h(export)f(list.)26 -b(If)20 b FC(package)f FD(is)h(the)h(string)g(\223)p -FA(#f)p FD(\224,)d(the)573 913 y(new)j(package)f(is)h(anonmyous,)h -(with)f(no)h(associated)e(named)g(str)o(uctur)o(e.)573 -1044 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 1143 y(bindings.)f(Y)-8 -b(ou)18 b(must)g(follow)g(a)f(\223)p FA(-n)42 b(foo)p -FD(\224)16 b(switch)i(with)g(\223)p FA(-o)42 b(scheme)p -FD(\224)15 b(to)i(access)573 1243 y(the)k(standar)o(d)e(identi\002ers)i -(such)g(as)f FA(car)g FD(and)g FA(define)p FD(.)490 1404 -y Fw(\017)41 b FA(-m)i FC(struct)573 1503 y FD(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 FC(struct)p FD(.)573 1603 y(\(The)20 b FA(-m)g -FD(stands)h(for)f(\223module.\224\))490 1764 y Fw(\017)41 -b FA(-lm)h FC(module-\002le-name)573 1864 y FD(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 1963 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 2063 y(not)d(alter)f(the)h(curr)o(ent)f -(package.)490 2224 y Fw(\017)41 b FA(-l)i FC(\002le-name)573 -2323 y FD(Load)20 b(the)h(speci\002ed)f(\002le)h(into)h(the)f(curr)o -(ent)f(package.)490 2484 y Fw(\017)41 b FA(-c)i FC(exp)573 -2584 y FD(Evaluate)28 b(expr)o(ession)h FC(exp)f FD(in)i(the)f(curr)o -(ent)f(package)g(and)h(exit.)50 b(This)30 b(is)f(called)573 -2684 y FA(-c)c FD(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 2783 -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 FA(-m)p FD('s)g(and)573 2883 -y FA(-n)p FD('s.\))573 3013 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 -3113 y(takes)j FA("scsh")e FD(to)i(be)g(the)h(pr)o(ogram)e(name.)33 -b(This)24 b(switch)g(terminates)f(ar)o(gument)573 3212 -y(scanning;)e(following)h(ar)o(gs)e(become)h(the)g(tail)g(of)f(the)h -(command-line)g(list.)490 3373 y Fw(\017)41 b FA(-e)i -FC(entry-point)573 3473 y FD(Specify)27 b(an)h(entry)g(point)h(for)f(a) -g(pr)o(ogram.)47 b(The)28 b FC(entry-point)f FD(is)i(a)f(variable)f -(that)573 3573 y(is)i(taken)f(fr)o(om)h(the)f(curr)o(ent)g(package)g -(in)h(for)o(ce)e(at)i(the)f(end)h(of)f(switch)i(evalua-)573 -3672 y(tion.)43 b(The)26 b(entry)h(point)g(does)g(not)g(have)f(to)g(be) -g(exported)g(by)g(the)h(package)e(in)i(a)573 3772 y(str)o(uctur)o(e;)18 -b(it)g(can)g(be)g(internal)g(to)h(the)f(package.)23 b(The)c(top)f -(level)g(passes)g(contr)o(ol)g(to)573 3871 y(the)23 b(entry)g(point)g -(by)g(applying)g(it)g(to)g(the)g(command-line)h(list)f(\(so)g(pr)o -(ograms)f(ex-)573 3971 y(ecuting)d(in)h(private)e(packages)h(can)f(r)o -(efer)o(ence)f(their)i(command-line)h(ar)o(guments)573 -4071 y(without)25 b(opening)h(the)e FA(scsh)f FD(package)g(to)h(access) -g(the)g FA(\(command-line\))19 b FD(pr)o(oce-)573 4170 -y(dur)o(e\).)k(Note)d(that,)f(like)g(the)g(list)h(r)o(eturned)e(by)h -(the)g FA(\(command-line\))14 b FD(pr)o(ocedur)o(e,)573 -4270 y(the)20 b(list)h(passed)e(to)i(the)f(entry)h(point)f(includes)h -(the)f(name)g(of)g(the)h(pr)o(ogram)e(being)573 4370 -y(executed)28 b(\(as)g(the)h(\002rst)g(element)g(of)g(the)g(list\),)i -(not)f(just)f(the)g(ar)o(guments)g(to)g(the)573 4469 -y(pr)o(ogram.)573 4599 y(A)21 b FA(-e)f FD(switch)i(can)f(occur)g -(anywher)o(e)g(in)h(the)f(switch)h(list,)g(but)g(it)f(is)h(the)f -FC(last)g FD(action)573 4699 y(performed)j(by)i(switch)h(scanning)f(if) -f(it)h(occurs.)40 b(\(W)-8 b(e)26 b(violate)f(or)o(dering)g(her)o(e)g -(as)573 4799 y(the)30 b(shell-script)h FA(#!)e FD(mechanism)i(pr)o -(events)f(you)g(fr)o(om)g(putting)h(the)g FC(-e)f FD(switch)573 -4898 y(last,)20 b(wher)o(e)g(it)h(belongs.\))1735 5147 -y(133)p eop +133 138 bop 623 692 a FC(meta-ar)o(g:)159 b FA(\\)20 +b FC(script-\002le-name)623 892 y(switch:)240 b FA(-e)20 +b FC(entry-point)404 b FD(Specify)20 b(top-level)h(entry-point.)1103 +991 y FA(-o)f FC(structur)o(e)479 b FD(Open)21 b(str)o(uctur)o(e)f(in)i +(curr)o(ent)e(package.)1103 1091 y FA(-m)g FC(structur)o(e)479 +b FD(Switch)21 b(to)g(package.)1103 1191 y FA(-n)f FC(new-package)361 +b FD(Switch)21 b(to)g(new)g(package.)1103 1390 y FA(-lm)e +FC(module-\002le-name)165 b FD(Load)20 b(module)h(into)h(con\002g)g +(package.)1103 1489 y FA(-l)e FC(\002le-name)481 b FD(Load)20 +b(\002le)h(into)h(curr)o(ent)e(package.)1103 1589 y FA(-dm)764 +b FD(Do)22 b(script)e(module.)1103 1689 y FA(-ds)764 +b FD(Do)22 b(script.)623 1888 y FC(end-option:)98 b FA(-s)20 +b FC(script)1103 1988 y FA(-sfd)f FC(num)1103 2087 y +FA(-c)h FC(exp)1103 2187 y FA(--)365 2354 y FD(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 +FA(,open)e(,load)g(,in)i FD(and)g FA(,new)e FD(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 FC(end-option)f FD(switches.)50 b(The)365 4035 +y FC(ar)o(g)474 4062 y Fp(i)520 4035 y FD(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 4134 y(gram)j(as)g(the)g(value)g(of)g +FA(command-line-arg)o(um)o(ent)o(s)15 b FD(and)20 b(the)i(tail)f(of)g +(the)g(list)h(r)o(eturned)365 4234 y(by)i FA(\(command-line\))p +FD(.)j(That)c(is,)g(an)g FC(end-option)f FD(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 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 Fw(\017)41 +b FA(-o)i FC(struct)573 4898 y FD(Open)21 b(the)g(str)o(uctur)o(e)f(in) +h(the)g(curr)o(ent)f(package.)1735 5147 y(133)p eop %%Page: 134 140 -134 139 bop 805 614 a Fw(\017)41 b FA(-s)i FC(script)888 -714 y FD(Specify)29 b(a)g(\002le)g(to)h(load.)52 b(A)29 -b FA(-ds)f FD(\(do-script\))g(or)i FA(-dm)e FD(\(do-module\))h(switch)h -(oc-)888 814 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 913 -y(be)j(loaded.)46 b(If)27 b(ther)o(e)g(is)h(no)g FA(-ds)f -FD(or)h FA(-dm)e FD(switch,)k(then)f(the)f(script)f(is)h(loaded)f(at) -888 1013 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 1112 -y(switch)f(scanning.)888 1243 y(W)-8 b(e)17 b(use)f(the)h -FA(-ds)e FD(switch)i(to)g(violate)f(left-to-right)h(switch)g(execution) -f(or)o(der)g(as)g(the)888 1343 y FA(-s)h FD(switch)h(is)g -FC(r)o(equir)o(ed)g FD(to)f(be)h(last)f(\(because)f(of)h(the)h -FA(#!)f FD(machinery\),)g(independent)888 1443 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 1574 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 1673 -y(it)k(takes)e FC(script)h FD(to)g(be)g(the)g(pr)o(ogram)f(name.)59 -b(This)33 b(switch)f(terminates)g(switch)888 1773 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 1872 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 2035 y Fw(\017)41 b FA(-sfd)h FC(num)888 2134 -y FD(Loads)36 b(the)h(script)f(fr)o(om)g(\002le)h(descriptor)f -FC(num)o FD(.)73 b(This)37 b(switch)g(is)g(like)f(the)h -FA(-s)888 2234 y FD(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 -2333 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 -2433 y(input,)j(specify)g FA(-sfd)42 b(0)p FD(.)805 2595 -y Fw(\017)f FA(--)888 2695 y FD(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 -2794 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 FA(-s)e FD(or)888 2894 y -FA(--)k FD(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 2994 -y FA(command-line-argu)o(me)o(nts)28 b FD(list)35 b(\(for)e(example,)k -(simply)e(entering)g FA(scsh)e FD(at)h(a)888 3093 y(shell)22 -b(pr)o(ompt)e(with)i(no)f(ar)o(gs)f(at)g(all\).)888 3224 -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 3324 y(it)e(takes)f -FA("scsh")e FD(to)j(be)f(the)h(pr)o(ogram)f(name.)42 -b(This)27 b(switch)h(terminates)e(switch)888 3423 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 3523 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 3685 y Fw(\017)41 b FA(-ds)888 3785 y FD(Specify)28 -b(when)h(to)g(load)f(the)g(script)h(\(\223do-script\224\).)46 -b(If)28 b(this)h(switch)h(occurs,)g(the)888 3884 y(switch)23 -b(list)g FC(must)e FD(be)h(terminated)g(by)g(a)f FA(-s)43 -b FC(script)21 b FD(switch.)31 b(The)22 b(script)f(is)i(loaded)888 -3984 y(into)f(the)f(package)e(that)i(is)g(curr)o(ent)f(at)h(the)f -FA(-ds)g FD(switch.)805 4146 y Fw(\017)41 b FA(-dm)888 -4246 y FD(As)19 b(above,)f(but)g(the)h(curr)o(ent)e(module)i(is)g -(ignor)o(ed.)24 b(The)19 b(script)f(is)h(loaded)f(into)h(the)888 -4345 y FA(config)14 b FD(package)h(\(\223do-module\224\),)h(and)g -(hence)g(must)h(be)f(written)h(in)g(the)f(Scheme)888 -4445 y(48)31 b(module)i(language.)59 b(This)33 b(switch)g(doesn't)f(af) -o(fect)e(the)i(curr)o(ent)g(module\227)888 4545 y(after)26 -b(executing)i(this)g(switch,)h(the)f(curr)o(ent)e(module)i(is)g(the)f -(same)g(as)g(as)h(it)f(was)888 4644 y(befor)o(e.)888 -4775 y(This)17 b(switch)g(is)f(pr)o(ovided)f(to)i(make)e(it)i(easy)e -(to)i(write)f(shell)g(scripts)h(in)f(the)g(Scheme)888 -4875 y(48)k(module)h(language.)2051 5147 y(134)p eop +134 139 bop 805 614 a Fw(\017)41 b FA(-n)i FC(package)888 +714 y FD(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 FC(package)f FD(with)j(an)e(empty)g(export)g(list.)26 +b(If)20 b FC(package)f FD(is)i(the)f(string)i(\223)p +FA(#f)p FD(\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 FA(-n)42 b(foo)p +FD(\224)15 b(switch)j(with)g(\223)p FA(-o)43 b(scheme)p +FD(\224)14 b(to)k(access)888 1243 y(the)j(standar)o(d)e(identi\002ers)i +(such)g(as)g FA(car)e FD(and)i FA(define)p FD(.)805 1404 +y Fw(\017)41 b FA(-m)i FC(struct)888 1503 y FD(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 FC(struct)p FD(.)888 1603 y(\(The)21 b FA(-m)f +FD(stands)g(for)h(\223module.\224\))805 1764 y Fw(\017)41 +b FA(-lm)i FC(module-\002le-name)888 1864 y FD(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 Fw(\017)41 b FA(-l)i FC(\002le-name)888 +2323 y FD(Load)20 b(the)h(speci\002ed)g(\002le)g(into)g(the)g(curr)o +(ent)f(package.)805 2484 y Fw(\017)41 b FA(-c)i FC(exp)888 +2584 y FD(Evaluate)28 b(expr)o(ession)h FC(exp)f FD(in)i(the)f(curr)o +(ent)g(package)f(and)g(exit.)51 b(This)29 b(is)h(called)888 +2684 y FA(-c)c FD(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 FA(-m)p FD('s)e(and)888 2883 +y FA(-n)p FD('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 FA("scsh")e FD(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 Fw(\017)41 b FA(-e)i +FC(entry-point)888 3473 y FD(Specify)28 b(an)g(entry)g(point)h(for)f(a) +g(pr)o(ogram.)47 b(The)28 b FC(entry-point)f FD(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 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 FA(scsh)f FD(package)g(to)i(access) +e(the)i FA(\(command-line\))18 b FD(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 FA(\(command-line\))13 b FD(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 4469 +y(pr)o(ogram.)888 4599 y(A)21 b FA(-e)g FD(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 +FC(last)f FD(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 4799 y(the)31 b(shell-script)f FA(#!)g FD(mechanism)h(pr)o +(events)e(you)i(fr)o(om)f(putting)h(the)f FC(-e)g FD(switch)888 +4898 y(last,)21 b(wher)o(e)f(it)h(belongs.\))2051 5147 +y(134)p eop %%Page: 135 141 -135 140 bop 365 614 a FB(9.1.5)81 b(The)21 b(meta)e(argument)365 -809 y FD(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 908 -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 -1008 y(command-line)k(ar)o(gument)f(is)g(a)g(\223)p FA(\\)p -FD(\224)f(ar)o(gument,)h(followed)h(by)f(a)g(\002lename)g(ar)o(gument) -365 1108 y FC(fname)p FD(,)g(scsh)g(will)g(open)g(the)g(\002le)f -FC(fname)h FD(and)f(r)o(ead)e(mor)o(e)j(ar)o(guments)f(fr)o(om)g(the)g -(second)365 1207 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 -FA(\\)p FD(\224)f(ar)o(gument\227)365 1307 y FC(i.e.)p -FD(,)21 b(the)h(new)f(ar)o(guments)g(ar)o(e)f(inserted)h(in)h(fr)o(ont) -f(of)g FC(fname)p FD(,)h(and)e(the)i(ar)o(gument)f(parser)365 -1407 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 -FA(#!)365 1506 y FD(featur)o(e:)23 b(the)d FA(#!)f FD(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 1606 y(example,)k(we)f(might)i(hope)e(the)g -(following)i(scsh)f(script,)g FA(ekko)p FD(,)f(would)h(implement)g(a) -365 1705 y(simple-minded)21 b(version)g(of)g(the)g(Unix)g -FA(echo)e FD(pr)o(ogram:)573 1911 y FA(#!/usr/local/bin)o(/s)o(csh)37 -b(-e)43 b(main)e(-s)573 2011 y(!#)573 2110 y(\(define)g(\(main)g -(args\))660 2210 y(\(map)h(\()p Fo(\025)d FA(\(arg\))i(\(display)g -(arg\))g(\(display)g(")i("\)\))878 2310 y(\(cdr)f(args\)\))660 -2409 y(\(newline\)\))365 2615 y FD(The)21 b(idea)f(would)h(be)g(that)f -(the)h(command)573 2767 y FA(ekko)42 b(Hi)h(there.)365 -2919 y FD(would)22 b(by)e(expanded)g(by)h(the)f FA(exec\(2\))e -FD(kernel)j(call)f(into)573 3125 y FA(/usr/local/bin/s)o(cs)o(h)38 -b(-e)k(main)g(-s)h(ekko)f(Hi)h(there.)365 3331 y FD(In)18 -b(theory)-9 b(,)17 b(this)h(would)f(cause)g(scsh)g(to)g(start)g(up,)g -(load)g(in)g(\002le)g FA(ekko)p FD(,)f(call)h(the)g(entry)g(point)365 -3430 y(on)22 b(the)f(command-line)g(list)573 3583 y FA(\(main)41 -b('\("ekko")g("Hi")h("there."\)\))365 3735 y FD(and)21 -b(exit.)490 3868 y(Unfortunately)-9 b(,)34 b(the)e(Unix)f -FA(exec\(2\))e FD(syscall's)k(support)f(for)f(scripts)h(is)g(not)h -(very)365 3968 y(general)28 b(or)h(well-designed.)49 -b(It)28 b(will)h(not)h(handle)e(multiple)h(ar)o(guments;)j(the)c -FA(#!)g FD(line)365 4068 y(is)g(usually)g(r)o(equir)o(ed)e(to)i -(contain)g(no)h(mor)o(e)e(than)h(32)e(characters;)k(it)e(is)g(not)g(r)o -(ecursive.)365 4167 y(If)c(these)h(r)o(estrictions)f(ar)o(e)f -(violated,)i(most)g(Unix)f(systems)i(will)f(not)g(pr)o(ovide)e -(accurate)365 4267 y(err)o(or)d(r)o(eporting,)g(but)h(either)f(fail)g -(silently)-9 b(,)22 b(or)e(simply)i(incorr)o(ectly)e(implement)i(the)e -(de-)365 4366 y(sir)o(ed)g(functionality)-9 b(.)26 b(These)21 -b(ar)o(e)e(the)i(facts)f(of)h(Unix)g(life.)490 4500 y(In)k(the)g -FA(ekko)e FD(example)h(above,)h(our)g FA(#!)f FD(trigger)h(line)g(has)g -(thr)o(ee)f(ar)o(guments)h(\(\223)p FA(-e)p FD(\224,)365 -4599 y(\223)p FA(main)p FD(\224,)i(and)h(\223)p FA(-s)p -FD(\224\),)f(so)i(it)f(will)h(not)g(work.)48 b(The)28 -b(meta-ar)o(gument)f(is)h(how)h(we)f(work)365 4699 y(ar)o(ound)18 -b(this)i(pr)o(oblem.)k(W)-8 b(e)19 b(must)g(instead)g(invoke)g(the)g -(scsh)g(interpr)o(eter)f(with)h(the)g(sin-)365 4799 y(gle)k -FA(\\)f FD(ar)o(gument,)f(and)h(put)h(the)f(r)o(est)g(of)g(the)g(ar)o -(guments)g(on)h(line)g(two)g(of)f(the)h(pr)o(ogram.)365 -4898 y(Her)o(e's)d(the)h(corr)o(ect)f(pr)o(ogram:)1735 -5147 y(135)p eop +135 140 bop 490 614 a Fw(\017)41 b FA(-s)i FC(script)573 +714 y FD(Specify)28 b(a)h(\002le)h(to)g(load.)51 b(A)29 +b FA(-ds)f FD(\(do-script\))h(or)g FA(-dm)g FD(\(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 +FA(-ds)e FD(or)i FA(-dm)f FD(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 +FA(-ds)g FD(switch)h(to)g(violate)f(left-to-right)g(switch)h(execution) +g(or)o(der)e(as)h(the)573 1343 y FA(-s)g FD(switch)j(is)e +FC(r)o(equir)o(ed)h FD(to)g(be)f(last)g(\(because)g(of)g(the)g +FA(#!)g FD(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 FC(script)f FD(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 Fw(\017)41 b FA(-sfd)h FC(num)573 2134 y FD(Loads)36 +b(the)g(script)h(fr)o(om)f(\002le)g(descriptor)g FC(num)p +FD(.)72 b(This)37 b(switch)g(is)g(like)g(the)f FA(-s)573 +2234 y FD(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 FA(-sfd)42 b(0)p FD(.)490 2595 +y Fw(\017)f FA(--)573 2695 y FD(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 FA(-s)f FD(or)573 2894 y +FA(--)j FD(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 FA(command-line-arg)o(um)o(ent)o(s)28 b FD(list)35 +b(\(for)f(example,)j(simply)e(entering)f FA(scsh)f FD(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 +FA("scsh")e FD(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 Fw(\017)41 b FA(-ds)573 3785 y FD(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 FC(must)g FD(be)g(terminated)f(by)h(a)g FA(-s)42 +b FC(script)22 b FD(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 +FA(-ds)f FD(switch.)490 4146 y Fw(\017)41 b FA(-dm)573 +4246 y FD(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 +4345 y FA(config)14 b FD(package)h(\(\223do-module\224\),)g(and)h +(hence)h(must)g(be)f(written)h(in)f(the)h(Scheme)573 +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 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 +4875 y(48)k(module)h(language.)1735 5147 y(135)p eop %%Page: 136 142 -136 141 bop 888 614 a FA(#!/usr/local/bin/)o(sc)o(sh)37 -b(\\)888 714 y(-e)43 b(main)f(-s)888 814 y(!#)888 913 -y(\(define)f(\(main)h(args\))976 1013 y(\(map)f(\()p -Fo(\025)e FA(\(arg\))j(\(display)e(arg\))i(\(display)e(")j("\)\))1193 -1112 y(\(cdr)f(args\)\))976 1212 y(\(newline\)\))681 -1429 y FD(Now)-8 b(,)21 b(the)g(invocation)h(starts)e(as)888 -1591 y FA(ekko)42 b(Hi)h(there.)681 1754 y FD(and)20 -b(is)h(expanded)f(by)g(exec\(2\))f(into)888 1970 y FA -(/usr/local/bin/sc)o(sh)37 b(\\)43 b(ekko)f(Hi)h(there.)681 -2187 y FD(When)17 b(scsh)g(starts)g(up,)g(it)g(expands)f(the)g(\223)p -FA(\\)p FD(\224)g(ar)o(gument)g(into)h(the)g(ar)o(guments)f(r)o(ead)f -(fr)o(om)681 2286 y(line)21 b(two)g(of)g FA(ekko)p FD(,)e(pr)o(oducing) -h(this)i(ar)o(gument)e(list:)888 2503 y FA(-e)43 b(main)f(-s)h(ekko)p -888 2516 654 4 v 42 w(Hi)f(there.)1237 2603 y Fw(")888 -2702 y FD(Expanded)20 b(fr)o(om)43 b FA(\\)g(ekko)681 -2919 y FD(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 3209 y FB(Secondary)e(argument)g -(syntax)681 3412 y FD(Scsh)g(uses)h(a)f(very)h(simple)g(grammar)f(to)h -(encode)f(the)h(extra)e(ar)o(guments)i(on)g(the)g(second)681 -3512 y(line)j(of)f(the)h(scsh)g(script.)31 b(The)23 b(only)g(special)f -(characters)g(ar)o(e)f(space,)h(tab,)g(newline,)h(and)681 -3611 y(backslash.)805 3828 y Fw(\017)41 b FD(Each)e(space)g(character)f -(terminates)i(an)f(ar)o(gument.)82 b(This)40 b(means)g(that)f(two)888 -3928 y(spaces)21 b(in)g(a)f(r)o(ow)h(intr)o(oduce)f(an)h(empty-string)g -(ar)o(gument.)805 4114 y Fw(\017)41 b FD(The)19 b(tab)f(character)e(is) -j(not)g(permitted)f(\(unless)h(you)g(quote)g(it)g(with)g(the)f -(backslash)888 4214 y(character)26 b(described)h(below\).)46 -b(This)28 b(is)g(to)g(pr)o(event)e(the)i(insidious)h(bug)f(wher)o(e)888 -4313 y(you)20 b(believe)e(you)i(have)f(six)g(space)f(characters,)g(but) -h(you)h(r)o(eally)e(have)g(a)h(tab)f(char)o(-)888 4413 -y(acter)-6 b(,)20 b(and)g FC(vice-versa)p FD(.)805 4599 -y Fw(\017)41 b FD(The)25 b(newline)h(character)d(terminates)i(an)g(ar)o -(gument,)g(like)g(the)g(space)f(character)-6 b(,)888 -4699 y(and)27 b(also)g(terminates)f(the)h(ar)o(gument)g(sequence.)43 -b(This)28 b(means)f(that)f(an)h(empty)888 4799 y(line)i(parses)f(to)h -(the)f(singleton)i(list)f(whose)g(one)g(element)g(is)f(the)h(empty)g -(string:)888 4898 y FA(\(""\))p FD(.)24 b(The)d(grammar)f(doesn't)h -(admit)g(the)g(empty)g(list.)2051 5147 y(136)p eop +136 141 bop 681 614 a FB(9.1.5)81 b(The)20 b(meta)f(argument)681 +809 y FD(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 FA(\\)p +FD(\224)e(ar)o(gument,)j(followed)f(by)g(a)g(\002lename)h(ar)o(gument) +681 1108 y FC(fname)p FD(,)e(scsh)h(will)h(open)e(the)h(\002le)g +FC(fname)f FD(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 +FA(\\)p FD(\224)f(ar)o(gument\227)681 1307 y FC(i.e.)p +FD(,)21 b(the)g(new)h(ar)o(guments)f(ar)o(e)f(inserted)h(in)h(fr)o(ont) +f(of)g FC(fname)p FD(,)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 +FA(#!)681 1506 y FD(featur)o(e:)23 b(the)c FA(#!)g FD(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 FA(ekko)p FD(,)f(would)h(implement)g(a) +681 1705 y(simple-minded)21 b(version)g(of)g(the)g(Unix)f +FA(echo)f FD(pr)o(ogram:)888 1911 y FA(#!/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 Fo(\025)e FA(\(arg\))j(\(display)e +(arg\))i(\(display)e(")j("\)\))1193 2310 y(\(cdr)f(args\)\))976 +2409 y(\(newline\)\))681 2615 y FD(The)21 b(idea)e(would)j(be)e(that)h +(the)g(command)888 2767 y FA(ekko)42 b(Hi)h(there.)681 +2919 y FD(would)21 b(by)g(expanded)e(by)i(the)g FA(exec\(2\))d +FD(kernel)i(call)h(into)888 3125 y FA(/usr/local/bin/sc)o(sh)37 +b(-e)43 b(main)f(-s)h(ekko)e(Hi)i(there.)681 3331 y FD(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 FA(ekko)p FD(,)f(call)g(the)h(entry)g(point)681 +3430 y(on)k(the)g(command-line)g(list)888 3583 y FA(\(main)42 +b('\("ekko")e("Hi")i("there."\)\))681 3735 y FD(and)20 +b(exit.)805 3868 y(Unfortunately)-9 b(,)34 b(the)e(Unix)g +FA(exec\(2\))d FD(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 +FA(#!)f FD(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 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 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 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 +FA(ekko)f FD(example)g(above,)h(our)g FA(#!)f FD(trigger)h(line)g(has)g +(thr)o(ee)f(ar)o(guments)g(\(\223)p FA(-e)p FD(\224,)681 +4599 y(\223)p FA(main)p FD(\224,)j(and)g(\223)p FA(-s)p +FD(\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 4799 y(gle)j +FA(\\)g FD(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 +4898 y(Her)o(e's)e(the)h(corr)o(ect)e(pr)o(ogram:)2051 +5147 y(136)p eop %%Page: 137 143 -137 142 bop 490 614 a Fw(\017)41 b FD(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 714 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 -814 y(ing)i(them)g(to)g(be)g(included)f(in)h(ar)o(guments.)58 -b(The)34 b(A)t Fv(N)t(S)t(I)g FD(C)d(escape)g(sequences)573 -913 y(\()p FA(\\b)p FD(,)36 b FA(\\n)p FD(,)g FA(\\r)c -FD(and)i FA(\\t)p FD(\))e(ar)o(e)h(also)h(supported;)40 -b(these)34 b(also)g(pr)o(oduce)e(ar)o(gument-)573 1013 -y(constituents\227)p FA(\\n)27 b FD(doesn't)h(act)e(like)h(a)g -(terminating)g(newline.)45 b(The)27 b(escape)f(se-)573 -1112 y(quence)31 b FA(\\)p FC(nnn)f FD(for)h FC(exactly)e -FD(thr)o(ee)h(octal)g(digits)h(r)o(eads)f(as)g(the)h(character)e(whose) -575 1212 y(A)t Fv(S)t(C)t(I)t(I)21 b FD(code)d(is)g FC(nnn)p -FD(.)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 1312 y(octal)26 b(digits:)36 -b FA(\\3Q)24 b FD(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 -1411 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 1511 y(escape-code)19 -b(space)h(later)g(if)h(we)f(like\).)490 1722 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 -1822 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 -1921 y(empty-string)g(ar)o(guments.)j(Her)o(e's)20 b(an)g(example:)573 -2079 y FA(#!/bin/interpret)o(er)37 b(\\)573 2178 y(foo)42 -b(bar)86 b(quux\\)42 b(yow)365 2336 y FD(would)22 b(pr)o(oduce)d(the)i -(ar)o(guments)573 2493 y FA(\("foo")41 b("bar")g("")i("quux)f(yow"\)) -365 2775 y FB(9.1.6)81 b(Examples)490 2974 y Fw(\017)41 -b FA(scsh)h(-dm)g(-m)h(myprog)e(-e)i(top)f(-s)h(myprog.scm)573 -3074 y FD(Load)18 b FA(myprog.scm)d FD(into)20 b(the)g -FA(config)c FD(package,)j(then)g(shift)h(to)f(the)h FA(myprog)c -FD(pack-)573 3173 y(age)25 b(and)g(call)h FA(\(top)42 -b('\("myprog.scm"\)\))o FD(,)21 b(then)26 b(exit.)40 -b(This)27 b(sort)f(of)g(invocation)573 3273 y(is)21 b(typically)g(used) -f(in)i FA(#!)e FD(script)g(lines)i(\(see)e(below\).)490 -3455 y Fw(\017)41 b FA(scsh)h(-c)h('\(display)c("Hello,)i(world."\)') -573 3555 y FD(A)20 b(simple)h(pr)o(ogram.)490 3737 y -Fw(\017)41 b FA(scsh)h(-o)h(bigscheme)573 3837 y FD(Start)52 -b(up)h(interactively)g(in)h(the)f(user)g(package)f(after)g(opening)i -(str)o(uctur)o(e)573 3936 y FA(bigscheme)p FD(.)490 4118 -y Fw(\017)41 b FA(scsh)h(-o)h(bigscheme)c(--)k(Three)f(args)g(passed) -573 4218 y FD(Start)23 b(up)i(interactively)f(in)g(the)h(user)f -(package)f(after)h(opening)h FA(bigscheme)p FD(.)33 b(The)573 -4318 y FA(command-line-arg)o(s)e FD(variable)37 b(in)h(the)g(scsh)g -(package)e(is)i(bound)g(to)g(the)g(list)573 4417 y FA(\("Three")i -("args")h("passed"\))p FD(,)h(and)d(the)i FA(\(command-line\))34 -b FD(pr)o(ocedur)o(e)39 b(r)o(e-)573 4517 y(turns)21 -b(the)g(list)g FA(\("scsh")41 b("Three")g("args")g("passed"\))p -FD(.)490 4699 y Fw(\017)g FD(Pr)o(ogram)20 b FA(ekko)573 -4799 y FD(This)h(shell)f(script,)g(called)g FA(ekko)p -FD(,)e(implements)j(a)f(version)g(of)h(the)f(Unix)g FA(echo)e -FD(pr)o(o-)573 4898 y(gram:)1735 5147 y(137)p eop +137 142 bop 573 614 a FA(#!/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 +Fo(\025)d FA(\(arg\))i(\(display)g(arg\))g(\(display)g(")i("\)\))878 +1112 y(\(cdr)f(args\)\))660 1212 y(\(newline\)\))365 +1429 y FD(Now)-8 b(,)22 b(the)f(invocation)g(starts)g(as)573 +1591 y FA(ekko)42 b(Hi)h(there.)365 1754 y FD(and)21 +b(is)g(expanded)e(by)i(exec\(2\))e(into)573 1970 y FA(/usr/local/bin/s) +o(cs)o(h)38 b(\\)43 b(ekko)f(Hi)g(there.)365 2187 y FD(When)17 +b(scsh)h(starts)e(up,)h(it)g(expands)f(the)h(\223)p FA(\\)p +FD(\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 FA(ekko)p FD(,)d(pr)o(oducing)j(this)g +(ar)o(gument)g(list:)573 2503 y FA(-e)43 b(main)f(-s)g(ekko)p +573 2516 654 4 v 42 w(Hi)h(there.)922 2603 y Fw(")573 +2702 y FD(Expanded)19 b(fr)o(om)43 b FA(\\)g(ekko)365 +2919 y FD(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 FB(Secondary)f(argument)f +(syntax)365 3412 y FD(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 Fw(\017)41 b FD(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 Fw(\017)41 b FD(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 +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 FC(vice-versa)p FD(.)490 4599 +y Fw(\017)41 b FD(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 +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 4898 y FA(\(""\))p FD(.)c(The)c(grammar)h(doesn't)g(admit) +f(the)h(empty)g(list.)1735 5147 y(137)p eop %%Page: 138 144 -138 143 bop 1071 614 a FA(#!/usr/local/bin)o(/sc)o(sh)37 -b(-s)1071 714 y(!#)1071 814 y(\(for-each)j(\()p Fo(\025)f -FA(\(arg\))i(\(display)f(arg\))i(\(display)f(")i("\)\))1507 -913 y(command-line-arg)o(s\))888 1207 y FD(Note)22 b(this)g(short)f(pr) -o(ogram)g(is)g(an)g(example)g(of)g(a)g FC(script)p FD(\227it)g -(executes)f(as)h(it)g(loads.)888 1307 y(The)g(Unix)g(r)o(ule)g(for)f -(executing)h FA(#!)f FD(shell)h(scripts)g(causes)1071 -1520 y FA(ekko)42 b(Hello,)f(world.)888 1732 y FD(to)21 -b(expand)f(as)1071 1945 y FA(/usr/local/bin/s)o(csh)37 -b(-s)42 b(ekko)g(Hello,)g(world.)805 2223 y Fw(\017)f -FD(Pr)o(ogram)21 b FA(ekko)888 2322 y FD(This)30 b(is)f(the)g(same)g -(pr)o(ogram,)h FC(not)e FD(as)h(a)f(script.)50 b(W)-6 -b(riting)29 b(it)h(this)f(way)g(makes)g(it)888 2422 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 2522 y(heap)h(image\).)1071 -2751 y FA(#!/usr/local/bin)o(/sc)o(sh)37 b(\\)1071 2850 -y(-e)43 b(top)f(-s)1071 2950 y(!#)1071 3050 y(\(define)f(\(top)h -(args\))1158 3149 y(\(for-each)e(\()p Fo(\025)f FA(\(arg\))i(\(display) -g(arg\))h(\(display)e(")j("\)\))1594 3249 y(\(cdr)f(args\)\)\))888 -3478 y FD(The)28 b FA(exec\(2\))d FD(expansion)j(of)f(the)h -FA(#!)f FD(line)h(together)g(with)h(the)e(scsh)i(expansion)888 -3578 y(of)34 b(the)g(\223)p FA(\\)42 b(ekko)p FD(\224)32 -b(meta-ar)o(gument)g(\(see)h(section)i(9.1.5\))c(gives)j(the)g -(following)888 3678 y(command-line)22 b(expansion:)1071 -3907 y FA(ekko)42 b(Hello,)f(world.)1245 4006 y Fn(=)-14 -b Fw(\))87 b FA(/usr/local/bin/sc)o(sh)37 b(\\)43 b(ekko)391 -b(Hello,)41 b(world.)1245 4106 y Fn(=)-14 b Fw(\))87 -b FA(/usr/local/bin/sc)o(sh)37 b(-e)43 b(top)f(-s)h(ekko)f(Hello,)f -(world.)805 4400 y Fw(\017)g FD(Pr)o(ogram)21 b FA(sort)888 -4500 y FD(This)c(is)g(a)e(pr)o(ogram)h(to)h(r)o(eplace)d(the)i(Unix)g -FA(sort)f FD(utility\227sorting)j(lines)f(r)o(ead)d(fr)o(om)888 -4599 y(stdin,)28 b(and)e(printing)h(the)f(r)o(esults)g(on)h(stdout.)42 -b(Note)27 b(that)f(the)g(sour)o(ce)g(code)g(de-)888 4699 -y(\002nes)f(a)f(general)g(sorting)i(package,)e(which)h(is)g(useful)f -(\(1\))f(as)i(a)f(Scheme)g(module)888 4799 y(exporting)f(sort)h(pr)o -(ocedur)o(es)d(to)i(other)g(Scheme)f(code,)h(and)g(\(2\))e(as)i(a)f -(standalone)888 4898 y(pr)o(ogram)e(invoked)i(fr)o(om)e(the)h -FA(top)e FD(pr)o(ocedur)o(e.)2051 5147 y(138)p eop +138 143 bop 805 614 a Fw(\017)41 b FD(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 Fv(N)t(S)t(I)h FD(C)e(escape)f(sequences)888 +913 y(\()p FA(\\b)p FD(,)36 b FA(\\n)p FD(,)g FA(\\r)d +FD(and)g FA(\\t)p FD(\))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 FA(\\n)28 b FD(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 FA(\\)p FC(nnn)g FD(for)f FC(exactly)g +FD(thr)o(ee)f(octal)i(digits)g(r)o(eads)e(as)h(the)h(character)e(whose) +890 1212 y(A)t Fv(S)t(C)t(I)t(I)21 b FD(code)d(is)h FC(nnn)p +FD(.)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 FA(\\3Q)25 b FD(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 FA(#!/bin/interprete)o(r)37 b(\\)888 2178 y(foo)43 +b(bar)86 b(quux\\)41 b(yow)681 2336 y FD(would)21 b(pr)o(oduce)f(the)h +(ar)o(guments)888 2493 y FA(\("foo")41 b("bar")h("")h("quux)e(yow"\)) +681 2775 y FB(9.1.6)81 b(Examples)805 2974 y Fw(\017)41 +b FA(scsh)h(-dm)h(-m)f(myprog)f(-e)i(top)g(-s)f(myprog.scm)888 +3074 y FD(Load)19 b FA(myprog.scm)c FD(into)20 b(the)f +FA(config)e FD(package,)h(then)i(shift)f(to)h(the)f FA(myprog)e +FD(pack-)888 3173 y(age)26 b(and)f(call)g FA(\(top)42 +b('\("myprog.scm"\)\))p FD(,)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 FA(#!)f FD(script)h(lines)g(\(see)f(below\).)805 +3455 y Fw(\017)41 b FA(scsh)h(-c)h('\(display)d("Hello,)h(world."\)') +888 3555 y FD(A)21 b(simple)g(pr)o(ogram.)805 3737 y +Fw(\017)41 b FA(scsh)h(-o)h(bigscheme)888 3837 y FD(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 FA(bigscheme)p FD(.)805 4118 +y Fw(\017)41 b FA(scsh)h(-o)h(bigscheme)d(--)j(Three)e(args)h(passed) +888 4218 y FD(Start)24 b(up)g(interactively)g(in)h(the)g(user)f +(package)f(after)g(opening)i FA(bigscheme)p FD(.)33 b(The)888 +4318 y FA(command-line-args)e FD(variable)36 b(in)i(the)g(scsh)g +(package)f(is)h(bound)g(to)g(the)f(list)888 4417 y FA(\("Three")k +("args")g("passed"\))p FD(,)g(and)f(the)g FA(\(command-line\))35 +b FD(pr)o(ocedur)o(e)j(r)o(e-)888 4517 y(turns)22 b(the)e(list)i +FA(\("scsh")40 b("Three")h("args")g("passed"\))p FD(.)805 +4699 y Fw(\017)g FD(Pr)o(ogram)21 b FA(ekko)888 4799 +y FD(This)g(shell)g(script,)f(called)f FA(ekko)p FD(,)g(implements)i(a) +e(version)i(of)f(the)g(Unix)g FA(echo)f FD(pr)o(o-)888 +4898 y(gram:)2051 5147 y(138)p eop %%Page: 139 145 139 144 bop 756 614 a FA(#!/usr/local/bi)o(n/)o(scs)o(h)37 -b(\\)756 714 y(-dm)42 b(-m)h(sort-toplevel)38 b(-e)43 -b(top)f(-s)756 814 y(!#)756 1013 y(;;;)g(This)g(is)h(a)g(sorting)d -(module.)h(TOP)h(procedure)e(exports)756 1112 y(;;;)i(the)g -(functionality)c(as)43 b(a)g(Unix)f(program)f(akin)h(to)h(sort\(1\).) -756 1212 y(\(define-structu)o(re)o(s)38 b(\(\(sort-struct)g(\(export)j -(sort-list)2543 1312 y(sort-vector!\)\))1627 1411 y(\(sort-toplevel)d -(\(export)j(top\)\)\))843 1511 y(\(open)g(scheme\))843 -1710 y(\(begin)g(\(define)f(\(sort-list)g(elts)i(<=\))g(...\))1148 -1810 y(\(define)e(\(sort-vec!)g(vec)i(<=\))86 b(...\))1148 -2009 y(;;)43 b(Parse)e(the)h(command)f(line)h(and)1148 -2109 y(;;)h(sort)e(stdin)h(to)h(stdout.)1148 2208 y(\(define)d(\(top)i -(args\))1279 2308 y(...\)\)\))573 2491 y FD(The)18 b(expansion)g(below) -h(shows)h(how)f(the)f(command-line)g(scanner)g(\(1\))f(loads)h(the)573 -2583 y(con\002g)i(\002le)f FA(sort)f FD(\(written)h(in)h(the)f(Scheme)g -(48)f(module)h(language\),)g(\(2\))f(switches)573 2674 -y(to)32 b(the)h(package)e(underlying)h(the)g FA(sort-toplevel)27 -b FD(str)o(uctur)o(e,)34 b(\(3\))d(calls)h FA(\(top)573 -2765 y('\("sort")40 b("foo")i("bar"\)\))18 b FD(in)j(the)g(package,)e -(and)h(\002nally)i(\(4\))d(exits.)573 2997 y Fh(sort)40 -b(foo)g(bar)573 3089 y Fb(=)-13 b Fa(\))78 b Fh(/usr/local/bin/scsh)44 -b(\\)39 b(sort)1178 b(foo)40 b(bar)573 3180 y Fb(=)-13 -b Fa(\))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 3352 y FD(An)21 -b(alternate)e(method)i(would)h(have)e(used)h(a)756 3513 -y FA(-n)42 b(#f)h(-o)g(sort-toplevel)573 3674 y FD(sequence)21 -b(of)g(switches)g(to)g(specify)g(a)f(top-level)g(package.)490 -3869 y(Note)e(that)g(the)g(sort)g(example)f(can)h(be)f(compiled)h(into) -h(a)e(Unix)h(pr)o(ogram)f(by)h(loading)365 3969 y(the)25 -b(\002le)g(into)h(an)f(scsh)h(pr)o(ocess,)f(and)f(dumping)i(a)e(heap)h -(with)h(top-level)e FA(top)p FD(.)37 b(Even)25 b(if)365 -4068 y(we)19 b(don't)g(want)g(to)g(export)f(the)g(sort's)i -(functionality)f(as)f(a)g(subr)o(outine)h(library)-9 -b(,)18 b(it)h(is)g(still)365 4168 y(useful)f(to)h(write)f(the)h(sort)f -(pr)o(ogram)g(with)h(the)f(module)h(language.)24 b(The)19 -b(command)f(line)365 4267 y(design)23 b(allows)g(us)g(to)g(r)o(un)g -(this)h(pr)o(ogram)e(as)g(either)h(an)f(interpr)o(eted)f(script)i -(\(given)f(the)365 4367 y FA(#!)e FD(ar)o(gs)g(in)h(the)g(header\))f -(or)g(as)h(a)f(compiled)h(heap)f(image.)365 4616 y FB(9.1.7)81 -b(Process)20 b(exit)f(values)365 4799 y FD(Scsh)j(ignor)o(es)g(the)g -(value)f(pr)o(oduced)f(by)i(its)g(top-level)f(computation)i(when)f -(determin-)365 4898 y(ing)g(its)g(exit)g(status)f(code.)28 -b(If)21 b(the)g(top-level)g(computation)i(completed)e(with)h(no)h(err)o -(ors,)1735 5147 y(139)p eop +b(-s)756 714 y(!#)756 814 y(\(for-each)i(\()p Fo(\025)g +FA(\(arg\))j(\(display)e(arg\))i(\(display)e(")j("\)\))1191 +913 y(command-line-args)o(\))573 1207 y FD(Note)21 b(this)h(short)g(pr) +o(ogram)e(is)i(an)f(example)f(of)h(a)g FC(script)p FD(\227it)g +(executes)g(as)f(it)i(loads.)573 1307 y(The)f(Unix)f(r)o(ule)h(for)g +(executing)f FA(#!)g FD(shell)i(scripts)f(causes)756 +1520 y FA(ekko)41 b(Hello,)h(world.)573 1732 y FD(to)21 +b(expand)f(as)756 1945 y FA(/usr/local/bin/)o(sc)o(sh)37 +b(-s)43 b(ekko)f(Hello,)f(world.)490 2223 y Fw(\017)g +FD(Pr)o(ogram)20 b FA(ekko)573 2322 y FD(This)29 b(is)h(the)f(same)f +(pr)o(ogram,)i FC(not)f FD(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 FA(#!/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 Fo(\025)e FA(\(arg\))k(\(display)e +(arg\))i(\(display)e(")j("\)\))1279 3249 y(\(cdr)e(args\)\)\))573 +3478 y FD(The)28 b FA(exec\(2\))c FD(expansion)k(of)g(the)g +FA(#!)f FD(line)h(together)g(with)g(the)g(scsh)g(expansion)573 +3578 y(of)33 b(the)h(\223)p FA(\\)43 b(ekko)p FD(\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 FA(ekko)41 b(Hello,)h(world.)930 4006 y Fn(=)-14 +b Fw(\))87 b FA(/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 +Fw(\))87 b FA(/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 Fw(\017)g FD(Pr)o(ogram)20 +b FA(sort)573 4500 y FD(This)d(is)f(a)g(pr)o(ogram)f(to)i(r)o(eplace)e +(the)h(Unix)g FA(sort)f FD(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 +FA(top)f FD(pr)o(ocedur)o(e.)1735 5147 y(139)p eop %%Page: 140 146 -140 145 bop 681 614 a FD(scsh)20 b(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 714 y(i\002ed)g(by)h(a)f FA(-c)42 b FC(exp)20 -b FD(or)h(a)f FA(-e)42 b FC(entry)21 b FD(entry)f(point)h(ignor)o(es)g -(the)g(value)e(pr)o(oduced)h(by)g(eval-)681 814 y(uating)f -FC(exp)g FD(and)g(calling)h FC(entry)p FD(,)f(r)o(espectively)-9 -b(.)24 b(If)19 b(these)h(computations)g(terminate)f(with)681 -913 y(no)i(err)o(ors,)f(the)h(scsh)g(pr)o(ocess)f(exits)h(with)h(an)e -(exit)h(code)f(of)h(0.)805 1061 y(T)-8 b(o)22 b(r)o(eturn)e(a)g -(speci\002c)h(exit)f(status,)h(use)g(the)g FA(exit)e -FD(pr)o(ocedur)o(e)f(explicitly)-9 b(,)21 b FC(e.g.)o -FD(,)888 1160 y FA(scsh)42 b(-c)h(\\)976 1260 y("\(exit)e -(\(status:exit-va)o(l)d(\(run)k(\(|)g(\(fmt\))g(\(mail)f -(shivers\)\)\)\)\)")681 1596 y Fy(9.2)99 b(The)25 b(scsh)g(virtual)h -(machine)681 1840 y FD(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 1940 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 2039 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 -2139 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 -2238 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 -2338 y(begin)e(with)g(the)g(simple)h(trigger)888 2512 -y FA(#!/usr/local/bin/)o(sc)o(sh)37 b(-s)805 2734 y FD(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 2834 -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 2934 y(a)f(1Mwor)o(d)f -(heap)i(\(split)g(into)g(two)h(semispaces\):)888 3108 -y FA(scshvm)41 b(-o)i(scshvm)e(-h)i(1000000)e(-i)i(scsh.image)c(arg1)j -(arg2)g(...)681 3282 y FD(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 FA(-i)g FD(heap)g(image)g(ar)o(gument,) -681 3382 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 -3481 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 -3581 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 -3681 y FA(command-line-arg)o(um)o(ent)o(s)p FD(.)805 -3828 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 3928 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 4027 y(compiled)d(scsh)g(pr)o(ograms)f(with)i -(their)f(own)g(top-level)g(pr)o(ocedur)o(es.)681 4337 -y FB(9.2.1)81 b(VM)20 b(arguments)681 4550 y FD(The)h(vm)f(takes)h(ar)o -(guments)f(in)i(the)f(following)h(form:)888 4724 y FA(scshvm)41 -b([)p FC(meta-ar)o(g)n FA(])i([)p FC(vm-options)2044 -4694 y Fx(+)2099 4724 y FA(])g([)p FC(end-option)f(scheme-ar)o(gs)o -FA(])681 4898 y FD(wher)o(e)2051 5147 y(140)p eop +140 145 bop 1071 614 a FA(#!/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 FD(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 FA(sort)d FD(\(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 FA(sort-toplevel)27 +b FD(str)o(uctur)o(e,)34 b(\(3\))d(calls)h FA(\(top)888 +2765 y('\("sort")41 b("foo")g("bar"\)\))18 b FD(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 Fb(=)-13 b Fa(\))79 b Fh(/usr/local/bin/scsh)43 +b(\\)d(sort)1177 b(foo)40 b(bar)888 3180 y Fb(=)-13 b +Fa(\))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 FD(An)21 b(alternate)f(method)h +(would)g(have)g(used)f(a)1071 3513 y FA(-n)43 b(#f)g(-o)f +(sort-toplevel)888 3674 y FD(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 +FA(top)p FD(.)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 FA(#!)d FD(ar)o(gs)g(in)h(the)g(header\))e +(or)i(as)f(a)h(compiled)g(heap)f(image.)681 4616 y FB(9.1.7)81 +b(Process)20 b(exit)f(values)681 4799 y FD(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(140)p eop %%Page: 141 147 -141 146 bop 623 601 a FC(meta-ar)o(g:)159 b FA(\\)43 -b FC(\002lename)623 800 y(vm-option)n FD(:)113 b FA(-h)43 -b FC(heap-size-in-words)1103 900 y FA(-s)g FC(stack-size-in-words)1103 -1000 y FA(-o)g FC(object-\002le-name)623 1199 y(end-option:)98 -b FA(-i)43 b FC(image-\002le-name)1103 1298 y FA(--)490 -1471 y FD(The)35 b(vm's)h(meta-switch)g(\223)p FA(\\)43 -b FC(\002lename)p FD(\224)35 b(is)h(handled)f(the)g(same)h(as)f(scsh's) -h(meta-)365 1571 y(switch,)22 b(and)e(serves)g(the)h(same)g(purpose.) -365 1832 y FB(VM)g(options)365 2020 y FD(The)e FA(-o)43 -b FC(object-\002le-name)18 b FD(switch)i(tells)g(the)f(vm)g(wher)o(e)f -(to)i(\002nd)f(r)o(elocation)g(information)365 2120 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 2220 -y(speci\002ed.)d(Scsh)19 b FC(must)f FD(have)h(this)g(information)h(to) -g(r)o(un,)f(since)g(scsh's)h(syscall)f(interfaces)365 -2319 y(ar)o(e)h(done)h(with)g(for)o(eign-function)g(calls.)490 -2448 y(The)h FA(-h)f FD(and)h FA(-s)f FD(options)j(tell)e(the)g(vm)h -(how)g(much)f(space)g(to)g(allocate)g(for)g(the)g(heap)365 -2547 y(and)j(stack.)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 -2647 y(heap;)31 b(this)d(space)f(is)h(then)g(split)g(into)h(two)f -(semi-spaces)f(for)h(Scheme)f(48's)g(stop-and-)365 2747 -y(copy)21 b(collector)-6 b(.)365 3008 y FB(End)20 b(options)365 -3196 y FD(End)31 b(options)i(terminate)e(ar)o(gument)f(parsing.)57 -b(The)32 b FA(-i)e FD(switch)i(is)g(followed)f(by)g(the)365 -3295 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 FC(image-\002le-name)e FD(string)i(is)g(also) -365 3395 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 -3495 y(comes)f(the)f(head)f(of)h(the)h(ar)o(gument)e(list)i(passed)e -(to)i(the)f(heap)f(image's)i(top-level)e(entry)365 3594 -y(point.)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 -3723 y(The)23 b FA(--)e FD(switch)j(terminates)f(ar)o(gument)f(parsing) -h(without)h(giving)f(a)f(speci\002c)h(heap)365 3822 y(image;)k(the)f -(vm)f(will)h(start)f(up)g(using)h(a)f(default)f(heap)h(\(whose)h -(location)g(is)f(compiled)365 3922 y(into)h(the)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 4022 y(of)o(f)20 b(to)h(the)g(heap)f(image's) -h(top-level)g(pr)o(ocedur)o(e.)490 4150 y(Notice)f(that)f(you)i(ar)o(e) -d(not)j(allowed)e(to)h(pass)g(ar)o(guments)f(to)i(the)e(heap)h(image's) -g(top-)365 4250 y(level)h(pr)o(ocedur)o(e)e(\()p FC(e.g.)o -FD(,)h(scsh\))h(without)h(delimiting)g(them)f(with)h -FA(-i)d FD(or)i FA(--)f FD(\003ags.)365 4511 y FB(9.2.2)81 -b(Inserting)20 b(interpreter)f(triggers)h(into)g(heap)f(images)365 -4699 y FD(Scheme)k(48's)f(heap)g(image)g(format)h(allows)g(for)f(an)h -(informational)g(header:)28 b(when)23 b(the)365 4799 -y(vm)c(loads)f(in)h(a)e(heap)h(image,)g(it)h(ignor)o(es)f(all)g(data)f -(occurring)i(befor)o(e)e(the)h(\002rst)h(contr)o(ol-L)365 -4898 y(character)k(\()r(A)t Fv(S)t(C)t(I)t(I)k FD(12\).)36 -b(This)25 b(means)g(that)f(you)h(can)g(insert)f(a)h(\223)p -FA(#!)p FD(\224)d(trigger)j(line)g(into)g(a)1735 5147 -y(141)p eop +141 146 bop 365 614 a FD(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 FA(-c)43 b FC(exp)20 +b FD(or)g(a)g FA(-e)43 b FC(entry)20 b FD(entry)h(point)g(ignor)o(es)g +(the)f(value)g(pr)o(oduced)f(by)i(eval-)365 814 y(uating)f +FC(exp)f FD(and)g(calling)g FC(entry)p FD(,)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 FA(exit)e +FD(pr)o(ocedur)o(e)g(explicitly)-9 b(,)20 b FC(e.g.)p +FD(,)573 1160 y FA(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 Fy(9.2)99 b(The)25 b(scsh)h(virtual)f +(machine)365 1840 y FD(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 FA(#!/usr/local/bin)o(/s)o(csh)37 b(-s)490 2734 y FD(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 FA(scshvm)41 b(-o)i(scshvm)e(-h)i(1000000)d(-i)j(scsh.image)c(arg1)j +(arg2)g(...)365 3282 y FD(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 FA(-i)e FD(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 FA(command-line-argu)o(me)o(nts)o FD(.)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 FB(9.2.1)81 b(VM)21 b(arguments)365 4550 y FD(The)g(vm)g(takes)f(ar)o +(guments)h(in)g(the)g(following)h(form:)573 4724 y FA(scshvm)41 +b([)p FC(meta-ar)o(g)n FA(])i([)p FC(vm-options)1729 +4694 y Fx(+)1784 4724 y FA(])g([)p FC(end-option)f(scheme-ar)o(gs)o +FA(])365 4898 y FD(wher)o(e)1735 5147 y(141)p eop %%Page: 142 148 -142 147 bop 681 614 a FD(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 714 y(multiple)22 b(ar)o(guments)g(to)g -(be)f(given)h(on)h(the)f(command)g(line,)g(you)h(must)f(use)g(the)g -(meta-)681 814 y(switch.)k(Her)o(e's)20 b(an)h(example)f(heap-image)f -(header:)888 1009 y FA(#!/usr/local/lib/)o(sc)o(sh/)o(sc)o(shv)o(m)37 -b(\\)888 1109 y(-o)43 b(/usr/local/lib/s)o(csh)o(/s)o(csh)o(vm)37 -b(-i)888 1209 y(...)43 b FC(Y)-9 b(our)21 b(heap)f(image)g(goes)h(her)o -(e)43 b FA(...)681 1535 y FB(9.2.3)81 b(Inserting)19 -b(a)i(double-level)c(trigger)k(into)f(Scheme)e(programs)681 -1722 y FD(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 -1822 y(ger)e(line)h(of)g(your)g(Scheme)g(pr)o(ograms)f(with)h(the)g -(following)i(magic:)888 2009 y Fh(#!/usr/local/lib/scsh/scshvm)46 -b(\\)888 2101 y(-o)40 b(/usr/local/lib/scsh/scshvm)45 -b(-i)40 b(/usr/local/lib/scsh/scsh.image)46 b(-s)888 -2192 y(!#)888 2283 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 2636 y Fy(9.3)99 b(Compiling)25 -b(scsh)h(programs)681 2854 y FD(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 2954 y(Adding)20 b(the)h(pair)f(of)h(lines)888 3150 -y FA(#!/usr/local/lib/)o(sc)o(sh/)o(sc)o(shv)o(m)37 b(\\)888 -3249 y(-o)43 b(/usr/local/lib/s)o(csh)o(/s)o(csh)o(vm)37 -b(-i)681 3445 y FD(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 -3572 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 3724 y FA(\(dump-scsh-progr)o -(am)37 b FC(main)20 b(fname)p FA(\))87 b Fw(\000)-14 -b(!)87 b FC(unde\002ned)585 b FD(pr)o(ocedur)o(e)888 -3867 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 3967 -y(executed)f(by)h(the)f(Scheme)h(48)e(vm,)k(it)e(will)g(call)f(the)h -FC(main)f FD(pr)o(ocedur)o(e,)h(passing)888 4066 y(it)d(the)f(vm's)h -(ar)o(gument)f(list.)37 b(When)25 b FA(main)d FD(r)o(eturns)i(an)h -(integer)f(value)g Fo(i)p FD(,)g(the)h(vm)888 4166 y(exits)17 -b(with)g(exit)f(status)h Fo(i)p FD(.)23 b(The)17 b(Scheme)f(vm)h(will)g -(parse)e(command-line)i(switches)888 4265 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 4365 y(command-line)19 b(list)g(that)g(is)g(passed)f(to)h -FA(main)p FD(.)k(\(The)18 b(head)g(of)h(the)f(list)h(is)g(the)g(name) -888 4465 y(of)h(the)g(pr)o(ogram)f(being)i(executed)d(by)i(the)g(vm.\)) -26 b(Further)19 b(ar)o(gument)h(parsing)g(\(as)888 4564 -y(described)g(for)h(scsh)g(in)g(section)h(9.1.4\))c(is)j(not)h -(performed.)888 4699 y(The)34 b(heap)f(image)g(cr)o(eated)e(by)j -FA(dump-scsh-progra)o(m)27 b FD(has)34 b(unused)f(code)g(and)888 -4799 y(data)26 b(pr)o(uned)h(out,)i(so)e(small)g(pr)o(ograms)g(compile) -g(to)g(much)h(smaller)f(heap)f(im-)888 4898 y(ages.)2051 -5147 y(142)p eop +142 147 bop 938 601 a FC(meta-ar)o(g:)159 b FA(\\)43 +b FC(\002lename)938 800 y(vm-option)n FD(:)113 b FA(-h)43 +b FC(heap-size-in-words)1418 900 y FA(-s)g FC(stack-size-in-words)1418 +1000 y FA(-o)g FC(object-\002le-name)938 1199 y(end-option:)98 +b FA(-i)43 b FC(image-\002le-name)1418 1298 y FA(--)805 +1471 y FD(The)36 b(vm's)g(meta-switch)f(\223)p FA(\\)43 +b FC(\002lename)p FD(\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 FB(VM)g(options)681 2020 y FD(The)f FA(-o)42 +b FC(object-\002le-name)19 b FD(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 FC(must)g FD(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 FA(-h)g FD(and)f FA(-s)h FD(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 FB(End)20 b(options)681 +3196 y FD(End)31 b(options)h(terminate)f(ar)o(gument)g(parsing.)57 +b(The)31 b FA(-i)f FD(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 FC(image-\002le-name)g FD(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 FA(--)f FD(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 FC(e.g.)o +FD(,)i(scsh\))g(without)h(delimiting)f(them)g(with)h +FA(-i)e FD(or)h FA(--)f FD(\003ags.)681 4511 y FB(9.2.2)81 +b(Inserting)19 b(interpreter)g(triggers)h(into)g(heap)g(images)681 +4699 y FD(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 Fv(S)t(C)t(I)t(I)k FD(12\).)35 +b(This)26 b(means)e(that)h(you)g(can)f(insert)h(a)f(\223)p +FA(#!)p FD(\224)f(trigger)h(line)h(into)h(a)2051 5147 +y(142)p eop %%Page: 143 149 -143 148 bop 365 614 a FA(\(dump-scsh)40 b FC(fname)p -FA(\))86 b Fw(\000)-14 b(!)87 b FC(unde\002ned)1126 b -FD(pr)o(ocedur)o(e)573 754 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 -853 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 953 y(command-line)21 -b(switches)h(as)e(described)g(in)h(section)g(9.1.4.)573 -1085 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 1184 -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 1350 y(Unfortunately)-9 -b(,)17 b(Scheme)g(48)f(does)i(not)g(support)f(separate)f(compilation)j -(of)e(Scheme)365 1449 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 1549 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 1648 y(addr)o(essed)19 b(by)i(the)g(Scheme)f(48)g -(development)h(team.)365 1925 y Fy(9.4)99 b(Statically)26 -b(linking)g(heap)e(images)365 2139 y FD(The)33 b(static)f(heap)g -(linker)g(converts)h(a)f(Scheme)f(48)h(bytecode)g(image)g(contained)g -(in)h(a)365 2239 y(.image)26 b(\002le)g(to)g(a)g(C)g(r)o(epr)o -(esentation.)39 b(This)27 b(C)f(code)f(is)i(then)f(compiled)g(and)g -(linked)g(in)365 2338 y(with)k(a)f(virtual)g(machine,)j(pr)o(oducing)d -(a)g(single)h(executable.)50 b(Some)29 b(of)h(the)f(bene\002ts)365 -2438 y(ar)o(e:)490 2625 y Fw(\017)41 b FD(Instantaneous)21 -b(start-up)f(time.)490 2789 y Fw(\017)41 b FD(Impr)o(oved)15 -b(paging;)j(scsh)e(images)g(can)g(be)g(shar)o(ed)f(between)g(dif)o(fer) -o(ent)f(pr)o(ocesses.)490 2953 y Fw(\017)41 b FD(V)-8 -b(astly)20 b(r)o(educed)f(GC)h(copying\227the)i(whole)f(initial)f -(image)h(is)f(moved)h(out)f(of)g(the)573 3053 y(heap,)g(and)g(neither)h -(traced)f(nor)h(copied.)490 3217 y Fw(\017)41 b FD(Result)21 -b(pr)o(ogram)f(no)i(longer)f(depends)f(on)i(the)f(\002lesystem)g(for)g -(its)g(initial)g(image.)490 3404 y(The)g(static)f(heap)g(linker)i -(takes)e(ar)o(guments)g(in)i(the)f(following)h(form:)573 -3543 y FA(scsh-hlink)39 b FC(image)k(executable)h FA([)p -FC(option)e FA(...])365 3682 y FD(It)20 b(r)o(eads)f(in)i(the)f(heap)g -(image)g FC(image)o FD(,)g(translates)g(it)g(into)h(C)f(code,)g -(compiles)h(the)f(C)g(code,)365 3781 y(and)d(links)g(it)g(against)g -(the)f(scsh)i(vm,)f(pr)o(oducing)g(the)g(standalone)f(binary)h(\002le)f -FC(executable)q FD(.)490 3897 y(Each)26 b(C)h(\002le)g(r)o(epr)o -(esents)f(part)g(of)h(the)g(heap)g(image)g(as)f(a)h(constant)h(C)e -FA(long)g FD(vector)365 3989 y(that)21 b(looks)h(something)g(like)f -(this:)365 4168 y Fh(const)80 b(long)40 b(p116[]={0x882,0x24,0x19,)1150 -4259 y(0x882,\(long\)\(&p19[785]\)+7,\(lon)q(g\)\(&)q(p119[)q(125])q -(\)+7,)1150 4350 y(0x882,\(long\)\(&p119[128]\)+7,\(lo)q(ng\)\()q -(&p119)q([131)q(]\)+7)q(,)1150 4442 y -(0x882,\(long\)\(&p102[348]\)+7,\(lo)q(ng\)\()q(&p3[1)q(14]\))q(+7,) -1150 4533 y(0xfc2,0x2030200,0x7100209,0x10)q(9100)q(2,0x1)q(c075)q(a,) -1150 4624 y(0x882,\(long\)\(&p29[1562]\)+7,\(lo)q(ng\)\()q(&p119)q -([137)q(]\)+7)q(,)1150 4716 y(0x882,\(long\)\(&p78[692]\)+7,\(lon)q -(g\)\(&)q(p119[)q(140])q(\)+7,)1307 4807 y(.)1307 4898 -y(.)1735 5147 y FD(143)p eop +143 148 bop 365 614 a FD(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 FA(#!/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 FC(Y)-9 b(our)21 b(heap)f(image)g(goes)h(her)o +(e)44 b FA(...)365 1535 y FB(9.2.3)81 b(Inserting)20 +b(a)g(double-level)e(trigger)i(into)g(Scheme)f(programs)365 +1722 y FD(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 Fy(9.3)99 b(Compiling)26 +b(scsh)f(programs)365 2854 y FD(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 FA(#!/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 FD(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 FA(\(dump-scsh-progra)o +(m)37 b FC(main)21 b(fname)p FA(\))87 b Fw(\000)-15 b(!)88 +b FC(unde\002ned)585 b FD(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 FC(main)f +FD(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 FA(main)f FD(r)o(eturns)h(an)g(integer)g(value)g +Fo(i)p FD(,)h(the)f(vm)573 4166 y(exits)16 b(with)i(exit)e(status)g +Fo(i)p FD(.)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 +FA(main)p FD(.)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 +FA(dump-scsh-program)27 b FD(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(143)p eop %%Page: 144 150 -144 149 bop 1622 614 a Fh(.)1465 706 y(};)805 893 y FD(T)-7 -b(ranslating)21 b(to)h(a)e(C)h(declaration)f(gives)i(us)f(fr)o(eedom)f -(fr)o(om)h(the)g(various)g(object-\002le)681 992 y(formats.)985 -962 y Fs(2)1047 992 y FD(Note)h(that)g(the)h(const)f(declaration)g -(allows)g(the)h(compiler)f(to)g(put)g(this)h(array)681 -1092 y(in)d(the)g(text)g(pages)f(of)h(the)g(executable.)k(The)c(heap)f -(is)i(split)f(into)h(parts)e(because)g(many)h(C)681 1192 -y(compilers)h(cannot)g(handle)g(multi-megabyte)g(initialised)g(vector)f -(declarations.)805 1316 y(The)h(allowed)g(options)h(to)f(the)g(heap)f -(linker)h(ar)o(e:)805 1503 y Fw(\017)41 b FA(--temp)g -FC(dir)888 1603 y FD(The)27 b(temporary)g(dir)o(ectory)f(to)h(hold)h -(.c)e(and)h(.o)g(\002les.)44 b(The)27 b(default)f(is)h(typically)888 -1702 y(con\002gur)o(ed)i(to)f(be)h FA(/usr/tmp)p FD(,)d(and)i(can)g(be) -h(overridden)e(by)i(the)f(envir)o(onment)888 1802 y(variable)20 -b FA(TMPDIR)p FD(.)e(Example:)1071 1941 y FA(--temp)41 -b(/tmp)805 2111 y Fw(\017)g FA(--cc)h FC(command)888 -2211 y FD(The)25 b(command)h(to)f(r)o(un)h(the)f(C)g(compiler)-6 -b(.)39 b(The)25 b(default)f(can)h(be)g(overridden)f(by)888 -2311 y(the)d(envir)o(onment)h(variable)d FA(CC)p FD(.)h(Example:)1071 -2449 y FA(--cc)42 b("gcc)g(-g)h(-O")805 2620 y Fw(\017)e -FA(--ld)h FC(command)888 2720 y FD(The)34 b(ar)o(guments)e(to)i(r)o(un) -g(the)f(C)g(compiler)h(as)e(a)h(linker)-6 b(.)63 b(The)33 -b(default)f(can)h(be)888 2819 y(overridden)20 b(by)h(the)g(envir)o -(onment)g(variable)f FA(LDFLAGS)p FD(.)e(Example:)1071 -2958 y FA(--ld)42 b("-Wl,-E")805 3129 y Fw(\017)f FA(--libs)g -FC(libs)888 3228 y FD(The)25 b(libraries)f(needed)g(to)h(link)h(the)f -(VM)f(and)h(heap.)37 b(The)24 b(default)g(can)h(be)f(over)o(-)888 -3328 y(ridden)d(by)f(the)h(envir)o(onment)h(variable)d -FA(LIBS)p FD(.)g(Example:)1071 3466 y FA(--libs)41 b("-ldld)g(-lld)h -(-lm")805 3653 y FD(Be)21 b(warned)f(that)g(the)h(curr)o(ent)f(heap)g -(linker)i(has)e(many)h(shortcomings.)805 3840 y Fw(\017)41 -b FD(It)30 b(is)g(extr)o(emely)f(slow)-8 b(.)53 b(Really)-9 -b(,)32 b(r)o(eally)d(slow)-8 b(.)53 b(T)-7 b(ranslating)30 -b(the)f(standar)o(d)f(scsh)888 3940 y(heap)42 b(image)h(into)h(a)e -(standalone)g(binary)h(takes)f(well)h(over)g(an)f(hour)h(on)h(a)888 -4040 y(40Mb/133Mhz)27 b(Pentium)k(system.)53 b(A)30 b(memory-starved)f -(486)g(could)h(take)f(all)888 4139 y(night.)805 4303 -y Fw(\017)41 b FD(It)c(cannot)g(be)g(applied)f(to)h(itself.)74 -b(The)37 b(curr)o(ent)e(implementation)j(works)g(by)888 -4403 y(r)o(eplacing)i(some)g(of)g(the)g(heap-dumping)g(code.)83 -b(This)41 b(means)f(you)h(cannot)888 4503 y(load)i(the)h(heap-linker)e -(code)h(into)h(a)f(scsh)h(system)g(and)f(subsequently)h(use)888 -4602 y FA(dump-scsh-program)14 b FD(to)21 b(cr)o(eate)e(a)h -(heap-linker)h(heap)f(image.)805 4766 y Fw(\017)41 b -FD(The)21 b(interface)f(leaves)g(a)g(lot)h(to)g(be)g(desir)o(ed.)p -681 4819 1146 4 v 771 4875 a Fr(2)800 4898 y Fv(This)c(idea)f(is)h(due) -f(to)h(Jonathan)f(Rees.)2051 5147 y FD(144)p eop +144 149 bop 681 614 a FA(\(dump-scsh)39 b FC(fname)p +FA(\))87 b Fw(\000)-14 b(!)87 b FC(unde\002ned)1125 b +FD(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 Fy(9.4)99 b(Statically)26 +b(linking)f(heap)g(images)681 2139 y FD(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 Fw(\017)41 b FD(Instantaneous)22 +b(start-up)e(time.)805 2789 y Fw(\017)41 b FD(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 Fw(\017)41 b FD(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 Fw(\017)41 b FD(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 FA(scsh-hlink)40 b FC(image)j(executable)h FA([)p +FC(option)e FA(...])681 3682 y FD(It)20 b(r)o(eads)f(in)h(the)h(heap)e +(image)h FC(image)p FD(,)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 +FC(executable)p FD(.)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 +FA(long)e FD(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 FD(144)p eop %%Page: 145 151 -145 150 bop 672 614 a FB(\226)42 b FD(It)19 b(r)o(equir)o(es)f(the)h -(heap)f(image)h(to)h(be)e(r)o(efer)o(enced)e(by)j(a)g(\002le-name;)g -(the)g(linker)756 714 y(will)i(not)g(allow)h(you)f(to)g(feed)f(it)h -(the)g(input)g(heap)f(image)h(on)g(a)f(port.)672 848 -y FB(\226)42 b FD(The)20 b(heap-image)g(is)h(linked)g(against)g(the)g -(vm)g(contained)g(in)911 948 y FA(/usr/local/lib/s)o(cs)o(h/)o(lib)o -(sc)o(shv)o(m.)o(a)756 1048 y FD(This)g(is)g(wir)o(ed)f(in)h(at)f(the)h -(time)g(scsh)h(is)f(installed)g(on)g(your)g(system.)672 -1182 y FB(\226)42 b FD(Ther)o(e)19 b(is)i(no)h(Scheme)e(pr)o(ocedural)f -(interface.)490 1351 y Fw(\017)41 b FD(The)27 b(pr)o(ogram)g(pr)o -(oduced)f(uses)i(the)f(default)g(VM)g(ar)o(gv)f(parser)h -FA(process_args)573 1451 y FD(fr)o(om)36 b(the)g(scsh)h(sour)o(ce)e -(\002le)i FA(main.c)c FD(to)k(pr)o(ocess)e(the)i(command)f(line)h -(befor)o(e)573 1550 y(handing)25 b(it)f(of)o(f)g(to)g(the)h(heap)e -(image's)i(top-level)f(pr)o(ocedur)o(e.)34 b(This)25 -b(is)f(not)h(what)573 1650 y(you)c(want)g(for)g(many)g(pr)o(ograms.)573 -1784 y(The)27 b(system)h(needs)f(to)h(be)f(changed)g(to)g(allow)h -(users)f(to)h(override)f(this)h(default)573 1884 y(with)21 -b(their)g(own)h(VM)e(ar)o(gument)g(parsers.)490 2053 -y Fw(\017)41 b FD(A)28 b(possible)h(pr)o(oblem)f(is)h(the)g(Unix)f -(limits)i(on)f(the)g(number)g(of)f(command)h(line)573 -2152 y(ar)o(guments.)58 b(The)31 b(heap-linker)g(calls)h(the)f(C)h -(linker)g(with)g(a)f(lar)o(ge)g(number)h(of)573 2252 -y(object)19 b(\002les.)25 b(Its)18 b(conceivable)g(that)h(on)g(some)g -(Unix)f(systems)h(this)g(could)g(fail)f(now)573 2352 -y(or)32 b(if)g(scsh)g(gr)o(ows)g(in)h(the)f(futur)o(e.)58 -b(The)31 b(solution)j(could)e(be)g(to)g(cr)o(eate)e(library)573 -2451 y(ar)o(chives)c(of)g(a)g(few)h(dozen)f(\002les)h(and)g(then)g -(link)g(the)g(r)o(esult)f(few)h(dozen)f(library)573 2551 -y(ar)o(chives)20 b(to)h(make)f(the)h(executable.)490 -2746 y(In)f(spite)g(of)g(these)f(many)h(shortcomings,)i(we)e(ar)o(e)e -(pr)o(oviding)i(the)g(static)g(linker)g(as)f(it)365 2845 -y(stands)i(in)g(this)h(r)o(elease)d(so)i(that)g(people)g(may)f(get)h -(some)g(experience)f(with)i(it.)490 2972 y(Her)o(e)d(is)j(an)e(example) -g(of)h(how)h(one)f(might)h(use)e(the)h(heap)f(linker:)922 -3167 y FA(scsh-hlink)39 b(scsh.image)g(fastscsh)490 3389 -y FD(W)-8 b(e'd)21 b(love)f(it)h(if)g(someone)h(would)f(dive)f(into)i -(the)f(sour)o(ce)f(and)g(impr)o(ove)h(it.)365 3672 y -Fy(9.5)99 b(Standard)24 b(\002le)h(locations)365 3889 -y FD(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 -3989 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 -4088 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 4188 y FA(/usr/local/lib/sc)o(sh)o(/)p FD(.)20 -b(Whenever)g(possible,)h(the)g(vm)g(should)g(be)g(located)f(in)573 -4330 y FA(/usr/local/lib/s)o(cs)o(h/s)o(cs)o(hvm)365 -4472 y FD(and)h(a)f(scsh)h(heap)f(image)h(should)h(be)e(located)g(in) -573 4614 y FA(/usr/local/lib/s)o(cs)o(h/s)o(cs)o(h.i)o(ma)o(ge)365 -4756 y FD(The)h(top-level)f(scsh)i(pr)o(ogram)e(should)h(be)g(located)f -(in)573 4898 y FA(/usr/local/lib/s)o(cs)o(h/s)o(cs)o(h)1735 -5147 y FD(145)p eop +145 150 bop 1307 614 a Fh(.)1150 706 y(};)490 893 y FD(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 992 y(formats.)669 +962 y Fs(2)732 992 y FD(Note)h(that)g(the)g(const)h(declaration)e +(allows)i(the)f(compiler)g(to)h(put)f(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 1503 y Fw(\017)41 b FA(--temp)g +FC(dir)573 1603 y FD(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 +1702 y(con\002gur)o(ed)h(to)h(be)f FA(/usr/tmp)p FD(,)f(and)h(can)g(be) +g(overridden)g(by)g(the)h(envir)o(onment)573 1802 y(variable)19 +b FA(TMPDIR)p FD(.)f(Example:)756 1941 y FA(--temp)41 +b(/tmp)490 2111 y Fw(\017)g FA(--cc)h FC(command)573 +2211 y FD(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 FA(CC)p FD(.)f(Example:)756 +2449 y FA(--cc)41 b("gcc)h(-g)h(-O")490 2620 y Fw(\017)e +FA(--ld)h FC(command)573 2720 y FD(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 2819 y(overridden)20 b(by)h(the)g(envir)o +(onment)g(variable)e FA(LDFLAGS)p FD(.)f(Example:)756 +2958 y FA(--ld)41 b("-Wl,-E")490 3129 y Fw(\017)g FA(--libs)g +FC(libs)573 3228 y FD(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 +3328 y(ridden)20 b(by)h(the)g(envir)o(onment)g(variable)f +FA(LIBS)p FD(.)e(Example:)756 3466 y FA(--libs)41 b("-ldld)g(-lld)h +(-lm")490 3653 y FD(Be)20 b(warned)g(that)h(the)g(curr)o(ent)f(heap)g +(linker)h(has)g(many)g(shortcomings.)490 3840 y Fw(\017)41 +b FD(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 3940 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 +4040 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 4139 +y(night.)490 4303 y Fw(\017)41 b FD(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 +4403 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 4503 y(load)j(the)g(heap-linker)g +(code)g(into)h(a)f(scsh)g(system)h(and)f(subsequently)i(use)573 +4602 y FA(dump-scsh-progra)o(m)15 b FD(to)21 b(cr)o(eate)e(a)h +(heap-linker)g(heap)h(image.)490 4766 y Fw(\017)41 b +FD(The)21 b(interface)e(leaves)h(a)h(lot)g(to)g(be)f(desir)o(ed.)p +365 4819 1146 4 v 456 4875 a Fr(2)485 4898 y Fv(This)c(idea)h(is)g(due) +f(to)h(Jonathan)f(Rees.)1735 5147 y FD(145)p eop %%Page: 146 152 -146 151 bop 681 614 a FD(with)21 b(a)g(symbolic)g(link)h(to)f(it)g(fr)o -(om)888 753 y FA(/usr/local/bin/sc)o(sh)805 916 y FD(The)30 -b(Scheme)g(48)f(image)h(format)g(allows)g(heap)g(images)g(to)h(have)e -FA(#!)g FD(triggers,)k(so)681 1016 y FA(scsh.image)16 -b FD(should)22 b(have)e(a)g FA(#!)g FD(trigger)h(of)g(the)g(following)h -(form:)888 1207 y FA(#!/usr/local/lib/)o(sc)o(sh/)o(sc)o(shv)o(m)37 -b(\\)888 1307 y(-o)43 b(/usr/local/lib/s)o(csh)o(/s)o(csh)o(vm)37 -b(-i)888 1406 y(...)43 b FC(heap)20 b(image)g(goes)g(her)o(e)44 -b FA(...)2051 5147 y FD(146)p eop +146 151 bop 988 614 a FB(\226)41 b FD(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 FB(\226)41 b FD(The)21 b(heap-image)f(is)h(linked)g(against)f(the)h +(vm)g(contained)g(in)1226 948 y FA(/usr/local/lib/sc)o(sh)o(/li)o(bs)o +(cs)o(hvm)o(.a)1071 1048 y FD(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 FB(\226)41 b FD(Ther)o(e)20 b(is)h(no)g(Scheme)g(pr)o(ocedural)e +(interface.)805 1351 y Fw(\017)41 b FD(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 +FA(process_args)888 1451 y FD(fr)o(om)36 b(the)g(scsh)h(sour)o(ce)f +(\002le)g FA(main.c)e FD(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 Fw(\017)41 b FD(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 FA(scsh-hlink)39 b(scsh.image)h(fastscsh)805 3389 +y FD(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 +Fy(9.5)99 b(Standard)24 b(\002le)h(locations)681 3889 +y FD(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 FA(/usr/local/lib/s)o(cs)o(h/)p FD(.)19 +b(Whenever)h(possible,)i(the)e(vm)h(should)h(be)e(located)h(in)888 +4330 y FA(/usr/local/lib/sc)o(sh)o(/sc)o(sh)o(vm)681 +4472 y FD(and)f(a)g(scsh)i(heap)e(image)h(should)g(be)g(located)f(in) +888 4614 y FA(/usr/local/lib/sc)o(sh)o(/sc)o(sh)o(.im)o(ag)o(e)681 +4756 y FD(The)h(top-level)f(scsh)h(pr)o(ogram)f(should)i(be)e(located)h +(in)888 4898 y FA(/usr/local/lib/sc)o(sh)o(/sc)o(sh)2051 +5147 y FD(146)p eop %%Page: 147 153 -147 152 bop 365 1283 a Fz(Chapter)45 b(10)365 1744 y -FE(Changes)53 b(from)e(previous)365 1993 y(releases)365 -2488 y Fy(10.1)99 b(Changes)25 b(from)f(the)h(previous)h(release)365 -2729 y FD(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 2829 -y(r)o(elease.)490 2975 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 3074 y(have)21 b(been)f(many)h(impr)o(ovements)h(and)e -(extensions)i(made.)j(These)c(new)g(featur)o(es)e(and)365 -3174 y(changes)31 b(ar)o(e)e(listed)i(below)-8 b(,)34 -b(in)d(no)g(particular)f(or)o(der;)k(the)d(r)o(elevant)e(sections)j(of) -e(the)365 3273 y(manual)21 b(give)g(the)g(full)f(details.)490 -3419 y(Scsh)28 b(now)h(supports)g(complete)i(P)t Fv(O)t(S)t(I)t(X)r -FD(,)g(including)f(signal)e(handlers.)49 b(Early)27 b(au-)365 -3519 y(tor)o(eaping)h(of)g(child)h(pr)o(ocesses)e(is)i(now)g(handled)f -(by)g(a)g FA(SIGCHLD)d FD(signal)k(handler)-6 b(,)29 -b(so)365 3618 y(childr)o(en)21 b(ar)o(e)e(r)o(eaped)g(as)h(early)g(as)h -(possible)g(with)h(no)f(user)g(intervention)g(r)o(equir)o(ed.)490 -3764 y(A)h(functional)g(static)g(heap)g(linker)g(is)h(included)f(in)g -(this)h(r)o(elease.)28 b(It)22 b(is)h(ugly)-9 b(,)22 -b(limited)365 3864 y(in)h(functionality)-9 b(,)24 b(and)e(extr)o(emely) -g(slow)-8 b(,)24 b(but)f(it)g(works.)32 b(It)23 b(can)f(be)h(used)f(to) -h(build)g(scsh)365 3963 y(binaries)e(that)g(start)f(up)h(instantly)-9 -b(.)490 4109 y(The)21 b(r)o(egular)g(expr)o(ession)g(system)h(has)g -(been)f(sped)g(up.)28 b(Regular)o(-expr)o(ession)20 b(com-)365 -4209 y(pilation)g(is)g(now)g(pr)o(ovided,)e(and)g(the)i -FA(awk)e FD(macr)o(o)g(has)h(been)g(r)o(ewritten)g(to)g(pr)o(e-compile) -365 4308 y(r)o(egexps)e(used)g(in)h(r)o(ules)g(outside)g(the)f(loop.)25 -b(It)18 b(is)g(still,)g(however)-6 b(,)18 b(slower)g(than)g(it)g -(should)365 4408 y(be.)490 4553 y(Execing)31 b(pr)o(ograms)f(should)i -(be)f(faster)f(in)i(this)g(r)o(elease,)g(since)f(we)g(now)h(use)f(the) -365 4653 y FA(CLOEXEC)18 b FD(status)j(bit)g(to)g(get)g(automatic)f -(closing)i(of)f(unr)o(evealed)e(port)i(\002le)g(descriptors.)490 -4799 y(scm's)32 b(\003oating)h(point)g(support)f(was)g(inadvertently)f -(omitted)i(fr)o(om)e(the)h(last)g(r)o(e-)365 4898 y(lease.)25 -b(It)c(has)g(been)f(r)o(einstated.)1735 5147 y(147)p -eop +147 152 bop 365 614 a FD(with)22 b(a)e(symbolic)i(link)f(to)h(it)f(fr)o +(om)573 753 y FA(/usr/local/bin/s)o(cs)o(h)490 916 y +FD(The)30 b(Scheme)g(48)f(image)h(format)f(allows)i(heap)e(images)i(to) +f(have)g FA(#!)f FD(triggers,)j(so)365 1016 y FA(scsh.image)17 +b FD(should)k(have)g(a)f FA(#!)g FD(trigger)h(of)f(the)h(following)h +(form:)573 1207 y FA(#!/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 FC(heap)20 b(image)g(goes)h(her)o(e)43 +b FA(...)1735 5147 y FD(147)p eop %%Page: 148 154 -148 153 bop 805 614 a FD(Ther)o(e)20 b(is)h(now)g(a)f(new)g -(command-line)h(switch,)g FA(-sfd)42 b FC(num)p FD(,)20 -b(which)i(causes)e(scsh)h(to)681 714 y(r)o(ead)e(its)i(script)g(fr)o -(om)f(\002le)h(descriptor)f FC(num)p FD(.)681 990 y Fy(10.2)99 -b(Changes)25 b(from)f(the)h(penultimate)f(release)681 -1204 y FD(This)c(section)h(details)e(changes)h(that)g(have)f(been)h -(made)f(in)h(scsh)h(since)f(the)g(penultimate)681 1304 -y(r)o(elease.)805 1429 y(Scsh)29 b(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 1528 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 -1628 y(made)20 b(some)h(incompatible)g(changes.)805 1752 -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 1852 y(r)o(elevant)19 -b(sections)j(of)f(the)g(manual)f(give)h(the)g(full)g(details.)681 -2102 y FB(10.2.1)80 b(New)21 b(features)681 2285 y FD(This)g(r)o -(elease)e(incorporates)i(several)f(new)h(featur)o(es)e(into)j(scsh.)805 -2487 y Fw(\017)41 b FD(Contr)o(ol)21 b(of)g(buf)o(fer)o(ed)d(I/O)888 -2586 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 2686 -y(on)d(a)e(Scheme)g(port.)805 2850 y Fw(\017)41 b FD(Her)o(e-strings) -888 2949 y(Scsh)26 b(now)h(has)f(a)f(new)i(lexical)e(featur)o(e,)g -FA(#<<)p FD(,)h(that)g(pr)o(ovides)f(the)h(ability)g(to)g(en-)888 -3049 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 3149 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 3248 y FA(<<)g -FD(r)o(edir)o(ection.)805 3412 y Fw(\017)41 b FD(Delimited)21 -b(r)o(eaders)e(and)i(r)o(ead-line)888 3512 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 3611 y(to)23 b(r)o(ead)f(input)h -(delimited)f(by)h(a)f(newline)i(character)d(\()p FA(read-line)p -FD(\),)e(a)j(blank)h(line)888 3711 y(\()p FA(read-paragraph)p -FD(\),)c(or)24 b(the)h(occurr)o(ence)e(of)h(any)g(character)f(in)i(an)f -(arbitrary)f(set)888 3810 y(\()p FA(read-delimited)p -FD(\).)888 3942 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 -4042 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 4141 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 4241 y(faster)20 b(than)h(the)g(equivalent)g(character)o -(-at-a-time)c(Scheme)j(code.)805 4405 y Fw(\017)41 b -FD(New)21 b(system)h(calls)888 4504 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 Fv(O)t(S)t(I)t(X)r FD(.)888 4604 y(This)22 b(r)o(elease)d(intr)o -(oduces)988 4768 y FB(\226)41 b FA(select)p FD(,)988 -4898 y FB(\226)g FD(full)21 b(terminal)g(device)f(contr)o(ol,)2051 -5147 y(148)p eop +148 153 bop 681 1283 a Fz(Chapter)44 b(10)681 1744 y +FE(Changes)52 b(from)g(previous)681 1993 y(releases)681 +2488 y Fy(10.1)99 b(Changes)25 b(from)f(the)h(previous)g(release)681 +2729 y FD(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 2829 +y(r)o(elease.)805 2975 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 3074 y(have)20 b(been)h(many)g(impr)o(ovements)g(and)f +(extensions)i(made.)j(These)c(new)g(featur)o(es)e(and)681 +3174 y(changes)31 b(ar)o(e)e(listed)i(below)-8 b(,)33 +b(in)e(no)h(particular)d(or)o(der;)34 b(the)d(r)o(elevant)f(sections)h +(of)g(the)681 3273 y(manual)20 b(give)h(the)g(full)g(details.)805 +3419 y(Scsh)29 b(now)g(supports)g(complete)h(P)t Fv(O)t(S)t(I)t(X)r +FD(,)i(including)d(signal)g(handlers.)48 b(Early)28 b(au-)681 +3519 y(tor)o(eaping)f(of)i(child)f(pr)o(ocesses)g(is)g(now)h(handled)f +(by)h(a)e FA(SIGCHLD)f FD(signal)i(handler)-6 b(,)30 +b(so)681 3618 y(childr)o(en)20 b(ar)o(e)f(r)o(eaped)g(as)i(early)f(as)g +(possible)i(with)f(no)h(user)e(intervention)i(r)o(equir)o(ed.)805 +3764 y(A)g(functional)h(static)f(heap)f(linker)i(is)f(included)g(in)h +(this)f(r)o(elease.)29 b(It)22 b(is)g(ugly)-9 b(,)23 +b(limited)681 3864 y(in)g(functionality)-9 b(,)24 b(and)e(extr)o(emely) +g(slow)-8 b(,)24 b(but)f(it)g(works.)32 b(It)22 b(can)h(be)f(used)h(to) +g(build)f(scsh)681 3963 y(binaries)e(that)h(start)f(up)h(instantly)-9 +b(.)805 4109 y(The)22 b(r)o(egular)e(expr)o(ession)h(system)i(has)e +(been)h(sped)f(up.)28 b(Regular)o(-expr)o(ession)20 b(com-)681 +4209 y(pilation)g(is)f(now)h(pr)o(ovided,)e(and)h(the)g +FA(awk)f FD(macr)o(o)h(has)g(been)g(r)o(ewritten)f(to)i(pr)o(e-compile) +681 4308 y(r)o(egexps)c(used)h(in)h(r)o(ules)g(outside)g(the)g(loop.)25 +b(It)17 b(is)h(still,)h(however)-6 b(,)18 b(slower)g(than)g(it)f +(should)681 4408 y(be.)805 4553 y(Execing)31 b(pr)o(ograms)g(should)h +(be)f(faster)f(in)h(this)h(r)o(elease,)g(since)g(we)f(now)h(use)f(the) +681 4653 y FA(CLOEXEC)18 b FD(status)i(bit)h(to)h(get)e(automatic)h +(closing)h(of)f(unr)o(evealed)e(port)h(\002le)h(descriptors.)805 +4799 y(scm's)33 b(\003oating)g(point)f(support)g(was)g(inadvertently)g +(omitted)g(fr)o(om)g(the)g(last)f(r)o(e-)681 4898 y(lease.)25 +b(It)20 b(has)h(been)g(r)o(einstated.)2051 5147 y(148)p +eop %%Page: 149 155 -149 154 bop 672 614 a FB(\226)42 b FD(support)20 b(for)h -(pseudo-terminal)f(\223pty\224)g(devices,)672 748 y FB(\226)42 -b FD(\002le)20 b(locking,)672 882 y FB(\226)42 b FD(pr)o(ocess)20 -b(timing,)672 1016 y FB(\226)42 b FA(set-file-times)p -FD(,)672 1150 y FB(\226)g FA(seek)19 b FD(and)h FA(tell)p -FD(.)573 1318 y(Note)d(that)g(having)g FA(select)p FD(,)e -(pseudo-terminals,)i(and)f(tty)h(device)f(contr)o(ol)h(means)573 -1417 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 1517 y(as)c(telnet)h -(servers)f(and)h(clients,)g(dir)o(ectly)f(in)h(Scheme.)490 -1685 y Fw(\017)41 b FD(New)21 b(command-line)g(switches)573 -1785 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 1884 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 1984 y(the)j(new)h(command-line)g -(switches)g(to)g(open)f(dependent)g(modules)h(and)f(load)573 -2084 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 -2183 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 2283 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 2383 y(grams.)490 2551 y Fw(\017)41 b FD(Static)20 -b(heap)g(linking)573 2650 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 -FA(.o)g FD(\002le)573 2750 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 -2849 y(dalone)33 b(executable)g(binary)-9 b(,)36 b(makes)e(startup)g -(time)g(near)o(-instantaneous,)i(and)573 2949 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 3049 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 3148 y(and)c(does)h(not)g(occupy)g(space)f(in)i(the)e(r)o(un-time)i -(heap.)756 3325 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 3417 -y(time)18 b(for)g(this)h(r)o(elease.)365 3672 y FB(10.2.2)81 -b(Incompatible)18 b(improvements)365 3856 y FD(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 3956 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 4056 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 4266 y Fw(\017)41 b FD(New)21 b(pr)o(ocess-object)f -(data-type)f(r)o(eturned)h(by)g FA(fork)573 4366 y FD(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 4466 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 4565 y FA(wait)15 b FD(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 4665 y(in)k(standar)o(d)e(C)i -(envir)o(onments,)g(as)g(well.\))573 4799 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 4898 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,)1735 +149 154 bop 490 614 a FD(Ther)o(e)19 b(is)i(now)g(a)f(new)h +(command-line)g(switch,)g FA(-sfd)42 b FC(num)p FD(,)20 +b(which)h(causes)f(scsh)h(to)365 714 y(r)o(ead)e(its)j(script)e(fr)o +(om)h(\002le)g(descriptor)f FC(num)p FD(.)365 990 y Fy(10.2)99 +b(Changes)25 b(from)f(the)h(penultimate)f(release)365 +1204 y FD(This)d(section)f(details)g(changes)g(that)f(have)h(been)f +(made)h(in)g(scsh)g(since)g(the)g(penultimate)365 1304 +y(r)o(elease.)490 1429 y(Scsh)29 b(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 1528 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 +1628 y(made)20 b(some)i(incompatible)f(changes.)490 1752 +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 1852 y(r)o(elevant)20 +b(sections)i(of)e(the)h(manual)g(give)g(the)f(full)h(details.)365 +2102 y FB(10.2.1)81 b(New)20 b(features)365 2285 y FD(This)i(r)o +(elease)d(incorporates)i(several)e(new)j(featur)o(es)d(into)i(scsh.)490 +2487 y Fw(\017)41 b FD(Contr)o(ol)21 b(of)g(buf)o(fer)o(ed)d(I/O)573 +2586 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 2686 +y(on)c(a)g(Scheme)f(port.)490 2850 y Fw(\017)41 b FD(Her)o(e-strings) +573 2949 y(Scsh)26 b(now)h(has)e(a)h(new)g(lexical)g(featur)o(e,)f +FA(#<<)p FD(,)g(that)h(pr)o(ovides)f(the)h(ability)h(to)f(en-)573 +3049 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 3149 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 3248 y FA(<<)f +FD(r)o(edir)o(ection.)490 3412 y Fw(\017)41 b FD(Delimited)21 +b(r)o(eaders)e(and)h(r)o(ead-line)573 3512 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 3611 y(to)23 b(r)o(ead)e(input)i +(delimited)g(by)g(a)f(newline)h(character)f(\()p FA(read-line)p +FD(\),)c(a)k(blank)h(line)573 3711 y(\()p FA(read-paragraph)p +FD(\))o(,)c(or)25 b(the)f(occurr)o(ence)f(of)i(any)f(character)f(in)h +(an)h(arbitrary)e(set)573 3810 y(\()p FA(read-delimited)p +FD(\))o(.)573 3942 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 +4042 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 4141 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 4241 y(faster)20 b(than)h(the)f(equivalent)h(character)o +(-at-a-time)c(Scheme)k(code.)490 4405 y Fw(\017)41 b +FD(New)21 b(system)g(calls)573 4504 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 Fv(O)t(S)t(I)t(X)r FD(.)573 4604 y(This)21 b(r)o(elease)e(intr)o +(oduces)672 4768 y FB(\226)42 b FA(select)p FD(,)672 +4898 y FB(\226)g FD(full)20 b(terminal)h(device)f(contr)o(ol,)1735 5147 y(149)p eop %%Page: 150 156 -150 155 bop 888 614 a FD(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 -714 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 -814 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 -913 y(further)21 b(details.)805 1099 y Fw(\017)41 b FD(Better)20 -b(stdio/curr)o(ent-port)h(synchr)o(onisation)888 1199 -y(The)i FA(\(begin)41 b(...\))20 b FD(pr)o(ocess)i(form)g(now)h(does)g -(a)e FA(stdio->stdports)16 b FD(call)22 b(befor)o(e)888 -1298 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 -1398 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 FA(begin)e -FD(form)j(in)888 1498 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 -1597 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 1697 y FC(E.g.)o -FD(,)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 1797 y(sation:)888 -2016 y FA(\(run)42 b(\(|)h(\(gunzip\))1237 2115 y(;;)g(Kill)f(line)g(1) -h(and)f(insert)f(doubled-sided)1237 2215 y(;;)i(code)f(at)g(head)g(of)h -(Postscript.)1237 2315 y(\(begin)e(\(read-line\))e(;)k(Eat)g(first)e -(line.)1542 2414 y(\(display)f("\045!PS-Adobe-2.0\\\\)o(n"\))1542 -2514 y(\(display)g("statusdict)f(/setduplexmode)f(known)k("\))1542 -2614 y(\(display)e("{statusdict)f(begin)j(true)f("\))1542 -2713 y(\(display)f("setduplexmode)e(end})k(if\\n"\))1542 -2813 y(\(exec-epf)e(\(cat\)\)\))1237 2912 y(\(lpr\)\))1106 -3012 y(\(<)j(paper.ps\)\))888 3231 y FD(Arranging)35 -b(for)f(the)g FA(begin)f FD(pr)o(ocess)h(form)g(to)h(synchr)o(onise)g -(the)g(curr)o(ent)e(I/O)888 3331 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 3430 y(r)o(ections.)805 3616 y -Fw(\017)41 b FA(file-match)17 b FD(mor)o(e)j(r)o(obust)888 -3716 y(The)h FA(file-match)16 b FD(pr)o(ocedur)o(e)i(now)k(catches)e -(any)g(err)o(or)g(condition)h(signalled)g(by)888 3816 -y(a)h(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 3915 -y FA(#f)p FD(,)h FC(i.e.)p FD(,)h(match)f(failur)o(e.)34 -b(This)25 b(means)f FA(file-match)c FD(no)25 b(longer)f(gets)h(blown)g -(out)888 4015 y(of)19 b(the)f(water)g(by)g(trying)h(to)g(apply)f(a)g -(function)h(like)f FA(file-directory?)12 b FD(to)19 b(a)f(dan-)888 -4115 y(gling)k(symlink,)g(and)e(other)h(r)o(elated)e(OS)i(err)o(ors.) -805 4301 y Fw(\017)41 b FD(Standar)o(d)19 b(input)i(now)h(unbuf)o(fer)o -(ed)888 4400 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 4500 -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 -4599 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 -4699 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 -4799 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 -4898 y(policy)h(yourself.)2051 5147 y(150)p eop +150 155 bop 988 614 a FB(\226)41 b FD(support)21 b(for)g +(pseudo-terminal)f(\223pty\224)g(devices,)988 748 y FB(\226)41 +b FD(\002le)21 b(locking,)988 882 y FB(\226)41 b FD(pr)o(ocess)20 +b(timing,)988 1016 y FB(\226)41 b FA(set-file-times)p +FD(,)988 1150 y FB(\226)g FA(seek)19 b FD(and)h FA(tell)p +FD(.)888 1318 y(Note)d(that)g(having)g FA(select)p FD(,)e +(pseudo-terminals,)i(and)g(tty)g(device)f(contr)o(ol)h(means)888 +1417 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 1517 y(as)c(telnet)g +(servers)f(and)g(clients,)h(dir)o(ectly)f(in)h(Scheme.)805 +1685 y Fw(\017)41 b FD(New)21 b(command-line)g(switches)888 +1785 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 1884 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 1984 y(the)k(new)g(command-line)f +(switches)h(to)g(open)g(dependent)f(modules)g(and)g(load)888 +2084 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 +2183 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 2283 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 2383 y(grams.)805 2551 y Fw(\017)41 b FD(Static)20 +b(heap)h(linking)888 2650 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 +FA(.o)g FD(\002le)888 2750 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 +2849 y(dalone)34 b(executable)e(binary)-9 b(,)37 b(makes)d(startup)f +(time)h(near)o(-instantaneous,)i(and)888 2949 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 3049 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 3148 y(and)d(does)f(not)i(occupy)f(space)f(in)h(the)g(r)o(un-time)g +(heap.)1071 3325 y Fl(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 3417 +y(time)19 b(for)e(this)i(r)o(elease.)681 3672 y FB(10.2.2)80 +b(Incompatible)18 b(improvements)681 3856 y FD(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 3956 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 4056 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 4266 y Fw(\017)41 b FD(New)21 +b(pr)o(ocess-object)f(data-type)g(r)o(eturned)f(by)i +FA(fork)888 4366 y FD(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 4466 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 +4565 y FA(wait)16 b FD(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 4665 y(in)22 b(standar)o(d)d(C)h(envir)o(onments,)i(as)e(well.\)) +888 4799 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 4898 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,)2051 5147 y(150)p eop %%Page: 151 157 -151 156 bop 490 614 a Fw(\017)41 b FD(\223writeable\224)19 -b(now)j(spelled)e(\223writable\224)573 714 y(W)-8 b(e)27 -b(inconsistently)h(spelled)f FA(file-writable?)21 b FD(and)26 -b FA(file-not-writabl)o(e?)20 b FD(in)573 814 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 913 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 1013 y(lease)c(0.4,)f(but)i(will)h(go)f(away)f -(in)h(futur)o(e)f(r)o(eleases.)490 1190 y Fw(\017)41 -b FA(char-set-member?)14 b FD(r)o(eplaced)573 1290 y(W)-8 -b(e)21 b(have)f(de-r)o(eleased)e(the)j FA(char-set-member?)14 -b FD(pr)o(ocedur)o(e.)24 b(The)d(scsh)g(0.3)f(ver)o(-)573 -1390 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 1541 y FA(\(char-set-membe)o(r?)37 -b FC(char)43 b(char-set)o FA(\))573 1693 y FD(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 1793 y(\()p FC(i.e.)o -FD(,)31 b Fo(x)38 b Fw(2)h Fo(S)5 b FD(\),)30 b(and)e(also)h -(consistent)h(with)g(the)f(R4RS)g FA(member)p FD(,)f -FA(memq)f FD(and)h FA(memv)573 1892 y FD(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 1992 y(used)23 b(by)h(the)g -FA(char-set-member?)18 b FD(in)24 b(MIT)f(Scheme's)h(character)o(-set)e -(library)-9 b(.)34 b(If)573 2092 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 -2191 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 2291 y(MIT)c(Scheme)h(meant)f -(inconsistency)j(with)f(common)g(mathematical)e(notation)573 -2391 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 2490 y(intr)o(oduce)20 -b(confusion.)573 2629 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 FA(char-set-member?)573 -2728 y FD(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 -2880 y FA(\(char-set-conta)o(in)o(s?)37 b FC(cset)44 -b(char)o FA(\))573 3032 y FD(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 3209 -y Fw(\017)41 b FA(file-attributes)14 b FD(now)22 b FA(file-info)573 -3309 y FD(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 3409 -y(r)o(etrieve)33 b(information)i(about)f(system)h(r)o(esour)o(ces)f -FA(...-info)d FD(\()p FC(e.g.)o FD(,)37 b FA(tty-info)p -FD(,)573 3508 y FA(user-info)p FD(,)16 b FA(group-info)p -FD(\),)f(the)20 b FA(file-attributes)14 b FD(pr)o(ocedur)o(e)k(is)i -(now)h(named)573 3608 y FA(file-info)p FD(.)573 3747 -y(W)-8 b(e)17 b(continue)h(to)f(export)g(a)f FA(file-attributes)11 -b FD(binding)17 b(for)g(the)g(curr)o(ent)f(r)o(elease,)573 -3846 y(but)21 b(it)g(will)g(go)g(away)g(in)g(futur)o(e)e(r)o(eleases.) -490 4024 y Fw(\017)41 b FD(Renaming)22 b(of)e(I/O)i(synchr)o(onisation) -g(pr)o(ocedur)o(es)573 4123 y(The)107 b FA(\(stdio->stdports)37 -b FC(thunk)o FA(\))107 b FD(pr)o(ocedur)o(e)f(has)h(been)g(r)o(enamed) -573 4223 y FA(with-stdio-ports)o(*)p FD(;)35 b(ther)o(e)f(is)g(now)i(a) -e(corr)o(esponding)g FA(with-stdio-ports)573 4322 y FD(special)54 -b(form.)126 b(The)54 b FA(stdio->stdports)48 b FD(pr)o(ocedur)o(e)53 -b(is)h(now)i(a)d(nullary)573 4422 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 4599 y Fw(\017)41 b FD(New)21 -b(meta-ar)o(g)e(line-two)i(syntax)573 4699 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 4799 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 4898 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)1735 -5147 y(151)p eop +151 156 bop 573 614 a FD(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 +714 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 +814 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 913 +y(further)20 b(details.)490 1099 y Fw(\017)41 b FD(Better)20 +b(stdio/curr)o(ent-port)g(synchr)o(onisation)573 1199 +y(The)i FA(\(begin)41 b(...\))21 b FD(pr)o(ocess)h(form)g(now)h(does)f +(a)g FA(stdio->stdports)16 b FD(call)22 b(befor)o(e)573 +1298 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 +1398 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 FA(begin)e +FD(form)i(in)573 1498 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 +1597 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 1697 y FC(E.g.)o +FD(,)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 1797 y(sation:)573 +2016 y FA(\(run)42 b(\(|)h(\(gunzip\))922 2115 y(;;)f(Kill)g(line)g(1)h +(and)g(insert)e(doubled-sided)922 2215 y(;;)h(code)g(at)h(head)f(of)h +(Postscript.)922 2315 y(\(begin)e(\(read-line\))e(;)k(Eat)f(first)g +(line.)1227 2414 y(\(display)e("\045!PS-Adobe-2.0\\)o(\\n)o("\))1227 +2514 y(\(display)g("statusdict)f(/setduplexmode)f(known)j("\))1227 +2614 y(\(display)f("{statusdict)f(begin)i(true)h("\))1227 +2713 y(\(display)e("setduplexmode)e(end})k(if\\n"\))1227 +2813 y(\(exec-epf)e(\(cat\)\)\))922 2912 y(\(lpr\)\))791 +3012 y(\(<)j(paper.ps\)\))573 3231 y FD(Arranging)34 +b(for)g(the)h FA(begin)d FD(pr)o(ocess)i(form)h(to)f(synchr)o(onise)i +(the)e(curr)o(ent)g(I/O)573 3331 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 3430 y(r)o(ections.)490 3616 y +Fw(\017)41 b FA(file-match)16 b FD(mor)o(e)21 b(r)o(obust)573 +3716 y(The)f FA(file-match)d FD(pr)o(ocedur)o(e)h(now)j(catches)f(any)h +(err)o(or)e(condition)j(signalled)e(by)573 3816 y(a)i(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 3915 y FA(#f)p FD(,)h +FC(i.e.)p FD(,)g(match)g(failur)o(e.)35 b(This)24 b(means)g +FA(file-match)c FD(no)25 b(longer)g(gets)f(blown)h(out)573 +4015 y(of)18 b(the)h(water)e(by)i(trying)g(to)f(apply)g(a)g(function)h +(like)g FA(file-directory?)12 b FD(to)19 b(a)e(dan-)573 +4115 y(gling)22 b(symlink,)g(and)e(other)h(r)o(elated)e(OS)i(err)o +(ors.)490 4301 y Fw(\017)41 b FD(Standar)o(d)18 b(input)k(now)f(unbuf)o +(fer)o(ed)573 4400 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 +4500 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 +4599 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 +4699 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 +4799 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 +4898 y(policy)f(yourself.)1735 5147 y(151)p eop %%Page: 152 158 -152 157 bop 888 614 a FD(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 714 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 -814 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 1065 y FB(10.2.3)80 -b(Backwards-compatible)17 b(improvements)681 1248 y FD(Some)k(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 1347 y(existing)f(code.)805 -1555 y Fw(\017)41 b FD(Impr)o(oved)20 b(err)o(or)g(r)o(eporting)888 -1654 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 1754 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 1854 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 -1953 y(fr)o(om)i(Scheme)f(48.)888 2086 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 2186 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 -2285 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 -2385 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 -2485 y(And)i(worth)g(it,)g(too.)888 2617 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 2717 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 -2817 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 2916 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 3016 y(the)21 -b(memory)h(system)f(until)h(it)f(is)g(r)o(efer)o(enced.\))888 -3149 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 -3248 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 -3348 y(was)29 b(\()p FC(e.g.)o FD(,)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 -3448 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.)805 3614 y Fw(\017)41 -b FD(Closing)22 b(a)f(port)f(twice)h(allowed)888 3713 -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 3813 -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 -3913 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 4079 y Fw(\017)41 -b FD(Better)20 b(time)h(pr)o(ecision)888 4178 y(The)34 -b FA(time+ticks)29 b FD(pr)o(ocedur)o(e)j(now)i(r)o(eturns)g -(sub-second)f(pr)o(ecision)h(on)g(OS's)888 4278 y(that)21 -b(support)g(it.)805 4444 y Fw(\017)41 b FD(Nicer)21 b(print-methods)g -(for)g(basic)f(data-types)888 4544 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 4643 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 4743 y(pr)o(ocess)21 b(object)g(for)f(pr)o -(ocess)h(id)f(2653)f(prints)i(as)g FA(#{proc)41 b(2653})p -FD(.)2051 5147 y(152)p eop +152 157 bop 805 614 a Fw(\017)41 b FD(\223writeable\224)19 +b(now)j(spelled)f(\223writable\224)888 714 y(W)-8 b(e)27 +b(inconsistently)i(spelled)d FA(file-writable?)21 b FD(and)26 +b FA(file-not-writable)o(?)21 b FD(in)888 814 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 913 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 +1013 y(lease)d(0.4,)g(but)h(will)g(go)g(away)f(in)i(futur)o(e)d(r)o +(eleases.)805 1190 y Fw(\017)41 b FA(char-set-member?)14 +b FD(r)o(eplaced)888 1290 y(W)-8 b(e)21 b(have)g(de-r)o(eleased)d(the)j +FA(char-set-member?)14 b FD(pr)o(ocedur)o(e.)24 b(The)c(scsh)i(0.3)d +(ver)o(-)888 1390 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 1541 +y FA(\(char-set-member)o(?)38 b FC(char)43 b(char-set)o +FA(\))888 1693 y FD(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 +1793 y(\()p FC(i.e.)p FD(,)30 b Fo(x)39 b Fw(2)f Fo(S)5 +b FD(\),)30 b(and)f(also)g(consistent)h(with)f(the)g(R4RS)g +FA(member)p FD(,)f FA(memq)f FD(and)i FA(memv)888 1892 +y FD(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 1992 y(used)24 b(by)g(the)g FA(char-set-member?)17 +b FD(in)25 b(MIT)e(Scheme's)h(character)o(-set)d(library)-9 +b(.)34 b(If)888 2092 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 +2191 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 2291 y(MIT)e(Scheme)f(meant)h +(inconsistency)i(with)e(common)i(mathematical)d(notation)888 +2391 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 2490 y(intr)o(oduce)21 +b(confusion.)888 2629 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 FA(char-set-member)o(?)888 +2728 y FD(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 +2880 y FA(\(char-set-contai)o(ns?)37 b FC(cset)43 b(char)p +FA(\))888 3032 y FD(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 3209 y Fw(\017)41 +b FA(file-attributes)15 b FD(now)22 b FA(file-info)888 +3309 y FD(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 3409 +y(r)o(etrieve)33 b(information)j(about)e(system)h(r)o(esour)o(ces)e +FA(...-info)e FD(\()p FC(e.g.)o FD(,)38 b FA(tty-info)p +FD(,)888 3508 y FA(user-info)p FD(,)16 b FA(group-info)p +FD(\),)g(the)k FA(file-attributes)13 b FD(pr)o(ocedur)o(e)18 +b(is)j(now)f(named)888 3608 y FA(file-info)p FD(.)888 +3747 y(W)-8 b(e)17 b(continue)h(to)g(export)e(a)h FA(file-attributes)10 +b FD(binding)18 b(for)f(the)g(curr)o(ent)f(r)o(elease,)888 +3846 y(but)21 b(it)g(will)h(go)f(away)f(in)h(futur)o(e)f(r)o(eleases.) +805 4024 y Fw(\017)41 b FD(Renaming)22 b(of)f(I/O)g(synchr)o(onisation) +h(pr)o(ocedur)o(es)888 4123 y(The)108 b FA(\(stdio->stdport)o(s)38 +b FC(thunk)o FA(\))107 b FD(pr)o(ocedur)o(e)e(has)i(been)g(r)o(enamed) +888 4223 y FA(with-stdio-ports*)o FD(;)35 b(ther)o(e)f(is)h(now)g(a)f +(corr)o(esponding)h FA(with-stdio-port)o(s)888 4322 y +FD(special)54 b(form.)126 b(The)55 b FA(stdio->stdports)48 +b FD(pr)o(ocedur)o(e)k(is)j(now)g(a)f(nullary)888 4422 +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 4599 y +Fw(\017)41 b FD(New)21 b(meta-ar)o(g)e(line-two)j(syntax)888 +4699 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 4799 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 4898 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)2051 5147 y(152)p +eop %%Page: 153 159 -153 158 bop 365 1262 a Fz(Chapter)45 b(1)-6 b(1)365 1702 -y FE(T)-23 b(odo)365 2159 y FD(Ther)o(e)35 b(ar)o(e)e(always)i(many)-9 -b(,)39 b(many)d(impr)o(ovements)f(and)g(extensions)h(that)f(could)h(be) -365 2258 y(made)30 b(to)h(scsh.)55 b(W)-8 b(e)31 b(invite)g(inter)o -(ested)f(hackers)g(to)h(do)f(any)h(of)f(them,)k(and)c(send)g(us)365 -2358 y(the)22 b(code;)f(we'll)h(put)g(you)g(on)g(the)g(team.)28 -b(V)-5 b(isit)22 b(the)g(Scheme)f(Under)o(gr)o(ound)g(W)-8 -b(eb)21 b(page)365 2457 y(for)g(mor)o(e)f(information)i(on)f(good)h -(hacks)e(at)573 2557 y FA(http://www.ai.mi)o(t.)o(edu)o(/p)o(roj)o(ec)o -(ts)o(/su)o(/)365 2657 y FD(Scsh)h(is)h(a)e(tool)i(that)f(lets)g(you)h -(write)f(fun)g(pr)o(ograms)f(that)h(do)g(r)o(eal)f(things)i(in)g(an)f -(elegant)365 2756 y(language;)f(go)i(wild.)490 2959 y -Fw(\017)41 b FD(Thr)o(eads.)490 3123 y Fw(\017)g FD(An)21 -b(X)g(gui)g(interface.)j(\(Needs)c(thr)o(eads.\))490 -3287 y Fw(\017)41 b FD(A)20 b(better)g(C)h(function/data-str)o(uctur)o -(e)f(interface.)k(This)d(is)h(not)f(easy)-9 b(.)490 3451 -y Fw(\017)41 b FD(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 3615 y Fw(\017)41 b FD(An)21 b(ILU)f(interface.)490 -3779 y Fw(\017)41 b FD(An)21 b(RPC)g(system,)g(with)g(\223tail-r)o -(ecursion.\224)490 3943 y Fw(\017)41 b FD(Interfaces)21 -b(to)i(r)o(elational)f(db's.)31 b(This)23 b(would)g(be)f(quite)h -(useful)f(for)h(W)-8 b(eb)22 b(servers.)573 4043 y(An)d(s-expr)o -(ession)f(embedding)h(of)g(SQL)f(would)h(be)g(a)f(key)h(design)h -(component)g(of)573 4142 y(such)h(a)f(system,)i(along)f(the)g(lines)g -(of)g(scsh's)g(pr)o(ocess)g(notation)h(or)e FA(awk)g -FD(notation.)490 4307 y Fw(\017)41 b FD(Port)21 b(Edwin,)g(and)g(emacs) -g(text)g(editor)g(written)g(in)h(MIT)e(Scheme,)h(to)g(scsh.)27 -b(Com-)573 4406 y(bine)21 b(it)g(with)g(scsh's)h(OS)e(interfaces)g(to)h -(make)g(a)f(visual)h(shell.)490 4570 y Fw(\017)41 b FD(An)21 -b FA(expect)d FD(knock-of)o(f.)490 4734 y Fw(\017)41 -b FD(A)20 b FA(make)f FD(r)o(eplacement,)h(using)h(scsh's)h(pr)o(ocess) -e(notation)i(in)f(the)g(build)g(r)o(ules.)490 4898 y -Fw(\017)41 b FD(Manual)20 b(hacking.)1735 5147 y(153)p -eop +153 158 bop 573 614 a FD(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 714 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 +814 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 1065 y FB(10.2.3)81 +b(Backwards-compatible)17 b(improvements)365 1248 y FD(Some)k(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 1347 y(existing)g(code.)490 +1555 y Fw(\017)41 b FD(Impr)o(oved)20 b(err)o(or)g(r)o(eporting)573 +1654 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 1754 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 1854 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 +1953 y(fr)o(om)h(Scheme)h(48.)573 2086 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 2186 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 +2285 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 +2385 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 2485 y(And)h(worth)i(it,)e +(too.)573 2617 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 2717 +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 2817 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 2916 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 3016 y(the)21 b(memory)g(system)h(until)f +(it)g(is)g(r)o(efer)o(enced.\))573 3149 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 3248 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 3348 y(was)28 b(\()p FC(e.g.)o +FD(,)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 3448 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.)490 3614 y Fw(\017)41 b FD(Closing)22 +b(a)e(port)h(twice)g(allowed)573 3713 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 3813 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 3913 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 4079 +y Fw(\017)41 b FD(Better)20 b(time)h(pr)o(ecision)573 +4178 y(The)33 b FA(time+ticks)d FD(pr)o(ocedur)o(e)h(now)k(r)o(eturns)e +(sub-second)h(pr)o(ecision)f(on)h(OS's)573 4278 y(that)21 +b(support)g(it.)490 4444 y Fw(\017)41 b FD(Nicer)20 b(print-methods)i +(for)e(basic)g(data-types)573 4544 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 4643 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 4743 y(pr)o(ocess)20 b(object)h(for)g(pr)o +(ocess)f(id)h(2653)e(prints)i(as)f FA(#{proc)41 b(2653})p +FD(.)1735 5147 y(153)p eop %%Page: 154 160 -154 159 bop 988 614 a FB(\226)41 b FD(The)17 b(L)1248 -597 y Fs(A)1281 614 y FD(T)1318 634 y(E)1358 614 y(X)h(hackery)f(needs) -h(yet)f(another)h(serious)g(pass.)24 b(Most)18 b(importantly)-9 -b(,)1071 714 y(long)22 b(pr)o(ocedur)o(e)c(\223declarations\224)i(need) -g(to)h(be)g(br)o(oken)f(acr)o(oss)g(two)i(lines.)988 -847 y FB(\226)41 b FD(Soup)24 b(up)h(the)f(markup)g(pr)o(ocessor)-6 -b(,)25 b(and)f(r)o(edo)g(manual)g(in)h(markup.)36 b(Gen-)1071 -946 y(erate)20 b(L)1294 929 y Fs(A)1327 946 y FD(T)1364 -966 y(E)1404 946 y(X,)g(HTML,)g(and)g(info)h(versions.)26 -b(Alternatively)-9 b(,)20 b(persuade)f(some)1071 1046 -y(kind)i(soul)h(to)f(hand-port)f(manual)h(to)g(HTML)f(or)h(info.)805 -1212 y Fw(\017)41 b FD(Job)21 b(contr)o(ol,)g(after)e -FA(jcontrol.scm)805 1378 y Fw(\017)41 b FD(Better)20 -b(static)h(heap)f(linker)-6 b(.)805 1544 y Fw(\017)41 -b FD(Gnu)22 b(r)o(eadline)d(lib.)2051 5147 y(154)p eop +154 159 bop 681 1262 a Fz(Chapter)44 b(1)-6 b(1)681 1702 +y FE(T)-23 b(odo)681 2159 y FD(Ther)o(e)34 b(ar)o(e)g(always)h(many)-9 +b(,)39 b(many)c(impr)o(ovements)h(and)f(extensions)h(that)f(could)g(be) +681 2258 y(made)30 b(to)h(scsh.)55 b(W)-8 b(e)31 b(invite)g(inter)o +(ested)e(hackers)h(to)h(do)g(any)f(of)h(them,)i(and)d(send)h(us)681 +2358 y(the)22 b(code;)f(we'll)h(put)g(you)g(on)g(the)g(team.)27 +b(V)-5 b(isit)23 b(the)f(Scheme)f(Under)o(gr)o(ound)f(W)-8 +b(eb)22 b(page)681 2457 y(for)e(mor)o(e)h(information)g(on)h(good)f +(hacks)g(at)888 2557 y FA(http://www.ai.mit)o(.e)o(du/)o(pr)o(oje)o(ct) +o(s/s)o(u/)681 2657 y FD(Scsh)g(is)g(a)g(tool)h(that)f(lets)g(you)g +(write)g(fun)g(pr)o(ograms)g(that)g(do)g(r)o(eal)f(things)i(in)f(an)g +(elegant)681 2756 y(language;)f(go)h(wild.)805 2959 y +Fw(\017)41 b FD(Thr)o(eads.)805 3123 y Fw(\017)g FD(An)21 +b(X)g(gui)g(interface.)k(\(Needs)19 b(thr)o(eads.\))805 +3287 y Fw(\017)41 b FD(A)21 b(better)f(C)g(function/data-str)o(uctur)o +(e)g(interface.)25 b(This)c(is)g(not)g(easy)-9 b(.)805 +3451 y Fw(\017)41 b FD(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 3615 y Fw(\017)41 b FD(An)21 b(ILU)f(interface.)805 +3779 y Fw(\017)41 b FD(An)21 b(RPC)g(system,)g(with)h(\223tail-r)o +(ecursion.\224)805 3943 y Fw(\017)41 b FD(Interfaces)22 +b(to)h(r)o(elational)e(db's.)31 b(This)23 b(would)g(be)g(quite)g +(useful)f(for)g(W)-8 b(eb)23 b(servers.)888 4043 y(An)c(s-expr)o +(ession)g(embedding)f(of)h(SQL)g(would)g(be)f(a)h(key)g(design)g +(component)h(of)888 4142 y(such)i(a)e(system,)h(along)g(the)g(lines)h +(of)e(scsh's)i(pr)o(ocess)e(notation)i(or)f FA(awk)e +FD(notation.)805 4307 y Fw(\017)41 b FD(Port)22 b(Edwin,)f(and)g(emacs) +f(text)h(editor)g(written)h(in)f(MIT)g(Scheme,)f(to)i(scsh.)27 +b(Com-)888 4406 y(bine)21 b(it)g(with)h(scsh's)f(OS)g(interfaces)f(to)h +(make)f(a)h(visual)f(shell.)805 4570 y Fw(\017)41 b FD(An)21 +b FA(expect)d FD(knock-of)o(f.)805 4734 y Fw(\017)41 +b FD(A)21 b FA(make)e FD(r)o(eplacement,)g(using)j(scsh's)f(pr)o(ocess) +g(notation)g(in)h(the)f(build)f(r)o(ules.)805 4898 y +Fw(\017)41 b FD(Manual)20 b(hacking.)2051 5147 y(154)p +eop %%Page: 155 161 -155 160 bop 365 1095 a FE(Index)365 1513 y FA(\045read-delimited!)p -FD(,)14 b(1)-5 b(1)g(1)365 1616 y(*temp-\002le-template*,)20 -b(49)365 1718 y FA(->uid)p FD(,)f(61)365 1821 y FA(->username)p -FD(,)e(61)365 1924 y FA(\045exec)p FD(,)i(52)365 2026 -y FA(\045exit)p FD(,)g(52)365 2129 y FA(\045fork)p FD(,)g(53)365 -2231 y FA(\045fork/pipe)p FD(,)e(53)365 2334 y FA(\045fork/pipe+)p -FD(,)f(54)365 2436 y(&,)k(13)365 2539 y FA(&)p FD(,)g(13)365 -2642 y FA(&&)p FD(,)g(20)365 2744 y FA(interrupt/alarm)p -FD(,)15 b(64)365 2847 y FA(interrupt/alrm)p FD(,)g(64)365 -2949 y FA(interrupt/chld)p FD(,)g(64)365 3052 y FA(interrupt/cont)p -FD(,)g(64)365 3154 y FA(interrupt/hup)p FD(,)g(64)365 -3257 y FA(interrupt/info)p FD(,)g(64)365 3360 y FA(interrupt/int)p -FD(,)g(64)365 3462 y FA(interrupt/io)p FD(,)h(64)365 -3565 y FA(interrupt/keyboar)o(d)p FD(,)e(64)365 3667 -y FA(interrupt/memory-)o(sh)o(ort)o(ag)o(e)p FD(,)g(64)365 -3770 y FA(interrupt/poll)p FD(,)h(64)365 3873 y FA(interrupt/prof)p -FD(,)g(64)365 3975 y FA(interrupt/pwr)p FD(,)g(64)365 -4078 y FA(interrupt/quit)p FD(,)g(64)365 4180 y FA(interrupt/term)p -FD(,)g(64)365 4283 y FA(interrupt/tstp)p FD(,)g(64)365 -4385 y FA(interrupt/urg)p FD(,)g(64)365 4488 y FA(interrupt/usr1)p -FD(,)g(64)365 4591 y FA(interrupt/usr2)p FD(,)g(64)365 -4693 y FA(interrupt/vtalrm)p FD(,)f(64)365 4796 y FA(interrupt/winch)p -FD(,)h(64)365 4898 y FA(interrupt/xcpu)p FD(,)g(64)1943 -1513 y FA(interrupt/xfsz)p FD(,)f(64)1943 1616 y FA(signal/abrt)p -FD(,)i(65)1943 1718 y FA(signal/alrm)p FD(,)g(64)1943 -1821 y FA(signal/bus)p FD(,)g(65)1943 1924 y FA(signal/chld)p -FD(,)g(64)1943 2026 y FA(signal/cont)p FD(,)g(64)1943 -2129 y FA(signal/emt)p FD(,)g(65)1943 2231 y FA(signal/fpe)p -FD(,)g(65)1943 2334 y FA(signal/hup)p FD(,)g(64)1943 -2436 y FA(signal/ill)p FD(,)g(65)1943 2539 y FA(signal/info)p -FD(,)g(64)1943 2642 y FA(signal/int)p FD(,)g(64)1943 -2744 y FA(signal/iot)p FD(,)g(65)1943 2847 y FA(signal/io)p -FD(,)h(64)1943 2949 y FA(signal/kill)p FD(,)f(65)1943 -3052 y FA(signal/pipe)p FD(,)g(65)1943 3154 y FA(signal/poll)p -FD(,)g(64)1943 3257 y FA(signal/prof)p FD(,)g(64)1943 -3360 y FA(signal/pwr)p FD(,)g(64)1943 3462 y FA(signal/quit)p -FD(,)g(64)1943 3565 y FA(signal/segv)p FD(,)g(65)1943 -3667 y FA(signal/stop)p FD(,)g(65)1943 3770 y FA(signal/sys)p -FD(,)g(65)1943 3873 y FA(signal/term)p FD(,)g(64)1943 -3975 y FA(signal/trap)p FD(,)g(65)1943 4078 y FA(signal/tstp)p -FD(,)g(64)1943 4180 y FA(signal/ttin)p FD(,)g(65)1943 -4283 y FA(signal/ttou)p FD(,)g(65)1943 4385 y FA(signal/urg)p -FD(,)g(64)1943 4488 y FA(signal/usr1)p FD(,)g(64)1943 -4591 y FA(signal/usr2)p FD(,)g(64)1943 4693 y FA(signal/vtalrm)p -FD(,)f(64)1943 4796 y FA(signal/winch)p FD(,)g(64)1943 -4898 y FA(signal/xcpu)p FD(,)h(64)1735 5147 y(155)p eop +155 160 bop 672 614 a FB(\226)42 b FD(The)17 b(L)933 +597 y Fs(A)966 614 y FD(T)1003 634 y(E)1043 614 y(X)h(hackery)f(needs)g +(yet)h(another)f(serious)h(pass.)25 b(Most)17 b(importantly)-9 +b(,)756 714 y(long)21 b(pr)o(ocedur)o(e)e(\223declarations\224)g(need)h +(to)i(be)e(br)o(oken)h(acr)o(oss)f(two)h(lines.)672 847 +y FB(\226)42 b FD(Soup)24 b(up)g(the)h(markup)f(pr)o(ocessor)-6 +b(,)25 b(and)f(r)o(edo)f(manual)h(in)h(markup.)36 b(Gen-)756 +946 y(erate)19 b(L)978 929 y Fs(A)1011 946 y FD(T)1048 +966 y(E)1088 946 y(X,)i(HTML,)e(and)i(info)g(versions.)26 +b(Alternatively)-9 b(,)20 b(persuade)f(some)756 1046 +y(kind)i(soul)g(to)g(hand-port)g(manual)f(to)h(HTML)f(or)h(info.)490 +1212 y Fw(\017)41 b FD(Job)20 b(contr)o(ol,)h(after)f +FA(jcontrol.scm)490 1378 y Fw(\017)41 b FD(Better)20 +b(static)g(heap)h(linker)-6 b(.)490 1544 y Fw(\017)41 +b FD(Gnu)21 b(r)o(eadline)f(lib.)1735 5147 y(155)p eop %%Page: 156 162 -156 161 bop 681 614 a FA(signal/xfsz)p FD(,)16 b(64)681 -807 y FA(accept-connectio)o(n)p FD(,)e(93)681 907 y FA(add-after)p -FD(,)j(75)681 1007 y FA(add-before)p FD(,)f(75)681 1107 -y FA(alist->env)p FD(,)g(74)681 1208 y FA(alist-compress)p -FD(,)e(74)681 1308 y FA(alist-delete)p FD(,)h(74)681 -1408 y FA(alist-update)p FD(,)g(74)681 1508 y FA(arg)p -FD(,)k(62)681 1608 y FA(arg*)p FD(,)g(62)681 1709 y FA(argv)p -FD(,)g(62)681 1809 y FA(arithmetic-shift)o FD(,)c(126)681 -1909 y FA(ascii->char)p FD(,)h(107)681 2009 y FA(ascii-range->cha)o(r-) -o(set)o FD(,)f(108)681 2109 y FA(autoreap-policy)p FD(,)f(56)681 -2210 y(awk,)20 b(120)681 2402 y FA(become-session-l)o(ea)o(der)o -FD(,)15 b(81)681 2502 y FA(bind-listen-acce)o(pt)o(-lo)o(op)o -FD(,)g(90)681 2602 y FA(bind-socket)p FD(,)h(93)681 2703 -y FA(bitwise-and)p FD(,)g(126)681 2803 y FA(bitwise-ior)p -FD(,)g(126)681 2903 y FA(bitwise-not)p FD(,)g(126)681 -3003 y FA(bitwise-xor)p FD(,)g(126)681 3196 y FA(call-terminally)p -FD(,)e(52)681 3296 y FA(call-with-string)o(-o)o(utp)o(ut)o(-p)o(ort)o -FD(,)1013 3396 y(26)681 3496 y FA(call/fdes)p FD(,)j(30)681 -3596 y FA(char->ascii)p FD(,)f(107)681 3696 y FA(char-alphabetic?)o -FD(,)f(109)681 3796 y FA(char-alphanumeri)o(c?)o FD(,)g(109)681 -3896 y FA(char-filter)p FD(,)h(20)681 3997 y FA(char-graphic?)p -FD(,)f(109)681 4097 y FA(char-lower-case?)o FD(,)g(109)681 -4197 y FA(char-numeric?)82 b FD(,)20 b(109)681 4297 y -FA(char-set)p FD(,)d(108)681 4397 y FA(char-set-contain)o(s?)o -FD(,)e(108)681 4498 y FA(char-set-differe)o(nc)o(e)p -FD(,)f(109)681 4598 y FA(char-set-interse)o(ct)o(ion)o -FD(,)h(109)681 4698 y FA(char-set-invert)p FD(,)f(109)681 -4798 y FA(char-set-members)o FD(,)h(108)681 4898 y FA(char-set-union)p -FD(,)f(109)2258 614 y(char)o(-set:alphabetic,)k(109)2258 -714 y(char)o(-set:alphanumeric,)h(109)2258 814 y(char)o(-set:graphic,)g -(109)2258 914 y(char)o(-set:lower)o(-case,)f(109)2258 -1014 y(char)o(-set:not-whitespace,)h(109)2258 1114 y(char)o -(-set:numeric,)g(109)2258 1214 y(char)o(-set:upper)o(-case,)e(109)2258 -1314 y(char)o(-set:whitespace,)i(109)2258 1414 y FA(char-set?)p -FD(,)e(107)2258 1514 y FA(char-upper-case?)p FD(,)d(109)2258 -1613 y FA(char-whitespace?)p FD(,)g(109)2258 1713 y FA(chars->char-set) -p FD(,)h(108)2258 1813 y FA(chdir)p FD(,)k(59)2258 1913 -y FA(close)p FD(,)g(25)2258 2013 y FA(close-after)p FD(,)d(24)2258 -2113 y FA(close-socket)p FD(,)g(90)2258 2213 y FA(command-line)p -FD(,)g(61)2258 2313 y(command-line-ar)o(guments,)k(61)2258 -2413 y FA(connect-socket)p FD(,)15 b(93)2258 2513 y FA -(control-tty-file-)o(na)o(me)p FD(,)f(82)2258 2613 y -FA(copy-tty-info)p FD(,)h(79)2258 2712 y FA(cpu-ticks/sec)p -FD(,)g(60)2258 2812 y FA(create-directory)p FD(,)f(40)2258 -2912 y FA(create-fifo)p FD(,)i(40)2258 3012 y FA(create-hard-link)p -FD(,)e(40)2258 3112 y FA(create-socket)p FD(,)h(90)2258 -3212 y FA(create-socket-pai)o(r)p FD(,)f(90)2258 3312 -y FA(create-symlink)p FD(,)h(40)2258 3412 y FA(create-temp-file)p -FD(,)f(48)2258 3512 y FA(cwd)p FD(,)19 b(59)2258 3699 -y(date,)h(68)2258 3799 y FA(date)p FD(,)f(70)2258 3899 -y FA(date->string)p FD(,)d(71)2258 3999 y FA(define-record)p -FD(,)f(7)2258 4099 y FA(delete-directory)p FD(,)f(40)2258 -4199 y FA(delete-file)p FD(,)i(40)2258 4299 y FA(delete-filesys-ob)o -(je)o(ct)p FD(,)e(40)2258 4399 y FA(directory-as-file)o(-n)o(ame)o -FD(,)h(103)2258 4499 y FA(directory-files)p FD(,)g(44)2258 -4599 y FA(disable-tty-char)p FD(,)f(78)2258 4698 y FA(drain-tty)p -FD(,)j(80)2258 4798 y FA(dump-scsh)p FD(,)g(143)2258 -4898 y FA(dump-scsh-program)o FD(,)e(142)2051 5147 y(156)p -eop +156 161 bop 681 1095 a FE(Index)681 1513 y FA(\045read-delimited!)o +FD(,)15 b(1)-5 b(12)681 1616 y(*temp-\002le-template*,)20 +b(49)681 1718 y FA(->uid)p FD(,)e(61)681 1821 y FA(->username)p +FD(,)e(61)681 1924 y FA(\045exec)p FD(,)i(52)681 2026 +y FA(\045exit)p FD(,)g(52)681 2129 y FA(\045fork)p FD(,)g(53)681 +2231 y FA(\045fork/pipe)p FD(,)e(53)681 2334 y FA(\045fork/pipe+)p +FD(,)g(54)681 2436 y(&,)k(13)681 2539 y FA(&)p FD(,)g(13)681 +2642 y FA(&&)p FD(,)f(20)681 2744 y FA(interrupt/alarm)p +FD(,)14 b(64)681 2847 y FA(interrupt/alrm)p FD(,)g(64)681 +2949 y FA(interrupt/chld)p FD(,)g(64)681 3052 y FA(interrupt/cont)p +FD(,)g(64)681 3154 y FA(interrupt/hup)p FD(,)h(64)681 +3257 y FA(interrupt/info)p FD(,)f(64)681 3360 y FA(interrupt/int)p +FD(,)h(64)681 3462 y FA(interrupt/io)p FD(,)g(64)681 +3565 y FA(interrupt/keyboa)o(rd)o FD(,)g(64)681 3667 +y FA(interrupt/memory)o(-s)o(hor)o(ta)o(ge)o FD(,)g(64)681 +3770 y FA(interrupt/poll)p FD(,)f(64)681 3873 y FA(interrupt/prof)p +FD(,)g(64)681 3975 y FA(interrupt/pwr)p FD(,)h(64)681 +4078 y FA(interrupt/quit)p FD(,)f(64)681 4180 y FA(interrupt/term)p +FD(,)g(64)681 4283 y FA(interrupt/tstp)p FD(,)g(64)681 +4385 y FA(interrupt/urg)p FD(,)h(64)681 4488 y FA(interrupt/usr1)p +FD(,)f(64)681 4591 y FA(interrupt/usr2)p FD(,)g(64)681 +4693 y FA(interrupt/vtalrm)o FD(,)h(64)681 4796 y FA(interrupt/winch)p +FD(,)f(64)681 4898 y FA(interrupt/xcpu)p FD(,)g(64)2258 +1513 y FA(interrupt/xfsz)p FD(,)h(64)2258 1616 y FA(signal/abrt)p +FD(,)h(65)2258 1718 y FA(signal/alrm)p FD(,)g(64)2258 +1821 y FA(signal/bus)p FD(,)h(65)2258 1924 y FA(signal/chld)p +FD(,)f(64)2258 2026 y FA(signal/cont)p FD(,)g(64)2258 +2129 y FA(signal/emt)p FD(,)h(65)2258 2231 y FA(signal/fpe)p +FD(,)g(65)2258 2334 y FA(signal/hup)p FD(,)g(64)2258 +2436 y FA(signal/ill)p FD(,)g(65)2258 2539 y FA(signal/info)p +FD(,)f(64)2258 2642 y FA(signal/int)p FD(,)h(64)2258 +2744 y FA(signal/iot)p FD(,)g(65)2258 2847 y FA(signal/io)p +FD(,)g(64)2258 2949 y FA(signal/kill)p FD(,)f(65)2258 +3052 y FA(signal/pipe)p FD(,)g(65)2258 3154 y FA(signal/poll)p +FD(,)g(64)2258 3257 y FA(signal/prof)p FD(,)g(64)2258 +3360 y FA(signal/pwr)p FD(,)h(64)2258 3462 y FA(signal/quit)p +FD(,)f(64)2258 3565 y FA(signal/segv)p FD(,)g(65)2258 +3667 y FA(signal/stop)p FD(,)g(65)2258 3770 y FA(signal/sys)p +FD(,)h(65)2258 3873 y FA(signal/term)p FD(,)f(64)2258 +3975 y FA(signal/trap)p FD(,)g(65)2258 4078 y FA(signal/tstp)p +FD(,)g(64)2258 4180 y FA(signal/ttin)p FD(,)g(65)2258 +4283 y FA(signal/ttou)p FD(,)g(65)2258 4385 y FA(signal/urg)p +FD(,)h(64)2258 4488 y FA(signal/usr1)p FD(,)f(64)2258 +4591 y FA(signal/usr2)p FD(,)g(64)2258 4693 y FA(signal/vtalrm)p +FD(,)f(64)2258 4796 y FA(signal/winch)p FD(,)h(64)2258 +4898 y FA(signal/xcpu)p FD(,)g(64)2051 5147 y(156)p eop %%Page: 157 163 -157 162 bop 365 614 a FA(dup)p FD(,)20 b(31)365 714 y -FA(dup->fdes)p FD(,)d(31)365 815 y FA(dup->inport)p FD(,)f(31)365 -915 y FA(dup->outport)p FD(,)g(31)365 1105 y FA(enabled-interrupt)o(s)p -FD(,)e(66)365 1205 y FA(env->alist)p FD(,)j(73)365 1305 -y FA(errno-error)p FD(,)f(21)365 1405 y FA(error-output-port)o -FD(,)f(24)365 1505 y FA(exec)p FD(,)k(51)365 1605 y(exec-epf,)g(13)365 -1706 y FA(exec-epf)p FD(,)e(13)365 1806 y FA(exec-path)p -FD(,)g(51)365 1906 y(exec-path-list,)j(76)365 2006 y -FA(exec-path-search)p FD(,)14 b(52)365 2106 y FA(exec-path/env)p -FD(,)h(51)365 2206 y FA(exec/env)p FD(,)i(51)365 2306 -y FA(exit)p FD(,)i(52)365 2406 y FA(expand-file-name)p -FD(,)14 b(106)365 2597 y FA(fdes->inport)p FD(,)i(30)365 -2697 y FA(fdes->outport)p FD(,)f(30)365 2797 y FA(fdes-flags)p -FD(,)i(32)365 2897 y FA(fdes-status)p FD(,)f(33)365 2997 -y FA(field-reader)p FD(,)g(1)-5 b(17)365 3097 y FA(field-splitter)p -FD(,)15 b(1)-5 b(14)365 3197 y FA(file-directory?)p FD(,)15 -b(43)365 3297 y FA(file-executable?)p FD(,)f(44)365 3397 -y FA(file-exists?)p FD(,)i(44)365 3497 y FA(file-fifo?)p -FD(,)h(43)365 3597 y FA(file-group)p FD(,)g(42)365 3697 -y FA(file-info)p FD(,)g(41)365 3797 y(\002le-info:atime,)k(42)365 -3898 y(\002le-info:ctime,)g(42)365 3998 y(\002le-info:device,)f(42)365 -4098 y(\002le-info:gid,)h(42)365 4198 y(\002le-info:inode,)g(42)365 -4298 y(\002le-info:mode,)g(42)365 4398 y(\002le-info:mtime,)g(42)365 -4498 y(\002le-info:nlinks,)h(42)365 4598 y(\002le-info:size,)e(42)365 -4698 y(\002le-info:type,)h(42)365 4798 y(\002le-info:uid,)g(42)365 -4898 y FA(file-inode)p FD(,)c(42)1943 614 y FA(file-last-access)o -FD(,)e(42)1943 714 y FA(file-last-mod)p FD(,)g(42)1943 -814 y FA(file-last-status)o(-c)o(ha)o(nge)o FD(,)g(42)1943 -914 y FA(file-match)p FD(,)h(46)1943 1014 y FA(file-mode)p -FD(,)h(42)1943 1114 y FA(file-name-absolu)o(te)o(?)p -FD(,)d(103)1943 1214 y FA(file-name-as-dir)o(ec)o(to)o(ry)p -FD(,)g(103)1943 1314 y FA(file-name-direct)o(or)o(y)p -FD(,)g(104)1943 1414 y FA(file-name-direct)o(or)o(y?)o -FD(,)h(103)1943 1514 y FA(file-name-extens)o(io)o(n)p -FD(,)f(105)1943 1613 y FA(file-name-non-di)o(re)o(ct)o(ory)o(?)p -FD(,)g(103)1943 1713 y FA(file-name-nondir)o(ec)o(to)o(ry)p -FD(,)g(104)1943 1813 y FA(file-name-sans-e)o(xt)o(en)o(sio)o(n)p -FD(,)g(105)1943 1913 y FA(file-nlinks)p FD(,)i(42)1943 -2013 y FA(file-not-executa)o(bl)o(e?)o FD(,)f(43)1943 -2113 y FA(file-not-exists?)o FD(,)g(44)1943 2213 y FA(file-not-readabl) -o(e?)o FD(,)g(43)1943 2313 y FA(file-not-writabl)o(e?)o -FD(,)g(43)1943 2413 y FA(file-owner)p FD(,)h(42)1943 -2513 y FA(file-readable?)p FD(,)e(44)1943 2613 y FA(file-regular?)p -FD(,)h(43)1943 2712 y FA(file-size)p FD(,)i(42)1943 2812 -y FA(file-socket?)p FD(,)e(43)1943 2912 y FA(file-special?)p -FD(,)g(43)1943 3012 y FA(file-symlink?)p FD(,)g(43)1943 -3112 y FA(file-type)p FD(,)i(42)1943 3212 y FA(file-writable?)p -FD(,)d(44)1943 3312 y FA(fill-in-date!)p FD(,)h(71)1943 -3412 y FA(flush-all-ports)p FD(,)f(37)1943 3512 y FA(flush-tty/both)p -FD(,)g(80)1943 3612 y FA(flush-tty/input)p FD(,)g(80)1943 -3712 y FA(flush-tty/output)o FD(,)h(80)1943 3811 y FA(force-output)p -FD(,)g(37)1943 3911 y FA(fork)p FD(,)k(53)1943 4011 y -FA(fork-pty-session)o FD(,)c(82)1943 4111 y FA(fork/pipe)p -FD(,)i(53)1943 4211 y FA(fork/pipe+)p FD(,)f(54)1943 -4311 y FA(format-date)p FD(,)g(71)1943 4499 y FA(get-lock-region)p -FD(,)e(39)1943 4599 y FA(getenv)p FD(,)k(73)1943 4698 -y FA(glob)p FD(,)h(45)1943 4798 y FA(glob-quote)p FD(,)d(46)1943 -4898 y(gr)o(oup-info,)k(61)1735 5147 y(157)p eop +157 162 bop 365 614 a FA(signal/xfsz)p FD(,)16 b(64)365 +807 y FA(accept-connection)o FD(,)f(93)365 907 y FA(add-after)p +FD(,)i(75)365 1007 y FA(add-before)p FD(,)g(75)365 1107 +y FA(alist->env)p FD(,)g(74)365 1208 y FA(alist-compress)p +FD(,)e(74)365 1308 y FA(alist-delete)p FD(,)h(74)365 +1408 y FA(alist-update)p FD(,)g(74)365 1508 y FA(arg)p +FD(,)k(62)365 1608 y FA(arg*)p FD(,)f(62)365 1709 y FA(argv)p +FD(,)g(62)365 1809 y FA(arithmetic-shift)p FD(,)14 b(127)365 +1909 y FA(ascii->char)p FD(,)i(108)365 2009 y FA(ascii-range->char)o +(-s)o(et)p FD(,)e(109)365 2109 y FA(autoreap-policy)p +FD(,)h(56)365 2210 y(awk,)21 b(121)365 2402 y FA(become-session-le)o +(ad)o(er)p FD(,)14 b(81)365 2502 y FA(bind-listen-accep)o(t-)o(loo)o(p) +p FD(,)g(90)365 2602 y FA(bind-socket)p FD(,)i(93)365 +2703 y FA(bitwise-and)p FD(,)g(127)365 2803 y FA(bitwise-ior)p +FD(,)g(127)365 2903 y FA(bitwise-not)p FD(,)g(127)365 +3003 y FA(bitwise-xor)p FD(,)g(127)365 3196 y FA(call-terminally)p +FD(,)f(52)365 3296 y FA(call-with-string-)o(ou)o(tpu)o(t-)o(por)o(t)p +FD(,)697 3396 y(26)365 3496 y FA(call/fdes)p FD(,)i(30)365 +3596 y FA(char->ascii)p FD(,)f(108)365 3696 y FA(char-alphabetic?)p +FD(,)e(1)-5 b(10)365 3796 y FA(char-alphanumeric)o(?)p +FD(,)14 b(1)-5 b(10)365 3896 y FA(char-filter)p FD(,)16 +b(20)365 3997 y FA(char-graphic?)p FD(,)f(1)-5 b(10)365 +4097 y FA(char-lower-case?)p FD(,)14 b(1)-5 b(10)365 +4197 y FA(char-numeric?)82 b FD(,)21 b(1)-5 b(10)365 +4297 y FA(char-set)p FD(,)17 b(108)365 4397 y FA(char-set-contains)o(?) +p FD(,)d(109)365 4498 y FA(char-set-differen)o(ce)o FD(,)h(109)365 +4598 y FA(char-set-intersec)o(ti)o(on)p FD(,)f(109)365 +4698 y FA(char-set-invert)p FD(,)h(109)365 4798 y FA(char-set-members)p +FD(,)f(109)365 4898 y FA(char-set-union)p FD(,)h(109)1943 +614 y(char)o(-set:alphabetic,)j(109)1943 714 y(char)o +(-set:alphanumeric,)g(109)1943 814 y(char)o(-set:graphic,)g(109)1943 +914 y(char)o(-set:lower)o(-case,)f(109)1943 1014 y(char)o +(-set:not-whitespace,)i(109)1943 1114 y(char)o(-set:numeric,)g(109)1943 +1214 y(char)o(-set:upper)o(-case,)e(109)1943 1314 y(char)o +(-set:whitespace,)h(109)1943 1414 y FA(char-set?)p FD(,)f(108)1943 +1514 y FA(char-upper-case?)o FD(,)e(1)-5 b(10)1943 1613 +y FA(char-whitespace?)o FD(,)15 b(1)-5 b(10)1943 1713 +y FA(chars->char-set)p FD(,)14 b(108)1943 1813 y FA(chdir)p +FD(,)k(59)1943 1913 y FA(close)p FD(,)g(25)1943 2013 +y FA(close-after)p FD(,)e(24)1943 2113 y FA(close-socket)p +FD(,)f(90)1943 2213 y FA(command-line)p FD(,)g(61)1943 +2313 y(command-line-ar)o(guments,)20 b(61)1943 2413 y +FA(connect-socket)p FD(,)14 b(93)1943 2513 y FA(control-tty-file)o(-n)o +(am)o(e)p FD(,)h(82)1943 2613 y FA(copy-tty-info)p FD(,)g(79)1943 +2712 y FA(cpu-ticks/sec)p FD(,)g(60)1943 2812 y FA(create-directory)o +FD(,)g(40)1943 2912 y FA(create-fifo)p FD(,)h(40)1943 +3012 y FA(create-hard-link)o FD(,)f(40)1943 3112 y FA(create-socket)p +FD(,)g(90)1943 3212 y FA(create-socket-pa)o(ir)o FD(,)g(90)1943 +3312 y FA(create-symlink)p FD(,)f(40)1943 3412 y FA(create-temp-file)o +FD(,)h(48)1943 3512 y FA(cwd)p FD(,)k(59)1943 3699 y(date,)g(68)1943 +3799 y FA(date)p FD(,)g(70)1943 3899 y FA(date->string)p +FD(,)c(71)1943 3999 y FA(define-record)p FD(,)g(7)1943 +4099 y FA(delete-directory)o FD(,)g(40)1943 4199 y FA(delete-file)p +FD(,)h(40)1943 4299 y FA(delete-filesys-o)o(bj)o(ec)o(t)p +FD(,)f(40)1943 4399 y FA(directory-as-fil)o(e-)o(na)o(me)p +FD(,)f(104)1943 4499 y FA(directory-files)p FD(,)g(44)1943 +4599 y FA(disable-tty-char)o FD(,)h(78)1943 4698 y FA(drain-tty)p +FD(,)i(80)1943 4798 y FA(dump-scsh)p FD(,)g(144)1943 +4898 y FA(dump-scsh-progra)o(m)p FD(,)d(143)1735 5147 +y(157)p eop %%Page: 158 164 -158 163 bop 681 614 a FA(group-info)p FD(,)16 b(61)681 -714 y(gr)o(oup-info:gid,)k(61)681 814 y(gr)o(oup-info:members,)g(61)681 -913 y(gr)o(oup-info:name,)g(61)681 1096 y FA(home-dir)p -FD(,)d(107)681 1196 y(home-dir)o(ectory)-9 b(,)20 b(76)681 -1295 y FA(home-file)p FD(,)d(107)681 1395 y FA(host-info)p -FD(,)g(96)681 1577 y FA(index)p FD(,)h(101)681 1677 y -FA(infix-splitter)p FD(,)c(1)-5 b(14)681 1777 y FA(internet-address)o -(->)o(soc)o(ke)o(t-)o(add)o(re)o(ss)p FD(,)1013 1876 -y(92)681 1976 y FA(interrupt-handle)o(r)p FD(,)14 b(67)681 -2076 y FA(interrupt-set)p FD(,)h(66)681 2175 y FA(itimer)p -FD(,)j(63)681 2358 y FA(join-strings)p FD(,)d(1)-5 b(17)681 -2540 y FA(listen-socket)p FD(,)15 b(93)681 2640 y FA(lock-region)p -FD(,)h(39)681 2740 y FA(lock-region/no-b)o(lo)o(ck)p -FD(,)e(39)681 2839 y(lock-r)o(egion:end,)20 b(38)681 -2939 y(lock-r)o(egion:exclusive?,)g(38)681 3039 y(lock-r)o(egion:len,)g -(38)681 3138 y(lock-r)o(egion:pr)o(oc,)g(38)681 3238 -y(lock-r)o(egion:start,)g(38)681 3337 y(lock-r)o(egion:whence,)h(38)681 -3437 y(lock-r)o(egion?,)f(38)681 3620 y FA(make-date)p -FD(,)d(69)681 3719 y FA(make-lock-region)o FD(,)e(39)681 -3819 y FA(make-pty-generat)o(or)o FD(,)g(83)681 3919 -y FA(make-regexp)p FD(,)h(99)681 4018 y FA(make-string-inpu)o(t-)o(por) -o(t)p FD(,)e(26)681 4118 y FA(make-string-outp)o(ut)o(-po)o(rt)o -FD(,)h(26)681 4218 y FA(make-tty-info)p FD(,)g(79)681 -4317 y FA(match:end)p FD(,)i(99)681 4417 y FA(match:start)p -FD(,)f(99)681 4516 y FA(match:substring)p FD(,)e(99)681 -4616 y FA(move->fdes)p FD(,)i(30)681 4799 y FA(network-info)p -FD(,)f(96)681 4898 y FA(nice)p FD(,)k(60)2258 614 y FA(nth)p -FD(,)g(126)2258 807 y FA(open-control-tty)p FD(,)14 b(81)2258 -907 y FA(open-fdes)p FD(,)j(32)2258 1007 y FA(open-file)p -FD(,)g(32)2258 1107 y FA(open-input-file)p FD(,)e(32)2258 -1208 y FA(open-output-file)p FD(,)f(32)2258 1308 y FA(open-pty)p -FD(,)j(82)2258 1500 y FA(parent-pid)p FD(,)g(60)2258 -1600 y FA(parse-file-name)p FD(,)e(106)2258 1700 y FA -(path-list->file-n)o(am)o(e)p FD(,)f(105)2258 1801 y -FA(pause-until-inter)o(ru)o(pt)p FD(,)g(63)2258 1901 -y FA(pid)p FD(,)19 b(60)2258 2001 y FA(pid->proc)p FD(,)e(55)2258 -2101 y FA(pipe)p FD(,)i(33)2258 2201 y FA(port->fdes)p -FD(,)e(30)2258 2302 y FA(port->list)p FD(,)g(15)2258 -2402 y FA(port->sexp-list)p FD(,)e(15)2258 2502 y FA(port->string)p -FD(,)h(15)2258 2602 y FA(port->string-list)o FD(,)f(15)2258 -2702 y FA(port-revealed)p FD(,)g(30)2258 2802 y FA(predicate->char-s)o -(et)o FD(,)g(108)2258 2903 y FA(priority)p FD(,)i(60)2258 -3003 y(pr)o(oc,)j(55)2258 3103 y(pr)o(oc:pid,)g(55)2258 -3203 y(pr)o(oc?,)g(55)2258 3303 y FA(process-group)p -FD(,)15 b(60)2258 3404 y FA(process-times)p FD(,)g(60)2258 -3504 y FA(protocol-info)p FD(,)g(96)2258 3604 y FA(pty-name->tty-nam)o -(e)p FD(,)f(82)2258 3796 y FA(read-delimited)p FD(,)h(1)-5 -b(1)g(1)2258 3896 y FA(read-delimited!)p FD(,)15 b(1)-5 -b(1)g(1)2258 3997 y FA(read-line)p FD(,)17 b(1)-5 b(10)2258 -4097 y FA(read-paragraph)p FD(,)15 b(1)-5 b(1)g(1)2258 -4197 y FA(read-string)p FD(,)16 b(33)2258 4297 y FA(read-string!)p -FD(,)g(33)2258 4397 y FA(read-string!/part)o(ia)o(l)p -FD(,)e(34)2258 4498 y FA(read-string/parti)o(al)o FD(,)h(34)2258 -4598 y FA(read-symlink)p FD(,)h(40)2258 4698 y FA(reap-zombies)p -FD(,)g(56)2258 4798 y FA(receive-message)p FD(,)f(94)2258 -4898 y FA(receive-message!)p FD(,)f(94)2051 5147 y(158)p -eop +158 163 bop 681 614 a FA(dup)p FD(,)19 b(31)681 714 y +FA(dup->fdes)p FD(,)e(31)681 815 y FA(dup->inport)p FD(,)f(31)681 +915 y FA(dup->outport)p FD(,)f(31)681 1105 y FA(enabled-interrup)o(ts)o +FD(,)g(66)681 1205 y FA(env->alist)p FD(,)h(73)681 1305 +y FA(errno-error)p FD(,)g(21)681 1405 y FA(error-output-por)o(t)p +FD(,)e(24)681 1505 y FA(exec)p FD(,)19 b(51)681 1605 +y(exec-epf,)f(13)681 1706 y FA(exec-epf)p FD(,)f(13)681 +1806 y FA(exec-path)p FD(,)g(51)681 1906 y(exec-path-list,)i(76)681 +2006 y FA(exec-path-search)o FD(,)c(52)681 2106 y FA(exec-path/env)p +FD(,)g(51)681 2206 y FA(exec/env)p FD(,)i(51)681 2306 +y FA(exit)p FD(,)i(52)681 2406 y FA(expand-file-name)o +FD(,)c(107)681 2597 y FA(fdes->inport)p FD(,)g(30)681 +2697 y FA(fdes->outport)p FD(,)g(30)681 2797 y FA(fdes-flags)p +FD(,)h(32)681 2897 y FA(fdes-status)p FD(,)g(33)681 2997 +y FA(field-reader)p FD(,)f(1)-5 b(18)681 3097 y FA(field-splitter)p +FD(,)14 b(1)-5 b(15)681 3197 y FA(file-directory?)p FD(,)14 +b(43)681 3297 y FA(file-executable?)o FD(,)h(44)681 3397 +y FA(file-exists?)p FD(,)g(44)681 3497 y FA(file-fifo?)p +FD(,)h(43)681 3597 y FA(file-group)p FD(,)g(42)681 3697 +y FA(file-info)p FD(,)h(41)681 3797 y(\002le-info:atime,)j(42)681 +3898 y(\002le-info:ctime,)g(42)681 3998 y(\002le-info:device,)f(42)681 +4098 y(\002le-info:gid,)h(42)681 4198 y(\002le-info:inode,)h(42)681 +4298 y(\002le-info:mode,)f(42)681 4398 y(\002le-info:mtime,)h(42)681 +4498 y(\002le-info:nlinks,)h(42)681 4598 y(\002le-info:size,)e(42)681 +4698 y(\002le-info:type,)g(42)681 4798 y(\002le-info:uid,)g(42)681 +4898 y FA(file-inode)p FD(,)c(42)2258 614 y FA(file-last-access)p +FD(,)e(42)2258 714 y FA(file-last-mod)p FD(,)h(42)2258 +814 y FA(file-last-status-)o(ch)o(ang)o(e)p FD(,)f(42)2258 +914 y FA(file-match)p FD(,)j(46)2258 1014 y FA(file-mode)p +FD(,)g(42)2258 1114 y FA(file-name-absolut)o(e?)o FD(,)e(104)2258 +1214 y FA(file-name-as-dire)o(ct)o(ory)o FD(,)g(104)2258 +1314 y FA(file-name-directo)o(ry)o FD(,)g(104)2258 1414 +y FA(file-name-directo)o(ry)o(?)p FD(,)f(103)2258 1514 +y FA(file-name-extensi)o(on)o FD(,)h(106)2258 1613 y +FA(file-name-non-dir)o(ec)o(tor)o(y?)o FD(,)g(103)2258 +1713 y FA(file-name-nondire)o(ct)o(ory)o FD(,)g(105)2258 +1813 y FA(file-name-sans-ex)o(te)o(nsi)o(on)o FD(,)g(106)2258 +1913 y FA(file-nlinks)p FD(,)h(42)2258 2013 y FA(file-not-executab)o +(le)o(?)p FD(,)e(43)2258 2113 y FA(file-not-exists?)p +FD(,)g(44)2258 2213 y FA(file-not-readable)o(?)p FD(,)g(43)2258 +2313 y FA(file-not-writable)o(?)p FD(,)g(43)2258 2413 +y FA(file-owner)p FD(,)j(42)2258 2513 y FA(file-readable?)p +FD(,)e(44)2258 2613 y FA(file-regular?)p FD(,)g(43)2258 +2712 y FA(file-size)p FD(,)i(42)2258 2812 y FA(file-socket?)p +FD(,)f(43)2258 2912 y FA(file-special?)p FD(,)f(43)2258 +3012 y FA(file-symlink?)p FD(,)g(43)2258 3112 y FA(file-type)p +FD(,)i(42)2258 3212 y FA(file-writable?)p FD(,)e(44)2258 +3312 y FA(fill-in-date!)p FD(,)g(71)2258 3412 y FA(flush-all-ports)p +FD(,)g(37)2258 3512 y FA(flush-tty/both)p FD(,)g(80)2258 +3612 y FA(flush-tty/input)p FD(,)g(80)2258 3712 y FA(flush-tty/output)p +FD(,)f(80)2258 3811 y FA(force-output)p FD(,)i(37)2258 +3911 y FA(fork)p FD(,)j(53)2258 4011 y FA(fork-pty-session)p +FD(,)14 b(82)2258 4111 y FA(fork/pipe)p FD(,)j(53)2258 +4211 y FA(fork/pipe+)p FD(,)g(54)2258 4311 y FA(format-date)p +FD(,)f(71)2258 4499 y FA(get-lock-region)p FD(,)f(39)2258 +4599 y FA(getenv)p FD(,)j(73)2258 4698 y FA(glob)p FD(,)h(45)2258 +4798 y FA(glob-quote)p FD(,)e(46)2258 4898 y(gr)o(oup-info,)k(61)2051 +5147 y(158)p eop %%Page: 159 165 -159 164 bop 365 614 a FA(receive-message!/)o(pa)o(rti)o(al)o -FD(,)15 b(94)365 714 y FA(receive-message/p)o(ar)o(tia)o(l)p -FD(,)f(94)365 814 y FA(record-reader)p FD(,)h(1)-5 b(14)365 -914 y FA(reduce-port)p FD(,)16 b(16)365 1014 y FA(regexp-exec)p -FD(,)g(99)365 1114 y FA(regexp-match?)p FD(,)f(98)365 -1214 y FA(regexp-quote)p FD(,)h(99)365 1314 y FA(regexp-substitute)o -FD(,)f(100)365 1414 y FA(regexp-substitute)o(/g)o(lob)o(al)o -FD(,)g(100)365 1514 y FA(regexp?)p FD(,)j(99)365 1613 -y FA(release-port-hand)o(le)o FD(,)d(30)365 1713 y FA(rename-file)p -FD(,)h(40)365 1813 y FA(repl)p FD(,)j(126)365 1913 y -FA(replace-extension)o FD(,)c(106)365 2013 y FA(resolve-file-name)o -FD(,)g(106)365 2113 y FA(rindex)p FD(,)j(101)365 2213 -y(r)o(un,)j(13)365 2313 y FA(run)p FD(,)f(13)365 2413 -y FA(run/collecting)p FD(,)15 b(17)365 2513 y FA(run/collecting*)p -FD(,)g(17)365 2613 y FA(run/file)p FD(,)i(14)365 2712 -y FA(run/file*)p FD(,)g(15)365 2812 y FA(run/port)p FD(,)g(14)365 -2912 y FA(run/port*)p FD(,)g(15)365 3012 y FA(run/port+proc)p -FD(,)e(17)365 3112 y FA(run/port+proc*)p FD(,)g(17)365 -3212 y FA(run/sexp)p FD(,)i(14)365 3312 y FA(run/sexp*)p -FD(,)g(15)365 3412 y FA(run/sexps)p FD(,)g(14)365 3512 -y FA(run/sexps*)p FD(,)g(15)365 3612 y FA(run/string)p -FD(,)g(14)365 3712 y FA(run/string*)p FD(,)f(15)365 3811 -y FA(run/strings)p FD(,)g(14)365 3911 y FA(run/strings*)p -FD(,)g(15)365 4099 y FA(seek)p FD(,)j(31)365 4199 y FA(select)41 -b FD(,)21 b(34)365 4299 y FA(send-message)p FD(,)16 b(94)365 -4399 y FA(send-message/part)o(ia)o(l)p FD(,)f(94)365 -4499 y FA(send-tty-break)p FD(,)g(80)365 4599 y FA(service-info)p -FD(,)h(96)365 4698 y FA(set-enabled-inter)o(ru)o(pts)o -FD(,)f(66)365 4798 y FA(set-fdes-flags)p FD(,)g(32)365 -4898 y FA(set-fdes-status)p FD(,)g(33)1943 614 y FA(set-file-group)p -FD(,)f(41)1943 714 y FA(set-file-mode)p FD(,)h(41)1943 -814 y FA(set-file-owner)p FD(,)f(41)1943 913 y FA(set-file-times)p -FD(,)g(41)1943 1013 y FA(set-gid)p FD(,)j(60)1943 1112 -y FA(set-interrupt-ha)o(nd)o(le)o(r)p FD(,)e(66)1943 -1212 y FA(set-port-bufferi)o(ng)o FD(,)g(37)1943 1312 -y FA(set-priority)p FD(,)g(60)1943 1411 y FA(set-process-grou)o(p)p -FD(,)f(60)1943 1511 y FA(set-socket-optio)o(n)p FD(,)g(95)1943 -1611 y FA(set-tty-info/dra)o(in)o FD(,)h(80)1943 1710 -y FA(set-tty-info/flu)o(sh)o FD(,)g(80)1943 1810 y FA(set-tty-info/now) -o FD(,)g(80)1943 1910 y FA(set-tty-process-)o(gr)o(ou)o(p)p -FD(,)g(82)1943 2009 y FA(set-uid)p FD(,)i(60)1943 2109 -y FA(set-umask)p FD(,)g(59)1943 2208 y FA(setenv)p FD(,)h(73)1943 -2308 y FA(shutdown-socket)p FD(,)c(94)1943 2408 y FA(signal->interrup)o -(t)p FD(,)g(66)1943 2507 y FA(signal-process)p FD(,)g(63)1943 -2607 y FA(signal-process-g)o(ro)o(up)o FD(,)h(63)1943 -2707 y FA(simplify-file-na)o(me)o FD(,)g(106)1943 2806 -y FA(skip-char-set)p FD(,)g(1)-5 b(12)1943 2906 y FA(sleep)p -FD(,)18 b(63)1943 3005 y FA(sleep-until)p FD(,)e(63)1943 -3105 y FA(sloppy-suffix-sp)o(li)o(tt)o(er)p FD(,)e(1)-5 -b(14)1943 3205 y FA(socket-address->)o(in)o(te)o(rne)o(t-)o(add)o(re)o -(ss)o FD(,)2275 3304 y(92)1943 3404 y FA(socket-address->)o(un)o(ix)o -(-ad)o(dr)o(ess)o FD(,)2275 3504 y(92)1943 3603 y FA(socket-connect)p -FD(,)14 b(89)1943 3703 y FA(socket-local-add)o(re)o(ss)o -FD(,)h(93)1943 3802 y FA(socket-option)p FD(,)g(95)1943 -3902 y FA(socket-remote-ad)o(dr)o(es)o(s)p FD(,)g(93)1943 -4002 y FA(split-file-name)p FD(,)f(104)1943 4101 y FA(start-tty-input)p -FD(,)g(81)1943 4201 y FA(start-tty-output)o FD(,)h(80)1943 -4301 y FA(status:exit-val)p FD(,)f(58)1943 4400 y FA(status:stop-sig)p -FD(,)g(59)1943 4500 y FA(status:term-sig)p FD(,)g(59)1943 -4599 y FA(stdio->stdports)p FD(,)g(25)1943 4699 y FA(stdports->stdio)p -FD(,)g(25)1943 4799 y FA(stop-tty-input)p FD(,)g(81)1943 -4898 y FA(stop-tty-output)p FD(,)g(80)1735 5147 y(159)p -eop +159 164 bop 365 614 a FA(group-info)p FD(,)17 b(61)365 +714 y(gr)o(oup-info:gid,)j(61)365 814 y(gr)o(oup-info:members,)g(61)365 +913 y(gr)o(oup-info:name,)g(61)365 1096 y FA(home-dir)p +FD(,)d(107)365 1196 y(home-dir)o(ectory)-9 b(,)20 b(76)365 +1295 y FA(home-file)p FD(,)d(107)365 1395 y FA(host-info)p +FD(,)g(96)365 1577 y FA(index)p FD(,)i(101)365 1677 y +FA(infix-splitter)p FD(,)c(1)-5 b(15)365 1777 y FA(internet-address-)o +(>s)o(ock)o(et)o(-ad)o(dr)o(es)o(s)p FD(,)697 1876 y(92)365 +1976 y FA(interrupt-handler)o FD(,)15 b(67)365 2076 y +FA(interrupt-set)p FD(,)g(66)365 2175 y FA(itimer)p FD(,)j(63)365 +2358 y FA(join-strings)p FD(,)e(1)-5 b(18)365 2540 y +FA(listen-socket)p FD(,)15 b(93)365 2640 y FA(lock-region)p +FD(,)h(39)365 2740 y FA(lock-region/no-bl)o(oc)o(k)p +FD(,)f(39)365 2839 y(lock-r)o(egion:end,)21 b(38)365 +2939 y(lock-r)o(egion:exclusive?,)f(38)365 3039 y(lock-r)o(egion:len,)h +(38)365 3138 y(lock-r)o(egion:pr)o(oc,)f(38)365 3238 +y(lock-r)o(egion:start,)g(38)365 3337 y(lock-r)o(egion:whence,)h(38)365 +3437 y(lock-r)o(egion?,)g(38)365 3620 y FA(make-date)p +FD(,)c(69)365 3719 y FA(make-lock-region)p FD(,)d(39)365 +3819 y FA(make-pty-generato)o(r)p FD(,)g(83)365 3919 +y FA(make-regexp)p FD(,)i(99)365 4018 y FA(make-string-input)o(-p)o +(ort)o FD(,)f(26)365 4118 y FA(make-string-outpu)o(t-)o(por)o(t)p +FD(,)f(26)365 4218 y FA(make-tty-info)p FD(,)h(79)365 +4317 y FA(match:end)p FD(,)i(99)365 4417 y FA(match:start)p +FD(,)f(99)365 4516 y FA(match:substring)p FD(,)f(99)365 +4616 y FA(move->fdes)p FD(,)i(30)365 4799 y FA(network-info)p +FD(,)f(96)365 4898 y FA(nice)p FD(,)j(60)1943 614 y FA(nth)p +FD(,)g(127)1943 807 y FA(open-control-tty)o FD(,)c(81)1943 +907 y FA(open-fdes)p FD(,)i(32)1943 1007 y FA(open-file)p +FD(,)g(32)1943 1107 y FA(open-input-file)p FD(,)d(32)1943 +1208 y FA(open-output-file)o FD(,)h(32)1943 1308 y FA(open-pty)p +FD(,)i(82)1943 1500 y FA(parent-pid)p FD(,)f(60)1943 +1600 y FA(parse-file-name)p FD(,)e(106)1943 1700 y FA(path-list->file-) +o(na)o(me)o FD(,)h(105)1943 1801 y FA(pause-until-inte)o(rr)o(up)o(t)p +FD(,)g(63)1943 1901 y FA(pid)p FD(,)k(60)1943 2001 y +FA(pid->proc)p FD(,)e(55)1943 2101 y FA(pipe)p FD(,)i(33)1943 +2201 y FA(port->fdes)p FD(,)d(30)1943 2302 y FA(port->list)p +FD(,)g(15)1943 2402 y FA(port->sexp-list)p FD(,)e(15)1943 +2502 y FA(port->string)p FD(,)h(15)1943 2602 y FA(port->string-lis)o(t) +p FD(,)f(15)1943 2702 y FA(port-revealed)p FD(,)h(30)1943 +2802 y FA(predicate->char-)o(se)o(t)p FD(,)f(108)1943 +2903 y FA(priority)p FD(,)j(60)1943 3003 y(pr)o(oc,)j(55)1943 +3103 y(pr)o(oc:pid,)f(55)1943 3203 y(pr)o(oc?,)g(55)1943 +3303 y FA(process-group)p FD(,)c(60)1943 3404 y FA(process-times)p +FD(,)g(60)1943 3504 y FA(protocol-info)p FD(,)g(96)1943 +3604 y FA(pty-name->tty-na)o(me)o FD(,)g(82)1943 3796 +y FA(read-delimited)p FD(,)f(1)-5 b(12)1943 3896 y FA(read-delimited!)p +FD(,)14 b(1)-5 b(12)1943 3997 y FA(read-line)p FD(,)17 +b(1)-5 b(1)g(1)1943 4097 y FA(read-paragraph)p FD(,)14 +b(1)-5 b(12)1943 4197 y FA(read-string)p FD(,)16 b(33)1943 +4297 y FA(read-string!)p FD(,)f(33)1943 4397 y FA(read-string!/par)o +(ti)o(al)o FD(,)g(34)1943 4498 y FA(read-string/part)o(ia)o(l)p +FD(,)f(34)1943 4598 y FA(read-symlink)p FD(,)h(40)1943 +4698 y FA(reap-zombies)p FD(,)g(56)1943 4798 y FA(receive-message)p +FD(,)f(94)1943 4898 y FA(receive-message!)o FD(,)h(94)1735 +5147 y(159)p eop %%Page: 160 166 -160 165 bop 681 614 a FA(string->char-set)o FD(,)15 b(108)681 -714 y FA(string-filter)p FD(,)g(20)681 814 y FA(string-match)p -FD(,)g(98)681 914 y FA(string-output-po)o(rt)o(-ou)o(tp)o(ut)o -FD(,)g(26)681 1014 y FA(substitute-env-v)o(ar)o(s)p FD(,)f(101)681 -1114 y FA(suffix-splitter)p FD(,)g(1)-5 b(14)681 1214 -y FA(suspend)p FD(,)17 b(53)681 1314 y FA(sync-file)p -FD(,)g(41)681 1414 y FA(sync-file-system)o FD(,)e(41)681 -1514 y FA(system-name)p FD(,)h(63)681 1701 y FA(tell)p -FD(,)j(31)681 1801 y FA(temp-file-channe)o(l)p FD(,)14 -b(50)681 1901 y FA(temp-file-iterat)o(e)p FD(,)g(49)681 -2001 y FA(ticks/sec)p FD(,)j(69)681 2101 y(time,)k(68)681 -2201 y FA(time)p FD(,)e(70)681 2301 y FA(time+ticks)p -FD(,)d(69)681 2401 y FA(truncate-file)p FD(,)f(41)681 -2500 y FA(tty-file-name)p FD(,)g(77)681 2600 y FA(tty-info)p -FD(,)i(80)681 2700 y(tty-info)k(r)o(ecor)o(d)e(type,)h(77)681 -2800 y FA(tty-info:control)o(-c)o(har)o(s)p FD(,)14 b(77)681 -2900 y FA(tty-info:control)o(-f)o(lag)o(s)p FD(,)g(77)681 -3000 y FA(tty-info:input-f)o(la)o(gs)p FD(,)g(77)681 -3100 y FA(tty-info:input-s)o(pe)o(ed)p FD(,)g(77)681 -3200 y FA(tty-info:local-f)o(la)o(gs)p FD(,)g(77)681 -3300 y FA(tty-info:min)p FD(,)h(77)681 3400 y FA(tty-info:output-)o(fl) -o(ags)o FD(,)g(77)681 3500 y FA(tty-info:output-)o(sp)o(eed)o -FD(,)g(77)681 3599 y FA(tty-info:time)p FD(,)g(77)681 -3699 y FA(tty-info?)p FD(,)i(77)681 3799 y FA(tty-name->pty-na)o(me)o -FD(,)e(82)681 3899 y FA(tty-process-grou)o(p)p FD(,)f(82)681 -3999 y FA(tty?)p FD(,)19 b(77)681 4099 y FA(ttyc/2-stop-bits)o -FD(,)c(87)681 4199 y FA(ttyc/carrier-flo)o(w-)o(ctl)o -FD(,)g(87)681 4299 y FA(ttyc/char-size)p FD(,)f(87)681 -4399 y FA(ttyc/char-size5)p FD(,)g(87)681 4499 y FA(ttyc/char-size6)p -FD(,)g(87)681 4599 y FA(ttyc/char-size7)p FD(,)g(87)681 -4698 y FA(ttyc/char-size8)p FD(,)g(87)681 4798 y FA(ttyc/CTS-output-)o -(fl)o(ow-)o(ct)o(l)p FD(,)g(87)681 4898 y FA(ttyc/enable-pari)o(ty)o -FD(,)h(87)2258 614 y FA(ttyc/enable-read)p FD(,)f(87)2258 -714 y FA(ttyc/hup-on-close)o FD(,)h(87)2258 814 y FA(ttyc/ignore-flags) -o FD(,)g(87)2258 913 y FA(ttyc/no-modem-syn)o(c)p FD(,)f(87)2258 -1013 y FA(ttyc/odd-parity)p FD(,)h(87)2258 1112 y FA(ttyc/RTS-input-fl) -o(ow)o(-ct)o(l)p FD(,)f(87)2258 1212 y FA(ttychar/delayed-s)o(us)o(pen) -o(d)p FD(,)g(84)2258 1312 y FA(ttychar/delete-ch)o(ar)o -FD(,)h(84)2258 1411 y FA(ttychar/delete-li)o(ne)o FD(,)g(84)2258 -1511 y FA(ttychar/delete-wo)o(rd)o FD(,)g(84)2258 1611 -y FA(ttychar/discard)p FD(,)g(84)2258 1710 y FA(ttychar/eof)p -FD(,)h(84)2258 1810 y FA(ttychar/eol)p FD(,)g(84)2258 -1910 y FA(ttychar/eol2)p FD(,)g(84)2258 2009 y FA(ttychar/interrupt)o -FD(,)f(84)2258 2109 y FA(ttychar/literal-n)o(ex)o(t)p -FD(,)f(84)2258 2208 y FA(ttychar/quit)p FD(,)i(84)2258 -2308 y FA(ttychar/reprint)p FD(,)f(84)2258 2408 y FA(ttychar/start)p -FD(,)g(84)2258 2507 y FA(ttychar/status)p FD(,)g(84)2258 -2607 y FA(ttychar/stop)p FD(,)h(84)2258 2707 y FA(ttychar/suspend)p -FD(,)f(84)2258 2806 y FA(ttyin/7bits)p FD(,)h(85)2258 -2906 y FA(ttyin/beep-on-ove)o(rf)o(low)o FD(,)f(85)2258 -3005 y FA(ttyin/check-parit)o(y)p FD(,)f(85)2258 3105 -y FA(ttyin/cr->nl)p FD(,)i(85)2258 3205 y FA(ttyin/ignore-bad-)o(pa)o -(rit)o(y-)o(ch)o(ars)o FD(,)2590 3304 y(85)2258 3404 -y FA(ttyin/ignore-brea)o(k)p FD(,)e(85)2258 3504 y FA(ttyin/ignore-cr)p -FD(,)h(85)2258 3603 y FA(ttyin/input-flow-)o(ct)o(l)p -FD(,)f(85)2258 3703 y FA(ttyin/interrupt-o)o(n-)o(bre)o(ak)o -FD(,)h(85)2258 3802 y FA(ttyin/lowercase)p FD(,)g(85)2258 -3902 y FA(ttyin/mark-parity)o(-e)o(rro)o(rs)o FD(,)g(85)2258 -4002 y FA(ttyin/nl->cr)p FD(,)h(85)2258 4101 y FA(ttyin/output-flow)o -(-c)o(tl)p FD(,)e(85)2258 4201 y FA(ttyin/xon-any)p FD(,)h(85)2258 -4301 y FA(ttyl/alt-delete-w)o(or)o(d)p FD(,)f(88)2258 -4400 y FA(ttyl/canonical)p FD(,)h(88)2258 4500 y FA(ttyl/case-map)p -FD(,)g(88)2258 4599 y FA(ttyl/echo)p FD(,)i(88)2258 4699 -y FA(ttyl/echo-ctl)p FD(,)e(88)2258 4799 y FA(ttyl/echo-delete-)o(li)o -(ne)p FD(,)f(88)2258 4898 y FA(ttyl/echo-nl)p FD(,)i(88)2051 -5147 y(160)p eop -%%Page: 161 167 -161 166 bop 365 614 a FA(ttyl/enable-signa)o(ls)o FD(,)15 -b(88)365 716 y FA(ttyl/extended)p FD(,)g(88)365 818 y -FA(ttyl/flush-output)o FD(,)g(88)365 920 y FA(ttyl/hardcopy-del)o(et)o -(e)p FD(,)g(88)365 1022 y FA(ttyl/no-flush-on-)o(in)o(ter)o(ru)o(pt)p -FD(,)f(88)365 1124 y FA(ttyl/no-kernel-st)o(at)o(us)p -FD(,)g(88)365 1226 y FA(ttyl/reprint-unre)o(ad)o(-ch)o(ar)o(s)p -FD(,)g(88)365 1328 y FA(ttyl/ttou-signal)p FD(,)g(88)365 -1430 y FA(ttyl/visual-delet)o(e)p FD(,)g(88)365 1532 -y FA(ttyl/visual-delet)o(e-)o(lin)o(e)p FD(,)g(88)365 -1634 y FA(ttyout/all-delay)p FD(,)g(86)365 1736 y FA(ttyout/bs-delay)p -FD(,)h(86)365 1838 y FA(ttyout/bs-delay0)p FD(,)f(86)365 -1940 y FA(ttyout/bs-delay1)p FD(,)g(86)365 2042 y FA(ttyout/cr->nl)p -FD(,)h(85)365 2144 y FA(ttyout/cr-delay)p FD(,)g(86)365 -2246 y FA(ttyout/cr-delay0)p FD(,)f(86)365 2348 y FA(ttyout/cr-delay1)p -FD(,)g(86)365 2450 y FA(ttyout/cr-delay2)p FD(,)g(86)365 -2552 y FA(ttyout/cr-delay3)p FD(,)g(86)365 2654 y FA(ttyout/delay-w/fi) -o(ll)o(-ch)o(ar)o FD(,)h(85)365 2756 y FA(ttyout/discard-eo)o(t)p -FD(,)f(85)365 2858 y FA(ttyout/enable)p FD(,)h(85)365 -2960 y FA(ttyout/expand-tab)o(s)p FD(,)f(85)365 3062 -y FA(ttyout/ff-delay)p FD(,)h(86)365 3164 y FA(ttyout/ff-delay0)p -FD(,)f(86)365 3266 y FA(ttyout/ff-delay1)p FD(,)g(86)365 -3368 y FA(ttyout/fill-w/del)o FD(,)h(85)365 3470 y FA(ttyout/nl->crnl)p -FD(,)g(85)365 3572 y FA(ttyout/nl-delay)p FD(,)g(86)365 -3674 y FA(ttyout/nl-delay0)p FD(,)f(86)365 3776 y FA(ttyout/nl-delay1)p -FD(,)g(86)365 3878 y FA(ttyout/nl-does-cr)o FD(,)h(85)365 -3980 y FA(ttyout/no-col0-cr)o FD(,)g(85)365 4082 y FA(ttyout/tab-delay) -p FD(,)f(86)365 4184 y FA(ttyout/tab-delay0)o FD(,)h(86)365 -4286 y FA(ttyout/tab-delay1)o FD(,)g(86)365 4388 y FA -(ttyout/tab-delay2)o FD(,)g(86)365 4490 y FA(ttyout/tab-delayx)o -FD(,)g(86)365 4592 y FA(ttyout/uppercase)p FD(,)f(85)365 -4694 y FA(ttyout/vtab-delay)o FD(,)h(86)365 4796 y FA -(ttyout/vtab-delay)o(0)p FD(,)f(86)365 4898 y FA(ttyout/vtab-delay)o(1) -p FD(,)g(86)1943 614 y FA(umask)p FD(,)k(59)1943 714 -y FA(unix-address->so)o(ck)o(et)o(-ad)o(dr)o(ess)o FD(,)2275 -814 y(92)1943 914 y FA(unlock-region)p FD(,)d(39)1943 -1014 y FA(user-effective-g)o(id)o FD(,)g(60)1943 1114 -y FA(user-effective-u)o(id)o FD(,)g(60)1943 1214 y FA(user-gid)p -FD(,)i(60)1943 1313 y(user)o(-info,)j(61)1943 1413 y -FA(user-info)p FD(,)d(61)1943 1513 y(user)o(-info:gid,)i(61)1943 -1613 y(user)o(-info:home-dir)-6 b(,)19 b(61)1943 1713 -y(user)o(-info:name,)g(61)1943 1813 y(user)o(-info:shell,)h(61)1943 -1913 y(user)o(-info:uid,)f(61)1943 2013 y FA(user-login-name)p -FD(,)14 b(60)1943 2113 y FA(user-supplementa)o(ry)o(-g)o(ids)o -FD(,)h(60)1943 2213 y FA(user-uid)p FD(,)i(60)1943 2400 -y FA(wait)p FD(,)i(57)1943 2500 y FA(wait-any)p FD(,)e(57)1943 -2600 y FA(wait-process-gro)o(up)o FD(,)e(58)1943 2700 -y FA(with-current-inp)o(ut)o(-p)o(ort)o FD(,)g(24)1943 -2800 y FA(with-current-inp)o(ut)o(-p)o(ort)o(*)p FD(,)f(24)1943 -2900 y FA(with-current-out)o(pu)o(t-)o(por)o(t)p FD(,)g(24)1943 -3000 y FA(with-current-out)o(pu)o(t-)o(por)o(t*)o FD(,)h(24)1943 -3100 y FA(with-cwd)p FD(,)i(59)1943 3200 y FA(with-cwd*)p -FD(,)g(59)1943 3300 y FA(with-enabled-int)o(er)o(ru)o(pts)o -FD(,)e(66)1943 3400 y FA(with-enabled-int)o(er)o(ru)o(pts)o(*)p -FD(,)f(66)1943 3499 y FA(with-env)p FD(,)j(74)1943 3599 -y FA(with-env*)p FD(,)g(74)1943 3699 y FA(with-errno-handl)o(er)o -FD(,)e(22)1943 3799 y FA(with-errno-handl)o(er)o(*)p -FD(,)f(22)1943 3899 y FA(with-error-outpu)o(t-)o(po)o(rt)p -FD(,)g(24)1943 3999 y FA(with-error-outpu)o(t-)o(po)o(rt*)o -FD(,)h(24)1943 4099 y FA(with-region-lock)o FD(,)g(39)1943 -4199 y FA(with-region-lock)o(*)p FD(,)f(39)1943 4299 -y FA(with-stdio-ports)o FD(,)h(26)1943 4399 y FA(with-stdio-ports)o(*)p -FD(,)f(26)1943 4499 y FA(with-total-env)p FD(,)g(74)1943 -4599 y FA(with-total-env*)p FD(,)g(74)1943 4698 y FA(with-umask)p -FD(,)i(59)1943 4798 y FA(with-umask*)p FD(,)g(59)1943 -4898 y FA(write-string)p FD(,)f(35)1735 5147 y(161)p +160 165 bop 681 614 a FA(receive-message!)o(/p)o(art)o(ia)o(l)p +FD(,)14 b(94)681 714 y FA(receive-message/)o(pa)o(rti)o(al)o +FD(,)h(94)681 814 y FA(record-reader)p FD(,)g(1)-5 b(15)681 +914 y FA(reduce-port)p FD(,)16 b(16)681 1014 y FA(regexp-exec)p +FD(,)g(99)681 1114 y FA(regexp-match?)p FD(,)f(98)681 +1214 y FA(regexp-quote)p FD(,)g(99)681 1314 y FA(regexp-substitut)o(e)p +FD(,)f(100)681 1414 y FA(regexp-substitut)o(e/)o(glo)o(ba)o(l)p +FD(,)g(100)681 1514 y FA(regexp?)p FD(,)j(99)681 1613 +y FA(release-port-han)o(dl)o(e)p FD(,)d(30)681 1713 y +FA(rename-file)p FD(,)i(40)681 1813 y FA(repl)p FD(,)j(127)681 +1913 y FA(replace-extensio)o(n)p FD(,)14 b(107)681 2013 +y FA(resolve-file-nam)o(e)p FD(,)g(107)681 2113 y FA(rindex)p +FD(,)k(101)681 2213 y(r)o(un,)j(13)681 2313 y FA(run)p +FD(,)e(13)681 2413 y FA(run/collecting)p FD(,)14 b(17)681 +2513 y FA(run/collecting*)p FD(,)g(17)681 2613 y FA(run/file)p +FD(,)j(14)681 2712 y FA(run/file*)p FD(,)g(15)681 2812 +y FA(run/port)p FD(,)g(14)681 2912 y FA(run/port*)p FD(,)g(15)681 +3012 y FA(run/port+proc)p FD(,)e(17)681 3112 y FA(run/port+proc*)p +FD(,)f(17)681 3212 y FA(run/sexp)p FD(,)j(14)681 3312 +y FA(run/sexp*)p FD(,)g(15)681 3412 y FA(run/sexps)p +FD(,)g(14)681 3512 y FA(run/sexps*)p FD(,)f(15)681 3612 +y FA(run/string)p FD(,)g(14)681 3712 y FA(run/string*)p +FD(,)g(15)681 3811 y FA(run/strings)p FD(,)g(14)681 3911 +y FA(run/strings*)p FD(,)f(15)681 4099 y FA(seek)p FD(,)k(31)681 +4199 y FA(select)41 b FD(,)20 b(34)681 4299 y FA(send-message)p +FD(,)15 b(94)681 4399 y FA(send-message/par)o(ti)o(al)p +FD(,)f(94)681 4499 y FA(send-tty-break)p FD(,)g(80)681 +4599 y FA(service-info)p FD(,)h(96)681 4698 y FA(set-enabled-inte)o(rr) +o(upt)o(s)p FD(,)f(66)681 4798 y FA(set-fdes-flags)p +FD(,)g(32)681 4898 y FA(set-fdes-status)p FD(,)g(33)2258 +614 y FA(set-file-group)p FD(,)h(41)2258 714 y FA(set-file-mode)p +FD(,)g(41)2258 814 y FA(set-file-owner)p FD(,)g(41)2258 +913 y FA(set-file-times)p FD(,)g(41)2258 1013 y FA(set-gid)p +FD(,)j(60)2258 1112 y FA(set-interrupt-han)o(dl)o(er)p +FD(,)c(66)2258 1212 y FA(set-port-bufferin)o(g)p FD(,)g(37)2258 +1312 y FA(set-priority)p FD(,)i(60)2258 1411 y FA(set-process-group)o +FD(,)f(60)2258 1511 y FA(set-socket-option)o FD(,)g(95)2258 +1611 y FA(set-tty-info/drai)o(n)p FD(,)f(80)2258 1710 +y FA(set-tty-info/flus)o(h)p FD(,)g(80)2258 1810 y FA(set-tty-info/now) +p FD(,)g(80)2258 1910 y FA(set-tty-process-g)o(ro)o(up)p +FD(,)g(82)2258 2009 y FA(set-uid)p FD(,)k(60)2258 2109 +y FA(set-umask)p FD(,)f(59)2258 2208 y FA(setenv)p FD(,)h(73)2258 +2308 y FA(shutdown-socket)p FD(,)d(94)2258 2408 y FA(signal->interrupt) +o FD(,)g(66)2258 2507 y FA(signal-process)p FD(,)g(63)2258 +2607 y FA(signal-process-gr)o(ou)o(p)p FD(,)f(63)2258 +2707 y FA(simplify-file-nam)o(e)p FD(,)g(107)2258 2806 +y FA(skip-char-set)p FD(,)h(1)-5 b(13)2258 2906 y FA(sleep)p +FD(,)19 b(63)2258 3005 y FA(sleep-until)p FD(,)d(63)2258 +3105 y FA(sloppy-suffix-spl)o(it)o(ter)o FD(,)f(1)-5 +b(15)2258 3205 y FA(socket-address->i)o(nt)o(ern)o(et)o(-a)o(ddr)o(es)o +(s)p FD(,)2590 3304 y(92)2258 3404 y FA(socket-address->u)o(ni)o(x-a)o +(dd)o(re)o(ss)p FD(,)2590 3504 y(92)2258 3603 y FA(socket-connect)p +FD(,)15 b(89)2258 3703 y FA(socket-local-addr)o(es)o(s)p +FD(,)f(93)2258 3802 y FA(socket-option)p FD(,)h(95)2258 +3902 y FA(socket-remote-add)o(re)o(ss)p FD(,)f(93)2258 +4002 y FA(split-file-name)p FD(,)h(105)2258 4101 y FA(start-tty-input)p +FD(,)g(81)2258 4201 y FA(start-tty-output)p FD(,)f(80)2258 +4301 y FA(status:exit-val)p FD(,)h(58)2258 4400 y FA(status:stop-sig)p +FD(,)g(59)2258 4500 y FA(status:term-sig)p FD(,)g(59)2258 +4599 y FA(stdio->stdports)p FD(,)g(25)2258 4699 y FA(stdports->stdio)p +FD(,)g(25)2258 4799 y FA(stop-tty-input)p FD(,)g(81)2258 +4898 y FA(stop-tty-output)p FD(,)g(80)2051 5147 y(160)p eop +%%Page: 161 167 +161 166 bop 365 614 a FA(string->char-set)p FD(,)14 b(108)365 +714 y FA(string-filter)p FD(,)h(20)365 814 y FA(string-match)p +FD(,)h(98)365 914 y FA(string-output-por)o(t-)o(out)o(pu)o(t)p +FD(,)e(26)365 1014 y FA(substitute-env-va)o(rs)o FD(,)h(102)365 +1114 y FA(suffix-splitter)p FD(,)g(1)-5 b(15)365 1214 +y FA(suspend)p FD(,)18 b(53)365 1314 y FA(sync-file)p +FD(,)f(41)365 1414 y FA(sync-file-system)p FD(,)d(41)365 +1514 y FA(system-name)p FD(,)i(63)365 1701 y FA(tell)p +FD(,)j(31)365 1801 y FA(temp-file-channel)o FD(,)c(50)365 +1901 y FA(temp-file-iterate)o FD(,)g(49)365 2001 y FA(ticks/sec)p +FD(,)i(69)365 2101 y(time,)k(68)365 2201 y FA(time)p +FD(,)e(70)365 2301 y FA(time+ticks)p FD(,)e(69)365 2401 +y FA(truncate-file)p FD(,)e(41)365 2500 y FA(tty-file-name)p +FD(,)g(77)365 2600 y FA(tty-info)p FD(,)i(80)365 2700 +y(tty-info)k(r)o(ecor)o(d)e(type,)i(77)365 2800 y FA(tty-info:control-) +o(ch)o(ars)o FD(,)15 b(77)365 2900 y FA(tty-info:control-)o(fl)o(ags)o +FD(,)g(77)365 3000 y FA(tty-info:input-fl)o(ag)o(s)p +FD(,)g(77)365 3100 y FA(tty-info:input-sp)o(ee)o(d)p +FD(,)g(77)365 3200 y FA(tty-info:local-fl)o(ag)o(s)p +FD(,)g(77)365 3300 y FA(tty-info:min)p FD(,)h(77)365 +3400 y FA(tty-info:output-f)o(la)o(gs)p FD(,)e(77)365 +3500 y FA(tty-info:output-s)o(pe)o(ed)p FD(,)g(77)365 +3599 y FA(tty-info:time)p FD(,)h(77)365 3699 y FA(tty-info?)p +FD(,)i(77)365 3799 y FA(tty-name->pty-nam)o(e)p FD(,)d(82)365 +3899 y FA(tty-process-group)o FD(,)h(82)365 3999 y FA(tty?)p +FD(,)k(77)365 4099 y FA(ttyc/2-stop-bits)p FD(,)14 b(87)365 +4199 y FA(ttyc/carrier-flow)o(-c)o(tl)p FD(,)g(87)365 +4299 y FA(ttyc/char-size)p FD(,)h(87)365 4399 y FA(ttyc/char-size5)p +FD(,)g(87)365 4499 y FA(ttyc/char-size6)p FD(,)g(87)365 +4599 y FA(ttyc/char-size7)p FD(,)g(87)365 4698 y FA(ttyc/char-size8)p +FD(,)g(87)365 4798 y FA(ttyc/CTS-output-f)o(lo)o(w-c)o(tl)o +FD(,)g(87)365 4898 y FA(ttyc/enable-parit)o(y)p FD(,)f(87)1943 +614 y FA(ttyc/enable-read)o FD(,)h(87)1943 714 y FA(ttyc/hup-on-clos)o +(e)p FD(,)f(87)1943 814 y FA(ttyc/ignore-flag)o(s)p FD(,)g(87)1943 +913 y FA(ttyc/no-modem-sy)o(nc)o FD(,)h(87)1943 1013 +y FA(ttyc/odd-parity)p FD(,)f(87)1943 1112 y FA(ttyc/RTS-input-f)o(lo)o +(w-)o(ctl)o FD(,)h(87)1943 1212 y FA(ttychar/delayed-)o(su)o(sp)o(end)o +FD(,)g(84)1943 1312 y FA(ttychar/delete-c)o(ha)o(r)p +FD(,)f(84)1943 1411 y FA(ttychar/delete-l)o(in)o(e)p +FD(,)g(84)1943 1511 y FA(ttychar/delete-w)o(or)o(d)p +FD(,)g(84)1943 1611 y FA(ttychar/discard)p FD(,)g(84)1943 +1710 y FA(ttychar/eof)p FD(,)i(84)1943 1810 y FA(ttychar/eol)p +FD(,)g(84)1943 1910 y FA(ttychar/eol2)p FD(,)f(84)1943 +2009 y FA(ttychar/interrup)o(t)p FD(,)f(84)1943 2109 +y FA(ttychar/literal-)o(ne)o(xt)o FD(,)h(84)1943 2208 +y FA(ttychar/quit)p FD(,)g(84)1943 2308 y FA(ttychar/reprint)p +FD(,)f(84)1943 2408 y FA(ttychar/start)p FD(,)h(84)1943 +2507 y FA(ttychar/status)p FD(,)f(84)1943 2607 y FA(ttychar/stop)p +FD(,)h(84)1943 2707 y FA(ttychar/suspend)p FD(,)f(84)1943 +2806 y FA(ttyin/7bits)p FD(,)i(85)1943 2906 y FA(ttyin/beep-on-ov)o(er) +o(fl)o(ow)p FD(,)e(85)1943 3005 y FA(ttyin/check-pari)o(ty)o +FD(,)h(85)1943 3105 y FA(ttyin/cr->nl)p FD(,)g(85)1943 +3205 y FA(ttyin/ignore-bad)o(-p)o(ar)o(ity)o(-c)o(har)o(s)p +FD(,)2275 3304 y(85)1943 3404 y FA(ttyin/ignore-bre)o(ak)o +FD(,)g(85)1943 3504 y FA(ttyin/ignore-cr)p FD(,)f(85)1943 +3603 y FA(ttyin/input-flow)o(-c)o(tl)o FD(,)h(85)1943 +3703 y FA(ttyin/interrupt-)o(on)o(-b)o(rea)o(k)p FD(,)f(85)1943 +3802 y FA(ttyin/lowercase)p FD(,)g(85)1943 3902 y FA(ttyin/mark-parit)o +(y-)o(er)o(ror)o(s)p FD(,)g(85)1943 4002 y FA(ttyin/nl->cr)p +FD(,)h(85)1943 4101 y FA(ttyin/output-flo)o(w-)o(ct)o(l)p +FD(,)g(85)1943 4201 y FA(ttyin/xon-any)p FD(,)g(85)1943 +4301 y FA(ttyl/alt-delete-)o(wo)o(rd)o FD(,)g(88)1943 +4400 y FA(ttyl/canonical)p FD(,)f(88)1943 4500 y FA(ttyl/case-map)p +FD(,)h(88)1943 4599 y FA(ttyl/echo)p FD(,)i(88)1943 4699 +y FA(ttyl/echo-ctl)p FD(,)e(88)1943 4799 y FA(ttyl/echo-delete)o(-l)o +(in)o(e)p FD(,)g(88)1943 4898 y FA(ttyl/echo-nl)p FD(,)g(88)1735 +5147 y(161)p eop %%Page: 162 168 -162 167 bop 681 614 a FA(write-string/par)o(ti)o(al)p -FD(,)14 b(36)2051 5147 y(162)p eop +162 167 bop 681 614 a FA(ttyl/enable-sign)o(al)o(s)p +FD(,)14 b(88)681 716 y FA(ttyl/extended)p FD(,)h(88)681 +818 y FA(ttyl/flush-outpu)o(t)p FD(,)f(88)681 920 y FA +(ttyl/hardcopy-de)o(le)o(te)p FD(,)g(88)681 1022 y FA(ttyl/no-flush-on) +o(-i)o(nte)o(rr)o(up)o(t)p FD(,)h(88)681 1124 y FA(ttyl/no-kernel-s)o +(ta)o(tus)o FD(,)g(88)681 1226 y FA(ttyl/reprint-unr)o(ea)o(d-c)o(ha)o +(rs)o FD(,)g(88)681 1328 y FA(ttyl/ttou-signal)o FD(,)g(88)681 +1430 y FA(ttyl/visual-dele)o(te)o FD(,)g(88)681 1532 +y FA(ttyl/visual-dele)o(te)o(-li)o(ne)o FD(,)g(88)681 +1634 y FA(ttyout/all-delay)o FD(,)g(86)681 1736 y FA(ttyout/bs-delay)p +FD(,)f(86)681 1838 y FA(ttyout/bs-delay0)o FD(,)h(86)681 +1940 y FA(ttyout/bs-delay1)o FD(,)g(86)681 2042 y FA(ttyout/cr->nl)p +FD(,)g(85)681 2144 y FA(ttyout/cr-delay)p FD(,)f(86)681 +2246 y FA(ttyout/cr-delay0)o FD(,)h(86)681 2348 y FA(ttyout/cr-delay1)o +FD(,)g(86)681 2450 y FA(ttyout/cr-delay2)o FD(,)g(86)681 +2552 y FA(ttyout/cr-delay3)o FD(,)g(86)681 2654 y FA(ttyout/delay-w/f)o +(il)o(l-c)o(ha)o(r)p FD(,)f(85)681 2756 y FA(ttyout/discard-e)o(ot)o +FD(,)h(85)681 2858 y FA(ttyout/enable)p FD(,)g(85)681 +2960 y FA(ttyout/expand-ta)o(bs)o FD(,)g(85)681 3062 +y FA(ttyout/ff-delay)p FD(,)f(86)681 3164 y FA(ttyout/ff-delay0)o +FD(,)h(86)681 3266 y FA(ttyout/ff-delay1)o FD(,)g(86)681 +3368 y FA(ttyout/fill-w/de)o(l)p FD(,)f(85)681 3470 y +FA(ttyout/nl->crnl)p FD(,)g(85)681 3572 y FA(ttyout/nl-delay)p +FD(,)g(86)681 3674 y FA(ttyout/nl-delay0)o FD(,)h(86)681 +3776 y FA(ttyout/nl-delay1)o FD(,)g(86)681 3878 y FA(ttyout/nl-does-c)o +(r)p FD(,)f(85)681 3980 y FA(ttyout/no-col0-c)o(r)p FD(,)g(85)681 +4082 y FA(ttyout/tab-delay)o FD(,)h(86)681 4184 y FA(ttyout/tab-delay)o +(0)p FD(,)f(86)681 4286 y FA(ttyout/tab-delay)o(1)p FD(,)g(86)681 +4388 y FA(ttyout/tab-delay)o(2)p FD(,)g(86)681 4490 y +FA(ttyout/tab-delay)o(x)p FD(,)g(86)681 4592 y FA(ttyout/uppercase)o +FD(,)h(85)681 4694 y FA(ttyout/vtab-dela)o(y)p FD(,)f(86)681 +4796 y FA(ttyout/vtab-dela)o(y0)o FD(,)h(86)681 4898 +y FA(ttyout/vtab-dela)o(y1)o FD(,)g(86)2258 614 y FA(umask)p +FD(,)k(59)2258 714 y FA(unix-address->soc)o(ke)o(t-a)o(dd)o(re)o(ss)p +FD(,)2590 814 y(92)2258 914 y FA(unlock-region)p FD(,)c(39)2258 +1014 y FA(user-effective-gi)o(d)p FD(,)f(60)2258 1114 +y FA(user-effective-ui)o(d)p FD(,)g(60)2258 1214 y FA(user-gid)p +FD(,)j(60)2258 1313 y(user)o(-info,)j(61)2258 1413 y +FA(user-info)p FD(,)d(61)2258 1513 y(user)o(-info:gid,)j(61)2258 +1613 y(user)o(-info:home-dir)-6 b(,)20 b(61)2258 1713 +y(user)o(-info:name,)g(61)2258 1813 y(user)o(-info:shell,)g(61)2258 +1913 y(user)o(-info:uid,)g(61)2258 2013 y FA(user-login-name)p +FD(,)15 b(60)2258 2113 y FA(user-supplementar)o(y-)o(gid)o(s)p +FD(,)f(60)2258 2213 y FA(user-uid)p FD(,)j(60)2258 2400 +y FA(wait)p FD(,)i(57)2258 2500 y FA(wait-any)p FD(,)e(57)2258 +2600 y FA(wait-process-grou)o(p)p FD(,)d(58)2258 2700 +y FA(with-current-inpu)o(t-)o(por)o(t)p FD(,)g(24)2258 +2800 y FA(with-current-inpu)o(t-)o(por)o(t*)o FD(,)h(24)2258 +2900 y FA(with-current-outp)o(ut)o(-po)o(rt)o FD(,)g(24)2258 +3000 y FA(with-current-outp)o(ut)o(-po)o(rt)o(*)p FD(,)f(24)2258 +3100 y FA(with-cwd)p FD(,)j(59)2258 3200 y FA(with-cwd*)p +FD(,)g(59)2258 3300 y FA(with-enabled-inte)o(rr)o(upt)o(s)p +FD(,)d(66)2258 3400 y FA(with-enabled-inte)o(rr)o(upt)o(s*)o +FD(,)h(66)2258 3499 y FA(with-env)p FD(,)i(74)2258 3599 +y FA(with-env*)p FD(,)g(74)2258 3699 y FA(with-errno-handle)o(r)p +FD(,)d(22)2258 3799 y FA(with-errno-handle)o(r*)o FD(,)h(22)2258 +3899 y FA(with-error-output)o(-p)o(ort)o FD(,)g(24)2258 +3999 y FA(with-error-output)o(-p)o(ort)o(*)p FD(,)f(24)2258 +4099 y FA(with-region-lock)p FD(,)g(39)2258 4199 y FA +(with-region-lock*)o FD(,)h(39)2258 4299 y FA(with-stdio-ports)p +FD(,)f(26)2258 4399 y FA(with-stdio-ports*)o FD(,)h(26)2258 +4499 y FA(with-total-env)p FD(,)g(74)2258 4599 y FA(with-total-env*)p +FD(,)g(74)2258 4698 y FA(with-umask)p FD(,)i(59)2258 +4798 y FA(with-umask*)p FD(,)f(59)2258 4898 y FA(write-string)p +FD(,)g(35)2051 5147 y(162)p eop +%%Page: 163 169 +163 168 bop 365 614 a FA(write-string/part)o(ia)o(l)p +FD(,)15 b(36)1735 5147 y(163)p eop %%Trailer end userdict /end-hook known{end-hook}if diff --git a/doc/scsh-manual/strings.tex b/doc/scsh-manual/strings.tex index 24ca51a..4cb925f 100644 --- a/doc/scsh-manual/strings.tex +++ b/doc/scsh-manual/strings.tex @@ -116,30 +116,59 @@ and returned instead. \end{desc} \defun{regexp-substitute/global}{port regexp string . items} - {{\str} or \boolean} + {{\str} or \undefined} \begin{desc} This procedure is similar to \ex{regexp-substitute}, -but can be used to perform multiple match/substitute operations over +but can be used to perform repeated match/substitute operations over a string. It has the following differences with \ex{regexp-substitute}: \begin{itemize} \item It takes a regular expression and string to be matched as parameters, instead of a completed match structure. + \item If the regular expression doesn't match the string, this + procedure is the identity transform---it returns or outputs the + string. \item If an item is \ex{'post}, the procedure recurses on the suffix string - (the text from \var{string} following the match). - \item If \var{port} is an output port: - \begin{itemize} - \item There was at least one match: return true. - \item No match: return false. - \end{itemize} - - \item \var{port} is \sharpf: - \begin{itemize} - \item There was at least one match: construct and return a string. - \item No match: return false. - \end{itemize} + (the text from \var{string} following the match). + Including a \ex{'post} in the list of items is how one gets multiple + match/substitution operations. + \item If an item is a procedure, it is applied to the match structure for + a given match. + The procedure returns a string to be used in the result. \end{itemize} +Some examples: +{\small +\begin{widecode} +;;; Replace occurrences of "Cotton" with "Jin". +(regexp-substitute/global #f "Cotton" s + 'pre "Jin" 'post) + +;;; mm/dd/yy -> dd/mm/yy date conversion. +(regexp-substitute/global #f "([0-9]+)/([0-9]+)/([0-9]+)" ; mm/dd/yy + s ; Source string + 'pre 2 "/" 1 "/" 3 'post) + +;;; "9/29/61" -> "Sep 29, 1961" date conversion. +(regexp-substitute/global #f "([0-9]+)/([0-9]+)/([0-9]+)" ; mm/dd/yy + s ; Source string + + 'pre + ;; Sleazy converter -- ignores "year 2000" issue, and blows up if + ;; month is out of range. + (lambda (m) + (let ((mon (vector-ref '#("Jan" "Feb" "Mar" "Apr" "May" "Jun" + "Jul" "Aug" "Sep" "Oct" "Nov" "Dec") + (- (string->number (match:substring m 1)) 1))) + (day (match:substring m 2)) + (year (match:substring m 3))) + (string-append mon " " day ", 19" year))) + 'post) + +;;; Remove potentially offensive substrings from string S. +(regexp-substitute/global #f "Windows|tcl|Intel" s + 'pre 'post)\end{widecode}} + \end{desc} \subsection{Other string manipulation facilities} diff --git a/scsh/re.scm b/scsh/re.scm index 004e1ad..57a0253 100644 --- a/scsh/re.scm +++ b/scsh/re.scm @@ -150,59 +150,68 @@ -(define (regexp-substitute/global port str re . items) - (let ((range (lambda (start item) ; Return start & end of +(define (regexp-substitute/global port re str . items) + (let ((range (lambda (start sv ev item) ; Return start & end of (cond ((integer? item) ; ITEM's range in STR. (values (vector-ref sv item) (vector-ref ev item))) ((eq? 'pre item) (values start (vector-ref sv 0))) (else (error "Illegal substitution item." item - regexp-substitute))))) + regexp-substitute/global))))) (num-posts (reduce (lambda (count item) (+ count (if (eq? item 'post) 1 0))) 0 items))) - (if (and port (< num-posts 2)) + (if (and port (< num-posts 2)) - ;; Output port case, with zero or one POST items. - (let recur ((start 0)) - (let ((match (string-match re str start))) - (and match - (let* ((sv (regexp-match:start match)) - (ev (regexp-match:end match))) - (for-each (lambda (item) - (cond ((string? item) (write-string item port)) - ((eq? 'post item) - (let ((post-start (vector-ref ev 0))) - (or (recur post-start) - (write-string item port post-start)))) - (else (receive (si ei) (range start item) - (write-string str port si ei))))) - items) - #t)))) + ;; Output port case, with zero or one POST items. + (let recur ((start 0)) + (let ((match (string-match re str start))) + (if match + (let* ((sv (regexp-match:start match)) + (ev (regexp-match:end match))) + (for-each (lambda (item) + (cond ((string? item) (write-string item port)) + ((procedure? item) (write-string (item match) port)) + ((eq? 'post item) (recur (vector-ref ev 0))) + (else (receive (si ei) + (range start sv ev item) + (write-string str port si ei))))) + items)) - (let ((pieces (let recur ((start 0)) - (let ((match (string-match re str start)) - (cached-post #f)) - (and match - (let* ((sv (regexp-match:start match)) - (ev (regexp-match:end match))) - (reduce (lambda (pieces item) - (cond ((string? item) (cons item pieces)) - ((eq? 'post item) - (append (or cached-post - (begin (set! cached-post - (recur (vector-ref ev 0))) - cached-post)) - pieces)) - (else (receive (si ei) (range start item) - (cons (substring str si e1) - pieces))))) - 0 items))))))) - (and pieces - (let ((pieces (reverse pieces))) - (if port (for-each (lambda (p) (write-string p port)) pieces) - (apply string-append pieces)))))))) + (write-string str port start)))) ; No match. + + (let* ((pieces (let recur ((start 0)) + (let ((match (string-match re str start)) + (cached-post #f)) + (if match + (let* ((sv (regexp-match:start match)) + (ev (regexp-match:end match))) + (reduce (lambda (pieces item) + (cond ((string? item) + (cons item pieces)) + + ((procedure? item) + (cons (item match) pieces)) + + ((eq? 'post item) + (if (not cached-post) + (set! cached-post + (recur (vector-ref ev 0)))) + (append cached-post pieces)) + + (else (receive (si ei) + (range start sv ev item) + (cons (substring str si ei) + pieces))))) + '() items)) + + ;; No match. Return str[start,end]. + (list (if (zero? start) str + (substring str start (string-length str)))))))) + (pieces (reverse pieces))) + (if port (for-each (lambda (p) (write-string p port)) pieces) + (apply string-append pieces))))))