Changeset 9381 in project


Ignore:
Timestamp:
03/09/08 17:54:28 (12 years ago)
Author:
Ivan Raikov
Message:

Merged trunk into prerelease

Location:
chicken/branches/prerelease
Files:
3 deleted
104 edited
23 copied

Legend:

Unmodified
Added
Removed
  • chicken/branches/prerelease/Makefile

    r7215 r9381  
    22#
    33# Copyright (c) 2007, Felix L. Winkelmann
     4# Copyright (c) 2008, The Chicken Team
    45# All rights reserved.
    56#
     
    2324# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425# POSSIBILITY OF SUCH DAMAGE.
    25 #
    26 # Send bugs, suggestions and ideas to:
    27 #
    28 # felix@call-with-current-continuation.org
    29 #
    30 # Felix L. Winkelmann
    31 # Unter den Gleichen 1
    32 # 37130 Gleichen
    33 # Germany
    3426
    3527
     
    5143        @echo "  $(MAKE) PLATFORM=solaris"
    5244        @echo "  $(MAKE) PLATFORM=cross-linux-mingw"
     45        @echo "  $(MAKE) PLATFORM=msvc"
    5346        @echo ""
    5447        @echo "For more information, consult the README file."
  • chicken/branches/prerelease/Makefile.bsd

    r6569 r9381  
    22#
    33# Copyright (c) 2007, Felix L. Winkelmann
     4# Copyright (c) 2008, The Chicken Team
    45# All rights reserved.
    56#
     
    2324# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425# POSSIBILITY OF SUCH DAMAGE.
    25 #
    26 # Send bugs, suggestions and ideas to:
    27 #
    28 # felix@call-with-current-continuation.org
    29 #
    30 # Felix L. Winkelmann
    31 # Unter den Gleichen 1
    32 # 37130 Gleichen
    33 # Germany
    3426
    3527
     
    5951
    6052chicken-config.h: chicken-defaults.h
    61         echo "#define HAVE_DIRENT_H 1" >>$@
     53        echo "#define HAVE_DIRENT_H 1" >$@
    6254        echo "#define HAVE_DLFCN_H 1" >>$@
    6355        echo "#define HAVE_INTTYPES_H 1" >>$@
  • chicken/branches/prerelease/Makefile.cross-linux-mingw

    r7331 r9381  
    22#
    33# Copyright (c) 2007, Felix L. Winkelmann
     4# Copyright (c) 2008, The Chicken Team
    45# All rights reserved.
    56#
     
    2324# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425# POSSIBILITY OF SUCH DAMAGE.
    25 #
    26 # Send bugs, suggestions and ideas to:
    27 #
    28 # felix@call-with-current-continuation.org
    29 #
    30 # Felix L. Winkelmann
    31 # Unter den Gleichen 1
    32 # 37130 Gleichen
    33 # Germany
    3426
    3527
     
    9183
    9284chicken-config.h: chicken-defaults.h
    93         echo "#define HAVE_DIRENT_H 1" >>$@
     85        echo "#define HAVE_DIRENT_H 1" >$@
    9486        echo "#define HAVE_INTTYPES_H 1" >>$@
    9587        echo "#define HAVE_LIMITS_H 1" >>$@
  • chicken/branches/prerelease/Makefile.cygwin

    r7077 r9381  
    22#
    33# Copyright (c) 2007, Felix L. Winkelmann
     4# Copyright (c) 2008, The Chicken Team
    45# All rights reserved.
    56#
     
    2324# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425# POSSIBILITY OF SUCH DAMAGE.
    25 #
    26 # Send bugs, suggestions and ideas to:
    27 #
    28 # felix@call-with-current-continuation.org
    29 #
    30 # Felix L. Winkelmann
    31 # Unter den Gleichen 1
    32 # 37130 Gleichen
    33 # Germany
    3426
    3527
     
    9082include defaults.make
    9183
    92 chicken-config.h: chicken-defaults.h
     84chicken-config.h: chicken-defaults.h buildsvnrevision
     85        echo "#define C_SVN_REVISION $(shell cat buildsvnrevision)" >$@
    9386        echo "#define HAVE_DIRENT_H 1" >>$@
    9487        echo "#define HAVE_INTTYPES_H 1" >>$@
  • chicken/branches/prerelease/Makefile.linux

    r7325 r9381  
    22#
    33# Copyright (c) 2007, Felix L. Winkelmann
     4# Copyright (c) 2008, The Chicken Team
    45# All rights reserved.
    56#
     
    2324# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425# POSSIBILITY OF SUCH DAMAGE.
    25 #
    26 # Send bugs, suggestions and ideas to:
    27 #
    28 # felix@call-with-current-continuation.org
    29 #
    30 # Felix L. Winkelmann
    31 # Unter den Gleichen 1
    32 # 37130 Gleichen
    33 # Germany
    3426
    3527
     
    6254
    6355chicken-config.h: chicken-defaults.h
    64         echo "#define HAVE_DIRENT_H 1" >>$@
     56        echo "#define HAVE_DIRENT_H 1" >$@
    6557        echo "#define HAVE_DLFCN_H 1" >>$@
    6658        echo "#define HAVE_INTTYPES_H 1" >>$@
  • chicken/branches/prerelease/Makefile.macosx

    r7773 r9381  
    22#
    33# Copyright (c) 2007, Felix L. Winkelmann
     4# Copyright (c) 2008, The Chicken Team
    45# All rights reserved.
    56#
     
    2324# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425# POSSIBILITY OF SUCH DAMAGE.
    25 #
    26 # Send bugs, suggestions and ideas to:
    27 #
    28 # felix@call-with-current-continuation.org
    29 #
    30 # Felix L. Winkelmann
    31 # Unter den Gleichen 1
    32 # 37130 Gleichen
    33 # Germany
     26
    3427
    3528# platform configuration
     
    6760
    6861chicken-config.h: chicken-defaults.h
    69         echo "#define HAVE_DIRENT_H 1" >>$@
     62        echo "#define HAVE_DIRENT_H 1" >$@
    7063        echo "#define HAVE_DLFCN_H 1" >>$@
    7164        echo "#define HAVE_INTTYPES_H 1" >>$@
  • chicken/branches/prerelease/Makefile.mingw

    r7180 r9381  
    22#
    33# Copyright (c) 2007, Felix L. Winkelmann
     4# Copyright (c) 2008, The Chicken Team
    45# All rights reserved.
    56#
     
    2324# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425# POSSIBILITY OF SUCH DAMAGE.
    25 #
    26 # Send bugs, suggestions and ideas to:
    27 #
    28 # felix@call-with-current-continuation.org
    29 #
    30 # Felix L. Winkelmann
    31 # Unter den Gleichen 1
    32 # 37130 Gleichen
    33 # Germany
    3426
    3527
     
    4032HACKED_APPLY = 1
    4133WINDOWS = 1
     34NO_UNIX_SHELL = 1
    4235
    4336# file extensions
     
    8982
    9083chicken-config.h: chicken-defaults.h
    91         echo #define HAVE_DIRENT_H 1 >>$@
     84        echo #define HAVE_DIRENT_H 1 >$@
    9285        echo #define HAVE_INTTYPES_H 1 >>$@
    9386        echo #define HAVE_LIMITS_H 1 >>$@
     
    210203        echo # define C_TARGET_STATIC_LIB_HOME "$(TARGET_PREFIX)/lib" >>$@
    211204        echo #endif >>$@
     205        echo #ifndef C_BINARY_VERSION >>$@
     206        echo # define C_BINARY_VERSION $(BINARYVERSION) >>$@
     207        echo #endif >>$@
    212208
    213209include rules.make
  • chicken/branches/prerelease/Makefile.mingw-msys

    r7180 r9381  
    22#
    33# Copyright (c) 2007, Felix L. Winkelmann
     4# Copyright (c) 2008, The Chicken Team
    45# All rights reserved.
    56#
     
    2324# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425# POSSIBILITY OF SUCH DAMAGE.
    25 #
    26 # Send bugs, suggestions and ideas to:
    27 #
    28 # felix@call-with-current-continuation.org
    29 #
    30 # Felix L. Winkelmann
    31 # Unter den Gleichen 1
    32 # 37130 Gleichen
    33 # Germany
    3426
    3527
     
    8678
    8779chicken-config.h: chicken-defaults.h
    88         echo "#define HAVE_DIRENT_H 1" >>$@
     80        echo "#define HAVE_DIRENT_H 1" >$@
    8981        echo "#define HAVE_INTTYPES_H 1" >>$@
    9082        echo "#define HAVE_LIMITS_H 1" >>$@
  • chicken/branches/prerelease/Makefile.solaris

    r6569 r9381  
    22#
    33# Copyright (c) 2007, Felix L. Winkelmann
     4# Copyright (c) 2008, The Chicken Team
    45# All rights reserved.
    56#
     
    2324# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425# POSSIBILITY OF SUCH DAMAGE.
    25 #
    26 # Send bugs, suggestions and ideas to:
    27 #
    28 # felix@call-with-current-continuation.org
    29 #
    30 # Felix L. Winkelmann
    31 # Unter den Gleichen 1
    32 # 37130 Gleichen
    33 # Germany
    3426
    3527
     
    5951
    6052chicken-config.h: chicken-defaults.h
    61         echo "#define HAVE_DIRENT_H 1" >>$@
     53        echo "#define HAVE_DIRENT_H 1" >$@
    6254        echo "#define HAVE_DLFCN_H 1" >>$@
    6355        echo "#define HAVE_INTTYPES_H 1" >>$@
  • chicken/branches/prerelease/NEWS

    r7864 r9381  
     13.0.5
     2
     3- chicken-setup: eggs are downloaded to and compiled in a temporary
     4  directory determined by CHICKEN_TMPDIR or TMPDIR environment
     5  variables, or by -build-prefix and -download-dir options,
     6  respectively; -destdir option is replaced with -install-prefix.
     7- unit regex: PCRE 7.6
     8- unit tcp: use of offset into string rather than substring for faster
     9  socket write [Jim Ursetto]
     10- MSVC can now be used to build the system, when standard UNIX tools (like
     11  MSYS) are available [Many thanks to Ashley]
     12- unit library: added "flonum-print-precision" for changing the default of
     13  16
     14- unit posix: added stat- predicates for file types
     15- unit posix: added strftime format string support to "time->string"
     16- unit posix: added "string->time", which takes a strptime format string
     17  (Unix only)
     18- unit extras: added "left-section", "right-section", "none?", "always?",
     19  and "never?"
     20- unit extras: added "hash-table-merge", "hash-table-map",
     21  "hash-table-for-each", and extended "make-hash-table" with minimum/maximum
     22  load & initial value
     23- unit extras: added "eq?-hash", "eqv?-hash", "equal?-hash", "number-hash",
     24  "symbol-hash", "keyword-hash", "##sys#number-hash-hook", and
     25  "hash-by-identity" as a synonym for "eq?-hash"
     26
    1273.0.0rc1
    228
  • chicken/branches/prerelease/README

    r7934 r9381  
    33  (c)2000-2008 Felix L. Winkelmann
    44
    5   version 3.0.0
    6 
     5  version 3.0.3
    76
    87 1. Introduction:
     
    7170        installed, then pass "CHICKEN=<chicken-executable>" to the
    7271        "make" invocation to override this setting. "CHICKEN" defaults
    73         to defaults to "$PREFIX/bin/chicken".
     72        to "$PREFIX/bin/chicken".
    7473
    7574        If you do not have a "chicken" binary installed, enter
     
    7978        which will unpack a tarball containing precompiled C sources
    8079        that are recent enough to generate the current version. After
    81         building a statically linked "chicken" executable, the system
    82         is rebuilt using the static compiler.
     80        building a statically linked compiler executable (named
     81        "chicken-boot") all *.scm files are marked for rebuilt. By
     82        passing "CHICKEN=./chicken-boot" to "make", you can force
     83        using this bootstrapped compiler to build the system.
    8384
    8485        The build may show errors when creating the info(1)
     
    111112          Build only static versions of the runtime library, compiler
    112113          and interpreter. `chicken-setup' will not be generated,
    113           as it is mostly unless compiled code can be loaded.
     114          as it is mostly useless unless compiled code can be loaded.
    114115
    115116        SYMBOLGC=1
     
    251252        - For Mac OS X, Chicken requires libdl, for loading compiled
    252253          code dynamically. This library is available on Mac OS X 10.4
    253           (Tiger) by default. For older version you can find it here:
     254          (Tiger) by default. For older versions you can find it here:
    254255
    255256            http://www.opendarwin.org/projects/dlcompat
     
    257258        - On Mac OS X, Chicken and its eggs can be built as universal
    258259          binaries which will work on either Intel or PowerPC.
    259 
     260          To build on Tiger (10.4):
     261
     262            make PLATFORM=macosx ARCH=universal
     263
     264          On Leopard (10.5), an extra step is required before `make':
     265
     266            export MACOSX_DEPLOYMENT_TARGET=10.4
    260267            make PLATFORM=macosx ARCH=universal
    261268
    262269        - On Mac OS X, Chicken can be built in 64-bit mode on Intel
    263270          Core 2 Duo systems--basically, most recent machines.  The default
    264           is 32-bit mode.  To enable 64-bit mode, invoke `make` thusly:
     271          is 32-bit mode.  To enable 64-bit mode, invoke `make' thusly:
    265272
    266273            make PLATFORM=macosx ARCH=x86-64
    267274
    268         - On Windows, only mingw32 <http://mingw.sourceforge.net/> and
    269           Cygwin is supported (Microsoft Visual Studio is
    270           NOT). Makefiles for mingw under MSYS and Windows shell are
    271           provided (`Makefile.mingw-msys' and `Makefile.mingw').
    272          
     275        - On Windows, mingw32, <http://mingw.sourceforge.net/>,
     276          Cygwin, and Visual C/C++ (PLATFORM=msvc) are supported.
     277          Makefiles for mingw under MSYS and Windows shell are provided
     278          (`Makefile.mingw-msys' and `Makefile.mingw').
     279
    273280        - Cygwin will not be able to find the chicken shared libraries
    274281          until Windows is rebooted.
     
    282289          warnings are bogus and can be ignored.
    283290
     291        - The Visual C build requires GNU make and other POSIX
     292          utilities.  Both cygwin and msys (with the Developer's
     293          Toolkit) have the necessary utilities. When setting PREFIX,
     294          use forward slashes:
     295
     296          make PLATFORM=msvc PREFIX=c:/development/chicken
     297
     298          The build has been tested with Visual Studio 2003 and 2008.  If
     299          you are able to build Chicken with other versions, please let
     300          us know.
     301
     302          The following additional issues apply when using Chicken with
     303          Visual C:
     304
     305          - Add the /DPIC flag when compiling your source files.  Otherwise
     306            you will encounter undefined symbols when linking.  Note that csc
     307            does this automatically for dlls but NOT for programs.
     308
     309          - csc generates dynamics libraries with a .so extension, not .dll.
    284310
    285311 6. Emacs support:
     
    335361        If you have any more questions or problems (even the slightest
    336362        problems, or the most stupid questions), then please subscribe
    337         to the "chicken-users" mailing list or contact me at:
    338 
    339         <felix@call-with-current-continuation.org>
     363        to the "chicken-users" mailing list and ask for help. It will
     364        be answered.
    340365
    341366
  • chicken/branches/prerelease/apply-hack.ppc.darwin.s

    r5861 r9381  
    22;
    33; Copyright (c) 2007, Felix L. Winkelmann
     4; Copyright (c) 2008 The Chicken Team
    45; All rights reserved.
    56;
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426*/
    3527
  • chicken/branches/prerelease/apply-hack.ppc.sysv.s

    r5861 r9381  
    22;
    33; Copyright (c) 2007, Felix L. Winkelmann
    4 ; All rights reserved.
     4; Copyright (c) 2008, The Chicken Team
     5; All rights reserved.         
    56;
    67; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426*/
    3527
  • chicken/branches/prerelease/apply-hack.x86-64.s

    r7044 r9381  
    22;
    33; Copyright (c) 2007, Felix L. Winkelmann
     4; Copyright (c) 2008, The Chicken Team
    45; All rights reserved.
    56;
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426*/
    3527
  • chicken/branches/prerelease/apply-hack.x86.s

    r5526 r9381  
    22;
    33; Copyright (c) 2007, Felix L. Winkelmann
     4; Copyright (c) 2008, The Chicken Team
    45; All rights reserved.
    56;
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426*/
    3527
  • chicken/branches/prerelease/banner.scm

    r7776 r9381  
    22
    33CHICKEN
     4(c)2008 The Chicken Team
     5(c)2000-2007 Felix L. Winkelmann
    46
    57EOF
    68)
    7 
    8 (define-constant +copyright+ "(c)2000-2008 Felix L. Winkelmann")
  • chicken/branches/prerelease/batch-driver.scm

    r7274 r9381  
    22;
    33; Copyright (c) 2000-2007, Felix L. Winkelmann
     4; Copyright (c) 2008, The Chicken Team
    45; All rights reserved.
    56;
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426
    3527
     
    381373           (unless quiet
    382374             (print-version #t)
    383              (display "\n\nEnter \"chicken -help\" for information on how to use it.\n") ) )
     375             (display "\nEnter \"chicken -help\" for information on how to use it.\n") ) )
    384376          (else
    385377
  • chicken/branches/prerelease/benchmarks/fib.scm

    r4232 r9381  
    66      (+ (fib (- n 1)) (fib (- n 2))) ) )
    77
    8 (time (pp (fib 40)))
     8(time (pp (fib 30)))
  • chicken/branches/prerelease/buildversion

    r7934 r9381  
    1 3.0.0
     13.0.5
     2
  • chicken/branches/prerelease/c-backend.scm

    r7784 r9381  
    22;
    33; Copyright (c) 2000-2007, Felix L. Winkelmann
     4; Copyright (c) 2008, The Chicken Team
    45; All rights reserved.
    56;
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426
    3527
     
    507499                ((>= n llen))
    508500              (gen #\, (char->integer (string-ref ll n))) )
    509             (do ((n (remainder llen 8) (sub1 n))) ; fill up with zeros to align following entry
     501            (do ((n (- (bitwise-and #xfffff8 (+ llen 7)) llen) (sub1 n))) ; fill up with zeros to align following entry
    510502                ((zero? n))
    511503              (gen ",0") )
     
    696688            ((null? lit)
    697689             (gen #t to "=C_SCHEME_END_OF_LIST;") )
    698             ((##sys#immediate? lit) (bad-literal lit))
    699             ((##core#inline "C_lambdainfop" lit))
    700             (else
     690            ((and (not (##sys#immediate? lit))
     691                  (##core#inline "C_lambdainfop" lit)))
     692            ((or (fixnum? lit) (not (##sys#immediate? lit)))
    701693             (gen #t to "=C_decode_literal(C_heaptop,")
    702694             (gen-string-constant (encode-literal lit))
    703              (gen ");") ) ) )
     695             (gen ");") )
     696            (else (bad-literal lit))))
    704697
    705698    (define (gen-string-constant str)
     
    13641357         ((eof-object? lit) "\xff\x3e")
    13651358         ((eq? (void) lit) "\xff\x1e")
    1366          ((and (fixnum? lit) (not (big-fixnum? lit)))
    1367           (string-append
    1368            "\xff\x01"
    1369            (string (integer->char (bitwise-and #xff (arithmetic-shift lit -24)))
    1370                    (integer->char (bitwise-and #xff (arithmetic-shift lit -16)))
    1371                    (integer->char (bitwise-and #xff (arithmetic-shift lit -8)))
    1372                    (integer->char (bitwise-and #xff lit)) ) ) )
     1359         ((fixnum? lit)
     1360          (if (not (big-fixnum? lit))
     1361              (string-append
     1362               "\xff\x01"
     1363               (string (integer->char (bitwise-and #xff (arithmetic-shift lit -24)))
     1364                       (integer->char (bitwise-and #xff (arithmetic-shift lit -16)))
     1365                       (integer->char (bitwise-and #xff (arithmetic-shift lit -8)))
     1366                       (integer->char (bitwise-and #xff lit)) ) )
     1367              (string-append "\xff\x55" (number->string lit) "\x00") ) )
    13731368         ((number? lit)
    13741369          (string-append "\x55" (number->string lit) "\x00") )
  • chicken/branches/prerelease/c-platform.scm

    r7167 r9381  
    22;
    33; Copyright (c) 2000-2007, Felix L. Winkelmann
     4; Copyright (c) 2008, The Chicken Team
    45; All rights reserved.
    56;
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426
    3527
  • chicken/branches/prerelease/chicken-bug.1

    r7036 r9381  
    5757
    5858.SH AUTHOR
    59 .I chicken-bug
    60 was written by Felix L. Winkelmann (felix@call-with-current-continuation.org).
     59Felix L. Winkelmann (felix@call-with-current-continuation.org)
     60and The Chicken Team.
    6161
    6262.SH SEE ALSO
  • chicken/branches/prerelease/chicken-bug.scm

    r7864 r9381  
    11;;;; chicken-bug.scm - Bug report-generator
     2;
     3; Copyright (c) 2008, The Chicken Team
     4; All rights reserved.
     5;
     6; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
     7; conditions are met:
     8;
     9;   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
     10;     disclaimer.
     11;   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
     12;     disclaimer in the documentation and/or other materials provided with the distribution.
     13;   Neither the name of the author nor the names of its contributors may be used to endorse or promote
     14;     products derived from this software without specific prior written permission.
     15;
     16; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
     17; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
     18; AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
     19; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     21; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     22; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     23; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     24; POSSIBILITY OF SUCH DAMAGE.
    225
    326
     
    1942
    2043(define-constant +fallbackdestinations+
    21   "chicken-janitors@nongnu.org\nchicken-hackers@nongnu.org\nchicken-users@nongnu.org\nfelix@call-with-current-continuation.org")
     44  "chicken-janitors@nongnu.org\nchicken-hackers@nongnu.org\nchicken-users@nongnu.org")
    2245
    2346(define-constant +destination+ "chicken-janitors@nongnu.org")
  • chicken/branches/prerelease/chicken-ffi-macros.scm

    r6839 r9381  
    22;
    33; Copyright (c) 2000-2007, Felix L. Winkelmann
     4; Copyright (c) 2008, The Chicken Team
    45; All rights reserved.
    56;
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426
    3527
  • chicken/branches/prerelease/chicken-more-macros.scm

    r7839 r9381  
    22;
    33; Copyright (c) 2000-2007, Felix L. Winkelmann
     4; Copyright (c) 2008, The Chicken Team
    45; All rights reserved.
    56;
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426
    3527
  • chicken/branches/prerelease/chicken-profile.1

    r5945 r9381  
    5555.SH BUGS
    5656Submit bug reports by e-mail to
    57 .I felix@call-with-current-continuation.org
     57.I chicken-janitors@nongnu.org
    5858
    59 .SH AUTHOR
    60 .I csc
    61 was written by Felix L. Winkelmann (felix@call-with-current-continuation.org).
     59.SH AUTHORS
     60Felix L. Winkelmann and the Chicken Team
    6261
    6362.SH SEE ALSO
  • chicken/branches/prerelease/chicken-profile.scm

    r6439 r9381  
    22;
    33; Copyright (c) 2000-2007, Felix L. Winkelmann
     4; Copyright (c) 2008, The Chicken Team
    45; All rights reserved.
    56;
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426
    3527
  • chicken/branches/prerelease/chicken-setup.1

    r7334 r9381  
    11.\" dummy line
    2 .TH CHICKEN-SETUP 1 "25 Jan 2004"
     2.TH CHICKEN-SETUP 1 "28 Feb 2008"
    33
    44.SH NAME
     
    5050.SH OPTIONS
    5151
     52.TP
     53.B \-h,\ \-help     
     54Shows a summary of options and exits.
     55
     56.TP
     57.B \-V,\ \-version
     58Shows the version of
     59.I chicken-setup
     60and exits.
     61
     62.TP
     63.B \-release
     64Shows release number of CHICKEN and exits.
     65
     66.TP
     67.BI \-R,\ \-repository \ [PATH]         
     68If
     69.B PATH
     70is not given, prints the location of the extension repository.
     71If
     72.B PATH
     73is given, specifies the location for the extension repository
     74The default repository path is the installation library directory (usually
     75.I /usr/local/lib/chicken
     76, or (if set) the directory given in the environment variable
     77.I CHICKEN\_REPOSITORY
     78
     79.TP
     80.B \-u,\ \-uninstall
     81Removes the given extension from the repository.
     82
     83.TP
     84.BI \-H,\ \-host \ HOSTNAME[:PORT]
     85Specifies alternative host for downloading extensions.
     86.B PORT
     87may be omitted and defaults to 80.
     88
     89.TP
     90.BI \-p,\ \-proxy \ HOSTNAME[:PORT]
     91Connects to server via proxy.
     92.B PORT
     93may be omitted and defaults to 80.
     94
     95.TP
     96.B \-l,\ \-list
     97Lists all installed extensions and exits, or show extension-information
     98of extensions given on the command-line (following this option).
     99
     100.TP
     101.BI \-r,\ \-run \ FILENAME
     102Loads and executes given file.
     103
     104.TP
     105.BI \-P,\ \-program\-path \ [PATH]
     106If
     107.B PATH
     108is not given, prints the location where executable files will be installed.
     109If
     110.B PATH
     111is given, specifies the location for installing executable files.
     112
     113.TP
     114.BI  \-s,\ \-script \ FILENAME           
     115Executes the given script with remaining arguments and exits.
     116
     117.TP
     118.B \-f,\ \-fetch
     119Only download, don't extract, build or install.
     120
     121.TP
     122.B \-v,\ \-verbose
     123Displays additional information (mainly for debugging).
     124
     125.TP
     126.B \-k,\ \-keep
     127Keeps intermediate files after building and installing.
     128
    52129.TP
    53 .BI \-csc\-option option
     130.BI \-c,\ \-csc\-option \ option
    54131Passes
    55132.B option
     
    62139
    63140.TP
    64 .BI \-destdir\ pathname
    65 Specifies alternative installation prefix by setting the
    66 .B installation-prefix
    67 parameter.
    68 
    69 .TP
    70 .B \-docindex
    71 Displays the path to the index-page of any installed extension-documentation. If the index page
    72 does not exist, it is created.
    73 
    74 .TP
    75 .B \-dont\-ask
    76 Do not ask the user before trying to download required extensions.
    77 
    78 .TP
    79 .BI \-eval\ expression
    80 Evaluates the given expression(s).
    81 
    82 .TP
    83 .B \-fetch
    84 Only download, don't extract, build or install.
    85 
    86 .TP
    87 .B \-fetch\-tree
    88 Downloads and prints the repository catalog to stdout.
    89 
    90 .TP
    91 .B \-help
    92 Show usage information and exit.
    93 
    94 .TP
    95 .BI \-host\ hostname:port
    96 Specifies alternative host for downloading extensions.
    97 .B port
    98 may be omitted and defaults to 80.
    99 
    100 .TP
    101 .B \-keep
    102 Keep temporary files and directories.
    103 
    104 .TP
    105 .B \-list
    106 List all installed extensions and exit, or show extension-information of extensions given on the
    107 command-line (following this option).
    108 
    109 .TP
    110 .BI \-local\ path
    111 Fetch extension sources from local filesystem at
    112 .B path
    113 instead of downloading egg from egg server.
    114 
    115 .TP
    116 .B \-no\-install
    117 Do not install generated binaries and/or support files. Any invocations of
     141.B \-d,\ \-dont\-ask
     142Does not ask the user before trying to download required extensions.
     143
     144.TP
     145.BI \-n,\ \-no\-install
     146Does not install generated binaries and support files after building.
     147Any invocations of
    118148.I install\-program
    119149,
    120150.I install\-extension
     151,
     152.I install\-script
    121153or
    122 .I install\-script
    123 will be be no-ops.
    124 
    125 .TP
    126 .B \-program\-path
    127 Display the path where executables are installed.
    128 
    129 .TP
    130 .BI \-program\-path\ directory
    131 Sets the location where executables are installed.
    132 
    133 .TP
    134 .BI \-proxy\ hostname:port
    135 Connect to server via proxy.
    136 .B port
    137 may be omitted and defaults to 80.
    138 
    139 .TP
    140 .B \-repository
    141 Displays the name of the extension repository.
    142 
    143 .TP
    144 .BI \-repository\ directory
    145 Sets the location of the extension repository for all subsequent operations.
    146 The default repository path is the installation library directory (usually
    147 .I \/usr\/local\/lib\/chicken
    148 , or (if set) the directory given in the environment variable
    149 .I CHICKEN\_REPOSITORY
    150 
    151 .TP
    152 .BI \-revision\ revision
    153 Specifies the subversion revision that you want to check out (only useful in
    154 combination with the
    155 .B \-svn
    156 option).
    157 
    158 .TP
    159 .BI \-run\ filename
    160 Load and execute given file.
    161 
    162 .TP
    163 .BI \-script\ filename
    164 Executes the given Scheme source file with all remaining arguments and exit.
    165 
    166 .TP
    167 .BI \-svn\ url
    168 Fetch extension sources from Subversion (http://subversion.tigris.org) repository,
    169 instead of downloading egg from egg server.
    170 
    171 .TP
    172 .B \-test
    173 If the extension sources contain a directory named
     154.I copy\-file
     155will be no-ops.
     156
     157.TP
     158.B \-i,\ \-docindex
     159Displays the path to the index-page of any installed
     160extension-documentation. If the index page does not exist, it is
     161created.
     162
     163.TP
     164.BI \-e,\ \-eval \ EXPRESSION
     165Evaluates the given expression(s).
     166
     167.TP
     168.BI \-t,\ \-test
     169If the
     170.B .egg
     171extension archive contains a directory named
    174172.B tests
    175173and this directory includes a file named
     
    180178
    181179.TP
    182 .BI \-tree\ filename
     180.B \-host\-extension
     181Compiles any extensions in "host" mode.
     182
     183.TP
     184.BI \-ls \ EXTENSION
     185Lists the installed files for the given extension.
     186
     187.TP
     188.B \-fetch\-tree
     189Downloads and prints the repository catalog to standard output.
     190
     191.TP
     192.BI \-create\-tree \ PATH
     193Creates repository catalog from SVN checkout.
     194
     195.TP
     196.BI \-tree \ FILENAME
    183197Uses the repository catalog stored in
    184 .B filename
     198.B FILENAME
    185199instead of downloading it.
    186200
    187 .TP
    188 .B \-uninstall
    189 Removes all following extensions from repository.
    190 
    191 .TP
    192 .B \-verbose
    193 Display additional information (mainly for debugging).
    194 
    195 .TP
    196 .B \-version
    197 Display version and exit.
     201
     202.TP
     203.BI \-svn \ URL
     204Fetches extension sources from an SVN repository instead of
     205downloading egg from egg server.
     206
     207.TP
     208.BI \-local \ PATH
     209Fetches extension sources from the local filesystem at
     210.B PATH
     211instead of downloading egg from egg server.
     212
     213.TP
     214.BI \-install-prefix \ PATH
     215Specifies alternative installation prefix. The installation paths for
     216all executable files, examples, and files installed with the
     217.I copy-file
     218and
     219.I move-file
     220procedures will be prepended by this prefix, if it is specified.
     221
     222.TP
     223.BI \-revision \ REVISION
     224Specifies the SVN revision that to check out (only useful in
     225combination with the
     226.B \-svn
     227option).
     228
     229.TP
     230.BI \-build\-prefix \ PATH
     231Specifies the location where
     232.I chicken-setup
     233will create build directories. The default location is the value
     234of environment variable
     235.I CHICKEN_TMPDIR
     236,
     237.I TMPDIR
     238or
     239.I /tmp/chicken-{MAJOR-VERSION}-build-{USER}
     240if none of those variables are found in the environment. If
     241.I /tmp
     242does not exist or is not writeable, then the build directory is
     243.I {HOME}/tmp/chicken-{MAJOR-VERSION}-build-{USER}
     244.
     245
     246
     247.TP
     248.BI \-download\-dir \ PATH
     249Specifies the location where chicken-setup will save downloaded files
     250The default is
     251.I {BUILD-PREFIX}/downloads)
     252
    198253
    199254.TP
    200255.B \-\-
    201 Ignore all further arguments.
     256Ignores all further arguments.
    202257
    203258.SH ENVIRONMENT\ VARIABLES
     
    205260.TP
    206261.B CHICKEN_PREFIX
    207 An alternative installation prefix, where the Scheme-to-C translator
    208 and any support files and libraries are located. Defaults to the installation
    209 time prefix given when configuring the system.
     262The installation prefix where CHICKEN Scheme and its support files and
     263libraries are located. Defaults to the installation time prefix given
     264when configuring the system.
     265
     266.TP
     267.B CHICKEN_INSTALL_PREFIX
     268An alternative installation prefix that will be prepended to extension
     269installation paths if specified.
    210270
    211271.TP
     
    222282.
    223283
     284.TP
     285.B CHICKEN_TMPDIR
     286The location where egg files will be unpacked and extensions compiled.
     287
    224288.SH DOCUMENTATION
    225289
     
    229293.SH BUGS
    230294Submit bug reports by e-mail to
    231 .I felix@call-with-current-continuation.org
     295.I chicken-janitors@nongnu.org
    232296, preferrably using the
    233297.B chicken\-bug
    234298tool.
    235299
    236 .SH AUTHOR
    237 .I chicken\-setup
    238 was written by Felix L. Winkelmann (felix@call-with-current-continuation.org).
     300.SH AUTHORS
     301Felix L. Winkelmann and the Chicken Team
    239302
    240303.SH SEE ALSO
  • chicken/branches/prerelease/chicken-setup.scm

    r7764 r9381  
    22;
    33; Copyright (c) 2000-2007, Felix L. Winkelmann
     4; Copyright (c) 2008, The Chicken Team
    45; All rights reserved.
    56;
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426
    3527
     
    3830  (uses srfi-1 regex utils posix tcp match srfi-18 srfi-13)
    3931  (export move-file run:execute make/proc uninstall-extension
    40           install-extension install-program install-script
    41           setup-verbose-flag setup-install-flag installation-prefix
    42           find-library find-header program-path remove-file* patch
    43           yes-or-no? setup-build-directory setup-root-directory
    44           create-directory test-compile try-compile copy-file run-verbose
    45           required-chicken-version required-extension-version
    46           cross-chicken ##sys#current-source-filename host-extension) )
     32          install-extension install-program install-script setup-verbose-flag
     33          setup-install-flag installation-prefix chicken-prefix find-library
     34          find-header program-path remove-file* patch yes-or-no?
     35          setup-build-directory setup-root-directory create-directory
     36          test-compile try-compile copy-file run-verbose
     37          required-chicken-version required-extension-version cross-chicken
     38          ##sys#current-source-filename host-extension) )
    4739
    4840
     
    119111
    120112(define-constant long-options
    121   '("-help" "-uninstall" "-list" "-run" "-repository" "-program-path" "-version" "-script"
    122     "-fetch" "-host" "-proxy" "-keep" "-verbose" "-csc-option" "-dont-ask" "-no-install" "-docindex" "-eval"
    123     "-debug" "-ls" "-release" "-test" "-fetch-tree" "-tree" "-svn" "-local" "-destdir" "-revision"
    124     "-host-extension") )
     113'("-help" "-uninstall" "-list" "-run" "-repository" "-program-path"
     114  "-version" "-script" "-fetch" "-host" "-proxy" "-keep" "-verbose"
     115  "-csc-option" "-dont-ask" "-no-install" "-docindex" "-eval"
     116  "-debug" "-ls" "-release" "-test" "-fetch-tree" "-tree" "-svn"
     117  "-local" "-revision" "-host-extension" "-build-prefix"
     118  "-download-path" "-install-prefix") )
     119
    125120
    126121(define-constant short-options
     
    136131    ("chicken-bug" . ,(foreign-value "C_CHICKEN_BUG_PROGRAM" c-string))))
    137132
    138 (define *install-bin-path*
    139   (or (and-let* ((p (getenv "CHICKEN_PREFIX")))
    140         (make-pathname p "bin") )
    141       (foreign-value "C_INSTALL_BIN_HOME" c-string) ) )
    142133
    143134(define *cc* (foreign-value "C_TARGET_CC" c-string))
     
    154145       (build-platform) ) )
    155146
    156 (define *windows-shell* (eq? *windows* 'mingw32))
     147(define *windows-shell* (or (eq? *windows* 'mingw32)
     148                            (eq? *windows* 'msvc)))
    157149(define *debug* #f)
    158150
    159151(register-feature! 'chicken-setup)
    160152
    161 (define program-path (make-parameter *install-bin-path*))
     153(define chicken-bin-path
     154  (or (and-let* ((p (getenv "CHICKEN_PREFIX")))
     155        (make-pathname p "bin") )
     156      (foreign-value "C_INSTALL_BIN_HOME" c-string) ) )
     157
     158(define chicken-prefix
     159  (or (getenv "CHICKEN_PREFIX")
     160      (match (string-match "(.*)/bin/?" chicken-bin-path)
     161             ((_ p) p)
     162             (_ "/usr/local") ) ) )
     163
     164(define example-path
     165  (make-parameter
     166   (or (and-let* ((p chicken-prefix))
     167         (make-pathname p "/share/chicken/examples") )
     168       "/usr/local/share/chicken/examples")))
     169
     170(define program-path (make-parameter chicken-bin-path))
     171
     172(define setup-build-prefix
     173  (make-parameter
     174   (or (getenv "CHICKEN_TMPDIR") (getenv "TMPDIR")
     175       ((lambda (user)
     176          (and user  (file-write-access? "/tmp")
     177               (conc "/tmp/chicken-setup-" *major-version* "-" user)))
     178        (getenv "USER"))
     179       ((lambda (home user)
     180          (and home user  (conc home "/tmp/chicken-setup-" *major-version* "-" user)))
     181        (getenv "HOME") (getenv "USER"))
     182       ".")))
     183(define setup-download-directory  (make-parameter (conc (setup-build-prefix) "/downloads")))
     184(define setup-root-directory      (make-parameter #f))
     185(define setup-build-directory     (make-parameter #f))
     186(define setup-verbose-flag        (make-parameter #f))
     187(define setup-install-flag        (make-parameter #t))
     188
    162189(define (cross-chicken) (##sys#fudge 39))
    163190(define host-extension (make-parameter #f))
    164 
    165 (define setup-root-directory (make-parameter #f))
    166 (define setup-build-directory (make-parameter (current-directory)))
    167 (define setup-verbose-flag (make-parameter #f))
    168 (define setup-install-flag (make-parameter #t))
    169191
    170192(define *copy-command* (if *windows-shell* 'copy "cp -r"))
     
    174196(define *tar-program* 'tar)
    175197(define *fetch-only* #f)
    176 (define *temporary-directory* #f)
    177 (define *tmpdir-created* #f)
     198(define *builddir-created* #f)
    178199(define *keep-stuff* #f)
    179200(define *csc-options* '())
     
    185206(define *proxy-host* #f)
    186207(define *proxy-port* #f)
    187 (define *example-directory* (make-pathname (chicken-home) "examples"))
    188208(define *base-directory* (current-directory))
    189209(define *fetch-tree-only* #f)
    190210(define *svn-repository* #f)
    191211(define *local-repository* #f)
    192 (define *destdir* #f)
    193 (define *repository-hosts*
    194   (list (list "www.call-with-current-continuation.org" *default-eggdir* 80)))
     212(define *repository-hosts* (list (list "www.call-with-current-continuation.org" *default-eggdir* 80)))
    195213(define *revision* #f)
    196214(define *run-tests* #f)
     
    219237          (verb dir)
    220238          (system* "mkdir -p ~a" (quotewrap dir) ) ) ) ) )
     239
    221240
    222241
     
    273292          (cons* (quotewrap
    274293                  (make-pathname
    275                    *install-bin-path*
     294                   chicken-bin-path
    276295                   (cdr (assoc prg *installed-executables*))))
    277296                 "-feature" "compiling-extension"
     
    279298          " ") )
    280299        ((assoc prg *installed-executables*) =>
    281          (lambda (a) (quotewrap (make-pathname *install-bin-path* (cdr a)))))
     300         (lambda (a) (quotewrap (make-pathname chicken-bin-path (cdr a)))))
    282301        (else prg) ) )
    283302
     
    456475         (filter-map
    457476          (lambda (d)
    458             (and-let* ((mf (or (file-exists? (make-pathname d d "meta"))
    459                                (file-exists? (make-pathname (list d "trunk") d "meta")))))
     477            (and-let* ((mf (or (file-exists? (make-pathname (list eggdir d) d "meta"))
     478                               (file-exists? (make-pathname (list eggdir d "trunk") d "meta")))))
    460479              (display mf (current-error-port))
    461480              (newline (current-error-port))
     
    470489               ,(conc e ".egg")
    471490               ,@(if needs (cdr needs) '())))))
    472      *eggs*)
     491     eggs)
    473492    (write-char #\))))
    474493
     
    480499usage: chicken-setup [OPTION ...] FILENAME
    481500
    482   -h  -help                      show this text and exit
    483   -V  -version                   show version of this program and exit
    484       -release                   show release number and exit
    485   -R  -repository [PATH]         prints the location of the extension repository
    486   -u  -uninstall                 remove the following extension from repository
    487   -H  -host HOSTNAME[:PORT]      specify alternative host for downloading
    488   -p  -proxy HOSTNAME[:PORT]     connect via proxy
    489   -l  -list [NAME ...]           list installed extensions or show extension information
    490   -r  -run FILENAME              load and execute given file
    491   -P  -program-path DIRECTORY    specify path for installing executables or scripts
    492   -s  -script FILENAME           execute script with remaining arguments and exit
     501  -h  -help                      shows this text and exits
     502  -V  -version                   shows version of this program and exits
     503      -release                   shows release number and exits
     504  -R  -repository [PATH]         if PATH is not given, prints the location of the extension repository
     505                                 if PATH is given, specifies the location for the extension repository
     506  -u  -uninstall                 removes the following extension from repository
     507  -H  -host HOSTNAME[:PORT]      specifies alternative host for downloading
     508  -p  -proxy HOSTNAME[:PORT]     connects via proxy
     509  -l  -list [NAME ...]           lists installed extensions or shows extension information
     510  -r  -run FILENAME              loads and executes given file
     511  -P  -program-path [PATH]       if PATH is not given, prints the location where executables will be installed
     512                                 if PATH is given, specifies the location for installing executables
     513  -s  -script FILENAME           executes script with remaining arguments and exits
    493514  -f  -fetch                     only download, don't extract, build or install
    494   -v  -verbose                   be verbose
    495   -k  -keep                      don't delete intermediate files
    496   -c  -csc-option OPTION         pass extra option to csc (if run with `(run (csc ...))')
     515  -v  -verbose                   verbose mode
     516  -k  -keep                      keeps intermediate files after building and installing
     517  -c  -csc-option OPTION         passes extra option to csc (if run with `(run (csc ...))')
    497518  -d  -dont-ask                  always download, if asked
    498   -n  -no-install                don't install generated binaries and support files
    499   -i  -docindex                  display path for documentation index
    500   -e  -eval EXPRESSION           evaluate expression
    501   -t  -test                      run test suite, if it exists
    502       -host-extension            compile any extensions in "host" mode
    503       -ls EXTENSION              list installed files for extension
    504       -fetch-tree                download and show repository catalog
    505       -create-tree               create repository catalog from SVN checkout
    506       -tree FILENAME             use repository catalog from given file
    507       -svn URL                   fetch extension from subversion repository
    508       -local PATH                fetch extension from local filesystem
    509       -destdir PATH              specify alternative installation prefix
    510       -revision REV              specify SVN revision for checkout
    511   --                             ignore all following arguments
     519  -n  -no-install                does not install generated binaries and support files
     520  -i  -docindex                  displays path for documentation index
     521  -e  -eval EXPRESSION           evaluates expression
     522  -t  -test                      runs test suite, if it exists
     523      -host-extension            compiles any extensions in "host" mode
     524      -ls EXTENSION              lists installed files for extension
     525      -fetch-tree                downloads and show repository catalog
     526      -create-tree DIRECTORY     creates repository catalog from SVN checkout
     527      -tree FILENAME             uses repository catalog from given file
     528      -svn URL                   fetches extension from subversion repository
     529      -local PATH                fetches extension from local filesystem
     530      -revision REV              specifies SVN revision for checkout
     531      -build-prefix PATH         location where chicken-setup will create egg build directories
     532                                 (default: the value of environment variable CHICKEN_TMPDIR, TMPDIR or
     533                                  /tmp/chicken-setup-{MAJOR-VERSION}-{USER}
     534                                  if none of these variables are found in the environment)
     535      -download-path PATH         location where chicken-setup will save downloaded files
     536                                 (default: {BUILD-PREFIX}/downloads)
     537      -install-prefix PATH       specifies alternative installation prefix
     538  --                             ignores all following arguments
    512539
    513540  Builds and installs extension libraries.
     
    524551
    525552(define installation-prefix
    526   (make-parameter
    527    (or (getenv "CHICKEN_PREFIX")
    528        (match (string-match "(.*)/bin/?" *install-bin-path*)
    529          ((_ p) p)
    530          (_ #f) ) ) ) )
     553  (make-parameter (or (getenv "CHICKEN_INSTALL_PREFIX") #f)))
    531554
    532555(define (with-ext filename ext)
     
    591614          (values '() oinfo) ) ) ) )
    592615
    593 (define (compute-tmpdir fname)
    594   (if (equal? "egg-dir" (pathname-extension fname))
    595       fname
    596       (string-append fname "-dir") ) )
     616(define (compute-builddir fpath)
     617  (if (equal? "egg-dir" (pathname-extension fpath)) fpath
     618      (let ((fname (pathname-strip-directory fpath)))
     619        (let loop ((num (random 10000)))
     620          (let* ((buildname (string-append "build." (number->string num)))
     621                 (path  (make-pathname (setup-build-prefix) buildname (string-append fname "-dir") )))
     622            (if (file-exists? path) (loop (random 10000))
     623                path))))))
     624
    597625
    598626(define (chdir dir)
     
    600628  (change-directory dir) )
    601629
    602 (define (rmtmpdir)
     630(define (clear-builddir)
    603631  (unless (string=? (current-directory) *base-directory*)
    604632    (chdir *base-directory*) )
    605   (when *tmpdir-created*
    606     (set! *tmpdir-created* #f)
     633  (when *builddir-created*
     634    (set! *builddir-created* #f)
    607635    (unless *keep-stuff*
    608       (when (setup-verbose-flag) (printf "removing temporary directory `~A'~%" *temporary-directory*))
     636      (when (setup-verbose-flag) (printf "removing egg build directory `~A'~%" (setup-build-directory)))
    609637      (handle-exceptions ex
    610           (warning "removal of temporary directory failed" *temporary-directory*)
    611         (run (,*remove-command* ,(quotewrap *temporary-directory*))) )) ) )
     638          (warning "removal of egg build directory failed" (setup-build-directory))
     639        (run (,*remove-command* ,(quotewrap (setup-build-directory))) )) ) ))
    612640
    613641(define (unpack/enter filename)
     
    615643    (with-input-from-file fn
    616644      (lambda () (string=? "\x1f\x8b" (read-string 2))) ) )
    617   (let ((tmpdir (compute-tmpdir filename)))
     645  (let ((tmpdir (compute-builddir filename)))
    618646    (cond ((file-exists? tmpdir)
    619647           (chdir tmpdir)
     
    621649          (else
    622650           (create-directory tmpdir)
    623            (set! *tmpdir-created* #t)
     651           (set! *builddir-created* #t)
    624652           (chdir tmpdir)
    625653           (setup-build-directory (current-directory))
    626            (let ((fn2 (string-append "../" filename))
     654           (let ((fn2 (if (and (not (or *local-repository* (with-ext filename "egg") (with-ext filename "egg-dir")))
     655                               (not (string-prefix? (setup-download-directory) filename)))
     656                          (make-pathname (setup-download-directory) filename)
     657                          filename))
    627658                 (v (setup-verbose-flag)) )
    628659             (if (testgz fn2)
    629660                 (run (,*gzip-program* -d -c ,fn2 |\|| ,*tar-program* ,(if v 'xvf 'xf) -))
    630661                 (run (,*tar-program* ,(if v 'xvf 'xf) ,fn2)) ) ) ) )
    631     (set! *temporary-directory* tmpdir) ) )
    632 
    633 (define (copy-file from to #!optional (err #t))
     662    ))
     663
     664(define (copy-file from to #!optional (err #t) (prefix (installation-prefix)))
    634665  (let ((from (if (pair? from) (car from) from))
    635         (to (if (pair? from) (make-pathname to (cadr from)) to)) )
     666        (to ((lambda (pre) (let ((to-path (if (pair? from) (make-pathname to (cadr from)) to)))
     667                             (if (and pre (not (string-prefix? pre to-path)))
     668                                 (make-pathname pre to-path) to-path)))
     669             prefix)))
    636670    (ensure-directory to)
    637671    (cond ((or (glob? from) (file-exists? from))
    638            (run (,*copy-command* ,(quotewrap from) ,(quotewrap to))) )
     672           (begin
     673             (run (,*copy-command* ,(quotewrap from) ,(quotewrap to)))
     674             to))
    639675          (err (error "file does not exist" from))
    640676          (else (warning "file does not exist" from)))))
    641677
    642678(define (move-file from to)
    643   (let ((from (if (pair? from) (car from) from))
    644         (to (if (pair? from) (make-pathname to (cadr from)) to)) )
     679  (let ((from  (if (pair? from) (car from) from))
     680        (to    (let ((to-path (if (pair? from) (make-pathname to (cadr from)) to)))
     681                 (if (and pre (not (string-prefix? pre to-path)))
     682                     (make-pathname pre to-path) to-path))))
    645683    (ensure-directory to)
    646684    (run (,*move-command* ,(quotewrap from) ,(quotewrap to)) ) ) )
     
    707745          (set! *rebuild-doc-index* #t)) )
    708746      (and-let* ((exs (assq 'examples info)))
    709         (print "\n* Installing example files in " *example-directory* ":")
    710         (for-each
    711          (lambda (f)
    712            (copy-file f (make-pathname *example-directory* f) #f)
    713            (unless *windows-shell*
    714              (run (chmod a+rx ,*example-directory*))) )
    715          (cdr exs))
    716         (newline) )
     747        (let ((example-dest
     748               ((lambda (pre) (if pre (list pre (example-path)) (list (example-path))))
     749                (installation-prefix))))
     750          (print "\n* Installing example files in " example-dest ":")
     751          (for-each
     752           (lambda (f)
     753             (copy-file f (make-pathname example-dest f) #f)
     754             (unless *windows-shell*
     755               (run (chmod a+rx ,example-dest))) )
     756           (cdr exs))
     757          (newline) ))
    717758      (write-info id dests info) ) ) )
    718759
     
    724765  (when (setup-install-flag)
    725766    (let* ((files (check-filelist (if (list? files) files (list files))))
    726            (ppath (if *destdir* (make-pathname *destdir* "bin") (program-path)))
     767           (ppath ((lambda (pre) (if pre (make-pathname pre (program-path)) (program-path)))
     768                   (installation-prefix)))
    727769           (files (if *windows*
    728770                      (map (lambda (f)
     
    745787  (when (setup-install-flag)
    746788    (let* ((files (check-filelist (if (list? files) files (list files))))
    747            (ppath (if *destdir* (make-pathname *destdir* "bin") (program-path)))
     789           (ppath ((lambda (pre) (if pre (make-pathname pre (program-path)) (program-path)))
     790                   (installation-prefix)))
    748791           (pfiles (map (lambda (f)
    749792                          (let ((from (if (pair? f) (car f) f))
     
    778821
    779822(define (repo-path #!optional ddir?)
    780   (let ((p (if (and ddir? *destdir*)
    781                (make-pathname
    782                 (list *destdir* "lib/chicken")
    783                 (pathname-file (repository-path))) ; we need the binary-compat. version
     823  (let ((p (if (and ddir? (installation-prefix))
     824               (make-pathname (installation-prefix) (repository-path))
    784825               (repository-path))) )
    785826    (ensure-directory p)
     
    942983  (cond (*local-repository*
    943984         (when (setup-verbose-flag) (printf "fetching from local directory ~a ...~%" *local-repository*))
    944          (let ((p (->string item)))
    945            (copy-file (make-pathname *local-repository* p) (make-pathname #f p "egg-dir")) ) )
     985         (let* ((p  (->string item))
     986               (fpath  (make-pathname (setup-download-directory) p "egg-dir")))
     987           (copy-file (make-pathname *local-repository* p) fpath #t #f)))
     988
    946989        (*svn-repository*
    947990         (when (setup-verbose-flag) (printf "fetching from svn repository ~a ...~%" *svn-repository*))
    948          (let ((p (->string item)))
     991         (let* ((p (->string item))
     992               (fpath (make-pathname (setup-download-directory) p "egg-dir")))
    949993           (run (svn co ,(if *revision* (conc "--revision " *revision*) "")
    950                      ,(make-pathname *svn-repository* p) ,(make-pathname #f p "egg-dir"))) ) )
     994                     ,(make-pathname *svn-repository* p) ,fpath))
     995           fpath))
     996
    951997        (else
    952998         (match hostdata
     
    9681014                          (close-input-port i)
    9691015                          (close-output-port o)
    970                           (with-output-to-file (pathname-strip-directory fname)
    971                             (cut display data)
    972                             binary:) )
     1016                          (if (not (file-exists? (setup-download-directory)))
     1017                              (create-directory (setup-download-directory)))
     1018                          (let ((fpath (make-pathname (setup-download-directory) (pathname-strip-directory fname))))
     1019                            (with-output-to-file fpath
     1020                              (cut display data)
     1021                              binary:)
     1022                            fpath))
    9731023                        (loop) ) ) ) ) ) )
    9741024           (x (error "(internal) invalid host" x)) ) ) ) )
     
    9981048               *last-decent-host*
    9991049               (pathname-file ext)
    1000                (pathname-replace-extension ext "egg") )
    1001               #t)
     1050               (pathname-replace-extension ext "egg") ))
     1051
    10021052             (else
    10031053              (download-repository-tree)
     
    10111061                             (print "installing required extensions ...")
    10121062                             (for-each (cut install <>) (map ->string reqs)) )
    1013                            (begin (download-data *last-decent-host* (first a)) #t) ) )
     1063                           (download-data *last-decent-host* (first a))) )
    10141064                      (else
    10151065                       (error "Extension does not exist in the repository" ext)) ) ) ) ) ) )
     
    10231073      (cond ((and df (with-ext filename "setup")) => run-setup-script)
    10241074            ((or (with-ext filename "egg") (with-ext filename "egg-dir")) =>
    1025              (lambda (f)
     1075             (lambda (fpath)
     1076               (let ((f (pathname-strip-directory fpath)))
     1077                 (when df
     1078                   (unpack/enter fpath)
     1079                   (let ((sfile (pathname-replace-extension f "setup")))
     1080                     (when (and (not (file-exists? sfile)) (file-exists? "tags") )
     1081                       (let ((ds (sort (directory "tags") string>=?)))
     1082                         (when (pair? ds)
     1083                           (let ((d (make-pathname "tags" (car ds))))
     1084                             (chdir d) ) )  ) )
     1085                     (loop sfile)
     1086                     (clear-builddir) ) ) ) ))
     1087            ((fetch-file filename) =>
     1088             (lambda (fpath)
     1089               (set! *fetched-eggs*
     1090                     (append
     1091                      *fetched-eggs*
     1092                      (if fpath (list fpath) (list (make-pathname (current-directory) filename "egg")))))
    10261093               (when df
    1027                  (unpack/enter f)
    1028                  (let ((sfile (pathname-replace-extension f "setup")))
    1029                    (when (and (not (file-exists? sfile)) (file-exists? "tags") )
    1030                      (let ((ds (sort (directory "tags") string>=?)))
    1031                        (when (pair? ds)
    1032                          (let ((d (make-pathname "tags" (car ds))))
    1033                            (chdir d)
    1034                            (setup-build-directory d) ) ) ) )
    1035                    (loop sfile)
    1036                    (rmtmpdir) ) ) ) )
    1037             ((fetch-file filename)
    1038              (set! *fetched-eggs*
    1039                (append
    1040                 *fetched-eggs*
    1041                 (list (make-pathname (current-directory) filename "egg"))))
    1042              (when df
    1043                (loop (pathname-file filename))))))))
     1094                 (loop fpath))))))))
    10441095
    10451096
     
    10651116  (let ((rpath (repository-path))
    10661117        (hn (get-host-name)))
    1067     (with-output-to-file (doc-stylesheet)
     1118    (with-output-to-file (doc-stylesheet #t)
    10681119      (lambda () (display #<<EOF
    10691120body, html {
     
    11421193}
    11431194EOF
    1144                           )))
    1145     (with-output-to-file (doc-index)
     1195    )))
     1196    (with-output-to-file (doc-index #t)
    11461197      (lambda ()
    11471198        (print "<html><head><title>Egg documentation index for " hn
     
    11761227                  string<?) ) )
    11771228          (display "</tbody></table></body></font></html>\n") ) ) ) ) )
    1178 
    11791229
    11801230;;; Output stuff
     
    12871337         (print (program-path))
    12881338         (exit) )
    1289         (("-destdir" path . more)
    1290          (set! *example-directory* (make-pathname path "examples"))
    1291          (set! *destdir* path)
     1339        (("-install-prefix" path . more)
    12921340         (installation-prefix path)
     1341         (loop more) )
     1342        (("-build-prefix" path . more)
     1343         (setup-build-prefix path)
     1344         (loop more) )
     1345        (("-download-path" path . more)
     1346         (setup-download-directory path)
    12931347         (loop more) )
    12941348        (("-program-path" dir . more)
     
    13471401         (loop more) )
    13481402        (("-docindex" . more)
    1349          (let ((di (doc-index)))
     1403         (let ((di (doc-index #t)))
    13501404           (unless (file-exists? di)
    13511405             (build-doc-index) )
     
    13791433         (host-extension #t)
    13801434         (loop more) )
    1381         (((or "-run" "-script" "-proxy" "-host" "-csc-option" "-ls" "-destdir" "-tree" "-local" "-svn" "-eval"))
     1435        (((or "-run" "-script" "-proxy" "-host" "-csc-option" "-ls" "-install-prefix"
     1436              "-tree" "-local" "-svn" "-eval" "-create-tree" "-build-prefix" "-download-dir"))
    13821437         (error "missing option argument" (car args)) )
    13831438        ((filename . more)
     
    14281483     (main (append (string-split (or (getenv "CHICKEN_SETUP_OPTIONS") ""))
    14291484                   (command-line-arguments) ) ) ) )
    1430   (rmtmpdir) )
     1485  (clear-builddir) )
  • chicken/branches/prerelease/chicken.1

    r7180 r9381  
    428428.I Chicken\ User's\ Manual
    429429
    430 .SH BUGS
    431 
    432 Submit bug reports by e-mail to
    433 .I felix@call-with-current-continuation.org
    434 , preferrably using the
    435 .B chicken\-bug
    436 tool.
    437 
    438 .SH AUTHOR
    439 
    440 .I Chicken
    441 was implemented by Felix L. Winkelmann (felix@call-with-current-continuation.org).
     430.SH AUTHORS
     431
     432Felix L. Winkelmann and The Chicken Team.
    442433
    443434.SH SEE ALSO
  • chicken/branches/prerelease/chicken.h

    r7777 r9381  
    22;
    33; Copyright (c) 2000-2007, Felix L. Winkelmann
     4; Copyright (c) 2008, The Chicken Team
    45; All rights reserved.
    56;
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426*/
    35 
    3627
    3728/* Configuration: */
     
    9384#  undef  C_externimport
    9485#  undef  C_externexport
    95 #  define C_externimport           C_extern __declspec(dllimport)
    9686#  define C_externexport           C_extern __declspec(dllexport)
    9787#  undef  C_varextern
     
    10090#   define C_varextern             C_extern __declspec(dllexport)
    10191#   define C_fctexport             __declspec(dllexport)
     92#   define C_externimport          C_extern __declspec(dllexport)
    10293#  else
    10394#   define C_varextern             C_extern __declspec(dllimport)
    10495#   define C_fctexport             __declspec(dllimport)
     96#   define C_externimport          C_extern __declspec(dllimport)
    10597#  endif
    10698# elif defined(__WATCOMC__)
     
    174166#if defined(__APPLE__) && defined(__MACH__)
    175167# define C_MACOSX
    176 #elif defined(__MWERKS__) && !defined(__INTEL__)
    177 /* This is a rather crude way of assuming this is MacOS 9 or lower! */
    178 # define C_MACOS
    179168#endif
    180169
     
    208197#if defined(__MINGW32__)
    209198# include <sys/param.h>
     199#elif defined(__CYGWIN__)
     200# include <endian.h>
    210201#elif defined(__linux__)
    211202# include <endian.h>
     
    242233#endif
    243234
    244 #ifdef C_MACOS
    245 # include <alloca.h>
    246 int strncasecmp(const char *one, const char *two, size_t n);
    247 #endif
    248 
    249235#ifdef __MINGW32__
    250236# include <malloc.h>
     
    262248typedef unsigned  __int16  uint16_t;
    263249typedef __int32            int32_t;
    264 typedef unsigned __int32   int32_t;
    265 typedef __int64            uint64_t;
     250typedef unsigned __int32   uint32_t;
     251typedef __int64            int64_t;
    266252typedef unsigned __int64   uint64_t;
    267253# pragma warning(disable: 4101)
     
    489475#define C_RUNTIME_SAFE_DLOAD_UNSAFE_ERROR             34
    490476#define C_BAD_ARGUMENT_TYPE_NO_FLONUM_ERROR           35
     477#define C_BAD_ARGUMENT_TYPE_NO_CLOSURE_ERROR          36
    491478
    492479
     
    10571044#endif
    10581045
     1046#define C_i_check_closure(x)            C_i_check_closure_2(x, C_SCHEME_FALSE)
    10591047#define C_i_check_exact(x)              C_i_check_exact_2(x, C_SCHEME_FALSE)
     1048#define C_i_check_inexact(x)            C_i_check_inexact_2(x, C_SCHEME_FALSE)
    10601049#define C_i_check_number(x)             C_i_check_number_2(x, C_SCHEME_FALSE)
    10611050#define C_i_check_string(x)             C_i_check_string_2(x, C_SCHEME_FALSE)
     
    12901279C_fctexport C_word C_exit_runtime(C_word code);
    12911280C_fctexport C_word C_fcall C_display_flonum(C_word port, C_word n) C_regparm;
     1281C_fctexport C_word C_fcall C_set_print_precision(C_word n) C_regparm;
     1282C_fctexport C_word C_fcall C_get_print_precision(void) C_regparm;
    12921283C_fctexport C_word C_fcall C_read_char(C_word port) C_regparm;
    12931284C_fctexport C_word C_fcall C_peek_char(C_word port) C_regparm;
     
    14551446C_fctexport C_word C_fcall C_i_length(C_word lst) C_regparm;
    14561447C_fctexport C_word C_fcall C_i_inexact_to_exact(C_word n) C_regparm;
     1448C_fctexport C_word C_fcall C_i_check_closure_2(C_word x, C_word loc) C_regparm;
    14571449C_fctexport C_word C_fcall C_i_check_exact_2(C_word x, C_word loc) C_regparm;
     1450C_fctexport C_word C_fcall C_i_check_inexact_2(C_word x, C_word loc) C_regparm;
    14581451C_fctexport C_word C_fcall C_i_check_number_2(C_word x, C_word loc) C_regparm;
    14591452C_fctexport C_word C_fcall C_i_check_string_2(C_word x, C_word loc) C_regparm;
     
    15061499C_fctexport C_word C_fcall C_i_o_fixnum_plus(C_word x, C_word y) C_regparm;
    15071500C_fctexport C_word C_fcall C_i_o_fixnum_difference(C_word x, C_word y) C_regparm;
     1501C_fctexport C_word C_fcall C_i_o_fixnum_and(C_word x, C_word y) C_regparm;
     1502C_fctexport C_word C_fcall C_i_o_fixnum_ior(C_word x, C_word y) C_regparm;
     1503C_fctexport C_word C_fcall C_i_o_fixnum_xor(C_word x, C_word y) C_regparm;
    15081504
    15091505C_fctexport C_word C_fcall C_i_foreign_char_argumentp(C_word x) C_regparm;
  • chicken/branches/prerelease/chicken.scm

    r6827 r9381  
    22;
    33; Copyright (c) 2000-2007, Felix L. Winkelmann
     4; Copyright (c) 2008, The Chicken Team
    45; All rights reserved.
    56;
     
    2324; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    2425; POSSIBILITY OF SUCH DAMAGE.
    25 ;
    26 ; Send bugs, suggestions and ideas to:
    27 ;
    28 ; felix@call-with-current-continuation.org
    29 ;
    30 ; Felix L. Winkelmann
    31 ; Unter den Gleichen 1
    32 ; 37130 Gleichen
    33 ; Germany
    3426
    3527
  • chicken/branches/prerelease/chicken.texi

    r5923 r9381  
    11\input texinfo @c -*- texinfo -*-
    2 @setfilename chicken.info
    32@settitle Chicken Scheme Reference Manual
    43@setchapternewpage on
    5 @ifinfo
    6 @format
    7 INFO-DIR-SECTION Programming
    8 START-INFO-DIR-ENTRY
    9 * Chicken: (chicken.info). A compiler that translates Scheme source files into C.
    10 END-INFO-DIR-ENTRY
    11 @end format
    12 @end ifinfo
    134@copying
    14 Copyright 2007 Felix Winkelmann
     5Copyright 2007-2008 Felix Winkelmann and the Chicken Team
    156@end copying
    167@titlepage
    178@sp 10
    189@title{Chicken Scheme Reference Manual}
    19 @author{Felix Winkelmann}
     10@author{Felix Winkelmann and the Chicken Team}
    2011@comment  The following two commands start the copyright page.
    2112@page
    2213@vskip 0pt plus 1fill
    23 Copyright 2007 Felix Winkelmann
     14Copyright 2007-2008 Felix Winkelmann and the Chicken Team
    2415@end titlepage
    2516@node Top, The User's Manual, (dir), (dir)
     
    2819@menu
    2920* The User's Manual::
     21* Overview::
    3022* Basic mode of operation::
    3123* Using the compiler::
     
    6860* Bibliography::
    6961@end menu
    70 @node The User's Manual, Basic mode of operation, Top, Top
     62@node The User's Manual, Overview, Top, Top
    7163@chapter The User's Manual
    7264
    7365
    74 @emph{(This document describes version 2.635)}
     66@emph{(This document describes version 3.0.5)}
    7567
    7668@b{CHICKEN is a compiler that translates Scheme source files into C}, which in turn can be fed to a C-compiler to generate a standalone executable.  An interpreter is also available and can be used as a scripting environment or for testing programs before compilation.
     
    156148
    157149@end table
    158 @node Basic mode of operation, Using the compiler, The User's Manual, Top
     150@node Overview, Basic mode of operation, The User's Manual, Top
     151@chapter Overview
     152
     153@menu
     154* Overview - Features::
     155
     156@end menu
     157
     158
     159@b{CHICKEN is a compiler that translates Scheme source files into C}, which in turn can be fed to a C-compiler to generate a standalone executable.  An interpreter is also available and can be used as a scripting environment or for testing programs before compilation.
     160
     161This package is distributed under the @b{BSD license} and as such is free to use and modify.
     162
     163The method of compilation and the design of the runtime-system follow closely Henry Baker's @uref{http://home.pipeline.com/~hbaker1/CheneyMTA.html, CONS Should Not CONS Its Arguments, Part II: Cheney on the M.T.A.} paper and expose a number of interesting properties:
     164
     165@itemize
     166@item Consing (creation of data on the heap) is relatively inexpensive, because a generational garbage collection scheme is used, in which short-lived data structures are reclaimed extremely quickly.
     167
     168@item Moreover, @code{call-with-current-continuation} is practically for free and CHICKEN does not suffer under any performance penalties if first-class continuations are used in complex ways.
     169
     170
     171@end itemize
     172The generated C code is fully tail-recursive.
     173
     174@node Overview - Features,  ,  , Overview
     175@section Features
     176
     177
     178Some of the features supported by CHICKEN:
     179
     180@itemize
     181@item SRFIs 0, 1, 2, 4, 6-19, 23, 25-31, 37-40, 42, 43, 45, 47, 55, 57, 60-63, 66, 69, 72, 78, 85 and 95.
     182
     183@item Lightweight threads based on first-class continuations
     184
     185@item Pattern matching with Andrew Wright's @code{match} package
     186
     187@item Record structures
     188
     189@item Extended comment- and string-literal syntaxes
     190
     191@item Libraries for regular expressions, string handling
     192
     193@item UNIX system calls and extended data structures
     194
     195@item Create interpreted or compiled shell scripts written in Scheme for UNIX or Windows
     196
     197@item Compiled C files can be easily distributed
     198
     199@item Allows the creation of fully self-contained statically linked executables
     200
     201@item On systems that support it, compiled code can be loaded dynamically
     202
     203
     204@end itemize
     205This manual is merely a reference for the CHICKEN system and assumes a working knowledge of Scheme.
     206
     207Back to @ref{The User's Manual, The User's Manual}
     208
     209@node Basic mode of operation, Using the compiler, Overview, Top
    159210@chapter Basic mode of operation
    160211
     
    164215The most portable way of creating separately linkable entities is supported by so-called @emph{unit}s.  A unit is a single compiled object module that contains a number of toplevel expressions that are executed either when the unit is the @emph{main} unit or if the unit is @emph{used}.  To use a unit, the unit has to be @emph{declare}ed as used, like this:
    165216
    166 <enscript highlight=scheme> (declare (uses UNITNAME)) </enscript>
    167 
     217@example
     218(declare (uses UNITNAME))
     219@end example
    168220The toplevel expressions of used units are executed in the order in which the units appear in the @code{uses} declaration. Units may be used multiple times and @code{uses} declarations may be circular (the unit is initialized at most once).  To compile a file as a unit, add a @code{unit} declaration:
    169221
    170 <enscript highlight=scheme> (declare (unit UNITNAME)) </enscript>
    171 
     222@example
     223(declare (unit UNITNAME))
     224@end example
    172225When compiling different object modules, make sure to have one main unit. This unit is called initially and initializes all used units before executing its toplevel expressions. The main-unit has no @code{unit} declaration.
    173226
    174227Another method of using definitions in separate source files is to @emph{include} them. This simply inserts the code in a given file into the current file:
    175228
    176 <enscript highlight=scheme> (include "FILENAME") </enscript>
    177 
     229@example
     230(include @strong{"FILENAME"})
     231@end example
    178232Macro definitions are only available when processed by @code{include} or @code{require-for-syntax}. Macro definitions in separate units are not available, since they are defined at compile time, i.e the time when that other unit was compiled (macros can optionally be available at runtime, see @code{define-macro} in @ref{Non-standard macros and special forms, Substitution forms and macros}).
    179233
     
    207261
    208262@verbatim
    209 chicken FILENAME @{OPTION@}
     263chicken FILENAME {OPTION}
    210264@end verbatim
    211265@code{FILENAME} is the complete pathname of the source file that is to be translated into C. A filename argument of @code{-} specifies that the source text should be read from standard input. Note that the filename has to be the first argument to @code{chicken}.
     
    232286
    233287Aborts compilation process after macro-expansion and syntax checks.
    234 @item -compress-literals THRESHOLD
    235 
    236 Compiles quoted literals that exceed the size @code{THRESHOLD} as strings and parse the strings at run-time. This reduces the size of the code and speeds up compile-times of the host C compiler, but has a small run-time performance penalty. The size of a literal is computed by counting recursively the objects in the literal, so a vector counts as 1 plus the count of the elements, a pair counts as the counts of the car and the cdr, respectively. All other objects count 1.
    237288@item -debug MODES
    238289
     
    355406@item -include-path PATHNAME
    356407
    357 Specifies an additional search path for files included via the @code{include} special form. This option may be given multiple times. If the environment variable @code{CHICKEN_INCLUDE_PATH} is set, it should contain a list of alternative include pathnames separated by @code{;}. The environment variable @code{CHICKEN_HOME} is also considered as a search path.
     408Specifies an additional search path for files included via the @code{include} special form. This option may be given multiple times. If the environment variable @code{CHICKEN_INCLUDE_PATH} is set, it should contain a list of alternative include pathnames separated by @code{;}.
    358409@item -inline
    359410
     
    361412@item -inline-limit THRESHOLD
    362413
    363 Sets the maximum size of a potentially inlinable procedure. This option is only effective when inlining has been enabled with the @code{-inline} option. The default threshold is @code{10}.
     414Sets the maximum size of a potentially inlinable procedure. The default threshold is @code{10}.
    364415@item -keyword-style STYLE
    365416
     
    534585
    535586@menu
    536 * Using the compiler - Examples - A simple example (with one source file)::
     587* Using the compiler - Examples - A simple example ;with one source file;::
    537588* Using the compiler - Examples - An example with multiple files::
    538589
     
    540591
    541592
    542 @node Using the compiler - Examples - A simple example (with one source file), Using the compiler - Examples - An example with multiple files,  , Using the compiler - Examples
     593@node Using the compiler - Examples - A simple example ;with one source file;, Using the compiler - Examples - An example with multiple files,  , Using the compiler - Examples
    543594@subsection A simple example (with one source file)
    544595
    545596@menu
    546 * Using the compiler - Examples - A simple example (with one source file) - Writing your source file::
    547 * Using the compiler - Examples - A simple example (with one source file) - Compiling your program::
    548 * Using the compiler - Examples - A simple example (with one source file) - Running your program::
     597* Using the compiler - Examples - A simple example ;with one source file; - Writing your source file::
     598* Using the compiler - Examples - A simple example ;with one source file; - Compiling your program::
     599* Using the compiler - Examples - A simple example ;with one source file; - Running your program::
    549600
    550601@end menu
     
    553604To compile a Scheme program (assuming a UNIX-like environment) consisting of a single source file, perform the following steps.
    554605
    555 @node Using the compiler - Examples - A simple example (with one source file) - Writing your source file, Using the compiler - Examples - A simple example (with one source file) - Compiling your program,  , Using the compiler - Examples - A simple example (with one source file)
     606@node Using the compiler - Examples - A simple example ;with one source file; - Writing your source file, Using the compiler - Examples - A simple example ;with one source file; - Compiling your program,  , Using the compiler - Examples - A simple example ;with one source file;
    556607@subsubsection Writing your source file
    557608
     
    559610In this example we will assume your source file is called @code{foo.scm}:
    560611
    561 <enscript highlight=scheme> ;;; foo.scm
    562 
    563 (define (fac n)
    564 
    565 @verbatim
    566  (if (zero? n)
    567      1
    568      (* n (fac (- n 1))) ) )
    569 @end verbatim
    570 (write (fac 10)) (newline) </enscript>
    571 
    572 @node Using the compiler - Examples - A simple example (with one source file) - Compiling your program, Using the compiler - Examples - A simple example (with one source file) - Running your program, Using the compiler - Examples - A simple example (with one source file) - Writing your source file, Using the compiler - Examples - A simple example (with one source file)
     612@example
     613@emph{;;; foo.scm
     614}
     615(@strong{define} (@strong{fac} n)
     616  (@strong{if} (zero? n)
     617      1
     618      (* n (fac (- n 1))) ) )
     619
     620(write (fac 10))
     621(newline)
     622@end example
     623@node Using the compiler - Examples - A simple example ;with one source file; - Compiling your program, Using the compiler - Examples - A simple example ;with one source file; - Running your program, Using the compiler - Examples - A simple example ;with one source file; - Writing your source file, Using the compiler - Examples - A simple example ;with one source file;
    573624@subsubsection Compiling your program
    574625
     
    585636foo  foo.scm
    586637@end verbatim
    587 @node Using the compiler - Examples - A simple example (with one source file) - Running your program,  , Using the compiler - Examples - A simple example (with one source file) - Compiling your program, Using the compiler - Examples - A simple example (with one source file)
     638@node Using the compiler - Examples - A simple example ;with one source file; - Running your program,  , Using the compiler - Examples - A simple example ;with one source file; - Compiling your program, Using the compiler - Examples - A simple example ;with one source file;
    588639@subsubsection Running your program
    589640
     
    597648If you get a @code{foo: command not found} error, you might want to try with @code{./foo} instead (or, in Unix machines, modify your @code{PATH} environment variable to include your current directory).
    598649
    599 @node Using the compiler - Examples - An example with multiple files,  , Using the compiler - Examples - A simple example (with one source file), Using the compiler - Examples
     650@node Using the compiler - Examples - An example with multiple files,  , Using the compiler - Examples - A simple example ;with one source file;, Using the compiler - Examples
    600651@subsection An example with multiple files
    601652
     
    617668The declarations in these files specify which of the compiled files is the main module, and which is the library module. An executable can only have one main module, since a program has only a single entry-point. In this case @code{foo.scm} is the main module, because it doesn't have a @code{unit} declaration:
    618669
    619 <enscript highlight=scheme> ;;; foo.scm
    620 
    621 @table @b
    622 @item The declaration marks this source file as dependant on the symbols provided
    623 
    624 
    625 @item by the bar unit
    626 
    627 
    628 
    629 @end table
    630 (declare (uses bar))
    631 
    632 (write (fac 10)) (newline) </enscript>
    633 
     670@example
     671@emph{;;; foo.scm
     672}
     673@emph{; The declaration marks this source file as dependant on the symbols provided
     674}@emph{; by the bar unit:
     675}(declare (uses bar))
     676
     677(write (fac 10)) (newline)
     678@end example
    634679@code{bar.scm} will be our library:
    635680
    636 <enscript highlight=scheme> ;;; bar.scm
    637 
    638 @table @b
    639 @item The declaration marks this source file as the bar unit.  The names of the
    640 
    641 
    642 @item units and your files don't need to match.
    643 
    644 
    645 
    646 @end table
    647 (declare (unit bar))
    648 
    649 (define (fac n)
    650 
    651 @verbatim
    652  (if (zero? n)
    653      1
    654      (* n (fac (- n 1))) ) )
    655 @end verbatim
    656 </enscript>
    657 
     681@example
     682@emph{;;; bar.scm
     683}
     684@emph{; The declaration marks this source file as the bar unit.  The names of the
     685}@emph{; units and your files don't need to match.
     686}(declare (unit bar))
     687
     688(@strong{define} (@strong{fac} n)
     689  (@strong{if} (zero? n)
     690      1
     691      (* n (fac (- n 1))) ) )
     692@end example
    658693@node Using the compiler - Examples - An example with multiple files - Compiling and running your program,  , Using the compiler - Examples - An example with multiple files - Writing your source files, Using the compiler - Examples - An example with multiple files
    659694@subsubsection Compiling and running your program
     
    720755It is relatively easy to create distributions of Scheme projects that have been compiled to C.  The runtime system of CHICKEN consists of only two handcoded C files (@code{runtime.c} and @code{chicken.h}), plus the file @code{chicken-config.h}, which is generated by the build process. All other modules of the runtime system and the extension libraries are just compiled Scheme code. The following example shows a minimal application, which should run without changes on the most frequent operating systems, like Windows, Linux or FreeBSD:
    721756
    722 Let's take a simple "Hello, world!":
    723 
    724 <enscript highlight=scheme> ; hello.scm
    725 
    726 (print "Hello, world!") </enscript>
    727 
     757Let's take a simple example.
     758
     759@example
     760@emph{; hello.scm
     761}
     762(print @strong{"Hello, world!"})
     763@end example
     764@verbatim
     765 % chicken hello.scm -optimize-level 3 -output-file hello.c
     766@end verbatim
    728767Compiled to C, we get @code{hello.c}. We need the files @code{chicken.h} and @code{runtime.c}, which contain the basic runtime system, plus the three basic library files @code{library.c}, @code{eval.c} and @code{extras.c} which contain the same functionality as the library linked into a plain CHICKEN-compiled application, or which is available by default in the interpreter, @code{csi}:
    729768
    730769@verbatim
    731 % csc hello.scm -O2 -d1
    732 @end verbatim
    733 A simple makefile is needed as well:
    734 
    735 <enscript highlight=makefile>
    736 
    737 @enumerate
    738 @item Makefile for UNIX systems
    739 
    740 
    741 @end enumerate
    742 hello: hello.o runtime.o library.o eval.o extras.o
    743 
    744 @verbatim
    745       $(CC) -o hello hello.o runtime.o library.o eval.o extras.o -lm
    746 @end verbatim
    747 hello.o: chicken.h runtime.o: chicken.h library.o: chicken.h eval.o: chicken.h extras.o: chicken.h </enscript>
    748 
     770 % cd /tmp
     771 %echo '(print "Hello World.")' > hello.scm
     772 % cp $CHICKEN_BUILD/runtime.c .
     773 % cp $CHICKEN_BUILD/library.c .
     774 % cp $CHICKEN_BUILD/eval.c    .
     775 % cp $CHICKEN_BUILD/extras.c  .
     776 % gcc -static -Os -fomit-frame-pointer runtime.c library.c eval.c \
     777   extras.c hello.c -o hello -lm
     778@end verbatim
    749779Now we have all files together, and can create an tarball containing all the files:
    750780
     
    753783% gzip hello.tar
    754784@end verbatim
    755 This is of naturally rather simplistic. Things like enabling dynamic loading, estimating the optimal stack-size and selecting supported features of the host system would need more configuration- and build-time support. All this can be addressed using more elaborate build-scripts, makefiles or by using autoconf/automake.
     785This is naturally rather simplistic. Things like enabling dynamic loading, estimating the optimal stack-size and selecting supported features of the host system would need more configuration- and build-time support. All this can be addressed using more elaborate build-scripts, makefiles or by using autoconf/automake.
    756786
    757787Note also that the size of the application can still be reduced by removing @code{extras} and @code{eval} and compiling @code{hello.scm} with the @code{-explicit-use} option.
     
    802832
    803833Evaluate @code{EXPRESSIONS}. This option implies @code{-batch} and @code{-quiet}, so no startup message will be printed and the interpreter exits after processing all @code{-eval} options and/or loading files given on the command-line.
     834@item -p  -print EXPRESSIONS
     835
     836Evaluate @code{EXPRESSIONS} and print the results of each expression using @code{print}. Implies @code{-batch} and @code{-quiet}.
     837@item -P  -pretty-print EXPRESSIONS
     838
     839Evaluate @code{EXPRESSIONS} and print the results of each expression using @code{pretty-print}. Implies @code{-batch} and @code{-quiet}.
    804840@item -D  -feature SYMBOL
    805841
    806 Registers @code{SYMBOL} to be a valid feature identifier for @code{cond-expand}.
     842Registers @code{SYMBOL} to be a valid feature identifier for @code{cond-expand} and @code{feature?}.
    807843@item -h  -help
    808844
     
    810846@item -I  -include-path PATHNAME
    811847
    812 Specifies an alternative search-path for files included via the @code{include} special form. This option may be given multiple times. If the environment variable @code{CHICKEN_INCLUDE_PATH} is set, it should contain a list of alternative include pathnames separated by @code{;}. The environment variable @code{CHICKEN_HOME} is also considered as a search path.
     848Specifies an alternative search-path for files included via the @code{include} special form. This option may be given multiple times. If the environment variable @code{CHICKEN_INCLUDE_PATH} is set, it should contain a list of alternative include pathnames separated by @code{;}.
    813849@item -k  -keyword-style STYLE
    814850
     
    822858@item -q  -quiet
    823859
    824 Do not print a startup message.
     860Do not print a startup message. Also disables generation of call-trace information for interpreted code.
    825861@item -s  -script PATHNAME
    826862
     
    863899@verbatim
    864900C:>type foo.bat
    865 @@;csibatch %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
     901@;csibatch %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
    866902(print (eval (with-input-from-string
    867903                (car (command-line-arguments))
     
    941977
    942978@end table
    943 <enscript highlight=scheme>
    944 
    945 @enumerate
    946 @item ;1> (fac 10)                       ==> 3628800
    947 
    948 @item ;2> ,tr fac
    949 
    950 @item ;3> (fac 3) |(fac 3) | (fac 2) |  (fac 1) |   (fac 0) |   fac -> 1  |  fac -> 1  | fac -> 2  |fac -> 6                          ==> 6
    951 
    952 @item ;4> ,utr fac
    953 
    954 @item ;5> (fac 3)                        ==> 6 </enscript>
    955 
    956 
    957 @end enumerate
     979@example
     980#@emph{;1> (fac 10)                       ==> 3628800
     981}#@emph{;2> ,tr fac
     982}#@emph{;3> (fac 3)
     983}|(fac 3)
     984| (fac 2)
     985|  (fac 1)
     986|   (fac 0)
     987|   fac -> 1
     988|  fac -> 1
     989| fac -> 2
     990|fac -> 6                          =@strong{=>} 6
     991#@emph{;4> ,utr fac
     992}#@emph{;5> (fac 3)                        ==> 6
     993}@end example
     994k
     995
    958996@table @b
    959997@item ,utr SYMBOL ...
     
    10111049@verbatim
    10121050#;1> (define-record point x y)
    1013 #;2> (set-describer! 'point (lambda (pt o) (print "a point with x=" (point-x pt) " and y=" (point-y pt))))
     1051#;2> (set-describer! 'point
     1052       (lambda (pt o)
     1053         (print "a point with x=" (point-x pt) " and y=" (point-y pt))))
    10141054#;3> ,d (make-point 1 2)
    10151055a point with x=1 and y=2
     
    10261066(use readline regex)
    10271067(current-input-port (make-gnu-readline-port))
    1028 (gnu-history-install-file-manager (string-append (or (getenv "HOME") ".") "/.csi.history"))
     1068(gnu-history-install-file-manager
     1069  (string-append (or (getenv "HOME") ".") "/.csi.history"))
    10291070@end verbatim
    10301071More details are available in @uref{http://www.call-with-current-continuation.org/eggs/readline.html, the egg's documentation}.
     
    11151156
    11161157
    1117 @itemize
    1118 @item Identifiers are by default case-sensitive (see @uref{http://galinha.ucpel.tche.br:8080/Using%20the%20compiler#Compiler%20command%20line%20format, Compiler command line format}).
    1119 
    1120 @item [4.1.3] The maximal number of arguments that may be passed to a compiled procedure or macro is 120.  A macro-definition that has a single rest-parameter can have any number of arguments.  If the @code{libffi} library is available on this platform, and if it is installed, then CHICKEN can take advantage of this. See the @uref{http://chicken.wiki.br/chicken/README, README} file for more details.
    1121 
    1122 @item [4.2.2] @code{letrec} does evaluate the initial values for the bound variables sequentially and not in parallel, that is:
    1123 
    1124 
    1125 @end itemize
     1158Identifiers are by default case-sensitive (see @uref{http://galinha.ucpel.tche.br:8080/Using%20the%20compiler#Compiler%20command%20line%20format, Compiler command line format}).
     1159
     1160[4.1.3] The maximal number of arguments that may be passed to a compiled procedure or macro is 120.  A macro-definition that has a single rest-parameter can have any number of arguments.  If the @code{libffi} library is available on this platform, and if it is installed, then CHICKEN can take advantage of this. See the @uref{http://chicken.wiki.br/chicken/README, README} file for more details.
     1161
     1162[4.2.2] @code{letrec} does evaluate the initial values for the bound variables sequentially and not in parallel, that is:
     1163
    11261164@verbatim
    11271165 (letrec ((x 1) (y 2)) (cons x y))
     
    11441182     (cons x y) ) )
    11451183@end verbatim
    1146 @itemize
    1147 @item [4.3] @code{syntax-rules} macros are not provided but available separately.
    1148 
    1149 @item [6.1] @code{equal?} compares all structured data recursively, while R5RS specifies that @code{eqv?} is used for data other than pairs, strings and vectors.
    1150 
    1151 @item [6.2.4]  The runtime system uses the numerical string-conversion routines of the underlying C library and so does only understand standard (C-library) syntax for floating-point constants.
    1152 
    1153 @item [6.2.5] There is no built-in support for rationals, complex numbers or extended-precision integers (bignums). The routines @code{complex?}, @code{real?} and @code{rational?} are identical to the standard procedure @code{number?}. The procedures @code{numerator}, @code{denominator}, @code{rationalize}, @code{make-rectangular} and @code{make-polar} are not implemented. Fixnums are limited to ±2<nowiki><sup>30</sup></nowiki> (or ±2<nowiki><sup>62</sup></nowiki> on 64-bit hardware).  Support for extended numbers is available as a separate package, provided the GNU multiprecision library is installed.
    1154 
    1155 @item [6.2.6] The procedure @code{string->number} does not obey read/write invariance on inexact numbers.
    1156 
    1157 @item [6.4] The maximum number of values that can be passed to continuations captured using @code{call-with-current-continuation} is 120.
    1158 
    1159 @item [6.5] Code evaluated in @code{scheme-report-environment} or @code{null-environment} still sees non-standard syntax.
    1160 
    1161 @item [6.6.2] The procedure @code{char-ready?} always returns @code{#t} for terminal ports.  The procedure @code{read} does not obey read/write invariance on inexact numbers.
    1162 
    1163 @item [6.6.3] The procedures @code{write} and @code{display} do not obey read/write invariance to inexact numbers.
    1164 
    1165 @item [6.6.4] The @code{transcript-on} and @code{transcript-off} procedures are not implemented.
    1166 
    1167 
    1168 @end itemize
     1184[4.3] @code{syntax-rules} macros are not provided but available separately.
     1185
     1186[6.1] @code{equal?} compares all structured data recursively, while R5RS specifies that @code{eqv?} is used for data other than pairs, strings and vectors.
     1187
     1188[6.2.4] The runtime system uses the numerical string-conversion routines of the underlying C library and so does only understand standard (C-library) syntax for floating-point constants.
     1189
     1190[6.2.5] There is no built-in support for rationals, complex numbers or extended-precision integers (bignums). The routines @code{complex?}, @code{real?} and @code{rational?} are identical to the standard procedure @code{number?}. The procedures @code{numerator}, @code{denominator}, @code{rationalize}, @code{make-rectangular} and @code{make-polar} are not implemented. Fixnums are limited to ±2<nowiki><sup>30</sup></nowiki> (or ±2<nowiki><sup>62</sup></nowiki> on 64-bit hardware).  Support for extended numbers is available as a separate package, provided the GNU multiprecision library is installed.
     1191
     1192[6.2.6] The procedure @code{string->number} does not obey read/write invariance on inexact numbers.
     1193
     1194[6.4] The maximum number of values that can be passed to continuations captured using @code{call-with-current-continuation} is 120.
     1195
     1196[6.5] Code evaluated in @code{scheme-report-environment} or @code{null-environment} still sees non-standard syntax.
     1197
     1198[6.6.2] The procedure @code{char-ready?} always returns @code{#t} for terminal ports.  The procedure @code{read} does not obey read/write invariance on inexact numbers.
     1199
     1200[6.6.3] The procedures @code{write} and @code{display} do not obey read/write invariance to inexact numbers.
     1201
     1202[6.6.4] The @code{transcript-on} and @code{transcript-off} procedures are not implemented.
     1203
    11691204Previous: @ref{Supported language, Supported language}
    11701205
     
    11771212[2.1] Identifiers may contain special characters if delimited with @code{| ... |}.
    11781213
    1179 [2.3] The brackets @code{[ ... ]} are provided as an alternative syntax for @code{( ... )}.  A number of reader extensions is provided. See @ref{Non-standard read syntax, Non-standard read syntax}.
     1214[2.3] The brackets @code{[ ... ]} and the braces @code{ @{ ... @} } are provided as an alternative syntax for @code{( ... )}.  A number of reader extensions is provided. See @ref{Non-standard read syntax, Non-standard read syntax}.
    11801215
    11811216[4] Numerous non-standard macros are provided. See  @ref{Non-standard macros and special forms, Non-standard macros and special forms} for more information.
    11821217
    1183 [4.1.4] Extended DSSSL style lambda lists are supported. DSSSL formal argument lists are defined by the following grammar:
    1184 
    1185 @verbatim
    1186 <formal-argument-list> ==> <required-formal-argument>*
    1187                            [(#!optional <optional-formal-argument>*)]
    1188                            [(#!rest <rest-formal-argument>)]
    1189                            [(#!key <key-formal-argument>*)]
    1190 <required-formal-argument> ==> <ident>
    1191 <optional-formal-argument> ==> <ident>
    1192                              | (<ident> <initializer>)
    1193 <rest-formal-argument> ==> <ident>
    1194 <key-formal-argument> ==> <ident>
    1195                           | (<ident> <initializer>)
     1218[4.1.4] Extended DSSSL style lambda lists are supported. DSSSL parameter lists are defined by the following grammar:
     1219
     1220@verbatim
     1221<parameter-list> ==> <required-parameter>*
     1222                     [(#!optional <optional-parameter>*)]
     1223                     [(#!rest <rest-parameter>)]
     1224                     [(#!key <keyword-parameter>*)]
     1225<required-parameter> ==> <ident>
     1226<optional-parameter> ==> <ident>
     1227                         | (<ident> <initializer>)
     1228<rest-parameter> ==> <ident>
     1229<keyword-parameter> ==> <ident>
     1230                        | (<ident> <initializer>)
    11961231<initializer> ==> <expr>
    11971232@end verbatim
    1198 When a procedure is applied to a list of actual arguments, the formal and actual arguments are processed from left to right as follows:
     1233When a procedure is applied to a list of arguments, the parameters and arguments are processed from left to right as follows:
    11991234
    12001235@itemize
    1201 @item Variables in required-formal-arguments are bound to successive actual arguments starting with the first actual argument. It shall be an error if there are fewer actual arguments than required-formal-arguments.
    1202 
    1203 @item Next, variables in optional-formal-arguments are bound to any remaining actual arguments. If there are fewer remaining actual arguments than optional-formal-arguments, then variables are bound to the result of the evaluation of initializer if one was specified or otherwise to @code{#f}. The initializer is evaluated in an environment in which all previous formal arguments have been bound.
    1204 
    1205 @item If there is a rest-formal-argument, then it is bound to a list of all remaining actual arguments. The remaining actual arguments are also eligible to be bound to keyword-formal-arguments. If there is no rest-formal-argument and there are no keywords, the it shall be an error if there are any remaining actual arguments.
    1206 
    1207 @item If @code{#!key} was specified in the formal-argument-list, there shall be an even number of remaining actual arguments. These are interpreted as a series of pairs, where the first member of each pair is a keyword specifying the argument name, and th corresponding value. It shall be an error if the first member of a pair is not a keyword. It shall be an error if the argument name is not the same as a variable in a keyword-formal-argument, unless there is a rest-formal-argument. If the same argument name occurs more than once in the list of actual arguments, then the first value is used. If there is no actual argument for a particular keyword-formal-argument, then the variable is bound to the result of evaluating initializer if one was specified or @code{#f}. The initializer is evaluated in an environment in which all previous formal arguments have been bound.
     1236@item Required-parameters are bound to successive arguments starting with the first argument. It shall be an error if there are fewer arguments than required-parameters.
     1237
     1238@item Next, the optional-parameters are bound with the remaining arguments. If there are fewer arguments than optional-parameters, then the remaining optional-parameters are bound to the result of the evaluation of their corresponding <initializer>, if one was specified, otherwise @code{#f}. The corresponding <initializer> is evaluated in an environment in which all previous parameters have been bound.
     1239
     1240@item If there is a rest-parameter, then it is bound to a list containing all the remaining arguments left over after the argument bindings with required-parameters and optional-parameters have been made.
     1241
     1242@item If @code{#!key} was specified in the parameter-list, there should be an even number of remaining arguments. These are interpreted as a series of pairs, where the first member of each pair is a keyword specifying the parameter name, and the second member is the corresponding value. If the same keyword occurs more than once in the list of arguments, then the corresponding value of the first keyword is the binding value. If there is no argument for a particular keyword-parameter, then the variable is bound to the result of evaluating <initializer>, if one was specified, otherwise @code{#f}. The corresponding <initializer> is evaluated in an environment in which all previous parameters have been bound.
    12081243
    12091244
    12101245@end itemize
    1211 It shall be an error for an @code{<ident>} to appear more than once in a formal-argument-list.
     1246Needing a special mention is the close relationship between the rest-parameter and possible keyword-parameters.  Declaring a rest-parameter binds up all remaining arguments in a list, as described above. These same remaining arguments are also used for attempted matches with declared keyword-parameters, as described above, in which case a matching keyword-parameter binds to the corresponding value argument at the same time that both the keyword and value arguments are added to the rest parameter list. Note that for efficiency reasons, the keyword-parameter matching does nothing more than simply attempt to match with pairs that may exist in the remaining arguments.  Extra arguments that don't match are simply unused and forgotten if no rest-parameter has been declared.  Because of this, the caller of a procedure containing one or more keyword-parameters cannot rely on any kind of system error to report wrong keywords being passed in.
     1247
     1248It shall be an error for an @code{<ident>} to appear more than once in a parameter-list.
     1249
     1250If there is no rest-parameter and no keyword-parameters in the parameter-list, then it shall be an error for any extra arguments to be passed to the procedure.
    12121251
    12131252Example:
     
    12831322
    12841323[6.6.1] if the procedures @code{current-input-port} and @code{current-output-port} are called with an argument (which should be a port), then that argument is selected as the new current input- and output-port, respectively.  The procedures @code{open-input-file}, @code{open-output-file}, @code{with-input-from-file}, @code{with-output-to-file}, @code{call-with-input-file} and @code{call-with-output-file} accept an optional second (or third) argument which should be one or more keywords, if supplied. These arguments specify the mode in which the file is opened. Possible values are the keywords @code{#:text}, @code{#:binary} or @code{#:append}.
     1324
     1325[6.7] The @code{exit} procedure exits a program right away and does @emph{not} invoke pending @code{dynamic-wind} thunks.
    12851326
    12861327Previous: @ref{Deviations from the standard, Deviations from the standard}
     
    13981439This is a simple string with an embedded `##' character
    13991440and substituted expressions: (+ three 99) ==> #(+ three 99)
    1400 (three is "#@{three@}")
     1441(three is "#{three}")
    14011442EOF
    14021443)
     
    15181559
    15191560@menu
    1520 * Non-standard macros and special forms - Making extra libraries and extensions availablee::
     1561* Non-standard macros and special forms - Making extra libraries and extensions available::
    15211562* Non-standard macros and special forms - Binding forms for optional arguments::
    15221563* Non-standard macros and special forms - Other binding forms::
     
    15291570
    15301571
    1531 @node Non-standard macros and special forms - Making extra libraries and extensions availablee, Non-standard macros and special forms - Binding forms for optional arguments,  , Non-standard macros and special forms
    1532 @section Making extra libraries and extensions availablee
    1533 
    1534 @menu
    1535 * Non-standard macros and special forms - Making extra libraries and extensions availablee - require-extension::
    1536 * Non-standard macros and special forms - Making extra libraries and extensions availablee - define-extension::
    1537 
    1538 @end menu
    1539 
    1540 
    1541 @node Non-standard macros and special forms - Making extra libraries and extensions availablee - require-extension, Non-standard macros and special forms - Making extra libraries and extensions availablee - define-extension,  , Non-standard macros and special forms - Making extra libraries and extensions availablee
     1572@node Non-standard macros and special forms - Making extra libraries and extensions available, Non-standard macros and special forms - Binding forms for optional arguments,  , Non-standard macros and special forms
     1573@section Making extra libraries and extensions available
     1574
     1575@menu
     1576* Non-standard macros and special forms - Making extra libraries and extensions available - require-extension::
     1577* Non-standard macros and special forms - Making extra libraries and extensions available - define-extension::
     1578
     1579@end menu
     1580
     1581
     1582@node Non-standard macros and special forms - Making extra libraries and extensions available - require-extension, Non-standard macros and special forms - Making extra libraries and extensions available - define-extension,  , Non-standard macros and special forms - Making extra libraries and extensions available
    15421583@subsection require-extension
    15431584
     
    15471588[syntax] (use ID ...)
    15481589@end verbatim
    1549 This form does all necessary steps to make the libraries or extensions given in @code{ID ...} available. It loads syntactic extension, if needed and generates code for loading/linking with core library modules or separately installed extensions. @code{use} is just a shorter alias for @code{require-extension}. This implementation of @code{require-extension} is compliant to @uref{http://srfi.schemers.org/srfi-55/srfi-55.html, SRFI-55} (see the @uref{http://srfi.schemers.org/srfi-55/srfi-55.html, SRFI-55} document for more information).
     1590This form does all the necessary steps to make the libraries or extensions given in @code{ID ...} available. It loads syntactic extensions, if needed and generates code for loading/linking with core library modules or separately installed extensions. @code{use} is just a shorter alias for @code{require-extension}. This implementation of @code{require-extension} is compliant with @uref{http://srfi.schemers.org/srfi-55/srfi-55.html, SRFI-55} (see the @uref{http://srfi.schemers.org/srfi-55/srfi-55.html, SRFI-55} document for more information).
    15501591
    15511592During interpretation/evaluation @code{require-extension} performs one of the following:
     
    15561597@item If @code{ID} names one of the syntactic extensions @code{chicken-more-macros chicken-ffi-macros}, then this extension will be loaded.
    15571598
    1558 @item @code{ID} names one of the core library units shipped with CHICKEN, then a @code{(load-library 'ID)} will be performed.
    1559 
    1560 @item @code{ID} names an installed extension with the @code{syntax} or @code{require-at-runtime} attribute, then the equivalent of @code{(require-for-syntax 'ID)} is performed, probably followed by @code{(require ...)} for any run-time requirements.
    1561 
    1562 @item Otherwise @code{(require-extension ID)} is equivalent to @code{(require 'ID)}.
     1599@item If @code{ID} names one of the core library units shipped with CHICKEN, then a @code{(load-library 'ID)} will be performed.
     1600
     1601@item If @code{ID} names an installed extension with the @code{syntax} or @code{require-at-runtime} attribute, then the equivalent of @code{(require-for-syntax 'ID)} is performed, probably followed by @code{(require ...)} for any run-time requirements.
     1602
     1603@item Otherwise, @code{(require-extension ID)} is equivalent to @code{(require 'ID)}.
    15631604
    15641605
    15651606@end itemize
    1566 During compilation one of the following happens instead:
     1607During compilation, one of the following happens instead:
    15671608
    15681609@itemize
     
    15711612@item If @code{ID} names one of the syntactic extensions @code{chicken-more-macros chicken-ffi-macros}, then this extension will be loaded at compile-time, making the syntactic extensions available in compiled code.
    15721613
    1573 @item If @code{ID} names one of the core library units shipped with CHICKEN, or if the option @code{-uses ID} has been passed to the compiler then a @code{(declare (uses ID))} is generated.
     1614@item If @code{ID} names one of the core library units shipped with CHICKEN, or if the option @code{-uses ID} has been passed to the compiler, then a @code{(declare (uses ID))} is generated.
    15741615
    15751616@item If @code{ID} names an installed extension with the @code{syntax} or @code{require-at-runtime} attribute, then the equivalent of @code{(require-for-syntax 'ID)} is performed, and code is emitted to @code{(require ...)} any needed run-time requirements.
     
    15961637When syntax extensions are loaded that redefine the global toplevel macro-expander (for example the @uref{http://www.call-with-current-continuation.org/eggs/syntax-case.html, syntax-case} extension), then all remaining expression @emph{in the same toplevel form} are still expanded with the old toplevel macro-expander.
    15971638
    1598 @node Non-standard macros and special forms - Making extra libraries and extensions availablee - define-extension,  , Non-standard macros and special forms - Making extra libraries and extensions availablee - require-extension, Non-standard macros and special forms - Making extra libraries and extensions availablee
     1639@node Non-standard macros and special forms - Making extra libraries and extensions available - define-extension,  , Non-standard macros and special forms - Making extra libraries and extensions available - require-extension, Non-standard macros and special forms - Making extra libraries and extensions available
    15991640@subsection define-extension
    16001641
     
    16051646This macro simplifies the task of writing extensions that can be linked both statically and dynamically. If encountered in interpreted code or code that is compiled into a shared object (specifically if compiled with the feature @code{chicken-compile-shared}, done automatically by @code{csc} when compiling with the @code{-shared} or @code{-dynamic} option) then the code given by clauses of the form
    16061647
    1607 <enscript highlight=scheme> (dynamic EXPRESSION ...) </enscript>
    1608 
     1648@example
     1649(dynamic EXPRESSION ...)
     1650@end example
    16091651are inserted into the output as a @code{begin} form.
    16101652
    16111653If compiled statically (specifically if the feature @code{chicken-compile-shared} has not been given), then this form expands into the following:
    16121654
    1613 <enscript highlight=scheme> (declare (unit NAME)) (provide 'NAME) </enscript>
    1614 
     1655@example
     1656(declare (unit NAME))
     1657(provide 'NAME)
     1658@end example
    16151659and all clauses of the form
    16161660
    1617 <enscript highlight=scheme> (static EXPRESSION ...) </enscript>
    1618 
     1661@example
     1662(static EXPRESSION ...)
     1663@end example
    16191664all additionally inserted into the expansion.
    16201665
    16211666As a convenience, the clause
    16221667
    1623 <enscript highlight=scheme> (export IDENTIFIER ...) </enscript>
    1624 
     1668@example
     1669(export IDENTIFIER ...)
     1670@end example
    16251671is also allowed and is identical to @code{(declare (export IDENTIFIER ...))} (unless the @code{define-extension} form occurs in interpreted code, in with it is simply ignored).
    16261672
    16271673Note that the compiler option @code{-extension NAME} is equivalent to prefixing the compiled file with
    16281674
    1629 <enscript highlight=scheme> (define-extension NAME) </enscript>
    1630 
    1631 @node Non-standard macros and special forms - Binding forms for optional arguments, Non-standard macros and special forms - Other binding forms, Non-standard macros and special forms - Making extra libraries and extensions availablee, Non-standard macros and special forms
     1675@example
     1676(define-extension NAME)
     1677@end example
     1678@node Non-standard macros and special forms - Binding forms for optional arguments, Non-standard macros and special forms - Other binding forms, Non-standard macros and special forms - Making extra libraries and extensions available, Non-standard macros and special forms
    16321679@section Binding forms for optional arguments
    16331680
     
    16501697Use this form for procedures that take a single optional argument. If @code{ARGS} is the empty list @code{DEFAULT} is evaluated and returned, otherwise the first element of the list @code{ARGS}. It is an error if @code{ARGS} contains more than one value.
    16511698
    1652 <enscript highlight=scheme> (define (incr x . i) (+ x (optional i 1))) (incr 10)                                   ==> 11 (incr 12 5)                                 ==> 17 </enscript>
    1653 
     1699@example
     1700(@strong{define} (@strong{incr} x . i) (+ x (optional i 1)))
     1701(incr 10)                                   =@strong{=>} 11
     1702(incr 12 5)                                 =@strong{=>} 17
     1703@end example
    16541704@node Non-standard macros and special forms - Binding forms for optional arguments - case-lambda, Non-standard macros and special forms - Binding forms for optional arguments - let-optionals, Non-standard macros and special forms - Binding forms for optional arguments - optional, Non-standard macros and special forms - Binding forms for optional arguments
    16551705@subsection case-lambda
     
    16611711Expands into a lambda that invokes the body following the first matching lambda-list.
    16621712
    1663 <enscript highlight=scheme> (define plus
    1664 
    1665 @verbatim
    1666  (case-lambda
    1667    (() 0)
    1668    ((x) x)
    1669    ((x y) (+ x y))
    1670    ((x y z) (+ (+ x y) z))
    1671    (args (apply + args))))
    1672 @end verbatim
    1673 (plus)                      ==> 9 (plus 1)                    ==> 1 (plus 1 2 3)                ==> 6 </enscript>
    1674 
     1713@example
     1714(@strong{define} @strong{plus}
     1715  (case-lambda
     1716    (() 0)
     1717    ((x) x)
     1718    ((x y) (+ x y))
     1719    ((x y z) (+ (+ x y) z))
     1720    (args (apply + args))))
     1721
     1722(plus)                      =@strong{=>} 9
     1723(plus 1)                    =@strong{=>} 1
     1724(plus 1 2 3)                =@strong{=>} 6
     1725@end example
    16751726For more information see the documentation for @uref{http://srfi.schemers.org/srfi-16/srfi-16.html, SRFI-16}
    16761727
     
    16841735Binding constructs for optional procedure arguments. @code{ARGS} should be a rest-parameter taken from a lambda-list. @code{let-optionals} binds @code{VAR1 ...} to available arguments in parallel, or to @code{DEFAULT1 ...} if not enough arguments were provided. @code{let-optionals*} binds @code{VAR1 ...} sequentially, so every variable sees the previous ones. it is an error if any excess arguments are provided.
    16851736
    1686 <enscript highlight=scheme> (let-optionals '(one two) ((a 1) (b 2) (c 3))
    1687 
    1688 @verbatim
    1689  (list a b c) )                               ==> (one two 3)
    1690 @end verbatim
    1691 </enscript>
    1692 
     1737@example
     1738(let-optionals '(one two) ((a 1) (b 2) (c 3))
     1739  (list a b c) )                               =@strong{=>} (one two 3)
     1740@end example
    16931741@node Non-standard macros and special forms - Binding forms for optional arguments - let-optionals*,  , Non-standard macros and special forms - Binding forms for optional arguments - let-optionals, Non-standard macros and special forms - Binding forms for optional arguments
    16941742@subsection let-optionals*
     
    17001748Binding constructs for optional procedure arguments. @code{ARGS} should be a rest-parameter taken from a lambda-list. @code{let-optionals} binds @code{VAR1 ...} to available arguments in parallel, or to @code{DEFAULT1 ...} if not enough arguments were provided. @code{let-optionals*} binds @code{VAR1 ...} sequentially, so every variable sees the previous ones. If a single variable @code{RESTVAR} is given, then it is bound to any remaining arguments, otherwise it is an error if any excess arguments are provided.
    17011749
    1702 <enscript highlight=scheme> (let-optionals* '(one two) ((a 1) (b 2) (c a))
    1703 
    1704 @verbatim
    1705  (list a b c) )                               ==> (one two one)
    1706 @end verbatim
    1707 </enscript>
    1708 
     1750@example
     1751(let-optionals* '(one two) ((a 1) (b 2) (c a))
     1752  (list a b c) )                               =@strong{=>} (one two one)
     1753@end example
    17091754@node Non-standard macros and special forms - Other binding forms, Non-standard macros and special forms - Substitution forms and macros, Non-standard macros and special forms - Binding forms for optional arguments, Non-standard macros and special forms
    17101755@section Other binding forms
     
    17911836Binds multiple variables to the result values of @code{EXP ...}. The variables are bound sequentially.
    17921837
    1793 <enscript highlight=scheme> (let*-values (((a b) (values 2 3))
    1794 
    1795 @verbatim
    1796              ((p) (+ a b)) )
    1797  p)                               ==> 5
    1798 @end verbatim
    1799 </enscript>
    1800 
     1838@example
     1839(let*-values (((a b) (values 2 3))
     1840              ((p) (+ a b)) )
     1841  p)                               =@strong{=>} 5
     1842@end example
    18011843@node Non-standard macros and special forms - Other binding forms - letrec-values, Non-standard macros and special forms - Other binding forms - parameterize, Non-standard macros and special forms - Other binding forms - let*-values, Non-standard macros and special forms - Other binding forms
    18021844@subsection letrec-values
     
    18081850Binds the result values of @code{EXP ...} to multiple variables at once. All variables are mutually recursive.
    18091851
    1810 <enscript highlight=scheme> (letrec-values (((odd even)
    1811 
    1812 @verbatim
    1813                   (values
    1814                     (lambda (n) (if (zero? n) #f (even (sub1 n))))
    1815                     (lambda (n) (if (zero? n) #t (odd (sub1 n)))) ) ) )
    1816  (odd 17) )                           ==> #t
    1817 @end verbatim
    1818 </enscript>
    1819 
     1852@example
     1853(letrec-values (((odd even)
     1854                   (values
     1855                     (@strong{lambda} (n) (@strong{if} (zero? n) #f (even (sub1 n))))
     1856                     (@strong{lambda} (n) (@strong{if} (zero? n) #t (odd (sub1 n)))) ) ) )
     1857  (odd 17) )                           =@strong{=>} #t
     1858@end example
    18201859@node Non-standard macros and special forms - Other binding forms - parameterize, Non-standard macros and special forms - Other binding forms - receive, Non-standard macros and special forms - Other binding forms - letrec-values, Non-standard macros and special forms - Other binding forms
    18211860@subsection parameterize
     
    18391878The syntax
    18401879
    1841 <enscript highlight=scheme> (receive VALUEEXP) </enscript>
    1842 
     1880@example
     1881(receive VALUEEXP)
     1882@end example
    18431883is equivalent to
    18441884
    1845 <enscript highlight=scheme> (receive _ VALUEEXP _) </enscript>
    1846 
     1885@example
     1886(receive _ VALUEEXP _)
     1887@end example
    18471888@node Non-standard macros and special forms - Other binding forms - set!-values,  , Non-standard macros and special forms - Other binding forms - receive, Non-standard macros and special forms - Other binding forms
    18481889@subsection set!-values
     
    19371978Equivalent to:
    19381979
    1939 <enscript highlight=scheme> (if (not TEST) (begin EXP1 EXP2 ...)) </enscript>
    1940 
     1980@example
     1981(@strong{if} (not TEST) (@strong{begin} EXP1 EXP2 ...))
     1982@end example
    19411983@node Non-standard macros and special forms - Conditional forms - when,  , Non-standard macros and special forms - Conditional forms - unless, Non-standard macros and special forms - Conditional forms
    19421984@subsection when
     
    19481990Equivalent to:
    19491991
    1950 <enscript highlight=scheme> (if TEST (begin EXP1 EXP2 ...)) </enscript>
    1951 
     1992@example
     1993(@strong{if} TEST (@strong{begin} EXP1 EXP2 ...))
     1994@end example
    19521995@node Non-standard macros and special forms - Record structures, Non-standard macros and special forms - Other forms, Non-standard macros and special forms - Conditional forms, Non-standard macros and special forms
    19531996@section Record structures
     
    19702013Defines a record type. Call @code{make-NAME} to create an instance of the structure (with one initialization-argument for each slot). @code{(NAME? STRUCT)} tests any object for being an instance of this structure.  Slots are accessed via @code{(NAME-SLOTNAME STRUCT)} and updated using @code{(NAME-SLOTNAME-set!} @code{STRUCT} @code{VALUE)}.
    19712014
    1972 <enscript highlight=scheme> (define-record point x y) (define p1 (make-point 123 456)) (point? p1)                      ==> #t (point-x p1)                     ==> 123 (point-y-set! p1 99) (point-y p1)                     ==> 99 </enscript>
    1973 
     2015@example
     2016(define-record point x y)
     2017(@strong{define} @strong{p1} (make-point 123 456))
     2018(point? p1)                      =@strong{=>} #t
     2019(point-x p1)                     =@strong{=>} 123
     2020(point-y-set! p1 99)
     2021(point-y p1)                     =@strong{=>} 99
     2022@end example
    19742023@node Non-standard macros and special forms - Record structures - define-record-printer, Non-standard macros and special forms - Record structures - define-record-type, Non-standard macros and special forms - Record structures - define-record, Non-standard macros and special forms - Record structures
    19752024@subsection define-record-printer
     
    19822031Defines a printing method for record of the type @code{NAME} by associating a procedure with the record type. When a record of this type is written using @code{display, write} or @code{print}, then the procedure is called with two arguments: the record to be printed and an output-port.
    19832032
    1984 <enscript highlight=scheme> (define-record foo x y z) (define f (make-foo 1 2 3)) (define-record-printer (foo x out)
    1985 
    1986 @verbatim
    1987  (fprintf out "#,(foo ~S ~S ~S)"
    1988           (foo-x x) (foo-y x) (foo-z x)) )
    1989 @end verbatim
    1990 (define-reader-ctor 'foo make-foo) (define s (with-output-to-string
    1991 
    1992 @verbatim
    1993              (lambda () (write f))))
    1994 @end verbatim
    1995 s                                   ==> "#,(foo 1 2 3)" (equal? f (with-input-from-string
    1996 
    1997 @verbatim
    1998              s read)))             ==> #t
    1999 @end verbatim
    2000 </enscript>
    2001 
     2033@example
     2034(define-record foo x y z)
     2035(@strong{define} @strong{f} (make-foo 1 2 3))
     2036(define-record-printer (foo x out)
     2037  (fprintf out @strong{"#,(foo ~S ~S ~S)"}
     2038           (foo-x x) (foo-y x) (foo-z x)) )
     2039(define-reader-ctor 'foo make-foo)
     2040(@strong{define} @strong{s} (with-output-to-string
     2041              (@strong{lambda} () (write f))))
     2042s                                   =@strong{=>} @strong{"#,(foo 1 2 3)"}
     2043(equal? f (with-input-from-string
     2044              s read)))             =@strong{=>} #t
     2045@end example
    20022046@code{define-record-printer} works also with SRFI-9 record types.
    20032047
     
    20632107The following feature-identifiers are available in all situations: @code{(machine-byte-order)}, @code{(machine-type)}, @code{(software-type)}, @code{(software-version)}, where the actual feature-identifier is platform dependent.
    20642108
    2065 In addition the following feature-identifiers may exist: @code{applyhook}, @code{extraslot}, @code{ptables}, @code{dload}, @code{libffi}.
     2109In addition the following feature-identifiers may exist: @code{applyhook}, @code{extraslot}, @code{ptables}, @code{dload}.
    20662110
    20672111For further information, see the documentation for @uref{http://srfi.schemers.org/srfi-0/srfi-0.html, SRFI-0}.
     
    21392183Pattern matching allows complicated control decisions based on data structure to be expressed in a concise manner.  Pattern matching is found in several modern languages, notably Standard ML, Haskell and Miranda. These syntactic extensions internally use the @code{match} library unit.
    21402184
     2185Note: this pattern matching package is not compatible with hygienic macro-expanders like the @code{syntax-case} extension (available separately).
     2186
    21412187The basic form of pattern matching expression is:
    21422188
    2143 <enscript highlight=scheme> (match exp [pat body] ...) </enscript>
    2144 
     2189@example
     2190(match exp [pat body] ...)
     2191@end example
    21452192where @code{exp} is an expression, @code{pat} is a pattern, and @code{body} is one or more expressions (like the body of a lambda-expression). The @code{match} form matches its first subexpression against a sequence of patterns, and branches to the @code{body} corresponding to the first pattern successfully matched. For example, the following code defines the usual @code{map} function:
    21462193
    2147 <enscript highlight=scheme> (define map
    2148 
    2149 @verbatim
    2150  (lambda (f l)
    2151    (match l
    2152      [() '()]
    2153      [(x . y) (cons (f x) (map f y))])))
    2154 @end verbatim
    2155 </enscript>
    2156 
     2194@example
     2195(@strong{define} @strong{map}
     2196  (@strong{lambda} (f l)
     2197    (match l
     2198      [() '()]
     2199      [(x . y) (cons (f x) (map f y))])))
     2200@end example
    21572201The first pattern @code{()} matches the empty list.  The second pattern @code{(x . y)} matches a pair, binding @code{x} to the first component of the pair and @code{y} to the second component of the pair.
    21582202
     
    22272271                             a vector of n+k or more elements
    22282272    |  ,pat                  a pattern
    2229     |  ,@@pat                 a pattern, spliced
     2273    |  ,@pat                 a pattern, spliced
    22302274@end verbatim
    22312275The notation @code{..k} denotes a keyword consisting of three consecutive dots (ie., @emph{@code{...}}),  or two dots and an non-negative integer (eg., @emph{@code{..1}}, @emph{@code{..2}}), or three consecutive underscores (ie., @emph{@code{___}}), or two underscores and a non-negative integer. The keywords @emph{@code{..k}} and @emph{@code{__ k}} are equivalent. The keywords @emph{@code{...}}, @emph{@code{___}}, @emph{@code{..0}}, and @emph{@code{__0}} are equivalent.
     
    22352279The @code{match-lambda} and @code{match-lambda*} forms are convenient combinations of @code{match} and @code{lambda}, and can be explained as follows:
    22362280
    2237 <enscript highlight=scheme> (match-lambda [pat body] ...)   =  (lambda (x) (match x [pat body] ...)) (match-lambda* [pat body] ...)  =  (lambda x (match x [pat body] ...)) </enscript>
    2238 
     2281@example
     2282(match-lambda [pat body] ...)   =  (@strong{lambda} (x) (match x [pat body] ...))
     2283(match-lambda* [pat body] ...)  =  (@strong{lambda} x (match x [pat body] ...))
     2284@end example
    22392285where @code{x} is a unique variable. The @code{match-lambda} form is convenient when defining a single argument function that immediately destructures its argument. The @code{match-lambda*} form constructs a function that accepts any number of arguments; the patterns of @code{match-lambda*} should be lists.
    22402286
    22412287The @code{match-let}, @code{match-let*}, @code{match-letrec}, and @code{match-define} forms generalize Scheme's @code{let}, @code{let*}, @code{letrec}, and @code{define} expressions to allow patterns in the binding position rather than just variables. For example, the following expression:
    22422288
    2243 <enscript highlight=scheme> (match-let ([(x y z) (list 1 2 3)]) body ...) </enscript>
    2244 
     2289@example
     2290(match-let ([(x y z) (list 1 2 3)]) body ...)
     2291@end example
    22452292binds @code{x} to 1, @code{y} to 2, and @code{z} to 3 in @code{body ...}. These forms are convenient for destructuring the result of a function that returns multiple values as a list or vector. As usual for @code{letrec} and @code{define}, pattern variables bound by @code{match-letrec} and @code{match-define} should not be used in computing the bound value.
    22462293
     
    22632310@code{(pat-1 ... pat-n pat-n+1 ...)}: matches a proper list of @code{n} or more elements, where each element of the tail matches @code{pat-n+1}.  Each pattern variable in @code{pat-n+1} is bound to a list of the matching values.  For example, the expression:
    22642311
    2265 <enscript highlight=scheme> (match '(let ([x 1][y 2]) z)
    2266 
    2267 @verbatim
    2268  [('let ((binding values) ...) exp)  body])
    2269 @end verbatim
    2270 </enscript>
    2271 
     2312@example
     2313(match '(@strong{let} ([x 1][y 2]) z)
     2314  [('@strong{let} ((binding values) ...) exp)  body])
     2315@end example
    22722316binds @code{binding} to the list @code{'(x y)}, @code{values} to the list \@code{'(1 2)}, and @code{exp} to @code{'z} in the body of the @code{match}-expression. For the special case where @code{pat-n+1} is a pattern variable, the list bound to that variable may share with the matched value.
    22732317
     
    22982342@code{(set! identifier)}: matches anything, and binds @code{identifier} to a procedure of one argument that mutates the corresponding field of the matching value. This pattern must be nested within a pair, vector, box, or structure pattern. For example, the expression:
    22992343
    2300 <enscript highlight=scheme> (define x (list 1 (list 2 3))) (match x [(_ (_ (set! setit)))  (setit 4)]) </enscript>
    2301 
     2344@example
     2345(@strong{define} @strong{x} (list 1 (list 2 3)))
     2346(match x [(_ (_ (@strong{set!} setit)))  (setit 4)])
     2347@end example
    23022348mutates the @code{cadadr} of @code{x} to 4, so that @code{x} is @code{'(1 (2 4))}.
    23032349
     
    23122358If no clause matches the value, the default action  is to invoke the procedure @code{(match-error-procedure)} with the value that did not match.  The default definition of @code{(match-error-procedure)} calls @code{error} with an appropriate message:
    23132359
    2314 <enscript highlight=scheme>
    2315 
    2316 @enumerate
    2317 @item ;1> (match 1 (2 2))
    2318 
    2319 
    2320 @end enumerate
    2321 Failed match: Error: no matching clause for : 1 </enscript>
    2322 
     2360@example
     2361#@emph{;1> (match 1 (2 2))
     2362}
     2363Failed match:
     2364Error: no matching clause for @strong{:} 1
     2365@end example
    23232366For most situations, this behavior is adequate, but it can be changed by altering the value of the parameter @code{match-error-control}:
    23242367
     
    23292372
    23302373@end table
    2331 <enscript highlight=scheme> (match-error-control [MODE]) </enscript> Selects a mode that specifies how @code{match...} macro forms are to be expanded.  With no argument this procedure returns the current mode. A single argument specifies the new mode that decides what should happen if no match-clause applies.  The following modes are supported:
     2374@example
     2375(match-error-control [MODE])
     2376@end example
     2377Selects a mode that specifies how @code{match...} macro forms are to be expanded.  With no argument this procedure returns the current mode. A single argument specifies the new mode that decides what should happen if no match-clause applies.  The following modes are supported:
    23322378
    23332379<table>
     
    23672413
    23682414@end table
    2369 <enscript highlight=scheme> (match-error-procedure [PROCEDURE]) </enscript> Sets or returns the procedure called upon a match error. The procedure takes one argument, the value which failed to match. When the error control mode is @code{#:match} a second argument, the source form of the match expression is available.
     2415@example
     2416(match-error-procedure [PROCEDURE])
     2417@end example
     2418Sets or returns the procedure called upon a match error. The procedure takes one argument, the value which failed to match. When the error control mode is @code{#:match} a second argument, the source form of the match expression is available.
    23702419
    23712420@node Pattern matching - Record Structures Pattern, Pattern matching - Code Generation, Pattern matching - Match Failure, Pattern matching
     
    23812430Pattern matching macros are compiled into @code{if}-expressions that decompose the value being matched with standard Scheme procedures, and test the components with standard predicates. Rebinding or lexically shadowing the names of any of these procedures will change the semantics of the @code{match} macros.  The names that should not be rebound or shadowed are:
    23822431
    2383 <enscript highlight=scheme> null? pair? number? string? symbol? boolean? char? procedure? vector? list? equal? car cdr cadr cdddr ... vector-length vector-ref reverse length call/cc </enscript>
    2384 
     2432@example
     2433null? pair? number? string? symbol? boolean? char? procedure? vector? list?
     2434equal?
     2435car cdr cadr cdddr ...
     2436vector-length vector-ref
     2437reverse length call/cc
     2438@end example
    23852439Additionally, the code generated to match a structure pattern like @code{($ Foo pat-1 ... pat-n)} refers to the name @code{Foo?}. This name also should not be shadowed.
    23862440
     
    24012455* Declarations - c-options::
    24022456* Declarations - check-c-syntax::
    2403 * Declarations - compress-literals::
    24042457* Declarations - constant::
    24052458* Declarations - export::
     
    24922545Declares additional C/C++ compiler options that are to be passed to the subsequent compilation pass that translates C to machine code. This declaration will only work if the source file is compiled with the @code{csc} compiler driver.
    24932546
    2494 @node Declarations - check-c-syntax, Declarations - compress-literals, Declarations - c-options, Declarations
     2547@node Declarations - check-c-syntax, Declarations - constant, Declarations - c-options, Declarations
    24952548@section check-c-syntax
    24962549
     
    25022555Enables or disables syntax-checking of embedded C/C++ code fragments. Checking C syntax is the default.
    25032556
    2504 @node Declarations - compress-literals, Declarations - constant, Declarations - check-c-syntax, Declarations
    2505 @section compress-literals
    2506 
    2507 
    2508 @verbatim
    2509 [declaration specifier] (compress-literals [THRESHOLD [INITIALIZER]])
    2510 @end verbatim
    2511 The same as the @code{-compress-literals} compiler option. The threshold argument defaults to 50. If the optional argument @code{INITIALIZER} is given, then the literals will not be created at module startup, but when the procedure with this name will be called.
    2512 
    2513 @node Declarations - constant, Declarations - export, Declarations - compress-literals, Declarations
     2557@node Declarations - constant, Declarations - export, Declarations - check-c-syntax, Declarations
    25142558@section constant
    25152559
     
    27892833Certain behavior of the interpreter and compiled programs can be customized via 'parameters', where a parameter is a procedure of zero or one arguments. To retrieve the value of a parameter call the parameter-procedure with zero arguments. To change the setting of the parameter, call the parameter-procedure with the new value as argument:
    27902834
    2791 <enscript highlight=scheme> (define foo (make-parameter 123)) (foo)                             ==> 123 (foo 99) (foo)                             ==> 99 </enscript>
    2792 
     2835@example
     2836(@strong{define} @strong{foo} (make-parameter 123))
     2837(foo)                             =@strong{=>} 123
     2838(foo 99)
     2839(foo)                             =@strong{=>} 99
     2840@end example
    27932841Parameters are fully thread-local, each thread of execution owns a local copy of a parameters' value.
    27942842
     
    29062954* Unit library - Standard Input/Output::
    29072955* Unit library - User-defined named characters::
     2956* Unit library - Blobs::
    29082957* Unit library - Vectors::
    29092958* Unit library - The unspecified value::
     
    29112960* Unit library - Setters::
    29122961* Unit library - Reader extensions::
     2962* Unit library - Property lists::
    29132963
    29142964@end menu
     
    29272977* Unit library - Arithmetic - Arithmetic fixnum operations::
    29282978* Unit library - Arithmetic - Arithmetic floating-point operations::
     2979* Unit library - Arithmetic - flonum-print-precision::
    29292980* Unit library - Arithmetic - signum::
    29302981* Unit library - Arithmetic - finite?::
     
    29523003
    29533004
    2954 Binary integer operations. @code{arithmetic-shift} shifts the argument @code{N1} by @code{N2} bits to the left. If @code{N2} is negative, than @code{N1} is shifted to the right.  These operations only accept exact integers or inexact integers in word range (32 bit signed on 32-bit platforms, or 64 bit signed on 64-bit platforms).
     3005Binary integer operations. @code{arithmetic-shift} shifts the argument @code{N1} by @code{N2} bits to the left. If @code{N2} is negative, than @code{N1} is shifted to the right. These operations only accept exact integers or inexact integers in word range (32 bit signed on 32-bit platforms, or 64 bit signed on 64-bit platforms).
    29553006
    29563007@table @b
     
    30603111
    30613112@end table
    3062 @node Unit library - Arithmetic - Arithmetic floating-point operations, Unit library - Arithmetic - signum, Unit library - Arithmetic - Arithmetic fixnum operations, Unit library - Arithmetic
     3113@node Unit library - Arithmetic - Arithmetic floating-point operations, Unit library - Arithmetic - flonum-print-precision, Unit library - Arithmetic - Arithmetic fixnum operations, Unit library - Arithmetic
    30633114@subsection Arithmetic floating-point operations
    30643115
    30653116
    3066 In safe mode, these procedures throw a type error with non-float arguments (except @code{flonum?}, which returns @code{#f}).  In unsafe mode, these procedures do not check their arguments. A non-flonum argument in unsafe mode can crash the system.
     3117In safe mode, these procedures throw a type error with non-float arguments (except @code{flonum?}, which returns @code{#f}). In unsafe mode, these procedures do not check their arguments. A non-flonum argument in unsafe mode can crash the system.
    30673118
    30683119@table @b
     
    31083159
    31093160@end table
    3110 @node Unit library - Arithmetic - signum, Unit library - Arithmetic - finite?, Unit library - Arithmetic - Arithmetic floating-point operations, Unit library - Arithmetic
     3161@node Unit library - Arithmetic - flonum-print-precision, Unit library - Arithmetic - signum, Unit library - Arithmetic - Arithmetic floating-point operations, Unit library - Arithmetic
     3162@subsection flonum-print-precision
     3163
     3164
     3165@verbatim
     3166[procedure] (flonum-print-precision [PRECISION])
     3167@end verbatim
     3168Gets and sets the number of significant digits printed for a floating-point number. @code{PRECISION} must be a positive @code{fixnum}. Always returns the setting in effect at the moment of invocation.
     3169
     3170@node Unit library - Arithmetic - signum, Unit library - Arithmetic - finite?, Unit library - Arithmetic - flonum-print-precision, Unit library - Arithmetic
    31113171@subsection signum
    31123172
     
    31153175[procedure] (signum N)
    31163176@end verbatim
    3117 Returns @code{1} if @code{N} is positive, @code{-1} if @code{N}  is negative or @code{0} if @code{N} is zero. @code{signum} is exactness preserving.
     3177Returns @code{1} if @code{N} is positive, @code{-1} if @code{N} is negative or @code{0} if @code{N} is zero. @code{signum} is exactness preserving.
    31183178
    31193179@node Unit library - Arithmetic - finite?,  , Unit library - Arithmetic - signum, Unit library - Arithmetic
     
    31473207[procedure] (current-output-port [PORT])
    31483208@end verbatim
    3149 Returns default output port.  If @code{PORT} is given, then that port is selected as the new current output port.
    3150 
    3151 Note that the default output port is not buffered. Use @ref{Unit posix - Setting the file buffering mode, @code{set-buffering-mode!}} if you need a different behaviour.
     3209Returns default output port. If @code{PORT} is given, then that port is selected as the new current output port.
     3210
     3211Note that the default output port is not buffered. Use [[Unit posix#Setting the file buffering mode|@code{set-buffering-mode!}]] if you need a different behavior.
    31523212
    31533213@node Unit library - File Input/Output - current-error-port, Unit library - File Input/Output - flush-output, Unit library - File Input/Output - current-output-port, Unit library - File Input/Output
     
    31603220Returns default error output port. If @code{PORT} is given, then that port is selected as the new current error output port.
    31613221
    3162 Note that the default error output port is not buffered. Use @ref{Unit posix - Setting the file buffering mode, @code{set-buffering-mode!}} if you need a different behaviour.
     3222Note that the default error output port is not buffered. Use [[Unit posix#Setting the file buffering mode|@code{set-buffering-mode!}]] if you need a different behavior.
    31633223
    31643224@node Unit library - File Input/Output - flush-output, Unit library - File Input/Output - port-name, Unit library - File Input/Output - current-error-port, Unit library - File Input/Output
     
    31783238[procedure] (port-name [PORT])
    31793239@end verbatim
    3180 Fetch filename from @code{PORT}. This returns the filename that was used to open this file.  Returns a special tag string, enclosed into parentheses for non-file ports. @code{PORT} defaults to the value of @code{(current-input-port)}.
     3240Fetch filename from @code{PORT}. This returns the filename that was used to open this file. Returns a special tag string, enclosed into parentheses for non-file ports. @code{PORT} defaults to the value of @code{(current-input-port)}.
    31813241
    31823242@node Unit library - File Input/Output - port-position, Unit library - File Input/Output - set-port-name!, Unit library - File Input/Output - port-name, Unit library - File Input/Output
     
    32863346
    32873347
    3288 CHICKEN maintains a global list of @emph{features} naming functionality available int the current system. Additionally the @code{cond-expand} form accesses this feature list to infer what features are provided. Predefined features are @code{chicken}, and the SRFIs (Scheme Request For Implementation) provided by the base system: @code{srfi-23, srfi-30, srfi-39}. If the @code{eval} unit is used (the default), the features @code{srfi-0, srfi-2, srfi-6, srfi-8, srfi-9} and @code{srfi-10} are defined. When compiling code (during compile-time) the feature @code{compiling} is registered. When evaluating code in the interpreter (csi), the feature @code{csi} is registered.
     3348CHICKEN maintains a global list of @emph{features} naming functionality available in the current system. Additionally the @code{cond-expand} form accesses this feature list to infer what features are provided. Predefined features are @code{chicken}, and the SRFIs (Scheme Request For Implementation) provided by the base system: @code{srfi-23, srfi-30, srfi-39}. If the @code{eval} unit is used (the default), the features @code{srfi-0, srfi-2, srfi-6, srfi-8, srfi-9} and @code{srfi-10} are defined. When compiling code (during compile-time) the feature @code{compiling} is registered. When evaluating code in the interpreter (csi), the feature @code{csi} is registered.
    32893349
    32903350@node Unit library - Feature identifiers - features, Unit library - Feature identifiers - feature?,  , Unit library - Feature identifiers
     
    33363396
    33373397
    3338 Keywords are special symbols prefixed with @code{#:} that evaluate to themselves.  Procedures can use keywords to accept optional named parameters in addition to normal required parameters. Assignment to and bindings of keyword symbols is not allowed. The parameter @code{keyword-style} and the compiler/interpreter option @code{-keyword-style} can be used to allow an additional keyword syntax, either compatible to Common LISP, or to DSSSL.
     3398Keywords are special symbols prefixed with @code{#:} that evaluate to themselves. Procedures can use keywords to accept optional named parameters in addition to normal required parameters. Assignment to and bindings of keyword symbols is not allowed. The parameter @code{keyword-style} and the compiler/interpreter option @code{-keyword-style} can be used to allow an additional keyword syntax, either compatible to Common LISP, or to DSSSL.
    33393399
    33403400@node Unit library - Keywords - get-keyword, Unit library - Keywords - keyword?,  , Unit library - Keywords
     
    33453405[procedure] (get-keyword KEYWORD ARGLIST [THUNK])
    33463406@end verbatim
    3347 Returns the argument from @code{ARGLIST} specified under the keyword @code{KEYWORD}.  If the keyword is not found, then the zero-argument procedure @code{THUNK} is invoked and the result value is returned. If @code{THUNK} is not given, @code{#f} is returned.
    3348 
    3349 <enscript highlight=scheme> (define (increase x . args)
    3350 
    3351 @verbatim
    3352  (+ x (get-keyword #:amount args (lambda () 1))) )
    3353 @end verbatim
    3354 (increase 123)                                      ==> 124 (increase 123 #:amount 10)                          ==> 133 </enscript>
    3355 
     3407Returns the argument from @code{ARGLIST} specified under the keyword @code{KEYWORD}. If the keyword is not found, then the zero-argument procedure @code{THUNK} is invoked and the result value is returned. If @code{THUNK} is not given, @code{#f} is returned.
     3408
     3409@example
     3410(@strong{define} (@strong{increase} x . args)
     3411  (+ x (get-keyword #:amount args (@strong{lambda} () 1))) )
     3412(increase 123)                                      =@strong{=>} 124
     3413(increase 123 #:amount 10)                          =@strong{=>} 133
     3414@end example
    33563415Note: the @code{KEYWORD} may actually be any kind of object.
    33573416
     
    34043463Evaluates @code{EXPRESSION} and handles any exceptions that are covered by @code{CLAUSE ...}, where @code{CLAUSE} should be of the following form:
    34053464
    3406 <enscript highlight=scheme> CLAUSE = ([VARIABLE] (KIND ...) BODY ...) </enscript>
    3407 
    3408 If provided, @code{VARIABLE} will be bound to the signalled exception object. @code{BODY ...} is executed when the exception is a property- or composite condition with the kinds given @code{KIND ...} (unevaluated). If no clause applies, the exception is re-signalled in the same dynamic context as the @code{condition-case} form.
    3409 
    3410 <enscript highlight=scheme> (define (check thunk)
    3411 
    3412 @verbatim
    3413  (condition-case (thunk)
    3414    [(exn file) (print "file error")]
    3415    [(exn) (print "other error")]
    3416    [var () (print "something else")] ) )
    3417 @end verbatim
    3418 (check (lambda () (open-input-file "")))   ; -> "file error" (check (lambda () some-unbound-variable))  ; -> "othererror" (check (lambda () (signal 99)))            ; -> "something else"
    3419 
     3465@example
     3466CLAUSE = ([VARIABLE] (KIND ...) BODY ...)
     3467@end example
     3468If provided, @code{VARIABLE} will be bound to the signaled exception object. @code{BODY ...} is executed when the exception is a property- or composite condition with the kinds given @code{KIND ...} (unevaluated). If no clause applies, the exception is re-signaled in the same dynamic context as the @code{condition-case} form.
     3469
     3470@example
     3471(@strong{define} (@strong{check} thunk)
     3472  (condition-case (thunk)
     3473    [(exn file) (print @strong{"file error"})]
     3474    [(exn) (print @strong{"other error"})]
     3475    [var () (print @strong{"something else"})] ) )
     3476
     3477(check (@strong{lambda} () (open-input-file @strong{""})))   @emph{; -> "file error"
     3478}(check (@strong{lambda} () some-unbound-variable))  @emph{; -> "othererror"
     3479}(check (@strong{lambda} () (signal 99)))            @emph{; -> "something else"
     3480}
    34203481(condition-case some-unbound-variable
    3421 
    3422 @verbatim
    3423  [(exn file) (print "ignored")] )      ; -> signals error
    3424 @end verbatim
    3425 </enscript>
    3426 
     3482  [(exn file) (print @strong{"ignored"})] )      @emph{; -> signals error
     3483}
     3484@end example
    34273485@node Unit library - Exceptions - breakpoint,  , Unit library - Exceptions - condition-case, Unit library - Exceptions
    34283486@subsection breakpoint
     
    34343492Programmatically triggers a breakpoint (similar to the @code{,br} top-level csi command).
    34353493
    3436 All error-conditions signalled by the system are of kind @code{exn}. The following composite conditions are additionally defined:
     3494All error-conditions signaled by the system are of kind @code{exn}. The following composite conditions are additionally defined:
    34373495
    34383496<table>
     
    34403498<tr><td> (exn arity)
    34413499
    3442 Signalled when a procedure is called with the wrong number of arguments.
     3500Signaled when a procedure is called with the wrong number of arguments.
    34433501
    34443502</td></tr><tr><td> (exn type)
    34453503
    3446 Signalled on type-mismatch errors, for example when an argument of the wrong type is passed to a builtin procedure.
     3504Signaled on type-mismatch errors, for example when an argument of the wrong type is passed to a built-in procedure.
    34473505
    34483506</td></tr><tr><td> (exn arithmetic)
    34493507
    3450 Signalled on arithmetic errors, like division by zero.
     3508Signaled on arithmetic errors, like division by zero.
    34513509
    34523510</td></tr><tr><td> (exn i/o)
    34533511
    3454 Signalled on input/output errors.
     3512Signaled on input/output errors.
    34553513
    34563514</td></tr><tr><td> (exn i/o file)
    34573515
    3458 Signalled on file-related errors.
     3516Signaled on file-related errors.
    34593517
    34603518</td></tr><tr><td> (exn i/o net)
    34613519
    3462 Signalled on network errors.
     3520Signaled on network errors.
    34633521
    34643522</td></tr><tr><td> (exn bounds)
    34653523
    3466 Signalled on errors caused by accessing non-existent elements of a collection.
     3524Signaled on errors caused by accessing non-existent elements of a collection.
    34673525
    34683526</td></tr><tr><td> (exn runtime)
    34693527
    3470 Signalled on low-level runtime-system error-situations.
     3528Signaled on low-level runtime-system error-situations.
    34713529
    34723530</td></tr><tr><td> (exn runtime limit)
    34733531
    3474 Signalled when an internal limit is exceeded (like running out of memory).
     3532Signaled when an internal limit is exceeded (like running out of memory).
    34753533
    34763534</td></tr><tr><td> (exn match)
    34773535
    3478 Signalled on errors raised by failed matches (see the section on @code{match}).
     3536Signaled on errors raised by failed matches (see the section on @code{match}).
    34793537
    34803538</td></tr><tr><td> (exn syntax)
    34813539
    3482 Signalled on syntax errors.
     3540Signaled on syntax errors.
    34833541
    34843542</td></tr><tr><td> (exn breakpoint)
    34853543
    3486 Signalled when a breakpoint is reached.
     3544Signaled when a breakpoint is reached.
    34873545
    34883546</td></tr>
     
    34993557@item When the @code{posix} unit is available and used, then a user-interrupt (@code{signal/int}) signals an exception of the kind @code{user-interrupt}.
    35003558
    3501 @item the procedure @code{condition-property-accessor} accepts an optional third argument. If the condition does not have a value for the desired property and if the optional argument is given, no error is signalled and the accessor returns the third argument.
    3502 
    3503 @item In composite conditionss all properties are currently collected in a single property-list, so in the case that to conditions have the same named property, only one will be visible.
     3559@item the procedure @code{condition-property-accessor} accepts an optional third argument. If the condition does not have a value for the desired property and if the optional argument is given, no error is signaled and the accessor returns the third argument.
     3560
     3561@item In composite conditions all properties are currently collected in a single property-list, so in the case that to conditions have the same named property, only one will be visible.
    35043562
    35053563
     
    35123570* Unit library - Environment information and system interface - exit::
    35133571* Unit library - Environment information and system interface - build-platform::
    3514 * Unit library - Environment information and system interface - build-style::
    35153572* Unit library - Environment information and system interface - chicken-version::
    35163573* Unit library - Environment information and system interface - errno::
     
    35343591[procedure] (argv)
    35353592@end verbatim
    3536 Return a list of all supplied command-line arguments. The first item in the list is a string containing the name of the executing program. The other items are the arguments passed to the application. This list is freshly created on every invocation of @code{(argv)}.  It depends on the host-shell whether arguments are expanded ('globbed') or not.
     3593Return a list of all supplied command-line arguments. The first item in the list is a string containing the name of the executing program. The other items are the arguments passed to the application. This list is freshly created on every invocation of @code{(argv)}. It depends on the host-shell whether arguments are expanded ('globbed') or not.
    35373594
    35383595@node Unit library - Environment information and system interface - exit, Unit library - Environment information and system interface - build-platform, Unit library - Environment information and system interface - argv, Unit library - Environment information and system interface
     
    35453602Exit the running process and return exit-code, which defaults to 0 (Invokes @code{exit-handler}).
    35463603
    3547 @node Unit library - Environment information and system interface - build-platform, Unit library - Environment information and system interface - build-style, Unit library - Environment information and system interface - exit, Unit library - Environment information and system interface
     3604Note that pending @code{dynamic-wind} thunks are @emph{not} invoked when exiting your program in this way.
     3605
     3606@node Unit library - Environment information and system interface - build-platform, Unit library - Environment information and system interface - chicken-version, Unit library - Environment information and system interface - exit, Unit library - Environment information and system interface
    35483607@subsection build-platform
    35493608
     
    35563615@verbatim
    35573616cygwin
    3558 msvc
    35593617mingw32
    35603618gnu
    3561 metrowerks
    35623619intel
    3563 watcom
    35643620unknown
    35653621@end verbatim
    3566 @node Unit library - Environment information and system interface - build-style, Unit library - Environment information and system interface - chicken-version, Unit library - Environment information and system interface - build-platform, Unit library - Environment information and system interface
    3567 @subsection build-style
    3568 
    3569 
    3570 @verbatim
    3571  [procedure] (build-style)
    3572 @end verbatim
    3573 Returns a symbol indicating the build system used to create the CHICKEN instance running this program. Possible values are:
    3574 
    3575 @verbatim
    3576  cmake
    3577  autotools
    3578  diy
    3579  custom
    3580 @end verbatim
    3581 @node Unit library - Environment information and system interface - chicken-version, Unit library - Environment information and system interface - errno, Unit library - Environment information and system interface - build-style, Unit library - Environment information and system interface
     3622@node Unit library - Environment information and system interface - chicken-version, Unit library - Environment information and system interface - errno, Unit library - Environment information and system interface - build-platform, Unit library - Environment information and system interface
    35823623@subsection chicken-version
    35833624
     
    36443685[procedure] (on-exit THUNK)
    36453686@end verbatim
    3646 Schedules the zero-argument procexdures @code{THUNK} to be executed before the process exits, either explicitly via @code{exit} or implicitly after exection of the last toplevel form. Note that finalizers for unreferenced finalized data are run before exit procedures.
     3687Schedules the zero-argument procedures @code{THUNK} to be executed before the process exits, either explicitly via @code{exit} or implicitly after execution of the last top-level form. Note that finalizers for unreferenced finalized data are run before exit procedures.
    36473688
    36483689@node Unit library - Environment information and system interface - software-type, Unit library - Environment information and system interface - software-version, Unit library - Environment information and system interface - on-exit, Unit library - Environment information and system interface
     
    37813822[procedure] (error [LOCATION] [STRING] EXP ...)
    37823823@end verbatim
    3783 Prints error message, writes all extra arguments to the value of @code{(current-error-port)} and invokes the current exception-handler.  This conforms to @uref{http://srfi.schemers.org/srfi-23/srfi-23.html, SRFI-23}. If @code{LOCATION} is given and a symbol, it specifies the @emph{location} (the name of the procedure) where the error occurred.
     3824Prints error message, writes all extra arguments to the value of @code{(current-error-port)} and invokes the current exception-handler. This conforms to @uref{http://srfi.schemers.org/srfi-23/srfi-23.html, SRFI-23}. If @code{LOCATION} is given and a symbol, it specifies the @emph{location} (the name of the procedure) where the error occurred.
    37843825
    37853826@node Unit library - Interrupts and error-handling - get-call-chain, Unit library - Interrupts and error-handling - print-call-chain, Unit library - Interrupts and error-handling - error, Unit library - Interrupts and error-handling
     
    37903831[procedure] (get-call-chain [START [THREAD]])
    37913832@end verbatim
    3792 Returns a list with the call history. Backtrace information is only generated in code compiled without @code{-no-trace} and evaluated code. If the optional argument @code{START} is given, the backtrace starts at this offset, i.e. when @code{START} is 1, the next to last trace-entry  is printed, and so on. If the optional argument @code{THREAD} is given, then the call-chain will only be constructed for calls performed by this thread.
     3833Returns a list with the call history. Backtrace information is only generated in code compiled without @code{-no-trace} and evaluated code. If the optional argument @code{START} is given, the backtrace starts at this offset, i.e. when @code{START} is 1, the next to last trace-entry is printed, and so on. If the optional argument @code{THREAD} is given, then the call-chain will only be constructed for calls performed by this thread.
    37933834
    37943835@node Unit library - Interrupts and error-handling - print-call-chain, Unit library - Interrupts and error-handling - print-error-message, Unit library - Interrupts and error-handling - get-call-chain, Unit library - Interrupts and error-handling
     
    38653906[procedure] (gc [FLAG])
    38663907@end verbatim
    3867 Invokes a garbage-collection and returns the number of free bytes in the heap. The flag specifies whether a minor (@code{#f}) or major (@code{#t}) GC is to be triggered. If no argument is given, @code{#t} is assumed. When the argument is @code{#t}, all pending finalizers are executed.
     3908Invokes a garbage-collection and returns the number of free bytes in the heap. The flag specifies whether a minor (@code{#f}) or major (@code{#t}) GC is to be triggered. If no argument is given, @code{#t} is assumed. An explicit @code{#t} argument will cause all pending finalizers to be executed.
    38683909
    38693910@node Unit library - Garbage collection - memory-statistics, Unit library - Garbage collection - set-finalizer!, Unit library - Garbage collection - gc, Unit library - Garbage collection
     
    38743915[procedure] (memory-statistics)
    38753916@end verbatim
    3876 Performs a major garbage collection and returns a three element vector  containing the total heap size in bytes, the number of bytes currently used and the size of the nursery (the first heap generation). Note that the actual heap is actually twice the size given in the heap size, because CHICKEN uses a copying semi-space collector.
     3917Performs a major garbage collection and returns a three element vector containing the total heap size in bytes, the number of bytes currently used and the size of the nursery (the first heap generation). Note that the actual heap is actually twice the size given in the heap size, because CHICKEN uses a copying semi-space collector.
    38773918
    38783919@node Unit library - Garbage collection - set-finalizer!, Unit library - Garbage collection - set-gc-report!, Unit library - Garbage collection - memory-statistics, Unit library - Garbage collection
     
    38833924[procedure] (set-finalizer! X PROC)
    38843925@end verbatim
    3885 Registers a procedure of one argument @code{PROC}, that will be called as soon as the non-immediate data object @code{X} is about to be garbage-collected (with that object as its argument).  Note that the finalizer will @b{not} be called while interrupts are disabled. This procedure returns @code{X}.
     3926Registers a procedure of one argument @code{PROC}, that will be called as soon as the non-immediate data object @code{X} is about to be garbage-collected (with that object as its argument). Note that the finalizer will @b{not} be called while interrupts are disabled. This procedure returns @code{X}.
    38863927
    38873928@node Unit library - Garbage collection - set-gc-report!,  , Unit library - Garbage collection - set-finalizer!, Unit library - Garbage collection
     
    38983939
    38993940@menu
    3900 * Unit library - Other control structures - andmap::
    3901 * Unit library - Other control structures - ormap::
    39023941* Unit library - Other control structures - promise?::
    39033942
     
    39053944
    39063945
    3907 @node Unit library - Other control structures - andmap, Unit library - Other control structures - ormap,  , Unit library - Other control structures
    3908 @subsection andmap
    3909 
    3910 
    3911 @verbatim
    3912 [procedure] (andmap PROC LIST1 ...)
    3913 @end verbatim
    3914 Repeatedly calls @code{PROC} with arguments taken from @code{LIST1 ...}.   If any invocation should return @code{#f}, the result of @code{andmap} is @code{#f}. If all invocations return a true result, then the result of @code{andmap} is @code{#t}.
    3915 
    3916 @node Unit library - Other control structures - ormap, Unit library - Other control structures - promise?, Unit library - Other control structures - andmap, Unit library - Other control structures
    3917 @subsection ormap
    3918 
    3919 
    3920 @verbatim
    3921 [procedure] (ormap PROC LIST1 ...)
    3922 @end verbatim
    3923 Repeatedly calls @code{PROC} with arguments taken from @code{LIST1 ...}.   If any invocation should return a value different from @code{#f}, then this value is returned as the  result of @code{ormap}. If all invocations return @b{#f}, then the result of @code{ormap} is @code{#f}.
    3924 
    3925 @node Unit library - Other control structures - promise?,  , Unit library - Other control structures - ormap, Unit library - Other control structures
     3946@node Unit library - Other control structures - promise?,  ,  , Unit library - Other control structures
    39263947@subsection promise?
    39273948
     
    40034024
    40044025@verbatim
    4005 [procedure] (print EXP1 EXP2 ...)
    4006 @end verbatim
    4007 Outputs the arguments @code{EXP1 EXP2 ...} using @code{display} and writes a newline character to the port that is the value of @code{(current-output-port)}. Returns its first argument.
     4026[procedure] (print [EXP1 ...])
     4027@end verbatim
     4028Outputs the optional arguments @code{EXP1 ...} using @code{display} and writes a newline character to the port that is the value of @code{(current-output-port)}. Returns @code{(void)}.
    40084029
    40094030@node Unit library - Standard Input/Output - print*,  , Unit library - Standard Input/Output - print, Unit library - Standard Input/Output
     
    40124033
    40134034@verbatim
    4014 [procedure] (print* EXP1 ...)
    4015 @end verbatim
    4016 Similar to @code{print}, but does not output a terminating newline character and performs a @code{flush-outout} after writing its arguments.
    4017 
    4018 @node Unit library - User-defined named characters, Unit library - Vectors, Unit library - Standard Input/Output, Unit library
     4035[procedure] (print* [EXP1 ...])
     4036@end verbatim
     4037Similar to @code{print}, but does not output a terminating newline character and performs a @code{flush-output} after writing its arguments.
     4038
     4039@node Unit library - User-defined named characters, Unit library - Blobs, Unit library - Standard Input/Output, Unit library
    40194040@section User-defined named characters
    40204041
     
    40324053[procedure] (char-name SYMBOL-OR-CHAR [CHAR])
    40334054@end verbatim
    4034 This procedure can be used to inquire about character names or to define new ones. With a single argument the behavior is as follows: If @code{SYMBOL-OR-CHAR} is a symbol, then @code{char-name} returns the character with this name, or @code{#f} if no character is defined under this name.  If @code{SYMBOL-OR-CHAR} is a character, then the name of the character is returned as a symbol, or @code{#f} if the character has no associated name.
    4035 
    4036 If the optional argument @code{CHAR} is provided, then @code{SYMBOL-OR-CHAR} should be a symbol that will be the new name of the given character.  If multiple names designate the same character, then the @code{write} will use the character name that was defined last.
    4037 
    4038 <enscript highlight=scheme> (char-name 'space)                  ==> #\space (char-name #\space)                 ==> space (char-name 'bell)                   ==> #f (char-name (integer->char 7))       ==> #f (char-name 'bell (integer->char 7)) (char-name 'bell)                   ==> #\bell (char->integer (char-name 'bell))   ==> 7 </enscript>
    4039 
    4040 @node Unit library - Vectors, Unit library - The unspecified value, Unit library - User-defined named characters, Unit library
     4055This procedure can be used to inquire about character names or to define new ones. With a single argument the behavior is as follows: If @code{SYMBOL-OR-CHAR} is a symbol, then @code{char-name} returns the character with this name, or @code{#f} if no character is defined under this name. If @code{SYMBOL-OR-CHAR} is a character, then the name of the character is returned as a symbol, or @code{#f} if the character has no associated name.
     4056
     4057If the optional argument @code{CHAR} is provided, then @code{SYMBOL-OR-CHAR} should be a symbol that will be the new name of the given character. If multiple names designate the same character, then the @code{write} will use the character name that was defined last.
     4058
     4059@example
     4060(char-name 'space)                  =@strong{=>} #\space
     4061(char-name #\space)                 =@strong{=>} space
     4062(char-name 'bell)                   =@strong{=>} #f
     4063(char-name (integer->char 7))       =@strong{=>} #f
     4064(char-name 'bell (integer->char 7))
     4065(char-name 'bell)                   =@strong{=>} #\bell
     4066(char->integer (char-name 'bell))   =@strong{=>} 7
     4067@end example
     4068@node Unit library - Blobs, Unit library - Vectors, Unit library - User-defined named characters, Unit library
     4069@section Blobs
     4070
     4071@menu
     4072* Unit library - Blobs - make-blob::
     4073* Unit library - Blobs - blob?::
     4074* Unit library - Blobs - blob-size::
     4075* Unit library - Blobs - blob->string::
     4076* Unit library - Blobs - string->blob::
     4077* Unit library - Blobs - blob=?::
     4078
     4079@end menu
     4080
     4081
     4082"blobs" are collections of unstructured bytes. You can't do much with them, but allow conversion to and from SRFI-4 number vectors.
     4083
     4084@node Unit library - Blobs - make-blob, Unit library - Blobs - blob?,  , Unit library - Blobs
     4085@subsection make-blob
     4086
     4087
     4088@verbatim
     4089[procedure] (make-blob SIZE)
     4090@end verbatim
     4091Returns a blob object of @code{SIZE} bytes, aligned on an 8-byte boundary, uninitialized.
     4092
     4093@node Unit library - Blobs - blob?, Unit library - Blobs - blob-size, Unit library - Blobs - make-blob, Unit library - Blobs
     4094@subsection blob?
     4095
     4096
     4097@verbatim
     4098[procedure] (blob? X)
     4099@end verbatim
     4100Returns @code{#t} if @code{X} is a blob object, or @code{#f} otherwise.
     4101
     4102@node Unit library - Blobs - blob-size, Unit library - Blobs - blob->string, Unit library - Blobs - blob?, Unit library - Blobs
     4103@subsection blob-size
     4104
     4105
     4106@verbatim
     4107[procedure] (blob-size BLOB)
     4108@end verbatim
     4109Returns the number of bytes in @code{BLOB}.
     4110
     4111@node Unit library - Blobs - blob->string, Unit library - Blobs - string->blob, Unit library - Blobs - blob-size, Unit library - Blobs
     4112@subsection blob->string
     4113
     4114
     4115@verbatim
     4116[procedure] (blob->string BLOB)
     4117@end verbatim
     4118Returns a string with the contents of @code{BLOB}.
     4119
     4120@node Unit library - Blobs - string->blob, Unit library - Blobs - blob=?, Unit library - Blobs - blob->string, Unit library - Blobs
     4121@subsection string->blob
     4122
     4123
     4124@verbatim
     4125[procedure] (string->blob STRING)
     4126@end verbatim
     4127Returns a blob with the contents of @code{STRING}.
     4128
     4129@node Unit library - Blobs - blob=?,  , Unit library - Blobs - string->blob, Unit library - Blobs
     4130@subsection blob=?
     4131
     4132
     4133@verbatim
     4134[procedure] (blob=? BLOB1 BLOB2)
     4135@end verbatim
     4136Returns @code{#t} if the two argument blobs are of the same size and have the same content.
     4137
     4138@node Unit library - Vectors, Unit library - The unspecified value, Unit library - Blobs, Unit library
    40414139@section Vectors
    40424140
     
    41154213[procedure] (continuation-capture PROCEDURE)
    41164214@end verbatim
    4117 Creates a continuation object representing the current continuation and tail-calls  @code{PROCEDURE} with this continuation as the single argument.
     4215Creates a continuation object representing the current continuation and tail-calls @code{PROCEDURE} with this continuation as the single argument.
    41184216
    41194217More information about this continuation API can be found in the paper @uref{http://repository.readscheme.org/ftp/papers/sw2001/feeley.pdf, http://repository.readscheme.org/ftp/papers/sw2001/feeley.pdf} @emph{A Better API for first class Continuations} by Marc Feeley.
     
    41264224[procedure] (continuation? X)
    41274225@end verbatim
    4128 Returns @code{#t} if @code{X} is a continuation object, or @code{#f} otherwise.
     4226Returns @code{#t} if @code{X} is a continuation object, or @code{#f} otherwise. Please note that this applies only to continuations created by the Continuation API, but not by call/cc, i.e.: @code{(call-with-current-continuation continuation?)} returns @code{#f}, whereas @code{(continuation-capture continuation?)} returns @code{#t}.
    41294227
    41304228@node Unit library - Continuations - continuation-graft, Unit library - Continuations - continuation-return, Unit library - Continuations - continuation?, Unit library - Continuations
     
    41464244Returns the value(s) to the continuation @code{CONT}. @code{continuation-return} could be implemented like this:
    41474245
    4148 <enscript highlight=scheme> (define (continuation-return k . vals)
    4149 
    4150 @verbatim
    4151  (continuation-graft
    4152    k
    4153    (lambda () (apply values vals)) ) )
    4154 @end verbatim
    4155 </enscript>
    4156 
     4246@example
     4247(@strong{define} (@strong{continuation-return} k . vals)
     4248  (continuation-graft
     4249    k
     4250    (@strong{lambda} () (apply values vals)) ) )
     4251@end example
    41574252@node Unit library - Setters, Unit library - Reader extensions, Unit library - Continuations, Unit library
    41584253@section Setters
     
    41874282Returns a copy of the procedure @code{GETTER} with the associated setter procedure @code{SETTER}. Contrary to the SRFI specification, the setter of the returned procedure may be changed.
    41884283
    4189 @node Unit library - Reader extensions,  , Unit library - Setters, Unit library
     4284@node Unit library - Reader extensions, Unit library - Property lists, Unit library - Setters, Unit library
    41904285@section Reader extensions
    41914286
     
    42164311[procedure] (set-read-syntax! CHAR-OR-SYMBOL PROC)
    42174312@end verbatim
    4218 When the reader is encounting the non-whitespace character @code{CHAR} while reading an expression from a given port, then the procedure @code{PROC} will be called with that port as its argument. The procedure should return a value that will be returned to the reader:
    4219 
    4220 <enscript highlight=scheme>
    4221 
    4222 @verbatim
    4223 ; A simple RGB color syntax:
    4224 @end verbatim
    4225 @verbatim
    4226 (set-read-syntax! #\%
    4227   (lambda (port)
    4228     (apply vector
    4229       (map (cut string->number <> 16)
    4230 @end verbatim
     4313When the reader encounters the non-whitespace character @code{CHAR} while reading an expression from a given port, then the procedure @code{PROC} will be called with that port as its argument. The procedure should return a value that will be returned to the reader:
     4314
     4315@example
     4316 @emph{; A simple RGB color syntax:
     4317}
     4318 (set-read-syntax! #\%
     4319   (@strong{lambda} (port)
     4320     (apply vector
     4321       (map (cut string->number <> 16)
    42314322            (string-chop (read-string 6 port) 2) ) ) ) )
    42324323
    4233 @verbatim
    4234 (with-input-from-string "(1 2 %f0f0f0 3)" read)
    4235 ; ==> (1 2 #(240 240 240) 3)
    4236 @end verbatim
    4237 </enscript>
    4238 
     4324 (with-input-from-string @strong{"(1 2 %f0f0f0 3)"} read)
     4325 @emph{; ==> (1 2 #(240 240 240) 3)
     4326}@end example
    42394327If @code{CHAR-OR-SYMBOL} is a symbol, then a so-called @emph{read-mark} handler is defined. In that case the handler procedure will be called when a character-sequence of the form
    42404328
     
    42744362@end verbatim
    42754363Returns a copy of the given read-table. You can access the currently active read-table with @code{(current-read-table)}.
     4364
     4365@node Unit library - Property lists,  , Unit library - Reader extensions, Unit library
     4366@section Property lists
     4367
     4368@menu
     4369* Unit library - Property lists - get::
     4370* Unit library - Property lists - put!::
     4371* Unit library - Property lists - remprop!::
     4372* Unit library - Property lists - symbol-plist::
     4373* Unit library - Property lists - get-properties::
     4374
     4375@end menu
     4376
     4377
     4378As in other Lisp dialects, CHICKEN supports "property lists" associated with symbols. Properties are accessible via a key that can be any kind of value but which will be compared using @code{eq?}.
     4379
     4380@node Unit library - Property lists - get, Unit library - Property lists - put!,  , Unit library - Property lists
     4381@subsection get
     4382
     4383
     4384@verbatim
     4385 [procedure] (get SYMBOL PROPERTY [DEFAULT])
     4386@end verbatim
     4387Returns the value stored under the key @code{PROPERTY} in the property list of @code{SYMBOL}. If no such property is stored, returns @code{DEFAULT}. The @code{DEFAULT} is optional and defaults to @code{#f}.
     4388
     4389@node Unit library - Property lists - put!, Unit library - Property lists - remprop!, Unit library - Property lists - get, Unit library - Property lists
     4390@subsection put!
     4391
     4392
     4393@verbatim
     4394 [procedure] (put! SYMBOL PROPERTY VALUE)
     4395 [setter] (set! (get SYMBOL PROPERTY) VALUE)
     4396@end verbatim
     4397Stores @code{VALUE} under the key @code{PROPERTY} in the property list of @code{SYMBOL} replacing any previously stored value.
     4398
     4399@node Unit library - Property lists - remprop!, Unit library - Property lists - symbol-plist, Unit library - Property lists - put!, Unit library - Property lists
     4400@subsection remprop!
     4401
     4402
     4403@verbatim
     4404 [procedure] (remprop! SYMBOL PROPERTY)
     4405@end verbatim
     4406Deletes the first property matching the key @code{PROPERTY} in the property list of @code{SYMBOL}. Returns @code{#t} when a deletion performed, and @code{#f} otherwise.
     4407
     4408@node Unit library - Property lists - symbol-plist, Unit library - Property lists - get-properties, Unit library - Property lists - remprop!, Unit library - Property lists
     4409@subsection symbol-plist
     4410
     4411
     4412@verbatim
     4413 [procedure] (symbol-plist SYMBOL)
     4414 [setter] (set! (symbol-plist SYMBOL) LST)
     4415@end verbatim
     4416Returns the property list of @code{SYMBOL} or sets it.
     4417
     4418@node Unit library - Property lists - get-properties,  , Unit library - Property lists - symbol-plist, Unit library - Property lists
     4419@subsection get-properties
     4420
     4421
     4422@verbatim
     4423 [procedure] (get-properties SYMBOL PROPERTIES)
     4424@end verbatim
     4425Searches the property list of @code{SYMBOL} for the first property with a key in the list @code{PROPERTIES}. Returns 3 values: the matching property key, value, and the tail of property list after the matching property. When no match found all values are @code{#f}.
     4426
     4427@code{PROPERTIES} may also be an atom, in which case it is treated as a list of one element.
    42764428
    42774429Previous: @ref{Parameters, Parameters}
     
    45104662
    45114663@end table
    4512 Contains a string naming the path to the extension repository, which defaults to either the value of the environment variable @code{CHICKEN_REPOSITORY}, the value of the environment variable @code{CHICKEN_HOME} or the default library path (usually @code{/usr/local/lib/chicken} on UNIX systems).
     4664Contains a string naming the path to the extension repository, which defaults to either the value of the environment variable @code{CHICKEN_REPOSITORY} or the default library path (usually @code{/usr/local/lib/chicken} on UNIX systems).
    45134665
    45144666@node Unit eval - Loading extension libraries - extension-information, Unit eval - Loading extension libraries - provide, Unit eval - Loading extension libraries - repository-path, Unit eval - Loading extension libraries
     
    45504702
    45514703@itemize
    4552 @item the current include path, which defaults to the pathnames given in @code{CHICKEN_INCLUDE_PATH} and @code{CHICKEN_HOME}.
     4704@item the current include path, which defaults to the pathnames given in @code{CHICKEN_INCLUDE_PATH}.
    45534705
    45544706@item the current directory
     
    45674719Registers the handler-procedure @code{PROC} as a extension-specifier with the name @code{SYMBOL}. This facility allows extending the set of valid extension specifiers to be used with @code{require-extension}. When @code{register-extension} is called with an extension specifier of the form @code{(SPEC ...)} and @code{SPEC} has been registered with @code{set-extension-specifier!}, then @code{PROC} will be called with two arguments: the specifier and the previously installed handler (or @code{#f} if no such handler was defined). The handler should return a new specifier that will be processed recursively. If the handler returns a vector, then each element of the vector will be processed recursively.  Alternatively the handler may return a string which specifies a file to be loaded:
    45684720
    4569 <enscript highlight=scheme> (eval-when (compile eval)
    4570 
    4571 @verbatim
    4572  (set-extension-specifier!
    4573    'my-package
    4574    (lambda (spec old)
    4575      (make-pathname my-package-directory (->string (cadr spec))) ) ) )
    4576 @end verbatim
    4577 (require-extension (my-package stuff))     ; --> expands into '(load "my-package-dir/stuff") </enscript>
    4578 
     4721@example
     4722(eval-when (compile eval)
     4723  (set-extension-specifier!
     4724    'my-package
     4725    (@strong{lambda} (spec old)
     4726      (make-pathname my-package-directory (->string (cadr spec))) ) ) )
     4727
     4728(require-extension (my-package stuff))     @emph{; --> expands into '(load "my-package-dir/stuff")
     4729}@end example
    45794730Note that the handler has to be registered at compile time, if it is to be  visible in compiled code.
    45804731
     
    45954746[procedure] (chicken-home)
    45964747@end verbatim
    4597 Returns a string given the installation directory (usually @code{/usr/local/share/chicken} on UNIX-like systems). If the environment variable @code{CHICKEN_HOME} is set, then its value will be returned. As a last option, if the environment variable @code{CHICKEN_PREFIX} is set, then @code{chicken-home} will return @code{$CHICKEN_PREFIX/share}.
     4748Returns a string given the installation directory (usually @code{/usr/local/share/chicken} on UNIX-like systems). As a last option, if the environment variable @code{CHICKEN_PREFIX} is set, then @code{chicken-home} will return @code{$CHICKEN_PREFIX/share}.
    45984749
    45994750@node Unit eval - Eval,  , Unit eval - System information, Unit eval
     
    46264777* Unit extras - String-port extensions::
    46274778* Unit extras - Formatted output::
    4628 * Unit extras - Hash tables::
     4779* Unit extras - Hash Tables::
    46294780* Unit extras - Queues::
    46304781* Unit extras - Sorting::
     
    46384789
    46394790
    4640 This unit contains a collection of useful utility definitions.  This unit is used by default, unless the program is compiled with the @code{-explicit-use} option.
     4791This unit contains a collection of useful utility definitions. This unit is used by default, unless the program is compiled with the @code{-explicit-use} option.
    46414792
    46424793@node Unit extras - Lists, Unit extras - String-port extensions,  , Unit extras
     
    47144865Returns a new list of sublists, where each sublist contains @code{N} elements of @code{LIST}. If @code{LIST} has a length that is not a multiple of @code{N}, then the last sublist contains the remaining elements.
    47154866
    4716 <enscript highlight=scheme> (chop '(1 2 3 4 5 6) 2) ==> ((1 2) (3 4) (5 6)) (chop '(a b c d) 3)     ==> ((a b c) (d)) </enscript>
    4717 
     4867@example
     4868(chop '(1 2 3 4 5 6) 2) =@strong{=>} ((1 2) (3 4) (5 6))
     4869(chop '(a b c d) 3)     =@strong{=>} ((a b c) (d))
     4870@end example
    47184871@node Unit extras - Lists - compress, Unit extras - Lists - flatten, Unit extras - Lists - chop, Unit extras - Lists
    47194872@subsection compress
     
    47254878Returns a new list with elements taken from @code{LIST} with corresponding true values in the list @code{BLIST}.
    47264879
    4727 <enscript highlight=scheme> (define nums '(99 100 110 401 1234)) (compress (map odd? nums) nums)      ==> (99 401) </enscript>
    4728 
     4880@example
     4881(@strong{define} @strong{nums} '(99 100 110 401 1234))
     4882(compress (map odd? nums) nums)      =@strong{=>} (99 401)
     4883@end example
    47294884@node Unit extras - Lists - flatten, Unit extras - Lists - intersperse, Unit extras - Lists - compress, Unit extras - Lists
    47304885@subsection flatten
     
    47544909Concatenates the lists in @code{LISTOFLISTS} with @code{LIST} placed between each sublist. @code{LIST} defaults to the empty list.
    47554910
    4756 <enscript highlight=scheme> (join '((a b) (c d) (e)) '(x y)) ==> (a b x y c d x y e) (join '((p q) () (r (s) t)) '(-))  ==> (p q - - r (s) t) </enscript>
    4757 
     4911@example
     4912(join '((a b) (c d) (e)) '(x y)) =@strong{=>} (a b x y c d x y e)
     4913(join '((p q) () (r (s) t)) '(-))  =@strong{=>} (p q - - r (s) t)
     4914@end example
    47584915@code{join} could be implemented as follows:
    47594916
    4760 <enscript highlight=scheme> (define (join lstoflsts #!optional (lst '()))
    4761 
    4762 @verbatim
    4763  (apply append (intersperse lstoflists lst)) )
    4764 @end verbatim
    4765 </enscript>
    4766 
     4917@example
     4918(@strong{define} (@strong{join} lstoflsts #!optional (lst '()))
     4919  (apply append (intersperse lstoflists lst)) )
     4920@end example
    47674921@node Unit extras - Lists - shuffle, Unit extras - Lists - tail?, Unit extras - Lists - join, Unit extras - Lists
    47684922@subsection shuffle
     
    48314985Call procedure @code{THUNK} with the current output-port temporarily bound to a string-output-port and return the accumulated output string.
    48324986
    4833 @node Unit extras - Formatted output, Unit extras - Hash tables, Unit extras - String-port extensions, Unit extras
     4987@node Unit extras - Formatted output, Unit extras - Hash Tables, Unit extras - String-port extensions, Unit extras
    48344988@section Formatted output
    48354989
     
    48575011@verbatim
    48585012[procedure] (fprintf PORT FORMATSTRING ARG ...)
    4859 [procedure] (printf FORMATSTRING ARG)
     5013[procedure] (printf FORMATSTRING ARG ...)
    48605014[procedure] (sprintf FORMATSTRING ARG ...)
    48615015@end verbatim
    4862 Simple formatted output to a given port (@code{fprintf}), the value of @code{(current-output-port)} (@code{printf}) or a string (@code{sprintf}).  The @code{FORMATSTRING} can contain any sequence of characters. The character `~' prefixes special formatting directives:
     5016Simple formatted output to a given port (@code{fprintf}), the value of @code{(current-output-port)} (@code{printf}), or a string (@code{sprintf}).  The @code{FORMATSTRING} can contain any sequence of characters.  There must be at least as many @code{ARG} arguments given as there are format directives that require an argument in @code{FORMATSTRING}.  Extra @code{ARG} arguments are ignored. The character `~' prefixes special formatting directives:
    48635017
    48645018<table> <tr><td> ~% write newline character </td></tr><tr><td> ~N the same as @code{~%} </td></tr><tr><td> ~S write the next argument </td></tr><tr><td> ~A display the next argument </td></tr><tr><td> ~\n skip all whitespace in the format-string until the next non-whitespace character </td></tr><tr><td> ~B write the next argument as a binary number </td></tr><tr><td> ~O write the next argument as an octal number </td></tr><tr><td> ~X write the next argument as a hexadecimal number </td></tr><tr><td> ~C write the next argument as a character </td></tr><tr><td> ~~ display `~' </td></tr><tr><td> ~! flush all pending output </td></tr><tr><td> ~? invoke formatted output routine recursively with the next two arguments as format-string and list of parameters </td></tr></table>
     
    48755029The optional @code{DESTINATION}, when supplied, performs a (@code{sprintf}) for a  @code{#f}, a (@code{printf}) for a @code{#t}, and a (@code{fprintf}) for an output-port. When missing a (@code{sprintf}) is performed.
    48765030
    4877 @node Unit extras - Hash tables, Unit extras - Queues, Unit extras - Formatted output, Unit extras
    4878 @section Hash tables
    4879 
    4880 @menu
    4881 * Unit extras - Hash tables - hash-table-remove!::
    4882 
    4883 @end menu
    4884 
    4885 
    4886 CHICKEN implements SRFI-69. For more information,  see @uref{http://srfi.schemers.org/srfi-69/srfi-69.html, SRFI-69}.
     5031@node Unit extras - Hash Tables, Unit extras - Queues, Unit extras - Formatted output, Unit extras
     5032@section Hash Tables
     5033
     5034@menu
     5035* Unit extras - Hash Tables - make-hash-table::
     5036* Unit extras - Hash Tables - hash-table-min-load::
     5037* Unit extras - Hash Tables - hash-table-max-load::
     5038* Unit extras - Hash Tables - hash-table-weak-keys::
     5039* Unit extras - Hash Tables - hash-table-weak-values::
     5040* Unit extras - Hash Tables - hash-table-has-initial::
     5041* Unit extras - Hash Tables - hash-table-initial::
     5042* Unit extras - Hash Tables - hash-table-update!::
     5043* Unit extras - Hash Tables - hash-table-update!/default::
     5044* Unit extras - Hash Tables - hash-table-remove!::
     5045* Unit extras - Hash Tables - hash-table-merge::
     5046* Unit extras - Hash Tables - hash-table-map::
     5047* Unit extras - Hash Tables - hash-table-for-each::
     5048* Unit extras - Hash Tables - number-hash::
     5049* Unit extras - Hash Tables - object-uid-hash::
     5050* Unit extras - Hash Tables - symbol-hash::
     5051* Unit extras - Hash Tables - keyword-hash::
     5052* Unit extras - Hash Tables - eq?-hash::
     5053* Unit extras - Hash Tables - eqv?-hash::
     5054* Unit extras - Hash Tables - equal?-hash::
     5055
     5056@end menu
     5057
     5058
     5059CHICKEN implements an extended SRFI-69. For more information, see @uref{http://srfi.schemers.org/srfi-69/srfi-69.html, SRFI-69} and @uref{http://srfi.schemers.org/srfi-69/srfi-90.html, SRFI-90}.
    48875060
    48885061A setter for @code{hash-table-ref} is defined, so
    48895062
    4890 <enscript highlight=scheme> (set! (hash-table-ref HT KEY) VAL) </enscript>
    4891 
     5063@example
     5064(@strong{set!} (hash-table-ref HT KEY) VAL)
     5065@end example
    48925066is equivalent to
    48935067
    4894 <enscript highlight=scheme> (hash-table-set! HT KEY VAL) </enscript>
    4895 
    4896 As an extension to SRFI-69, @code{hash-table-update!} and @code{hash-table-update!/default} return the new value (after applying the update procedure).
    4897 
    4898 @node Unit extras - Hash tables - hash-table-remove!,  ,  , Unit extras - Hash tables
     5068@example
     5069(hash-table-set! HT KEY VAL)
     5070@end example
     5071@node Unit extras - Hash Tables - make-hash-table, Unit extras - Hash Tables - hash-table-min-load,  , Unit extras - Hash Tables
     5072@subsection make-hash-table
     5073
     5074
     5075@verbatim
     5076[procedure] (make-hash-table [TEST [HASH [SIZE]]] [#:TEST #:HASH #:SIZE #:INITIAL #:MIN-LOAD #:MAX-LOAD #:WEAK-KEYS #:WEAK-VALUES])
     5077@end verbatim
     5078The SRFI-69 procedure is extended:
     5079
     5080Returns a new @code{HASH-TABLE}, parameterized as follows:
     5081
     5082@code{TEST} is a procedure of one argument, @code{(object -> boolean)}; an equality predicate. The first argument is a @code{KEY}.
     5083
     5084@code{HASH} is a procedure of two arguments, @code{(object (fixnum positive) -> (fixnum (<= 0 _ _2)))}; a bounded hash function, where the returned hash value is in @code{[0 BOUND)}. The first argument is a @code{KEY} and the second argument is the @code{BOUND}.
     5085
     5086@code{SIZE} is a @code{fixnum}; the initial size of the hash-table.
     5087
     5088@code{INITIAL} is an @code{object}; the default initial value for any @code{KEY}.
     5089
     5090@code{MIN-LOAD} is a @code{flonum} in @code{(0.0 1.0)}; the lower bound for resizing the table.
     5091
     5092@code{MAX-LOAD} is a @code{flonum} in @code{(0.0 1.0)}; the upper bound for resizing the table.
     5093
     5094@code{WEAK-KEYS} is a @code{boolean}; always @code{#f} (until further notice).
     5095
     5096@code{WEAK-VALUES} is a @code{boolean}; always @code{#f} (until further notice).
     5097
     5098Keyword arguments take precedence over optional arguments when both are specified.
     5099
     5100@node Unit extras - Hash Tables - hash-table-min-load, Unit extras - Hash Tables - hash-table-max-load, Unit extras - Hash Tables - make-hash-table, Unit extras - Hash Tables
     5101@subsection hash-table-min-load
     5102
     5103
     5104@verbatim
     5105[procedure] (hash-table-min-load HASH-TABLE)
     5106@end verbatim
     5107Returns the @code{MIN-LOAD} property of the @code{HASH-TABLE}.
     5108
     5109@node Unit extras - Hash Tables - hash-table-max-load, Unit extras - Hash Tables - hash-table-weak-keys, Unit extras - Hash Tables - hash-table-min-load, Unit extras - Hash Tables
     5110@subsection hash-table-max-load
     5111
     5112
     5113@verbatim
     5114[procedure] (hash-table-max-load HASH-TABLE)
     5115@end verbatim
     5116Returns the @code{MAX-LOAD} property of the @code{HASH-TABLE}.
     5117
     5118@node Unit extras - Hash Tables - hash-table-weak-keys, Unit extras - Hash Tables - hash-table-weak-values, Unit extras - Hash Tables - hash-table-max-load, Unit extras - Hash Tables
     5119@subsection hash-table-weak-keys
     5120
     5121
     5122@verbatim
     5123[procedure] (hash-table-weak-keys HASH-TABLE)
     5124@end verbatim
     5125Returns the @code{WEAK-KEYS} property of the @code{HASH-TABLE}.
     5126
     5127@node Unit extras - Hash Tables - hash-table-weak-values, Unit extras - Hash Tables - hash-table-has-initial, Unit extras - Hash Tables - hash-table-weak-keys, Unit extras - Hash Tables
     5128@subsection hash-table-weak-values
     5129
     5130
     5131@verbatim
     5132[procedure] (hash-table-weak-values HASH-TABLE)
     5133@end verbatim
     5134Returns the @code{WEAK-VALUES} property of the @code{HASH-TABLE}.
     5135
     5136@node Unit extras - Hash Tables - hash-table-has-initial, Unit extras - Hash Tables - hash-table-initial, Unit extras - Hash Tables - hash-table-weak-values, Unit extras - Hash Tables
     5137@subsection hash-table-has-initial
     5138
     5139
     5140@verbatim
     5141[procedure] (hash-table-has-initial HASH-TABLE)
     5142@end verbatim
     5143Does the @code{HASH-TABLE} have an @code{INITIAL} property.
     5144
     5145@node Unit extras - Hash Tables - hash-table-initial, Unit extras - Hash Tables - hash-table-update!, Unit extras - Hash Tables - hash-table-has-initial, Unit extras - Hash Tables
     5146@subsection hash-table-initial
     5147
     5148
     5149@verbatim
     5150[procedure] (hash-table-initial HASH-TABLE)
     5151@end verbatim
     5152Returns the @code{INITIAL} property of the @code{HASH-TABLE}.
     5153
     5154@node Unit extras - Hash Tables - hash-table-update!, Unit extras - Hash Tables - hash-table-update!/default, Unit extras - Hash Tables - hash-table-initial, Unit extras - Hash Tables
     5155@subsection hash-table-update!
     5156
     5157
     5158@verbatim
     5159[procedure] (hash-table-update! HASH-TABLE KEY [FUNCTION [THUNK]])
     5160@end verbatim
     5161The SRFI-69 procedure is extended:
     5162
     5163@code{FUNCTION} is optional. The default is @code{identity}.
     5164
     5165@code{THUNK} is optional. The default is @code{(lambda () (hash-table-initial HASH-TABLE))}; when the @code{HASH-TABLE} has no initial value an error is signaled.
     5166
     5167Returns the new value, after the update.
     5168
     5169@node Unit extras - Hash Tables - hash-table-update!/default, Unit extras - Hash Tables - hash-table-remove!, Unit extras - Hash Tables - hash-table-update!, Unit extras - Hash Tables
     5170@subsection hash-table-update!/default
     5171
     5172
     5173@verbatim
     5174[procedure] (hash-table-update!/default HASH-TABLE KEY FUNCTION DEFAULT)
     5175@end verbatim
     5176The SRFI-69 procedure is extended:
     5177
     5178Returns the new value, after the update.
     5179
     5180@node Unit extras - Hash Tables - hash-table-remove!, Unit extras - Hash Tables - hash-table-merge, Unit extras - Hash Tables - hash-table-update!/default, Unit extras - Hash Tables
    48995181@subsection hash-table-remove!
    49005182
    49015183
    49025184@verbatim
    4903 [procedure] (hash-table-remove! HASHTABLE PROC)
    4904 @end verbatim
    4905 Calls @code{PROC} for all entries in @code{HASHTABLE} with the key and value of each entry. If @code{PROC} returns true, then that entry is removed.
    4906 
    4907 @node Unit extras - Queues, Unit extras - Sorting, Unit extras - Hash tables, Unit extras
     5185[procedure] (hash-table-remove! HASH-TABLE PROC)
     5186@end verbatim
     5187Calls @code{PROC} for all entries in @code{HASH-TABLE} with the key and value of each entry. If @code{PROC} returns true, then that entry is removed.
     5188
     5189@node Unit extras - Hash Tables - hash-table-merge, Unit extras - Hash Tables - hash-table-map, Unit extras - Hash Tables - hash-table-remove!, Unit extras - Hash Tables
     5190@subsection hash-table-merge
     5191
     5192
     5193@verbatim
     5194[procedure] (hash-table-merge HASH-TABLE-1 HASH-TABLE-2)
     5195@end verbatim
     5196Returns a new @code{hash-table}, the merged result of @code{HASH-TABLE-1} & @code{HASH-TABLE-2}.
     5197
     5198@node Unit extras - Hash Tables - hash-table-map, Unit extras - Hash Tables - hash-table-for-each, Unit extras - Hash Tables - hash-table-merge, Unit extras - Hash Tables
     5199@subsection hash-table-map
     5200
     5201
     5202@verbatim
     5203[procedure] (hash-table-map HASH-TABLE PROC)
     5204@end verbatim
     5205Calls @code{PROC} for all entries in @code{HASH-TABLE} with the key and value of each entry.
     5206
     5207@code{PROC} is a procedure of 2 arguments, @code{(object object -> object)}; the first argument is the @code{KEY}, and the second argument is the @code{VALUE}. The return value is collected in a list.
     5208
     5209Returns the list collection.
     5210
     5211@node Unit extras - Hash Tables - hash-table-for-each, Unit extras - Hash Tables - number-hash, Unit extras - Hash Tables - hash-table-map, Unit extras - Hash Tables
     5212@subsection hash-table-for-each
     5213
     5214
     5215@verbatim
     5216[procedure] (hash-table-for-each HASH-TABLE PROC)
     5217@end verbatim
     5218Calls @code{PROC} for all entries in @code{HASH-TABLE} with the key and value of each entry.
     5219
     5220@code{PROC} is a procedure of 2 arguments, @code{(object object -> unspecified)}; the first argument is the @code{KEY}, and the second argument is the @code{VALUE}.
     5221
     5222No return value.
     5223
     5224A synonym for @code{hash-table-walk}.
     5225
     5226@node Unit extras - Hash Tables - number-hash, Unit extras - Hash Tables - object-uid-hash, Unit extras - Hash Tables - hash-table-for-each, Unit extras - Hash Tables
     5227@subsection number-hash
     5228
     5229
     5230@verbatim
     5231[procedure] (number-hash NUMBER [BOUND])
     5232@end verbatim
     5233Returns a hash value for the @code{NUMBER}, with optional @code{BOUND}.
     5234
     5235@node Unit extras - Hash Tables - object-uid-hash, Unit extras - Hash Tables - symbol-hash, Unit extras - Hash Tables - number-hash, Unit extras - Hash Tables
     5236@subsection object-uid-hash
     5237
     5238
     5239@verbatim
     5240[procedure] (object-uid-hash OBJECT [BOUND])
     5241@end verbatim
     5242Returns a hash value for the @code{OBJECT}, with optional @code{BOUND}.
     5243
     5244Currently this is a synonym for @code{equal?-hash}.
     5245
     5246@node Unit extras - Hash Tables - symbol-hash, Unit extras - Hash Tables - keyword-hash, Unit extras - Hash Tables - object-uid-hash, Unit extras - Hash Tables
     5247@subsection symbol-hash
     5248
     5249
     5250@verbatim
     5251[procedure] (symbol-hash SYMBOL [BOUND])
     5252@end verbatim
     5253Returns a hash value for the @code{SYMBOL}, with optional @code{BOUND}.
     5254
     5255@node Unit extras - Hash Tables - keyword-hash, Unit extras - Hash Tables - eq?-hash, Unit extras - Hash Tables - symbol-hash, Unit extras - Hash Tables
     5256@subsection keyword-hash
     5257
     5258
     5259@verbatim
     5260[procedure] (keyword-hash KEYWORD [BOUND])
     5261@end verbatim
     5262Returns a hash value for the @code{KEYWORD}, with optional @code{BOUND}.
     5263
     5264@node Unit extras - Hash Tables - eq?-hash, Unit extras - Hash Tables - eqv?-hash, Unit extras - Hash Tables - keyword-hash, Unit extras - Hash Tables
     5265@subsection eq?-hash
     5266
     5267
     5268@verbatim
     5269[procedure] (eq?-hash OBJECT [BOUND])
     5270@end verbatim
     5271Returns a hash value for the @code{OBJECT}, with optional @code{BOUND}.
     5272
     5273For use with @code{eq?} as @code{TEST}.
     5274
     5275@code{hash-by-identity} is a synonym.
     5276
     5277Uses @code{object-uid-hash} for non-immediate, non-symbol objects.
     5278
     5279@node Unit extras - Hash Tables - eqv?-hash, Unit extras - Hash Tables - equal?-hash, Unit extras - Hash Tables - eq?-hash, Unit extras - Hash Tables
     5280@subsection eqv?-hash
     5281
     5282
     5283@verbatim
     5284[procedure] (eqv?-hash OBJECT [BOUND])
     5285@end verbatim
     5286Returns a hash value for the @code{OBJECT}, with optional @code{BOUND}.
     5287
     5288For use with @code{eqv?} as @code{TEST}.
     5289
     5290Uses @code{object-uid-hash} for non-immediate, non-number, non-symbol objects.
     5291
     5292@node Unit extras - Hash Tables - equal?-hash,  , Unit extras - Hash Tables - eqv?-hash, Unit extras - Hash Tables
     5293@subsection equal?-hash
     5294
     5295
     5296@verbatim
     5297[procedure] (equal?-hash OBJECT [BOUND])
     5298@end verbatim
     5299Returns a hash value for the @code{OBJECT}, with optional @code{BOUND}.
     5300
     5301For use with @code{equal?} as @code{TEST}.
     5302
     5303@code{hash} is a synonym.
     5304
     5305@node Unit extras - Queues, Unit extras - Sorting, Unit extras - Hash Tables, Unit extras
    49085306@section Queues
    49095307
     
    51715569[procedure] (read-file [FILE-OR-PORT [READER [MAXCOUNT]]])
    51725570@end verbatim
    5173 Returns a list containing all toplevel expressions read from the file or port @code{FILE-OR-PORT}. If no argument is given, input is read from the port that is the current value of @code{(current-input-port)}. After all expressions are read, and if the argument is a port, then the port will not be closed. The @code{READER} argument specifies the procedure used to read  expressions from the given file or port and defaults to @code{read}. The reader procedure will be called with a single argument (an input port). If @code{MAXCOUNT} is given then only up to @code{MAXCOUNT} expressions will be read in.
     5571Returns a list containing all toplevel expressions read from the file or port @code{FILE-OR-PORT}. If no argument is given, input is read from the port that is the current value of @code{(current-input-port)}. After all expressions are read, and if the argument is a port, then the port will not be closed. The @code{READER} argument specifies the procedure used to read expressions from the given file or port and defaults to @code{read}. The reader procedure will be called with a single argument (an input port). If @code{MAXCOUNT} is given then only up to @code{MAXCOUNT} expressions will be read in.
    51745572
    51755573@node Unit extras - Input/Output extensions - read-line, Unit extras - Input/Output extensions - write-line, Unit extras - Input/Output extensions - read-file, Unit extras - Input/Output extensions
     
    51855583[procedure] (write-line STRING [PORT])
    51865584@end verbatim
    5187 Line-input and -output. @code{PORT} defaults to the value of @code{(current-input-port)} and @code{(current-output-port)}, respectively. if the optional argument @code{LIMIT} is given and not @code{#f}, then @code{read-line} reads at most @code{LIMIT} characters per line.
     5585Line-input and -output. @code{PORT} defaults to the value of @code{(current-input-port)} and @code{(current-output-port)}, respectively. If the optional argument @code{LIMIT} is given and not @code{#f}, then @code{read-line} reads at most @code{LIMIT} characters per line. @code{read-line} returns a string without the terminating newline and @code{write-line} adds a terminating newline  before outputting.
    51885586
    51895587@node Unit extras - Input/Output extensions - read-lines, Unit extras - Input/Output extensions - read-string, Unit extras - Input/Output extensions - write-line, Unit extras - Input/Output extensions
     
    51945592[procedure] (read-lines [PORT [MAX]])
    51955593@end verbatim
    5196 Read @code{MAX} or fewer lines from @code{PORT}. @code{PORT} defaults to the value of @code{(current-input-port)}. @code{PORT} may optionally be a string naming a file.
     5594Read @code{MAX} or fewer lines from @code{PORT}. @code{PORT} defaults to the value of @code{(current-input-port)}. @code{PORT} may optionally be a string naming a file. Returns a list of strings, each string representing a line read, not including any line separation character(s).
    51975595
    51985596@node Unit extras - Input/Output extensions - read-string, Unit extras - Input/Output extensions - read-string!, Unit extras - Input/Output extensions - read-lines, Unit extras - Input/Output extensions
     
    52135611[procedure] (write-string STRING [NUM [PORT]]
    52145612@end verbatim
    5215 Read or write @code{NUM} characters from/to @code{PORT}, which defaults to the value of @code{(current-input-port)} or @code{(current-output-port)}, respectively.  If @code{NUM} is @code{#f} or not given, then all data up to the end-of-file is read, or, in the case of @code{write-string} the whole string is written. If no more input is available, @code{read-string} returns the empty string. @code{read-string!} reads destructively into the given @code{STRING} argument, but never more characters that would fit into @code{STRING}. If @code{START} is given, then the read characters are stored starting at that position. @code{read-string!} returns the actual number of characters read.
     5613Read or write @code{NUM} characters from/to @code{PORT}, which defaults to the value of @code{(current-input-port)} or @code{(current-output-port)}, respectively. If @code{NUM} is @code{#f} or not given, then all data up to the end-of-file is read, or, in the case of @code{write-string} the whole string is written. If no more input is available, @code{read-string} returns the empty string. @code{read-string!} reads destructively into the given @code{STRING} argument, but never more characters that would fit into @code{STRING}. If @code{START} is given, then the read characters are stored starting at that position. @code{read-string!} returns the actual number of characters read.
    52165614
    52175615@node Unit extras - Input/Output extensions - read-token, Unit extras - Input/Output extensions - with-error-output-to-port, Unit extras - Input/Output extensions - write-string, Unit extras - Input/Output extensions
     
    52795677Returns a string with the string-represenation of all arguments concatenated together. @code{conc} could be implemented as
    52805678
    5281 <enscript highlight=scheme> (define (conc . args)
    5282 
    5283 @verbatim
    5284  (apply string-append (map ->string args)) )
    5285 @end verbatim
    5286 </enscript>
    5287 
     5679@example
     5680(@strong{define} (@strong{conc} . args)
     5681  (apply string-append (map ->string args)) )
     5682@end example
    52885683@node Unit extras - Strings - ->string, Unit extras - Strings - string-chop, Unit extras - Strings - conc, Unit extras - Strings
    52895684@subsection ->string
     
    53045699Returns a list of substrings taken by @emph{chopping} @code{STRING} every @code{LENGTH} characters:
    53055700
    5306 <enscript highlight=scheme> (string-chop "one two three" 4)  ==>  ("one " "two " "thre" "e") </enscript>
    5307 
     5701@example
     5702(string-chop @strong{"one two three"} 4)  =@strong{=>}  (@strong{"one "} @strong{"two "} @strong{"thre"} @strong{"e"})
     5703@end example
    53085704@node Unit extras - Strings - string-chomp, Unit extras - Strings - string-compare3, Unit extras - Strings - string-chop, Unit extras - Strings
    53095705@subsection string-chomp
     
    53345730Returns a string that contains all strings in @code{LIST} concatenated together.  @code{STRING} is placed between each concatenated string and defaults to @code{" "}.
    53355731
    5336 <enscript highlight=scheme> (string-intersperse '("one" "two") "three") </enscript>
    5337 
     5732@example
     5733(string-intersperse '(@strong{"one"} @strong{"two"}) @strong{"three"})
     5734@end example
    53385735is equivalent to
    53395736
    5340 <enscript highlight=scheme> (apply string-append (intersperse '("one" "two") "three")) </enscript>
    5341 
     5737@example
     5738(apply string-append (intersperse '(@strong{"one"} @strong{"two"}) @strong{"three"}))
     5739@end example
    53425740@node Unit extras - Strings - string-split, Unit extras - Strings - string-translate, Unit extras - Strings - string-intersperse, Unit extras - Strings
    53435741@subsection string-split
     
    53475745[procedure] (string-split STRING [DELIMITER-STRING [KEEPEMPTY]])
    53485746@end verbatim
    5349 Split string into substrings separated by the given delimiters. If no delimiters are specified, a string comprising the tab, newline and space characters  is assumed. If the parameter @code{KEEPEMPTY} is given and not @code{#f}, then empty substrings are retained:
    5350 
    5351 <enscript highlight=scheme> (string-split "one  two  three") ==> ("one" "two" "three") (string-split "foo:bar::baz:" ":" #t) ==> ("foo" "bar" "" "baz" "") </enscript>
    5352 
     5747Split string into substrings separated by the given delimiters. If no delimiters are specified, a string comprising the tab, newline and space characters is assumed. If the parameter @code{KEEPEMPTY} is given and not @code{#f}, then empty substrings are retained:
     5748
     5749@example
     5750(string-split @strong{"one  two  three"}) =@strong{=>} (@strong{"one"} @strong{"two"} @strong{"three"})
     5751(string-split @strong{"foo:bar::baz:"} @strong{":"} #t) =@strong{=>} (@strong{"foo"} @strong{"bar"} @strong{""} @strong{"baz"} @strong{""})
     5752@end example
    53535753@node Unit extras - Strings - string-translate, Unit extras - Strings - string-translate*, Unit extras - Strings - string-split, Unit extras - Strings
    53545754@subsection string-translate
     
    53695769Substitutes elements of @code{STRING} according to @code{SMAP}. @code{SMAP} should be an association-list where each element of the list is a pair of the form @code{(MATCH \. REPLACEMENT)}. Every occurrence of the string @code{MATCH} in @code{STRING} will be replaced by the string @code{REPLACEMENT}:
    53705770
    5371 <enscript highlight=scheme> (string-translate*
    5372 
    5373 @verbatim
    5374  "<h1>this is a \"string\"</h1>"
    5375  '(("<" . "&lt;") (">" . "&gt;") ("\"" . "&quot;")) )
    5376 @end verbatim
    5377 =>  "&lt;h1&gt;this is a &quot;string&quot;&lt;/ht&gt;" </enscript>
    5378 
     5771@example
     5772(string-translate*
     5773  @strong{"<h1>this is a \"string\"</h1>"}
     5774  '((@strong{"<"} . @strong{"&lt;"}) (@strong{">"} . @strong{"&gt;"}) (@strong{"\""} . @strong{"&quot;"})) )
     5775@strong{=>}  @strong{"&lt;h1&gt;this is a &quot;string&quot;&lt;/ht&gt;"}
     5776@end example
    53795777@node Unit extras - Strings - substring=?, Unit extras - Strings - substring-index, Unit extras - Strings - string-translate*, Unit extras - Strings
    53805778@subsection substring=?
     
    54025800@menu
    54035801* Unit extras - Combinators - any?::
     5802* Unit extras - Combinators - none?::
     5803* Unit extras - Combinators - always?::
     5804* Unit extras - Combinators - never?::
    54045805* Unit extras - Combinators - constantly::
    54055806* Unit extras - Combinators - complement::
     
    54145815* Unit extras - Combinators - noop::
    54155816* Unit extras - Combinators - o::
    5416 
    5417 @end menu
    5418 
    5419 
    5420 @node Unit extras - Combinators - any?, Unit extras - Combinators - constantly,  , Unit extras - Combinators
     5817* Unit extras - Combinators - left-section::
     5818* Unit extras - Combinators - right-section::
     5819
     5820@end menu
     5821
     5822
     5823@node Unit extras - Combinators - any?, Unit extras - Combinators - none?,  , Unit extras - Combinators
    54215824@subsection any?
    54225825
     
    54275830Ignores its argument and always returns @code{#t}. This is actually useful sometimes.
    54285831
    5429 @node Unit extras - Combinators - constantly, Unit extras - Combinators - complement, Unit extras - Combinators - any?, Unit extras - Combinators
     5832@node Unit extras - Combinators - none?, Unit extras - Combinators - always?, Unit extras - Combinators - any?, Unit extras - Combinators
     5833@subsection none?
     5834
     5835
     5836@verbatim
     5837[procedure] (none? X)
     5838@end verbatim
     5839Ignores its argument and always returns @code{#f}. This is actually useful sometimes.
     5840
     5841@node Unit extras - Combinators - always?, Unit extras - Combinators - never?, Unit extras - Combinators - none?, Unit extras - Combinators
     5842@subsection always?
     5843
     5844
     5845@verbatim
     5846[procedure] (always? X ...)
     5847@end verbatim
     5848Ignores its arguments and always returns @code{#t}. This is actually useful sometimes.
     5849
     5850@node Unit extras - Combinators - never?, Unit extras - Combinators - constantly, Unit extras - Combinators - always?, Unit extras - Combinators
     5851@subsection never?
     5852
     5853
     5854@verbatim
     5855[procedure] (never? X ...)
     5856@end verbatim
     5857Ignores its arguments and always returns @code{#f}. This is actually useful sometimes.
     5858
     5859@node Unit extras - Combinators - constantly, Unit extras - Combinators - complement, Unit extras - Combinators - never?, Unit extras - Combinators
    54305860@subsection constantly
    54315861
     
    54365866Returns a procedure that always returns the values @code{X ...} regardless of the number and value of its arguments.
    54375867
    5438 <enscript highlight=scheme> (constantly X) <=> (lambda args X) </enscript>
    5439 
     5868@example
     5869(constantly X) <@strong{=>} (@strong{lambda} args X)
     5870@end example
    54405871@node Unit extras - Combinators - complement, Unit extras - Combinators - compose, Unit extras - Combinators - constantly, Unit extras - Combinators
    54415872@subsection complement
     
    54475878Returns a procedure that returns the boolean inverse of @code{PROC}.
    54485879
    5449 <enscript highlight=scheme> (complement PROC) <=> (lambda (x) (not (PROC x))) </enscript>
    5450 
     5880@example
     5881(complement PROC) <@strong{=>} (@strong{lambda} (x) (not (PROC x)))
     5882@end example
    54515883@node Unit extras - Combinators - compose, Unit extras - Combinators - conjoin, Unit extras - Combinators - complement, Unit extras - Combinators
    54525884@subsection compose
     
    54585890Returns a procedure that represents the composition of the argument-procedures @code{PROC1 PROC2 ...}.
    54595891
    5460 <enscript highlight=scheme> (compose F G) <=> (lambda args
    5461 
    5462 @verbatim
    5463                      (call-with-values
    5464                         (lambda () (apply G args))
    5465                         F))
    5466 @end verbatim
    5467 </enscript>
    5468 
     5892@example
     5893(compose F G) <@strong{=>} (@strong{lambda} args
     5894                      (call-with-values
     5895                         (@strong{lambda} () (apply G args))
     5896                         F))
     5897@end example
    54695898@code{(compose)} is equivalent to @code{values}.
    54705899
     
    54765905[procedure] (conjoin PRED ...)
    54775906@end verbatim
    5478 Returns a procedure that returns @code{#t} if its argument satisfies the predicates @code{PRED ...}. <enscript highlight=scheme> ((conjoin odd? positive?) 33)   ==>  #t ((conjoin odd? positive?) -33)  ==>  #f </enscript>
     5907Returns a procedure that returns @code{#t} if its argument satisfies the predicates @code{PRED ...}. @example
     5908((conjoin odd? positive?) 33)   =@strong{=>}  #t
     5909((conjoin odd? positive?) -33)  =@strong{=>}  #f
     5910@end example
     5911
    54795912
    54805913@node Unit extras - Combinators - disjoin, Unit extras - Combinators - each, Unit extras - Combinators - conjoin, Unit extras - Combinators
     
    54855918[procedure] (disjoin PRED ...)
    54865919@end verbatim
    5487 Returns a procedure that returns @code{#t} if its argument satisfies any predicate @code{PRED ...}. <enscript highlight=scheme> ((disjoin odd? positive?) 32)    ==>  #t ((disjoin odd? positive?) -32)   ==>  #f </enscript>
     5920Returns a procedure that returns @code{#t} if its argument satisfies any predicate @code{PRED ...}. @example
     5921((disjoin odd? positive?) 32)    =@strong{=>}  #t
     5922((disjoin odd? positive?) -32)   =@strong{=>}  #f
     5923@end example
     5924
    54885925
    54895926@node Unit extras - Combinators - each, Unit extras - Combinators - flip, Unit extras - Combinators - disjoin, Unit extras - Combinators
     
    54965933Returns a procedure that applies @code{PROC ...} to its arguments, and returns the result(s) of the last procedure application. For example
    54975934
    5498 <enscript highlight=scheme> (each pp eval) </enscript>
    5499 
     5935@example
     5936(each pp eval)
     5937@end example
    55005938is equivalent to
    55015939
    5502 <enscript highlight=scheme> (lambda args
    5503 
    5504 @verbatim
    5505  (apply pp args)
    5506  (apply eval args) )
    5507 @end verbatim
    5508 </enscript>
    5509 
     5940@example
     5941(@strong{lambda} args
     5942  (apply pp args)
     5943  (apply eval args) )
     5944@end example
    55105945@code{(each PROC)} is equivalent to @code{PROC} and @code{(each)} is equivalent to @code{noop}.
    55115946
     
    55175952[procedure] (flip PROC)
    55185953@end verbatim
    5519 Returns a two-argument procedure that calls @code{PROC} with its arguments swapped: <enscript highlight=scheme> (flip PROC) <=> (lambda (x y) (PROC y x)) </enscript>
     5954Returns a two-argument procedure that calls @code{PROC} with its arguments swapped: @example
     5955(flip PROC) <@strong{=>} (@strong{lambda} (x y) (PROC y x))
     5956@end example
     5957
    55205958
    55215959@node Unit extras - Combinators - identity, Unit extras - Combinators - project, Unit extras - Combinators - flip, Unit extras - Combinators
     
    55465984Returns a procedure of one argument that returns @code{#t} when applied to a list of elements that all satisfy the predicate procedure @code{PRED}, or @code{#f} otherwise.
    55475985
    5548 <enscript highlight=scheme> ((list-of even?) '(1 2 3))   ==> #f ((list-of number?) '(1 2 3)) ==> #t </enscript>
    5549 
     5986@example
     5987((list-of even?) '(1 2 3))   =@strong{=>} #f
     5988((list-of number?) '(1 2 3)) =@strong{=>} #t
     5989@end example
    55505990@node Unit extras - Combinators - noop, Unit extras - Combinators - o, Unit extras - Combinators - list-of, Unit extras - Combinators
    55515991@subsection noop
     
    55575997Ignores it's arguments, does nothing and returns an unspecified value.
    55585998
    5559 @node Unit extras - Combinators - o,  , Unit extras - Combinators - noop, Unit extras - Combinators
     5999@node Unit extras - Combinators - o, Unit extras - Combinators - left-section, Unit extras - Combinators - noop, Unit extras - Combinators
    55606000@subsection o
    55616001
     
    55656005@end verbatim
    55666006A single value version of @code{compose} (slightly faster). @code{(o)} is equivalent to @code{identity}.
     6007
     6008@node Unit extras - Combinators - left-section, Unit extras - Combinators - right-section, Unit extras - Combinators - o, Unit extras - Combinators
     6009@subsection left-section
     6010
     6011
     6012@verbatim
     6013[procedure] (left-section PROC ARG ...)
     6014@end verbatim
     6015A left section partially applies arguments starting from the left.
     6016
     6017Returns a variadic procedure in which some prefix of its arguments, @code{ARG ...}, are partially applied to @code{PROC}.
     6018
     6019@node Unit extras - Combinators - right-section,  , Unit extras - Combinators - left-section, Unit extras - Combinators
     6020@subsection right-section
     6021
     6022
     6023@verbatim
     6024[procedure] (right-section PROC ARG ...)
     6025@end verbatim
     6026A right section partially applies arguments starting from the right.
     6027
     6028Returns a variadic procedure in which some reversed suffix of its arguments, @code{ARG ...}, are partially applied to @code{PROC}.
    55676029
    55686030@node Unit extras - Binary searching,  , Unit extras - Combinators, Unit extras
     
    58866348[procedure] (read-u8vector LENGTH [PORT])
    58876349@end verbatim
    5888 Reads @code{LENGTH} bytes from the @code{PORT} and returns a fresh @code{u8vector} or less of end-of-file is encountered. @code{PORT} defaults to the value of @code{(current-input-port)}. If @code{LENGTH} is @code{#f}, the vector will be filled completely until end-of-file is reached.
     6350Reads @code{LENGTH} bytes from the @code{PORT} and returns a fresh @code{u8vector} or less if end-of-file is encountered. @code{PORT} defaults to the value of @code{(current-input-port)}. If @code{LENGTH} is @code{#f}, the vector will be filled completely until end-of-file is reached.
    58896351
    58906352@node Unit srfi-4 - read-u8vector!, Unit srfi-4 - write-u8vector, Unit srfi-4 - read-u8vector, Unit srfi-4
     
    59186380On systems that support dynamic loading, the @code{srfi-13} unit can be made available in the interpreter (@code{csi}) by entering
    59196381
    5920 <enscript highlight=scheme> (require-extension srfi-13) </enscript>
    5921 
     6382@example
     6383(require-extension srfi-13)
     6384@end example
    59226385Previous: @ref{Unit srfi-4, Unit srfi-4}
    59236386
     
    59326395On systems that support dynamic loading, the @code{srfi-14} unit can be made available in the interpreter (@code{csi}) by entering
    59336396
    5934 <enscript highlight=scheme> (require-extension srfi-14) </enscript>
    5935 
     6397@example
     6398(require-extension srfi-14)
     6399@end example
    59366400This library provides only the Latin-1 character set.
    59376401
     
    59576421* Unit regex - glob->regexp::
    59586422* Unit regex - glob?::
     6423* Unit regex - regex-chardef-table?::
     6424* Unit regex - regex-chardef-table::
    59596425* Unit regex - regexp::
     6426* Unit regex - regexp*::
    59606427* Unit regex - regexp?::
     6428* Unit regex - regexp-optimize::
    59616429* Unit regex - string-match::
    59626430* Unit regex - string-match-positions::
     
    59676435* Unit regex - string-substitute*::
    59686436* Unit regex - regexp-escape::
    5969 
    5970 @end menu
    5971 
    5972 
    5973 This library unit provides support for regular expressions. The regular  expression package used is @code{PCRE} (@emph{Perl Compatible Regular Expressions})  written by Philip Hazel. See @uref{http://www.pcre.org, http://www.pcre.org} for information about the particular regexp flavor and extensions provided by this library.
     6437* Unit regex - make-anchored-pattern::
     6438
     6439@end menu
     6440
     6441
     6442This library unit provides support for regular expressions. The regular expression package used is @code{PCRE} (@emph{Perl Compatible Regular Expressions}) written by Philip Hazel. See @uref{http://www.pcre.org, http://www.pcre.org} for information about the particular regexp flavor and extensions provided by this library.
    59746443
    59756444To test that PCRE support has been built into Chicken properly, try:
    59766445
    5977 <enscript highlight=scheme> (require 'regex) (test-feature? 'pcre) => t </enscript>
    5978 
     6446@example
     6447(require 'regex)
     6448(test-feature? 'pcre) @strong{=>} #t
     6449@end example
    59796450@node Unit regex - grep, Unit regex - glob->regexp,  , Unit regex
    59806451@section grep
     
    59866457Returns all items of @code{LIST} that match the regular expression @code{REGEX}.  This procedure could be defined as follows:
    59876458
    5988 <enscript highlight=scheme> (define (grep regex lst)
    5989 
    5990 @verbatim
    5991  (filter (lambda (x) (string-search regex x)) lst) )
    5992 @end verbatim
    5993 </enscript>
    5994 
     6459@example
     6460(@strong{define} (@strong{grep} regex lst)
     6461  (filter (@strong{lambda} (x) (string-search regex x)) lst) )
     6462@end example
    59956463@node Unit regex - glob->regexp, Unit regex - glob?, Unit regex - grep, Unit regex
    59966464@section glob->regexp
     
    60026470Converts the file-pattern @code{PATTERN} into a regular expression.
    60036471
    6004 <enscript highlight=scheme> (glob->regexp "foo.*") => "foo\..*" </enscript>
    6005 
     6472@example
     6473(glob->regexp @strong{"foo.*"})
     6474@strong{=>} @strong{"foo\..*"}
     6475@end example
    60066476@code{PATTERN} should follow "glob" syntax. Allowed wildcards are
    60076477
     
    60136483?
    60146484@end verbatim
    6015 @node Unit regex - glob?, Unit regex - regexp, Unit regex - glob->regexp, Unit regex
     6485@node Unit regex - glob?, Unit regex - regex-chardef-table?, Unit regex - glob->regexp, Unit regex
    60166486@section glob?
    60176487
     
    60246494A string without any "glob" wildcards does not meet the criteria, even though it technically is a valid "glob" file-pattern.
    60256495
    6026 @node Unit regex - regexp, Unit regex - regexp?, Unit regex - glob?, Unit regex
     6496@node Unit regex - regex-chardef-table?, Unit regex - regex-chardef-table, Unit regex - glob?, Unit regex
     6497@section regex-chardef-table?
     6498
     6499
     6500@verbatim
     6501[procedure] (regex-chardef-table? OBJECT)
     6502@end verbatim
     6503Returns @code{#t} if the @code{OBJECT} is a @code{character definitions table}, and @code{#f} otherwise.
     6504
     6505@node Unit regex - regex-chardef-table, Unit regex - regexp, Unit regex - regex-chardef-table?, Unit regex
     6506@section regex-chardef-table
     6507
     6508
     6509@verbatim
     6510[procedure] (regex-chardef-table)
     6511@end verbatim
     6512Returns a new @code{character definitions table}.
     6513
     6514@node Unit regex - regexp, Unit regex - regexp*, Unit regex - regex-chardef-table, Unit regex
    60276515@section regexp
    60286516
     
    60336521Returns a precompiled regular expression object for @code{string}. The optional arguments @code{IGNORECASE}, @code{IGNORESPACE} and @code{UTF8} specify whether the regular expression should be matched with case- or whitespace-differences ignored, or whether the string should be treated as containing UTF-8 encoded characters, respectively.
    60346522
    6035 @node Unit regex - regexp?, Unit regex - string-match, Unit regex - regexp, Unit regex
     6523@node Unit regex - regexp*, Unit regex - regexp?, Unit regex - regexp, Unit regex
     6524@section regexp*
     6525
     6526@menu
     6527* Unit regex - regexp* - Option Symbols;::
     6528
     6529@end menu
     6530
     6531
     6532@verbatim
     6533[procedure] (regexp* STRING [OPTIONS [CHARDEFS-TABLE]])
     6534@end verbatim
     6535Returns a precompiled regular expression object for @code{string}. The optional argument @code{OPTIONS} must be a list of option symbols. The optional argument @code{CHARDEFS-TABLE} must be a character definitions table.
     6536
     6537@node Unit regex - regexp* - Option Symbols;,  ,  , Unit regex - regexp*
     6538@subsection Option Symbols:
     6539
     6540
     6541@table @b
     6542@item caseless
     6543
     6544Character case insensitive match
     6545@item multiline
     6546
     6547Equivalent to Perl's /m option
     6548@item dotall
     6549
     6550Equivalent to Perl's /s option
     6551@item extended
     6552
     6553Ignore whitespace
     6554@item anchored
     6555
     6556Anchor pattern match
     6557@item dollar-endonly
     6558
     6559`$' metacharacter in the pattern matches only at the end of the subject string
     6560@item extra
     6561
     6562Currently of very little use
     6563@item notbol
     6564
     6565First character of the string is not the beginning of a line
     6566@item noteol
     6567
     6568End of the string is not the end of a line
     6569@item ungreedy
     6570
     6571Inverts the "greediness" of the quantifiers so that they are not greedy by default
     6572@item notempty
     6573
     6574The empty string is not considered to be a valid match
     6575@item utf8
     6576
     6577UTF-8 encoded characters
     6578@item no-auto-capture
     6579
     6580Disables the use of numbered capturing parentheses
     6581@item no-utf8-check
     6582
     6583Skip valid UTF-8 sequence check
     6584@item auto-callout
     6585
     6586Automatically inserts callout items (not defined here)
     6587@item partial
     6588
     6589Partial match ok
     6590@item firstline
     6591
     6592An unanchored pattern is required to match before or at the first newline
     6593@item dupnames
     6594
     6595Names used to identify capturing subpatterns need not be unique
     6596@item newline-cr
     6597
     6598Newline definition is `\r'
     6599@item newline-lf
     6600
     6601Newline definition is `\n'
     6602@item newline-crlf
     6603
     6604Newline definition is `\r\n'
     6605@item newline-anycrlf
     6606
     6607Newline definition is any of `\r', `\n', or `\r\n'
     6608@item newline-any
     6609
     6610Newline definition is any Unicode newline sequence
     6611@item bsr-anycrlf
     6612
     6613`\R' escape sequence matches only CR, LF, or CRLF
     6614@item bsr-unicode
     6615
     6616`\R' escape sequence matches only Unicode newline sequence
     6617@item dfa-shortest
     6618
     6619Currently unused
     6620@item dfa-restart
     6621
     6622Currently unused
     6623
     6624@end table
     6625@node Unit regex - regexp?, Unit regex - regexp-optimize, Unit regex - regexp*, Unit regex
    60366626@section regexp?
    60376627
     
    60426632Returns @code{#t} if @code{X} is a precompiled regular expression, or @code{#f} otherwise.
    60436633
    6044 @node Unit regex - string-match, Unit regex - string-match-positions, Unit regex - regexp?, Unit regex
     6634@node Unit regex - regexp-optimize, Unit regex - string-match, Unit regex - regexp?, Unit regex
     6635@section regexp-optimize
     6636
     6637
     6638@verbatim
     6639[procedure] (regexp-optimize RX)
     6640@end verbatim
     6641Perform available optimizations for the precompiled regular expression @code{RX}. Returns @code{#t} when optimization performed, and @code{#f} otherwise.
     6642
     6643@node Unit regex - string-match, Unit regex - string-match-positions, Unit regex - regexp-optimize, Unit regex
    60456644@section string-match
    60466645
     
    60796678Splits @code{STRING} into a list of fields according to @code{MODE}, where @code{MODE} can be the keyword @code{#:infix} (@code{REGEXP} matches field separator), the keyword @code{#:suffix} (@code{REGEXP} matches field terminator) or @code{#t} (@code{REGEXP} matches field), which is the default.
    60806679
    6081 <enscript highlight=scheme> (define s "this is a string 1, 2, 3,")
    6082 
    6083 (string-split-fields "[^ ]+" s)
    6084 
    6085 @verbatim
    6086  => ("this" "is" "a" "string" "1," "2," "3,")
    6087 @end verbatim
    6088 (string-split-fields " " s #:infix)
    6089 
    6090 @verbatim
    6091  => ("this" "is" "a" "string" "1," "2," "3,")
    6092 @end verbatim
    6093 (string-split-fields "," s #:suffix))
    6094 
    6095 @verbatim
    6096 
    6097  => ("this is a string 1" " 2" " 3")
    6098 @end verbatim
    6099 </enscript>
    6100 
     6680@example
     6681(@strong{define} @strong{s} @strong{"this is a string 1, 2, 3,"})
     6682
     6683(string-split-fields @strong{"[^ ]+"} s)
     6684
     6685  @strong{=>} (@strong{"this"} @strong{"is"} @strong{"a"} @strong{"string"} @strong{"1,"} @strong{"2,"} @strong{"3,"})
     6686
     6687(string-split-fields @strong{" "} s #:infix)
     6688
     6689  @strong{=>} (@strong{"this"} @strong{"is"} @strong{"a"} @strong{"string"} @strong{"1,"} @strong{"2,"} @strong{"3,"})
     6690
     6691(string-split-fields @strong{","} s #:suffix)
     6692
     6693  @strong{=>} (@strong{"this is a string 1"} @strong{" 2"} @strong{" 3"})
     6694@end example
    61016695@node Unit regex - string-substitute, Unit regex - string-substitute*, Unit regex - string-split-fields, Unit regex
    61026696@section string-substitute
     
    61066700[procedure] (string-substitute REGEXP SUBST STRING [MODE])
    61076701@end verbatim
    6108 Searches substrings in @code{STRING} that match @code{REGEXP} and substitutes them with the string @code{SUBST}. The substitution can contain references to subexpressions in  @code{REGEXP} with the @code{\NUM} notation, where @code{NUM} refers to the NUMth parenthesized expression. The optional argument @code{MODE} defaults to 1 and specifies the number of the match to be substituted. Any non-numeric index specifies that all matches are to be substituted.
    6109 
    6110 <enscript highlight=scheme> (string-substitute "([0-9]+) (eggs|chicks)"
    6111 
    6112 @verbatim
    6113                   "\\2 (\\1)" "99 eggs or 99 chicks" 2)
    6114 @end verbatim
    6115 => "99 eggs or chicks (99)" </enscript>
    6116 
     6702Searches substrings in @code{STRING} that match @code{REGEXP} and substitutes them with the string @code{SUBST}. The substitution can contain references to subexpressions in @code{REGEXP} with the @code{\NUM} notation, where @code{NUM} refers to the NUMth parenthesized expression. The optional argument @code{MODE} defaults to 1 and specifies the number of the match to be substituted. Any non-numeric index specifies that all matches are to be substituted.
     6703
     6704@example
     6705(string-substitute @strong{"([0-9]+) (eggs|chicks)"}
     6706                   @strong{"\\2 (\\1)"} @strong{"99 eggs or 99 chicks"} 2)
     6707@strong{=>} @strong{"99 eggs or chicks (99)"}
     6708@end example
    61176709Note that a regular expression that matches an empty string will signal an error.
    61186710
     
    61266718Substitutes elements of @code{STRING} with @code{string-substitute} according to @code{SMAP}. @code{SMAP} should be an association-list where each element of the list is a pair of the form @code{(MATCH . REPLACEMENT)}. Every occurrence of the regular expression @code{MATCH} in @code{STRING} will be replaced by the string @code{REPLACEMENT}
    61276719
    6128 <enscript highlight=scheme> (string-substitute* "<h1>Hello, world!</h1>"
    6129 
    6130 @verbatim
    6131                    '(("<[/A-Za-z0-9]+>" . ""))))
    6132 @end verbatim
    6133 =>  "Hello, world!" </enscript>
    6134 
    6135 @node Unit regex - regexp-escape,  , Unit regex - string-substitute*, Unit regex
     6720@example
     6721(string-substitute* @strong{"<h1>Hello, world!</h1>"}
     6722                    '((@strong{"<[/A-Za-z0-9]+>"} . @strong{""})))
     6723
     6724@strong{=>}  @strong{"Hello, world!"}
     6725@end example
     6726@node Unit regex - regexp-escape, Unit regex - make-anchored-pattern, Unit regex - string-substitute*, Unit regex
    61366727@section regexp-escape
    61376728
     
    61426733Escapes all special characters in @code{STRING} with @code{\}, so that the string can be embedded into a regular expression.
    61436734
    6144 <enscript highlight=scheme> (regexp-escape "^[0-9]+:.*$") =>  "\\^\\[0-9\\]\\+:.\n.\\*\\$" </enscript>
     6735@example
     6736(regexp-escape @strong{"^[0-9]+:.*$"})
     6737@strong{=>}  @strong{"\\^\\[0-9\\]\\+:.\n.\\*\\$"}
     6738@end example
     6739@node Unit regex - make-anchored-pattern,  , Unit regex - regexp-escape, Unit regex
     6740@section make-anchored-pattern
     6741
     6742
     6743@verbatim
     6744[procedure] (make-anchored-pattern REGEXP [WITHOUT-BOL [WITHOUT-EOL]])
     6745@end verbatim
     6746Makes an anchored pattern from @code{REGEXP} (a string or a precompiled regular expression) and returns the updated pattern. When @code{WITHOUT-BOL} is @code{#t} the beginning-of-line anchor is not added. When @code{WITHOUT-EOL} is @code{#t} the end-of-line anchor is not added.
     6747
     6748The @code{WITHOUT-BOL} and @{WITHOUT-EOL@}@} arguments are ignored for a precompiled regular expression.
    61456749
    61466750Previous: @ref{Unit match, Unit match}
     
    61576761* Unit srfi-18 - thread-suspend!::
    61586762* Unit srfi-18 - thread-resume!::
     6763* Unit srfi-18 - thread-wait-for-i/o!::
    61596764* Unit srfi-18 - time->milliseconds::
    61606765
     
    62326837Suspends the execution of @code{THREAD} until resumed.
    62336838
    6234 @node Unit srfi-18 - thread-resume!, Unit srfi-18 - time->milliseconds, Unit srfi-18 - thread-suspend!, Unit srfi-18
     6839@node Unit srfi-18 - thread-resume!, Unit srfi-18 - thread-wait-for-i/o!, Unit srfi-18 - thread-suspend!, Unit srfi-18
    62356840@section thread-resume!
    62366841
     
    62416846Readies the suspended thread @code{THREAD}.
    62426847
    6243 @node Unit srfi-18 - time->milliseconds,  , Unit srfi-18 - thread-resume!, Unit srfi-18
     6848@node Unit srfi-18 - thread-wait-for-i/o!, Unit srfi-18 - time->milliseconds, Unit srfi-18 - thread-resume!, Unit srfi-18
     6849@section thread-wait-for-i/o!
     6850
     6851
     6852@verbatim
     6853[procedure] (thread-wait-for-i/o! FD [MODE])
     6854@end verbatim
     6855Suspends the current thread until input (@code{MODE} is @code{#:input}), output (@code{MODE} is @code{#:output}) or both (@code{MODE} is @code{#:all}) is available. @code{FD} should be a file-descriptor (not a port!) open for input or output, respectively.
     6856
     6857@node Unit srfi-18 - time->milliseconds,  , Unit srfi-18 - thread-wait-for-i/o!, Unit srfi-18
    62446858@section time->milliseconds
    62456859
     
    62586872
    62596873@menu
     6874* Unit posix - Constants::
    62606875* Unit posix - Directories::
    62616876* Unit posix - Pipes::
     
    62666881* Unit posix - Processes::
    62676882* Unit posix - Hard and symbolic links::
    6268 * Unit posix - Permissions::
     6883* Unit posix - Retrieving user & group information::
     6884* Unit posix - Changing user & group information::
    62696885* Unit posix - Record locking::
    62706886* Unit posix - Signal handling::
     
    62906906All errors related to failing file-operations will signal a condition of kind @code{(exn i/o file)}.
    62916907
    6292 @node Unit posix - Directories, Unit posix - Pipes,  , Unit posix
     6908@node Unit posix - Constants, Unit posix - Directories,  , Unit posix
     6909@section Constants
     6910
     6911@menu
     6912* Unit posix - Constants - File-control Commands::
     6913* Unit posix - Constants - Standard I/O file-descriptors::
     6914* Unit posix - Constants - Open flags::
     6915* Unit posix - Constants - Permission bits::
     6916
     6917@end menu
     6918
     6919
     6920@node Unit posix - Constants - File-control Commands, Unit posix - Constants - Standard I/O file-descriptors,  , Unit posix - Constants
     6921@subsection File-control Commands
     6922
     6923@menu
     6924* Unit posix - Constants - File-control Commands - fcntl/dupfd::
     6925* Unit posix - Constants - File-control Commands - fcntl/getfd::
     6926* Unit posix - Constants - File-control Commands - fcntl/setfd::
     6927* Unit posix - Constants - File-control Commands - fcntl/getfl::
     6928* Unit posix - Constants - File-control Commands - fcntl/setfl::
     6929
     6930@end menu
     6931
     6932
     6933@node Unit posix - Constants - File-control Commands - fcntl/dupfd, Unit posix - Constants - File-control Commands - fcntl/getfd,  , Unit posix - Constants - File-control Commands
     6934@subsubsection fcntl/dupfd
     6935
     6936
     6937@node Unit posix - Constants - File-control Commands - fcntl/getfd, Unit posix - Constants - File-control Commands - fcntl/setfd, Unit posix - Constants - File-control Commands - fcntl/dupfd, Unit posix - Constants - File-control Commands
     6938@subsubsection fcntl/getfd
     6939
     6940
     6941@node Unit posix - Constants - File-control Commands - fcntl/setfd, Unit posix - Constants - File-control Commands - fcntl/getfl, Unit posix - Constants - File-control Commands - fcntl/getfd, Unit posix - Constants - File-control Commands
     6942@subsubsection fcntl/setfd
     6943
     6944
     6945@node Unit posix - Constants - File-control Commands - fcntl/getfl, Unit posix - Constants - File-control Commands - fcntl/setfl, Unit posix - Constants - File-control Commands - fcntl/setfd, Unit posix - Constants - File-control Commands
     6946@subsubsection fcntl/getfl
     6947
     6948
     6949@node Unit posix - Constants - File-control Commands - fcntl/setfl,  , Unit posix - Constants - File-control Commands - fcntl/getfl, Unit posix - Constants - File-control Commands
     6950@subsubsection fcntl/setfl
     6951
     6952
     6953@node Unit posix - Constants - Standard I/O file-descriptors, Unit posix - Constants - Open flags, Unit posix - Constants - File-control Commands, Unit posix - Constants
     6954@subsection Standard I/O file-descriptors
     6955
     6956@menu
     6957* Unit posix - Constants - Standard I/O file-descriptors - fileno/stdin::
     6958* Unit posix - Constants - Standard I/O file-descriptors - fileno/stdout::
     6959* Unit posix - Constants - Standard I/O file-descriptors - fileno/stderr::
     6960
     6961@end menu
     6962
     6963
     6964@node Unit posix - Constants - Standard I/O file-descriptors - fileno/stdin, Unit posix - Constants - Standard I/O file-descriptors - fileno/stdout,  , Unit posix - Constants - Standard I/O file-descriptors
     6965@subsubsection fileno/stdin
     6966
     6967
     6968@node Unit posix - Constants - Standard I/O file-descriptors - fileno/stdout, Unit posix - Constants - Standard I/O file-descriptors - fileno/stderr, Unit posix - Constants - Standard I/O file-descriptors - fileno/stdin, Unit posix - Constants - Standard I/O file-descriptors
     6969@subsubsection fileno/stdout
     6970
     6971
     6972@node Unit posix - Constants - Standard I/O file-descriptors - fileno/stderr,  , Unit posix - Constants - Standard I/O file-descriptors - fileno/stdout, Unit posix - Constants - Standard I/O file-descriptors
     6973@subsubsection fileno/stderr
     6974
     6975
     6976@node Unit posix - Constants - Open flags, Unit posix - Constants - Permission bits, Unit posix - Constants - Standard I/O file-descriptors, Unit posix - Constants
     6977@subsection Open flags
     6978
     6979@menu
     6980* Unit posix - Constants - Open flags - open/rdonly::
     6981* Unit posix - Constants - Open flags - open/wronly::
     6982* Unit posix - Constants - Open flags - open/rdwr::
     6983* Unit posix - Constants - Open flags - open/read::
     6984* Unit posix - Constants - Open flags - open/write::
     6985* Unit posix - Constants - Open flags - open/creat::
     6986* Unit posix - Constants - Open flags - open/append::
     6987* Unit posix - Constants - Open flags - open/excl::
     6988* Unit posix - Constants - Open flags - open/noctty::
     6989* Unit posix - Constants - Open flags - open/nonblock::
     6990* Unit posix - Constants - Open flags - open/trunc::
     6991* Unit posix - Constants - Open flags - open/sync::
     6992* Unit posix - Constants - Open flags - open/fsync::
     6993* Unit posix - Constants - Open flags - open/binary::
     6994* Unit posix - Constants - Open flags - open/text::
     6995
     6996@end menu
     6997
     6998
     6999@node Unit posix - Constants - Open flags - open/rdonly, Unit posix - Constants - Open flags - open/wronly,  , Unit posix - Constants - Open flags
     7000@subsubsection open/rdonly
     7001
     7002
     7003@node Unit posix - Constants - Open flags - open/wronly, Unit posix - Constants - Open flags - open/rdwr, Unit posix - Constants - Open flags - open/rdonly, Unit posix - Constants - Open flags
     7004@subsubsection open/wronly
     7005
     7006
     7007@node Unit posix - Constants - Open flags - open/rdwr, Unit posix - Constants - Open flags - open/read, Unit posix - Constants - Open flags - open/wronly, Unit posix - Constants - Open flags
     7008@subsubsection open/rdwr
     7009
     7010
     7011@node Unit posix - Constants - Open flags - open/read, Unit posix - Constants - Open flags - open/write, Unit posix - Constants - Open flags - open/rdwr, Unit posix - Constants - Open flags
     7012@subsubsection open/read
     7013
     7014
     7015@node Unit posix - Constants - Open flags - open/write, Unit posix - Constants - Open flags - open/creat, Unit posix - Constants - Open flags - open/read, Unit posix - Constants - Open flags
     7016@subsubsection open/write
     7017
     7018
     7019@node Unit posix - Constants - Open flags - open/creat, Unit posix - Constants - Open flags - open/append, Unit posix - Constants - Open flags - open/write, Unit posix - Constants - Open flags
     7020@subsubsection open/creat
     7021
     7022
     7023@node Unit posix - Constants - Open flags - open/append, Unit posix - Constants - Open flags - open/excl, Unit posix - Constants - Open flags - open/creat, Unit posix - Constants - Open flags
     7024@subsubsection open/append
     7025
     7026
     7027@node Unit posix - Constants - Open flags - open/excl, Unit posix - Constants - Open flags - open/noctty, Unit posix - Constants - Open flags - open/append, Unit posix - Constants - Open flags
     7028@subsubsection open/excl
     7029
     7030
     7031@node Unit posix - Constants - Open flags - open/noctty, Unit posix - Constants - Open flags - open/nonblock, Unit posix - Constants - Open flags - open/excl, Unit posix - Constants - Open flags
     7032@subsubsection open/noctty
     7033
     7034
     7035@node Unit posix - Constants - Open flags - open/nonblock, Unit posix - Constants - Open flags - open/trunc, Unit posix - Constants - Open flags - open/noctty, Unit posix - Constants - Open flags
     7036@subsubsection open/nonblock
     7037
     7038
     7039@node Unit posix - Constants - Open flags - open/trunc, Unit posix - Constants - Open flags - open/sync, Unit posix - Constants - Open flags - open/nonblock, Unit posix - Constants - Open flags
     7040@subsubsection open/trunc
     7041
     7042
     7043@node Unit posix - Constants - Open flags - open/sync, Unit posix - Constants - Open flags - open/fsync, Unit posix - Constants - Open flags - open/trunc, Unit posix - Constants - Open flags
     7044@subsubsection open/sync
     7045
     7046
     7047@node Unit posix - Constants - Open flags - open/fsync, Unit posix - Constants - Open flags - open/binary, Unit posix - Constants - Open flags - open/sync, Unit posix - Constants - Open flags
     7048@subsubsection open/fsync
     7049
     7050
     7051@node Unit posix - Constants - Open flags - open/binary, Unit posix - Constants - Open flags - open/text, Unit posix - Constants - Open flags - open/fsync, Unit posix - Constants - Open flags
     7052@subsubsection open/binary
     7053
     7054
     7055@node Unit posix - Constants - Open flags - open/text,  , Unit posix - Constants - Open flags - open/binary, Unit posix - Constants - Open flags
     7056@subsubsection open/text
     7057
     7058
     7059@node Unit posix - Constants - Permission bits,  , Unit posix - Constants - Open flags, Unit posix - Constants
     7060@subsection Permission bits
     7061
     7062@menu
     7063* Unit posix - Constants - Permission bits - perm/irusr::
     7064* Unit posix - Constants - Permission bits - perm/iwusr::
     7065* Unit posix - Constants - Permission bits - perm/ixusr::
     7066* Unit posix - Constants - Permission bits - perm/irgrp::
     7067* Unit posix - Constants - Permission bits - perm/iwgrp::
     7068* Unit posix - Constants - Permission bits - perm/ixgrp::
     7069* Unit posix - Constants - Permission bits - perm/iroth::
     7070* Unit posix - Constants - Permission bits - perm/iwoth::
     7071* Unit posix - Constants - Permission bits - perm/ixoth::
     7072* Unit posix - Constants - Permission bits - perm/irwxu::
     7073* Unit posix - Constants - Permission bits - perm/irwxg::
     7074* Unit posix - Constants - Permission bits - perm/irwxo::
     7075* Unit posix - Constants - Permission bits - perm/isvtx::
     7076* Unit posix - Constants - Permission bits - perm/isuid::
     7077* Unit posix - Constants - Permission bits - perm/isgid::
     7078
     7079@end menu
     7080
     7081
     7082@node Unit posix - Constants - Permission bits - perm/irusr, Unit posix - Constants - Permission bits - perm/iwusr,  , Unit posix - Constants - Permission bits
     7083@subsubsection perm/irusr
     7084
     7085
     7086@node Unit posix - Constants - Permission bits - perm/iwusr, Unit posix - Constants - Permission bits - perm/ixusr, Unit posix - Constants - Permission bits - perm/irusr, Unit posix - Constants - Permission bits
     7087@subsubsection perm/iwusr
     7088
     7089
     7090@node Unit posix - Constants - Permission bits - perm/ixusr, Unit posix - Constants - Permission bits - perm/irgrp, Unit posix - Constants - Permission bits - perm/iwusr, Unit posix - Constants - Permission bits
     7091@subsubsection perm/ixusr
     7092
     7093
     7094@node Unit posix - Constants - Permission bits - perm/irgrp, Unit posix - Constants - Permission bits - perm/iwgrp, Unit posix - Constants - Permission bits - perm/ixusr, Unit posix - Constants - Permission bits
     7095@subsubsection perm/irgrp
     7096
     7097
     7098@node Unit posix - Constants - Permission bits - perm/iwgrp, Unit posix - Constants - Permission bits - perm/ixgrp, Unit posix - Constants - Permission bits - perm/irgrp, Unit posix - Constants - Permission bits
     7099@subsubsection perm/iwgrp
     7100
     7101
     7102@node Unit posix - Constants - Permission bits - perm/ixgrp, Unit posix - Constants - Permission bits - perm/iroth, Unit posix - Constants - Permission bits - perm/iwgrp, Unit posix - Constants - Permission bits
     7103@subsubsection perm/ixgrp
     7104
     7105
     7106@node Unit posix - Constants - Permission bits - perm/iroth, Unit posix - Constants - Permission bits - perm/iwoth, Unit posix - Constants - Permission bits - perm/ixgrp, Unit posix - Constants - Permission bits
     7107@subsubsection perm/iroth
     7108
     7109
     7110@node Unit posix - Constants - Permission bits - perm/iwoth, Unit posix - Constants - Permission bits - perm/ixoth, Unit posix - Constants - Permission bits - perm/iroth, Unit posix - Constants - Permission bits
     7111@subsubsection perm/iwoth
     7112
     7113
     7114@node Unit posix - Constants - Permission bits - perm/ixoth, Unit posix - Constants - Permission bits - perm/irwxu, Unit posix - Constants - Permission bits - perm/iwoth, Unit posix - Constants - Permission bits
     7115@subsubsection perm/ixoth
     7116
     7117
     7118@node Unit posix - Constants - Permission bits - perm/irwxu, Unit posix - Constants - Permission bits - perm/irwxg, Unit posix - Constants - Permission bits - perm/ixoth, Unit posix - Constants - Permission bits
     7119@subsubsection perm/irwxu
     7120
     7121
     7122@node Unit posix - Constants - Permission bits - perm/irwxg, Unit posix - Constants - Permission bits - perm/irwxo, Unit posix - Constants - Permission bits - perm/irwxu, Unit posix - Constants - Permission bits
     7123@subsubsection perm/irwxg
     7124
     7125
     7126@node Unit posix - Constants - Permission bits - perm/irwxo, Unit posix - Constants - Permission bits - perm/isvtx, Unit posix - Constants - Permission bits - perm/irwxg, Unit posix - Constants - Permission bits
     7127@subsubsection perm/irwxo
     7128
     7129
     7130@node Unit posix - Constants - Permission bits - perm/isvtx, Unit posix - Constants - Permission bits - perm/isuid, Unit posix - Constants - Permission bits - perm/irwxo, Unit posix - Constants - Permission bits
     7131@subsubsection perm/isvtx
     7132
     7133
     7134@node Unit posix - Constants - Permission bits - perm/isuid, Unit posix - Constants - Permission bits - perm/isgid, Unit posix - Constants - Permission bits - perm/isvtx, Unit posix - Constants - Permission bits
     7135@subsubsection perm/isuid
     7136
     7137
     7138@node Unit posix - Constants - Permission bits - perm/isgid,  , Unit posix - Constants - Permission bits - perm/isuid, Unit posix - Constants - Permission bits
     7139@subsubsection perm/isgid
     7140
     7141
     7142@node Unit posix - Directories, Unit posix - Pipes, Unit posix - Constants, Unit posix
    62937143@section Directories
    62947144
     
    64717321Temporarily set the value of @code{current-input-port/current-output-port} to a port for a pipe connected to the subprocess named in @code{CMDLINE} and call the procedure @code{THUNK} with no arguments. After @code{THUNK} returns normally the pipe is closed and the standard input-/output port is restored to its previous value and any result values are returned.
    64727322
    6473 <enscript highlight=scheme> (with-output-to-pipe
    6474 
    6475 @verbatim
    6476  "gs -dNOPAUSE -sDEVICE=jpeg -dBATCH -sOutputFile=signballs.jpg -g600x600 -q -"
    6477  (lambda ()
    6478    (print #<<EOF
    6479 %!IOPSC-1993 %%Creator: HAYAKAWA Takashi<@uref{mailto:xxxxxxxx@@xx.xxxxxx.xx.xx, xxxxxxxx@@xx.xxxxxx.xx.xx}>
    6480 /C/neg/d/mul/R/rlineto/E/exp/H@{@{cvx def@}repeat@}def/T/dup/g/gt/r/roll/J/ifelse 8
    6481 H/A/copy(z&v4QX&93r9AxYQOZomQalxS2w!!O&vMYa43d6r93rMYvx2dca!D&cjSnjSnjjS3o!v&6A
    6482 X&55SAxM1CD7AjYxTTd62rmxCnTdSST0g&12wECST!&!J0g&D1!&xM0!J0g!l&544dC2Ac96ra!m&3A
    6483 F&&vGoGSnCT0g&wDmlvGoS8wpn6wpS2wTCpS1Sd7ov7Uk7o4Qkdw!&Mvlx1S7oZES3w!J!J!Q&7185d
    6484 Z&lx1CS9d9nE4!k&X&MY7!&1!J!x&jdnjdS3odS!N&mmx1C2wEc!G&150Nx4!n&2o!j&43r!U&0777d
    6485 ]&2AY2A776ddT4oS3oSnMVC00VV0RRR45E42063rNz&v7UX&UOzF!F!J![&44ETCnVn!a&1CDN!Y&0M
    6486 V1c&j2AYdjmMdjjd!o&1r!M)@{( )T 0 4 3 r put T(/)g@{T(9)g@{cvn@}@{cvi@}J@}@{($)g[]J@}J
    6487 cvx@}forall/moveto/p/floor/w/div/S/add 29 H[@{[@{]setgray fill@}for Y@}for showpage
    6488 EOF
    6489 ) ) )
    6490 @end verbatim
    6491 </enscript>
    6492 
     7323@example
     7324(with-output-to-pipe
     7325  @strong{"gs -dNOPAUSE -sDEVICE=jpeg -dBATCH -sOutputFile=signballs.jpg -g600x600 -q -"}
     7326  (@strong{lambda} ()
     7327    (print #<<EOF
     7328 %!IOPSC-1993 %%Creator: HAYAKAWA Takashi<xxxxxxxx@@xx.xxxxxx.xx.xx>
     7329 /C/neg/d/mul/R/rlineto/E/exp/H@{@{cvx def@}repeat@}def/T/dup/g/gt/r/roll/J/ifelse 8
     7330 H/A/copy(z&v4QX&93r9AxYQOZomQalxS2w!!O&vMYa43d6r93rMYvx2dca!D&cjSnjSnjjS3o!v&6A
     7331 X&55SAxM1CD7AjYxTTd62rmxCnTdSST0g&12wECST!&!J0g&D1!&xM0!J0g!l&544dC2Ac96ra!m&3A
     7332 F&&vGoGSnCT0g&wDmlvGoS8wpn6wpS2wTCpS1Sd7ov7Uk7o4Qkdw!&Mvlx1S7oZES3w!J!J!Q&7185d
     7333 Z&lx1CS9d9nE4!k&X&MY7!&1!J!x&jdnjdS3odS!N&mmx1C2wEc!G&150Nx4!n&2o!j&43r!U&0777d
     7334 ]&2AY2A776ddT4oS3oSnMVC00VV0RRR45E42063rNz&v7UX&UOzF!F!J![&44ETCnVn!a&1CDN!Y&0M
     7335 V1c&j2AYdjmMdjjd!o&1r!M)@{( )T 0 4 3 r put T(/)g@{T(9)g@{cvn@}@{cvi@}J@}@{($)g[]J@}J
     7336 cvx@}forall/moveto/p/floor/w/div/S/add 29 H[@{[@{]setgray fill@}for Y@}for showpage
     7337 EOF
     7338 ) ) )
     7339@end example
    64937340@node Unit posix - Fifos, Unit posix - File descriptors and low-level I/O, Unit posix - Pipes, Unit posix
    64947341@section Fifos
     
    65107357Creates a FIFO with the name @code{FILENAME} and the permission bits @code{MODE}, which defaults to
    65117358
    6512 <enscript highlight=scheme>
    6513 
    6514 @verbatim
    6515 [procedure] (+ perm/irwxu perm/irwxg perm/irwxo)
    6516 @end verbatim
    6517 </enscript>
    6518 
     7359@example
     7360 [procedure] (+ perm/irwxu perm/irwxg perm/irwxo)
     7361@end example
    65197362@node Unit posix - Fifos - fifo?,  , Unit posix - Fifos - create-fifo, Unit posix - Fifos
    65207363@subsection fifo?
     
    65387381* Unit posix - File descriptors and low-level I/O - file-write::
    65397382* Unit posix - File descriptors and low-level I/O - file-control::
    6540 * Unit posix - File descriptors and low-level I/O - fcntl/dupfd::
    6541 * Unit posix - File descriptors and low-level I/O - fcntl/getfd::
    6542 * Unit posix - File descriptors and low-level I/O - fcntl/setfd::
    6543 * Unit posix - File descriptors and low-level I/O - fcntl/getfl::
    6544 * Unit posix - File descriptors and low-level I/O - fcntl/setfl::
    6545 * Unit posix - File descriptors and low-level I/O - fileno/stdin::
    6546 * Unit posix - File descriptors and low-level I/O - fileno/stdout::
    6547 * Unit posix - File descriptors and low-level I/O - fileno/stderr::
    6548 * Unit posix - File descriptors and low-level I/O - open/rdonly::
    6549 * Unit posix - File descriptors and low-level I/O - open/wronly::
    6550 * Unit posix - File descriptors and low-level I/O - open/rdwr::
    6551 * Unit posix - File descriptors and low-level I/O - open/read::
    6552 * Unit posix - File descriptors and low-level I/O - open/write::
    6553 * Unit posix - File descriptors and low-level I/O - open/creat::
    6554 * Unit posix - File descriptors and low-level I/O - open/append::
    6555 * Unit posix - File descriptors and low-level I/O - open/excl::
    6556 * Unit posix - File descriptors and low-level I/O - open/noctty::
    6557 * Unit posix - File descriptors and low-level I/O - open/nonblock::
    6558 * Unit posix - File descriptors and low-level I/O - open/trunc::
    6559 * Unit posix - File descriptors and low-level I/O - open/sync::
    6560 * Unit posix - File descriptors and low-level I/O - open/fsync::
    6561 * Unit posix - File descriptors and low-level I/O - open/binary::
    6562 * Unit posix - File descriptors and low-level I/O - open/text::
    65637383* Unit posix - File descriptors and low-level I/O - open-input-file*::
    65647384* Unit posix - File descriptors and low-level I/O - open-output-file*::
     
    65937413[procedure] (file-open FILENAME FLAGS [MODE])
    65947414@end verbatim
    6595 Opens the file specified with the string @code{FILENAME} and open-flags @code{FLAGS} using the C function @code{open()}. On success a file-descriptor for the opened file is returned.  @code{FLAGS} should be a bitmask containing one or more of the @code{open/...} values @b{or}ed together using @code{bitwise-ior} (or simply added together).  The optional @code{MODE} should be a bitmask composed of one or more permission values like @code{perm/irusr} and is only relevant when a new file is created. The default mode is  @code{perm/irwxu | perm/irgrp | perm/iroth}.
     7415Opens the file specified with the string @code{FILENAME} and open-flags @code{FLAGS} using the C function @code{open()}. On success a file-descriptor for the opened file is returned.  @code{FLAGS} should be a bitmask containing one or more of the @code{open/...} values @b{or}ed together using @code{bitwise-ior} (or simply added together).  The optional @code{MODE} should be a bitmask composed of one or more permission values like @code{perm/irusr} and is only relevant when a new file is created. The default mode is @code{perm/irwxu | perm/irgrp | perm/iroth}.
    65967416
    65977417@node Unit posix - File descriptors and low-level I/O - file-mkstemp, Unit posix - File descriptors and low-level I/O - file-read, Unit posix - File descriptors and low-level I/O - file-open, Unit posix - File descriptors and low-level I/O