Changeset 7276 in project


Ignore:
Timestamp:
01/05/08 20:17:50 (12 years ago)
Author:
felix winkelmann
Message:

merged trunk

Location:
chicken/branches/release
Files:
72 edited
11 copied

Legend:

Unmodified
Added
Removed
  • chicken/branches/release/Makefile

    r6421 r7276  
    3434
    3535
    36 .PHONY: all clean distclean spotless install uninstall confclean check
     36.PHONY: all clean distclean spotless install uninstall confclean check dist \
     37        libs install-libs fullcheck bootstrap
    3738
    3839ifndef PLATFORM
     
    7071check:
    7172        $(MAKE) -f Makefile.$(PLATFORM) check
     73fullcheck:
     74        $(MAKE) -f Makefile.$(PLATFORM) fullcheck
     75dist:
     76        $(MAKE) -f Makefile.$(PLATFORM) distfiles
     77        csi -s misc/makedist.scm
     78libs:
     79        $(MAKE) -f Makefile.$(PLATFORM) libs
     80install-libs:
     81        $(MAKE) -f Makefile.$(PLATFORM) install-libs
     82bootstrap:
     83        $(MAKE) -f Makefile.$(PLATFORM) bootstrap
    7284endif
  • chicken/branches/release/Makefile.cross-linux-mingw

    r6577 r7276  
    3636# platform configuration
    3737
     38DLLSINPATH = 1
    3839ARCH = x86
    3940HACKED_APPLY = 1
     
    4748# commands
    4849
    49 HOST=mingw32
     50HOSTSYSTEM=mingw32
    5051
    5152# options
     
    6061C_COMPILER_GUI_RUNTIME_OPTIONS = -DC_WINDOWS_GUI
    6162LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
    62 LIBRARIES = -lm
     63LIBRARIES = -lm -lws2_32
    6364LIBCHICKEN_SO_LINKER_OPTIONS = -Wl,--out-implib,libchicken.dll.a
    6465LIBUCHICKEN_SO_LINKER_OPTIONS = -Wl,--out-implib,libuchicken.dll.a
     
    6970LIBCHICKEN_IMPORT_LIBRARY = libchicken.dll.a
    7071LIBUCHICKEN_IMPORT_LIBRARY = libuchicken.dll.a
     72TARGET_C_COMPILER = gcc
     73TARGET_CXX_COMPILER = g++
    7174
    7275# special files
     
    8487        chicken-profile$(EXE) csc$(EXE) libchicken$(SO) \
    8588        libuchicken$(SO) chicken-setup$(EXE) chicken.info \
    86         libchickengui$(SO)
     89        libchickengui$(SO) chicken-bug$(EXE)
    8790
    8891chicken-config.h: chicken-defaults.h
  • chicken/branches/release/Makefile.cygwin

    r6208 r7276  
    4141# options
    4242
     43SO = .dll
     44EXE = .exe
     45
     46C_COMPILER = gcc
     47CXX_COMPILER = g++
     48LINKER = gcc
     49
     50
    4351C_COMPILER_OPTIONS = -fno-strict-aliasing -DHAVE_CHICKEN_CONFIG_H
    4452ifdef DEBUGBUILD
    4553C_COMPILER_OPTIMIZATION_OPTIONS ?= -g -Wall -Wno-unused
    4654else
    47 C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os -fomit-frame-pointer
     55C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os
    4856endif
    4957C_COMPILER_SHARED_OPTIONS = -DPIC
    50 LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
    51 LIBRARIES = -lm
     58LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
     59LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,--dll-search-prefix=cyg -Wl,--export-dynamic
     60LIBCHICKEN_SO_LINKER_OPTIONS = -Wl,--out-implib,libchicken.dll.a \
     61        -Wl,--export-all-symbols \
     62        -Wl,--enable-auto-import \
     63        -Wl,--image-base=0x10000000 \
     64        -Wl,--dll \
     65        -Wl,--add-stdcall-alias \
     66        -Wl,--no-whole-archive
     67LIBUCHICKEN_SO_LINKER_OPTIONS = -Wl,--out-implib,libuchicken.dll.a \
     68        -Wl,--export-all-symbols \
     69        -Wl,--enable-auto-import \
     70        -Wl,--image-base=0x10000000 \
     71        -Wl,--dll \
     72        -Wl,--add-stdcall-alias \
     73        -Wl,--no-whole-archive
     74
     75LIBRARIES = -lm
     76LIBCHICKEN_SO_LIBRARIES = -lm
     77LIBUCHICKEN_SO_LIBRARIES = -lm
     78LIBCHICKEN_IMPORT_LIBRARY = libchicken.dll.a
     79LIBUCHICKEN_IMPORT_LIBRARY = libuchicken.dll.a
     80
    5281
    5382# special files
    5483
    5584CHICKEN_CONFIG_H = chicken-config.h
     85APPLY_HACK_OBJECT = apply-hack.$(ARCH)$(O)
    5686
    5787# select default and internal settings
    5888
     89CUSTOM_CHICKEN_DEFAULTS=1
    5990include defaults.make
    6091
     
    84115        echo "#define HAVE_GCVT 1" >>$@
    85116        echo "#define HAVE_SYSEXITS_H 1" >>$@
    86         echo "#define HAVE_MEMMOVE 1" >>$@
     117        echo "#define HAVE_DLFCN_H 1" >>$@
    87118        echo "#define C_STACK_GROWS_DOWNWARD 1" >>$@
    88119ifdef GCHOOKS
     
    100131        cat chicken-defaults.h >>$@
    101132
     133chicken-defaults.h:
     134        echo "/* generated */" >$@
     135        echo "#define C_BUILD_TAG \"$(BUILD_TAG)\"" >>$@
     136        echo "#ifndef C_INSTALL_CC" >>$@
     137        echo "# define C_INSTALL_CC \"$(C_COMPILER)\"" >>$@
     138        echo "#endif" >>$@
     139        echo "#ifndef C_INSTALL_CXX" >>$@
     140        echo "# define C_INSTALL_CXX \"$(CXX_COMPILER)\"" >>$@
     141        echo "#endif" >>$@
     142        echo "#ifndef C_INSTALL_CFLAGS" >>$@
     143        echo "# define C_INSTALL_CFLAGS \"$(C_COMPILER_OPTIONS) $(C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@
     144        echo "#endif" >>$@
     145        echo "#ifndef C_INSTALL_LDFLAGS" >>$@
     146        echo "# define C_INSTALL_LDFLAGS \"$(LINKER_OPTIONS) $(LINKER_OPTIMIZATION_OPTIONS)\"" >>$@
     147        echo "#endif" >>$@
     148        echo "#ifndef C_INSTALL_SHARE_HOME" >>$@
     149        echo "# define C_INSTALL_SHARE_HOME \"$(DATADIR)\"" >>$@
     150        echo "#endif" >>$@
     151        echo "#ifndef C_INSTALL_BIN_HOME" >>$@
     152        echo "# define C_INSTALL_BIN_HOME \"$(BINDIR)\"" >>$@
     153        echo "#endif" >>$@
     154        echo "#ifndef C_INSTALL_EGG_HOME" >>$@
     155        echo "# define C_INSTALL_EGG_HOME \"$(EGGDIR)\"" >>$@
     156        echo "#endif" >>$@
     157        echo "#ifndef C_INSTALL_LIB_HOME" >>$@
     158        echo "# define C_INSTALL_LIB_HOME \"$(BINDIR)\"" >>$@
     159        echo "#endif" >>$@
     160        echo "#ifndef C_INSTALL_STATIC_LIB_HOME" >>$@
     161        echo "# define C_INSTALL_STATIC_LIB_HOME \"$(LIBDIR)\"" >>$@
     162        echo "#endif" >>$@
     163        echo "#ifndef C_INSTALL_INCLUDE_HOME" >>$@
     164        echo "# define C_INSTALL_INCLUDE_HOME \"$(INCDIR)\"" >>$@
     165        echo "#endif" >>$@
     166        echo "#ifndef C_INSTALL_MORE_LIBS" >>$@
     167        echo "# define C_INSTALL_MORE_LIBS \"$(LIBRARIES)\"" >>$@
     168        echo "#endif" >>$@
     169        echo "#ifndef C_INSTALL_MORE_STATIC_LIBS" >>$@
     170        echo "# define C_INSTALL_MORE_STATIC_LIBS \"$(LIBRARIES)\"" >>$@
     171        echo "#endif" >>$@
     172        echo "#ifndef C_DEFAULT_TARGET_STACK_SIZE" >>$@
     173        echo "# define C_DEFAULT_TARGET_STACK_SIZE $(NURSERY)" >>$@
     174        echo "#endif" >>$@
     175        echo "#ifndef C_STACK_GROWS_DOWNWARD" >>$@
     176        echo "# define C_STACK_GROWS_DOWNWARD $(STACKDIRECTION)" >>$@
     177        echo "#endif" >>$@
     178        echo "#ifndef C_TARGET_MORE_LIBS" >>$@
     179        echo "# define C_TARGET_MORE_LIBS \"$(TARGET_LIBRARIES)\"" >>$@
     180        echo "#endif" >>$@
     181        echo "#ifndef C_TARGET_MORE_STATIC_LIBS" >>$@
     182        echo "# define C_TARGET_MORE_STATIC_LIBS \"$(TARGET_LIBRARIES)\"" >>$@
     183        echo "#endif" >>$@
     184        echo "#ifndef C_TARGET_CC" >>$@
     185        echo "# define C_TARGET_CC \"$(TARGET_C_COMPILER)\"" >>$@
     186        echo "#endif" >>$@
     187        echo "#ifndef C_TARGET_CXX" >>$@
     188        echo "# define C_TARGET_CXX \"$(TARGET_CXX_COMPILER)\"" >>$@
     189        echo "#endif" >>$@
     190        echo "#ifndef C_TARGET_CFLAGS" >>$@
     191        echo "# define C_TARGET_CFLAGS \"$(TARGET_C_COMPILER_OPTIONS) $(TARGET_C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@
     192        echo "#endif" >>$@
     193        echo "#ifndef C_TARGET_LDFLAGS" >>$@
     194        echo "# define C_TARGET_LDFLAGS \"$(TARGET_LINKER_OPTIONS) $(TARGET_LINKER_OPTIMIZATION_OPTIONS)\"" >>$@
     195        echo "#endif" >>$@
     196        echo "#ifndef C_CROSS_CHICKEN" >>$@
     197        echo "# define C_CROSS_CHICKEN $(CROSS_CHICKEN)" >>$@
     198        echo "#endif" >>$@
     199        echo "#ifndef C_TARGET_LIB_HOME" >>$@
     200        echo "# define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)/bin\"" >>$@
     201        echo "#endif" >>$@
     202        echo "#ifndef C_TARGET_RUN_LIB_HOME" >>$@
     203        echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)/bin\"" >>$@
     204        echo "#endif" >>$@
     205        echo "#ifndef C_TARGET_SHARE_HOME" >>$@
     206        echo "# define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)/share\"" >>$@
     207        echo "#endif" >>$@
     208        echo "#ifndef C_TARGET_INCLUDE_HOME" >>$@
     209        echo "# define C_TARGET_INCLUDE_HOME \"$(TARGET_PREFIX)/include\"" >>$@
     210        echo "#endif" >>$@
     211        echo "#ifndef C_TARGET_STATIC_LIB_HOME" >>$@
     212        echo "# define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
     213        echo "#endif" >>$@
     214        echo "#ifndef C_CHICKEN_PROGRAM" >>$@
     215        echo "# define C_CHICKEN_PROGRAM \"$(CHICKEN_PROGRAM)\"" >>$@
     216        echo "#endif" >>$@
     217        echo "#ifndef C_CSC_PROGRAM" >>$@
     218        echo "# define C_CSC_PROGRAM \"$(CSC_PROGRAM)\"" >>$@
     219        echo "#endif" >>$@
     220        echo "#ifndef C_CSI_PROGRAM" >>$@
     221        echo "# define C_CSI_PROGRAM \"$(CSI_PROGRAM)\"" >>$@
     222        echo "#endif" >>$@
     223        echo "#ifndef C_CHICKEN_PROFILE_PROGRAM" >>$@
     224        echo "# define C_CHICKEN_PROFILE_PROGRAM \"$(CHICKEN_PROFILE_PROGRAM)\"" >>$@
     225        echo "#endif" >>$@
     226        echo "#ifndef C_CHICKEN_SETUP_PROGRAM" >>$@
     227        echo "# define C_CHICKEN_SETUP_PROGRAM \"$(CHICKEN_SETUP_PROGRAM)\"" >>$@
     228        echo "#endif" >>$@
     229        echo "#ifndef C_CHICKEN_BUG_PROGRAM" >>$@
     230        echo "# define C_CHICKEN_BUG_PROGRAM \"$(CHICKEN_BUG_PROGRAM)\"" >>$@
     231        echo "#endif" >>$@
     232
    102233include rules.make
  • chicken/branches/release/Makefile.linux

    r6577 r7276  
    4747endif
    4848LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
    49 LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-R$(LIBDIR)
    50 ifdef STATICBUILD
    51 LIBRARIES = -lm
    52 else
     49RUNTIME_LINKER_PATH = $(shell pwd)
     50LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-R$(RUNTIME_LINKER_PATH)
    5351LIBRARIES = -lm -ldl
    54 endif
     52NEEDS_RELINKING = yes
    5553
    5654# special files
  • chicken/branches/release/Makefile.macosx

    r6577 r7276  
    5454POSTINSTALL_PROGRAM_FLAGS = -change libchicken$(SO) $(LIBDIR)/libchicken$(SO)
    5555
     56ifeq ($(ARCH),x86-64)
     57C_COMPILER_OPTIONS += -m64
     58LINKER_OPTIONS += -m64
     59endif
     60
    5661# file extensions
    5762
  • chicken/branches/release/Makefile.mingw

    r6577 r7276  
    3636# platform configuration
    3737
     38DLLSINPATH = 1
    3839ARCH = x86
    3940HACKED_APPLY = 1
     
    6667LIBCHICKEN_IMPORT_LIBRARY = libchicken.dll.a
    6768LIBUCHICKEN_IMPORT_LIBRARY = libuchicken.dll.a
     69MAKEDIR_COMMAND_OPTIONS =
    6870
    6971# special files
     
    139141        echo # define C_INSTALL_CFLAGS "$(C_COMPILER_OPTIONS) $(C_COMPILER_OPTIMIZATION_OPTIONS)" >>$@
    140142        echo #endif >>$@
     143        echo #ifndef C_INSTALL_LDFLAGS >>$@
     144        echo # define C_INSTALL_LDFLAGS "$(LINKER_OPTIONS) $(LINKER_OPTIMIZATION_OPTIONS)" >>$@
     145        echo #endif >>$@
    141146        echo #ifndef C_INSTALL_SHARE_HOME >>$@
    142147        echo # define C_INSTALL_SHARE_HOME "$(DATADIR)" >>$@
     
    184189        echo # define C_TARGET_CFLAGS "$(TARGET_C_COMPILER_OPTIONS) $(TARGET_C_COMPILER_OPTIMIZATION_OPTIONS)" >>$@
    185190        echo #endif >>$@
     191        echo #ifndef C_TARGET_LDFLAGS >>$@
     192        echo # define C_TARGET_LDFLAGS "$(TARGET_LINKER_OPTIONS) $(TARGET_LINKER_OPTIMIZATION_OPTIONS)" >>$@
     193        echo #endif >>$@
    186194        echo #ifndef C_CROSS_CHICKEN >>$@
    187195        echo # define C_CROSS_CHICKEN $(CROSS_CHICKEN) >>$@
  • chicken/branches/release/Makefile.mingw-msys

    r6577 r7276  
    3636# platform configuration
    3737
     38DLLSINPATH = 1
    3839ARCH = x86
    3940HACKED_APPLY = 1
  • chicken/branches/release/NEWS

    r6577 r7276  
    1 2.732
    2 
     12.736
     2
     3- added pre GC hook C-level variable
     4- Cygwin is now fully supported
     5- removed deprecated functions:
     6  extension-info
     7  print-backtrace
     8  test-feature?
     9  ___callback (chicken.h)
     10  foreign-callback-lambda[*]
     11  thread-deliver-signal!
     12  critical-section
     13  enable-interrupts
     14  disable-interrupts
     15  invalid-procedure-call-handler
     16- chicken-setup: can create repository catalog file from local
     17  SVN checkout of egg repository
    318- Better cross-development support for the build system (the
    4   Makefile accepts PROGRAM_PREFIX, PROGRAM_SUFFIX, HOST and TARGET
    5   settings)
     19  Makefile accepts various variables for customizing the build)
     20- "file-size" and "file-stat" handle file-sizes of >4GB now
     21- "find-files" collects directories as well, now [Thanks to Ivan Raikov]
     22- added "dist" target to toplevel makefile
     23- "andmap" and "ormap" have been deprecated
     24- makefiles support relinking now
    625
    7262.717
  • chicken/branches/release/README

    r6577 r7276  
    33  (c)2000-2007 Felix L. Winkelmann
    44
    5   Version 2.732
     5  version 2.739
    66
    77
     
    5656          make PLATFORM=<platform> PREFIX=<destination>
    5757
    58         where "PLATFORM" specifies on what kind of system CHICKEN shall
    59         be built and "PREFIX" specifies where the executables and
    60         libraries shall be installed.
     58        where "PLATFORM" specifies on what kind of system CHICKEN
     59        shall be built and "PREFIX" specifies where the executables
     60        and libraries shall be installed. Out-of-directory builds are
     61        currently not supported, so you must be in the toplevel source
     62        directory to invoke "make".
    6163
    6264        Enter "make" without any options to see a list of supported
    6365        platforms.
    6466
    65         If you build CHICKEN directly from the development sources
    66         out of the subversion repository, an installed "chicken"
    67         executable is required, which defaults to
    68         "$PREFIX/bin/chicken". Pass "CHICKEN=<chicken-executable>"
    69         to the "make" invocation to override this setting.
     67        If you build CHICKEN directly from the development sources out
     68        of the subversion repository, you will need a "chicken"
     69        executable to generate the compiled C files from the Scheme
     70        library sources. If you have a recent version of CHICKEN
     71        installed, then pass "CHICKEN=<chicken-executable>" to the
     72        "make" invocation to override this setting. "CHICKEN" defaults
     73        to defaults to "$PREFIX/bin/chicken".
     74
     75        If you do not have a "chicken" binary installed, enter
     76
     77          make PLATFORM=<platform> PREFIX=<destination> bootstrap
     78
     79        which will unpack a tarball containing precompiled C sources
     80        that are recent enough to generate the current version. After
     81        building a statically linked "chicken" executable, all Scheme
     82        sources are recompiled with it. From this stage on
     83        bootstrapping isn't necessary anymore, as long as you have a
     84        compiler binary in your source tree.
    7085
    7186        The build may show errors when creating the info(1)
     
    128143          A suffix to be appended to the names of all generated executables.
    129144
     145        HOSTSYSTEM=
     146          A "<machine>-<platform>" name prefix to use for the C compiler to to
     147          use to compile the runtime system and executables. Set this variable
     148          if you want to compile CHICKEN for a different architecture than
     149          the one on which you are building it.
     150
     151        TARGETSYSTEM=
     152          Similar to "HOSTSYSTEM", but specifies the name prefix to use for compiling
     153          code with the "csc" compiler driver. This is required for creating
     154          a "cross chicken", a specially built CHICKEN that invokes a cross
     155          C compiler to build the final binaries. You will need a cross compiled
     156          runtime system by building a version of CHICKEN with the "HOST" option
     157          mentioned above. More information about this process and the variables
     158          that you should set are provided in the CHICKEN wiki at
     159          <http://chicken.wiki.br/cross-compilation>.
     160
    130161        To remove CHICKEN from your file-system, enter (probably as
    131162        root):
     
    182213 5. Platform issues:
    183214
    184   - *BSD system users *must* use GNU make ("gmake") - the makefiles
     215        - *BSD system users *must* use GNU make ("gmake") - the makefiles
    185216          can not be processed by BSD make.
    186217
     
    194225          `gcc'.
    195226
    196         - Older versions of Solaris have a bug in ld.so that causes
    197           trouble with dynamic loading. Patching Solaris fixes the
    198           problem. Solaris 7 needs patch 106950-18. Solaris 8 has an
    199           equivalent patch, 109147-16.
    200 
    201           You can find out if you have these patches installed by
    202           running:
     227        - Older versions of Solaris have a bug in ld.so that causes
     228          trouble with dynamic loading. Patching Solaris fixes the
     229          problem. Solaris 7 needs patch 106950-18. Solaris 8 has an
     230          equivalent patch, 109147-16.
     231
     232          You can find out if you have these patches installed by
     233          running:
    203234
    204235          % showrev -p | grep 106950    # solaris 7
    205236          % showrev -p | grep 109147    # solaris 8
    206237
    207   - On NetBSD it might be possible that compilation fails with a
     238        - On NetBSD it might be possible that compilation fails with a
    208239          "virtual memory exhausted error".  Try the following:
    209240
    210           % unlimit datasize
    211 
    212   - For Mac OS X, Chicken requires libdl, for loading compiled
     241          % unlimit datasize
     242
     243        - For Mac OS X, Chicken requires libdl, for loading compiled
    213244          code dynamically. This library is available on Mac OS X 10.4
    214245          (Tiger) by default. For older version you can find it here:
     
    216247            http://www.opendarwin.org/projects/dlcompat
    217248
    218         - On Windows, only mingw32 <http://mingw.sourceforge.net/> is
    219           supported (Microsoft Visual Studio is NOT). Makefiles for
    220           mingw under MSYS and Windows shell are provided
    221           (`Makefile.mingw-msys' and `Makefile.mingw').
     249        - On Mac OS X, Chicken can be built in 64-bit mode on Intel
     250          Core 2 Duo systems--basically, most recent machines.  The default
     251          is 32-bit mode.  To enable 64-bit mode, invoke `make` thusly:
     252
     253            make PLATFORM=macosx ARCH=x86-64
     254
     255        - On Windows, only mingw32 <http://mingw.sourceforge.net/> and
     256          Cygwin is supported (Microsoft Visual Studio is
     257          NOT). Makefiles for mingw under MSYS and Windows shell are
     258          provided (`Makefile.mingw-msys' and `Makefile.mingw').
    222259         
    223           Be sure that the Chicken LIBDIR is in the Path. Windows
    224           looks for '.dll' files along the Path.
     260        - Cygwin will not be able to find the chicken shared libraries
     261          until Windows is rebooted.
    225262
    226263        - gcc 3.4 shows sometimes warnings of the form
    227264
    228            easyffi.c: In function `f_11735':
    229            easyffi.c:18697: warning: `noreturn' function does return
     265            easyffi.c: In function `f_11735':
     266            easyffi.c:18697: warning: `noreturn' function does return
    230267       
    231268          when compiling the system or compiled Scheme files. These
     
    280317 7. What's next?
    281318
     319        If you find any bugs, or want to report a problem, please consider
     320        using the "chicken-bug" tool to create a detailed bug report.
     321
    282322        If you have any more questions or problems (even the slightest
    283323        problems, or the most stupid questions), then please subscribe
    284         to the CHICKEN mailing list or contact me at:
    285 
    286         <felix@call-with-current-continuation.org>.
     324        to the "chicken-users" mailing list or contact me at:
     325
     326        <felix@call-with-current-continuation.org>
    287327
    288328
  • chicken/branches/release/apply-hack.x86-64.s

    r5970 r7276  
    3737
    3838        .globl _C_do_apply_hack
     39#ifndef __APPLE__
    3940        .type _C_do_apply_hack, @function
    40        
     41#endif
     42
    4143_C_do_apply_hack:
    4244        subq $8, %rsp           /* force non-16 byte alignment */
  • chicken/branches/release/batch-driver.scm

    r5616 r7276  
    3939
    4040
    41 #{compiler
     41(private
     42 compiler
    4243  compiler-arguments process-command-line dump-nodes dump-undefined-globals
    4344  default-standard-bindings default-extended-bindings side-effecting-standard-bindings
     
    6162  reorganize-recursive-bindings substitution-table simplify-named-call emit-unsafe-marker
    6263  perform-closure-conversion prepare-for-code-generation compiler-source-file create-foreign-stub expand-foreign-lambda*
    63   transform-direct-lambdas! source-filename compressed-literals literal-compression-threshold
     64  transform-direct-lambdas! source-filename
    6465  debugging-chicken bomb check-signature posq stringify symbolify build-lambda-list
    6566  string->c-identifier c-ify-string words check-and-open-input-file close-checked-input-file fold-inner constant?
     
    7172  topological-sort print-version print-usage initialize-analysis-database dump-exported-globals
    7273  default-declarations units-used-by-default words-per-flonum default-debugging-declarations
    73   default-profiling-declarations default-optimization-passes compressed-literals-initializer
     74  default-profiling-declarations default-optimization-passes
    7475  inline-max-size file-requirements use-import-table lookup-exports-file
    7576  foreign-string-result-reserve parameter-limit eq-inline-operator optimizable-rest-argument-operators
     
    7879  generate-code make-variable-list make-argument-list generate-foreign-stubs foreign-type-declaration
    7980  export-list do-lambda-lifting compiler-warning export-file-name
    80   foreign-argument-conversion foreign-result-conversion}
     81  foreign-argument-conversion foreign-result-conversion)
    8182
    8283
     
    129130        [hshrink (memq 'heap-shrinkage options)]
    130131        [kwstyle (memq 'keyword-style options)]
    131         [lcthreshold (memq 'compress-literals options)]
    132132        [uses-units '()]
    133133        [uunit (memq 'unit options)]
     
    261261      (register-feature! 'case-insensitive)
    262262      (case-sensitive #f) )
     263    (when (memq 'compress-literals options)
     264      (compiler-warning 'usage "`the -compress-literals' option is obsolete") )
    263265    (when kwstyle
    264266      (let ([val (option-arg kwstyle)])
     
    267269              [(string=? "suffix" val) (keyword-style #:suffix)]
    268270              [else (quit "invalid argument to `-keyword-style' option")] ) ) )
    269     (when lcthreshold
    270       (let ([t (option-arg lcthreshold)])
    271         (set! literal-compression-threshold
    272           (or (string->number t)
    273               (quit "invalid argument to `-compress-literals' option: ~A" t) ) ) ) )
    274271    (set! verbose-mode verbose)
    275272    (set! ##sys#read-error-with-line-number #t)
     
    455452                                  ',(cdr pl) ) )
    456453                              profile-lambda-list)
    457                          (let ([is (fold (lambda (clf r)
    458                                            `(let ([,(gensym)
    459                                                    (set! ,(car clf)
    460                                                      (##sys#read-from-string ',(cdr clf)))])
    461                                               ,r) )
    462                                          '(##core#undefined)
    463                                          compressed-literals) ] )
    464                            (if compressed-literals-initializer
    465                                `((##core#set! ,compressed-literals-initializer
    466                                               (lambda () ,is) ) )
    467                                (list is) ) )
    468454                         exps0
    469455                         (if (and (not unit-name) (not dynamic))
     
    596582                              (print-db "final-analysis" '|8| db i)
    597583                              (when (and ##sys#warnings-enabled (> (- (cputime) start-time) funny-message-timeout))
    598                                 (display "(don't despair - still compiling...)\n") )
     584                                (display "(do not worry - still compiling...)\n") )
    599585                              (when export-file-name
    600586                                (dump-exported-globals db export-file-name) )
     
    603589
    604590                              (begin-time)
    605                               (receive (node literals lambdas) (prepare-for-code-generation node3 db)
     591                              (receive (node literals lliterals lambdas)
     592                                  (prepare-for-code-generation node3 db)
    606593                                (end-time "preparation")
    607594
     
    610597                                  (unless quiet
    611598                                    (printf "generating `~A' ...~%" outfile) )
    612                                   (generate-code literals lambdas out filename dynamic db)
     599                                  (generate-code literals lliterals lambdas out filename dynamic db)
    613600                                  (when outfile (close-output-port out)))
    614601                                (end-time "code generation")
  • chicken/branches/release/buildversion

    r6577 r7276  
    1 2.732
     12.739
  • chicken/branches/release/c-backend.scm

    r6325 r7276  
    3737
    3838
    39 #{compiler
     39(private compiler
    4040  compiler-arguments process-command-line find-early-refs
    4141  default-standard-bindings default-extended-bindings side-effecting-standard-bindings
     
    4444  standard-bindings-that-never-return-false side-effect-free-standard-bindings-that-never-return-false
    4545  installation-home optimization-iterations debugging cleanup
    46   file-io-only namespace-table
     46  file-io-only
    4747  unit-name insert-timer-checks used-units inlining external-variables
    4848  foreign-declarations emit-trace-info block-compilation line-number-database-size
     
    5252  current-program-size line-number-database-2 foreign-lambda-stubs immutable-constants
    5353  rest-parameters-promoted-to-vector inline-table inline-table-used constant-table constants-used
    54   mutable-constants
     54  mutable-constants encode-literal
    5555  broken-constant-nodes inline-substitutions-enabled
    5656  direct-call-ids foreign-type-table first-analysis block-variable-literal?
     
    7474  topological-sort print-version print-usage initialize-analysis-database
    7575  generate-external-variables real-name real-name2 unique-id
    76   default-declarations units-used-by-default words-per-flonum
     76  default-declarations units-used-by-default words-per-flonum big-fixnum?
    7777  foreign-string-result-reserve parameter-limit eq-inline-operator optimizable-rest-argument-operators
    7878  membership-test-operators membership-unfold-limit valid-compiler-options valid-compiler-options-with-argument
    7979  default-optimization-iterations generate-foreign-callback-header generate-foreign-callback-stub-prototypes
    8080  generate-code make-variable-list make-argument-list generate-foreign-stubs foreign-type-declaration
    81   foreign-argument-conversion foreign-result-conversion quick-namespace-list setup-quick-namespace-list
    82   namespace-lookup compute-namespace-size}
     81  foreign-argument-conversion foreign-result-conversion)
    8382
    8483(include "tweaks")
     
    102101   (intersperse lst #\space) ) )
    103102
    104 (define (compute-namespace-size n)
    105   37)                                   ; Arbitrary...
    106 
    107103
    108104;;; Unique id/prefix:
     
    113109
    114110
    115 ;;; Check name for namespace:
    116 ;;
    117 ;; This stuff is basically not needed. The namespace thingy once looked good, but
    118 ;; can not replace a proper module system. It's still available, and might be
    119 ;; handy for certain hacks.
    120 
    121 (define quick-namespace-list '())
    122 
    123 (define (setup-quick-namespace-list)
    124   (for-each
    125    (lambda (ns)
    126      (set! quick-namespace-list (append (cdr ns) quick-namespace-list)) )
    127    namespace-table) )
    128 
    129 (define (namespace-lookup sym)
    130   (and (memq sym quick-namespace-list)
    131        (let loop ([nslist namespace-table] [i 0])
    132          (cond [(null? nslist) (bomb "symbol not in namespace" sym)]
    133                [(memq sym (cdar nslist)) i]
    134                [else (loop (cdr nslist) (add1 i))] ) ) ) )
    135 
    136 
    137111;;; Generate target code:
    138112
    139 (define (generate-code literals lambdas out source-file dynamic db)
     113(define (generate-code literals lliterals lambdas out source-file dynamic db)
    140114  (let ()
    141115
     
    166140               (else (bomb "bad immediate")) ) )
    167141
    168             ((##core#literal) (gen "lf[" (first params) #\]))
     142            ((##core#literal)
     143             (let ((lit (first params)))
     144               (if (vector? lit)
     145                   (gen "((C_word)li" (vector-ref lit 0) ")")
     146                   (gen "lf[" (first params) #\])) ) )
    169147
    170148            ((if)
     
    482460               "   http://www.call-with-current-continuation.org" #t
    483461               "   " (+ 1900 year) #\- (pad0 (add1 mon)) #\- (pad0 mday) #\space (pad0 hour) #\: (pad0 min) #t
    484                "   " (chicken-version #t) #t
     462               (string-intersperse
     463                (map (cut string-append "   " <> "\n")
     464                     (string-split (chicken-version #t) "\n") )
     465                "")
    485466               "   command line: ")
    486467          (gen-list compiler-arguments)
     
    511492         used-units)
    512493        (unless (zero? n)
    513           (gen #t #t "static C_TLS C_word lf[" n"];") ) ) )
     494          (gen #t #t "static C_TLS C_word lf[" n "];") )
     495        (do ((i 0 (add1 i))
     496             (llits lliterals (cdr llits)))
     497            ((null? llits))
     498          (let* ((ll (##sys#lambda-info->string (car llits)))
     499                 (llen (string-length ll)))
     500            (gen #t "static C_char C_TLS li" i "[]={C_lihdr("
     501                 (arithmetic-shift llen -16) #\,
     502                 (bitwise-and #xff (arithmetic-shift llen -8)) #\,
     503                 (bitwise-and #xff llen)
     504                 #\))
     505            (do ((n 0 (add1 n)))
     506                ((>= n llen))
     507              (gen #\, (char->integer (string-ref ll n))) )
     508            (gen "};")))))
    514509 
    515510    (define (prototypes)
     
    572567        (for-each
    573568         (lambda (s)
    574            (gen #t "typedef void (C_cdecl *C_proc" s ")(C_word")
     569           (gen #t "typedef void (*C_proc" s ")(C_word")
    575570           (for-each gen (make-list s ",C_word"))
    576571           (gen ") C_noret;") )
     
    651646 
    652647    (define (literal-frame)
    653       (do ([i 0 (+ i 1)]
     648      (do ([i 0 (add1 i)]
    654649           [lits literals (cdr lits)] )
    655650          ((null? lits))
    656         (gen-lit (car lits) (sprintf "lf[~s]" i) #t) ) )
     651        (gen-lit (car lits) (sprintf "lf[~s]" i)) ) )
    657652
    658653    (define (bad-literal lit)
     
    669664            [(##sys#immediate? lit) (bad-literal lit)]
    670665            [(##core#inline "C_lambdainfop" lit) 0]
    671             [(##sys#bytevector? lit)
    672              (if (##sys#permanent? lit)
    673                  0
    674                  (+ 2 (words (##sys#size lit))) ) ]
     666            [(##sys#bytevector? lit) (+ 2 (words (##sys#size lit))) ] ; drops "permanent" property!
    675667            [(##sys#generic-structure? lit)
    676668             (let ([n (##sys#size lit)])
     
    681673            [else (bad-literal lit)] ) )
    682674
    683     ;; This is currently not needed but will be handy for optimized literal lists/vector constructors...
    684     (define (imm-lit lit)
    685       (cond [(fixnum? lit) (string-append "C_fix(" (number->string lit) ")")]
    686             [(eq? #t lit) "C_SCHEME_TRUE"]
    687             [(eq? #f lit) "C_SCHEME_FALSE"]
    688             [(null? lit) "C_SCHEME_END_OF_LIST"]
    689             [(eq? lit (void)) "C_SCHEME_UNDEFINED"]
    690             [(char? lit) (string-append "C_make_character(" (number->string (char->integer lit)) ")")]
    691             [(eof-object? lit) "C_SCHEME_END_OF_FILE"]
    692             [(and (number? lit) (eq? 'fixnum number-type))
    693              (let ([flit (##sys#flo2fix lit)])
    694                (compiler-warning 'type "coerced inexact literal number `~S' to fixnum `~S'" lit flit)
    695                (string-append "C_fix(" (number->string flit) ")") ) ]
    696             [else #f] ) )
    697 
    698     (define (gen-lit lit to lf)
    699       (cond ((fixnum? lit)
    700              (if (eq? 'flonum number-type)
    701                  (gen #t to "=C_flonum(C_heaptop," lit ");")
    702                  (gen #t to "=C_fix(" lit ");") ) )
     675    (define (gen-lit lit to)
     676      ;; we do simple immediate literals directly to avoid a function call:
     677      (cond ((and (fixnum? lit) (not (big-fixnum? lit)))
     678             (gen #t to "=C_fix(" lit ");") )
    703679            ((block-variable-literal? lit))
    704680            ((eq? lit (void))
    705681             (gen #t to "=C_SCHEME_UNDEFINED;") )
    706             ((number? lit)
    707              (cond [(eq? 'fixnum number-type)
    708                     (let ([flit (##sys#flo2fix lit)])
    709                       (compiler-warning 'type "coerced inexact literal number `~S' to fixnum `~S'" lit flit)
    710                       (gen #t to "=C_fix(" flit ");") ) ]
    711                    [else
    712                     (let ((str (number->string lit)))
    713                       (if (and (> (string-length str) 1) (char-alphabetic? (string-ref str 1))) ; inf or nan?
    714                           (gen #t to "=C_flonum(C_heaptop, C_strtod(\"" lit "\", NULL));")
    715                           (gen #t to "=C_flonum(C_heaptop," lit ");"))) ] ) )
    716682            ((boolean? lit)
    717683             (gen #t to #\= (if lit "C_SCHEME_TRUE" "C_SCHEME_FALSE") #\;) )
    718684            ((char? lit)
    719685             (gen #t to "=C_make_character(" (char->integer lit) ");") )
     686            ((symbol? lit)              ; handled slightly specially (see C_h_intern_in)
     687             (let* ([str (##sys#slot lit 1)]
     688                    [cstr (c-ify-string str)]
     689                    [len (##sys#size str)] )
     690               (gen #t to "=")
     691               (gen "C_h_intern(&" to #\, len #\, cstr ");") ) )
    720692            ((null? lit)
    721693             (gen #t to "=C_SCHEME_END_OF_LIST;") )
    722             ((string? lit) (gen-string-like-lit to lit "C_static_string" #t))
    723             ((##core#inline "C_lambdainfop" lit) (gen-string-like-lit to lit "C_static_lambda_info" #t))
    724             ((pair? lit)
    725              (cond ((and (proper-list? lit) (pair? (cdr lit)))
    726                     (do ((len 0 (add1 len))
    727                          (lst lit (cdr lst)) )
    728                         ((null? lst)
    729                          (gen #t to "=C_h_list(" len)
    730                          (do ((k (sub1 len) (sub1 k)))
    731                              ((< k 0) (gen ");" #t "C_drop(" len ");"))
    732                            (gen ",C_pick(" k #\)) ) )
    733                       (gen-lit (car lst) "tmp" #f)
    734                       (gen #t "C_save(tmp);") ) )
    735                    (else
    736                     (gen-lit (car lit) "tmp" #f)
    737                     (gen #t "C_save(tmp);")
    738                     (gen-lit (cdr lit) "tmp" #f)
    739                     (gen #t to "=C_h_pair(C_restore,tmp);") ) ) )
    740             ((vector? lit) (gen-vector-like-lit to lit "C_h_vector"))
    741             ((symbol? lit)
    742              (let* ([str (##sys#slot lit 1)]
    743                     [cstr (c-ify-string str)]
    744                     [len (##sys#size str)]
    745                     [nsi (namespace-lookup lit)] )
    746                (gen #t to "=")
    747                (if nsi
    748                    (if lf
    749                        (gen "C_h_intern_in(&" to #\, len #\, cstr ",stable" nsi ");")
    750                        (gen "C_intern_in(C_heaptop," len #\, cstr ",stable" nsi ");") )
    751                    (if lf
    752                        (gen "C_h_intern(&" to #\, len #\, cstr ");")
    753                        (gen "C_intern(C_heaptop," len #\, cstr ");") ) ) ) )
    754694            ((##sys#immediate? lit) (bad-literal lit))
    755             ((##sys#bytevector? lit)
    756              (if (##sys#permanent? lit)
    757                  (gen-string-like-lit to lit "C_pbytevector" #f)
    758                  (gen-string-like-lit to lit "C_bytevector" #t) ) )
    759             ((##sys#generic-structure? lit) (gen-vector-like-lit to lit "C_h_structure"))
    760             (else (bad-literal lit)) ) )
    761 
    762     (define (gen-string-like-lit to lit conser top)
    763       (let* ([len (##sys#size lit)]
     695            ((##core#inline "C_lambdainfop" lit))
     696            (else
     697             (gen #t to "=C_decode_literal(C_heaptop,")
     698             (gen-string-constant (encode-literal lit))
     699             (gen ");") ) ) )
     700
     701    (define (gen-string-constant str)
     702      (let* ([len (##sys#size str)]
    764703             [ns (fx/ len 80)]
    765704             [srest (modulo len 80)] )
    766         (gen #t to #\= conser #\()
    767         (when top (gen "C_heaptop,"))
    768         (gen len #\,)
    769705        (do ([i ns (sub1 i)]
    770706             [offset 0 (+ offset 80)] )
    771707            ((zero? i)
    772708             (when (or (zero? len) (not (zero? srest)))
    773                (gen (c-ify-string (string-like-substring lit offset len))) )
    774              (gen ");") )
    775           (gen (c-ify-string (string-like-substring lit offset (+ offset 80))) #t) ) ) )
    776  
     709               (gen (c-ify-string (string-like-substring str offset len))) ) )
     710          (gen (c-ify-string (string-like-substring str offset (+ offset 80))) #t) ) ) )
     711 
    777712    (define (string-like-substring s start end)
    778713      (let* ([len (- end start)]
     
    780715        (##sys#copy-bytes s s2 start 0 len)
    781716        s2) )
    782 
    783     (define (gen-vector-like-lit to lit conser)
    784       (let ([len (##sys#size lit)])
    785         (do ([j 0 (+ j 1)]
    786              [n len (- n 1)] )
    787             ((zero? n)
    788              (gen #t to #\= conser #\( len)
    789              (do ([j (- len 1) (- j 1)])
    790                  ((< j 0) (gen ");" #t "C_drop(" len ");"))
    791                (gen ",C_pick(" j #\)) ) )
    792           (gen-lit (##sys#slot lit j) "tmp" #f)
    793           (gen #t "C_save(tmp);") ) ) )
    794717
    795718    (define (procedures)
     
    852775                 (gen #t "C_word t" i #\;) ) )
    853776           (cond [(eq? 'toplevel id)
    854                   (do ([i 0 (add1 i)]
    855                        [ns namespace-table (cdr ns)] )
    856                       ((null? ns))
    857                     (gen #t "C_SYMBOL_TABLE *stable" i #\;) )
    858777                  (let ([ldemand (fold (lambda (lit n) (+ n (literal-size lit))) 0 literals)]
    859778                        [llen (length literals)] )
     
    861780                         #t "if(toplevel_initialized) C_kontinue(t1,C_SCHEME_UNDEFINED);"
    862781                         #t "else C_toplevel_entry(C_text(\"" topname "\"));")
    863                     (do ([i 0 (add1 i)]
    864                          [ns namespace-table (cdr ns)] )
    865                         ((null? ns))
    866                       (gen #t "stable" i "=C_new_symbol_table(\""
    867                            (caar ns) "\"," (compute-namespace-size (cdar ns)) ");") )
    868782                    (when disable-stack-overflow-checking
    869783                      (gen #t "C_disable_overflow_check=1;") )
     
    990904    (generate-foreign-callback-stubs foreign-callback-stubs db)
    991905    (trampolines)
    992     (setup-quick-namespace-list)
    993906    (procedures)
    994907    (emit-procedure-table-info lambdas source-file)
     
    11811094           (gen #t "/* from " (cleanup rname) " */") )
    11821095         (generate-foreign-callback-header "" stub)
    1183          (gen #\{ #t "C_word x, *a=C_alloc(" sizestr ");")
    1184          (gen #t "C_callback_adjust_stack_limits(a);")
     1096         (gen #\{ #t "C_word x,s=" sizestr ",*a=C_alloc(s);")
     1097         (gen #t "C_callback_adjust_stack(a,s);") ; make sure content is below stack_bottom as well
    11851098         (for-each
    11861099          (lambda (v t)
     
    13771290      ((byte) "C_fix((char)")
    13781291      ((unsigned-byte) "C_fix(0xff&(C_word)")
    1379       ((float double integer64) (sprintf "C_flonum(&~a," dest)) ;*** suboptimal for int64
     1292      ((float double) (sprintf "C_flonum(&~a," dest))   ;*** suboptimal for int64
    13801293      ((number) (sprintf "C_number(&~a," dest))
    13811294      ((nonnull-c-string c-string nonnull-c-pointer c-string* nonnull-c-string*
     
    13851298      ((c-pointer) (sprintf "C_mpointer_or_false(&~a,(void*)" dest))
    13861299      ((integer integer32) (sprintf "C_int_to_num(&~a," dest))
     1300      ((integer64) (sprintf "C_a_double_to_num(&~a," dest))
    13871301      ((unsigned-integer unsigned-integer32) (sprintf "C_unsigned_int_to_num(&~a," dest))
    13881302      ((long) (sprintf "C_long_to_num(&~a," dest))
     
    14131327                [else (err)] ) ]
    14141328             [else (err)] ) ) ) ) )
     1329
     1330
     1331;;; Encoded literals as strings, to be decoded by "C_decode_literal()"
     1332;;
     1333;; - everything hardcoded, using the FFI would be the ugly, but safer method.
     1334
     1335(define (encode-literal lit)
     1336  (define getbits
     1337    (foreign-lambda* int ((scheme-object lit))
     1338      "
     1339#ifdef C_SIXTY_FOUR
     1340return((C_header_bits(lit) >> (24 + 32)) & 0xff);
     1341#else
     1342return((C_header_bits(lit) >> 24) & 0xff);
     1343#endif
     1344") )
     1345  (define getsize
     1346    (foreign-lambda* int ((scheme-object lit))
     1347      "return(C_header_size(lit));"))
     1348  (define (encode-size n)
     1349    ;; only handles sizes in the 24-bit range!
     1350    (string (integer->char (bitwise-and #xff (arithmetic-shift n -16)))
     1351            (integer->char (bitwise-and #xff (arithmetic-shift n -8)))
     1352            (integer->char (bitwise-and #xff n))))
     1353  (define (finish str)             ; can be taken out at a later stage
     1354    (string-append (string #\xfe) str))
     1355  (finish
     1356   (cond ((eq? #t lit) "\xff\x06\x01")
     1357         ((eq? #f lit) "\xff\x06\x00")
     1358         ((char? lit) (string-append "\xff\x0a" (encode-size (char->integer lit))))
     1359         ((null? lit) "\xff\x0e")
     1360         ((eof-object? lit) "\xff\x3e")
     1361         ((eq? (void) lit) "\xff\x1e")
     1362         ((and (fixnum? lit) (not (big-fixnum? lit)))
     1363          (string-append
     1364           "\xff\x01"
     1365           (string (integer->char (bitwise-and #xff (arithmetic-shift lit -24)))
     1366                   (integer->char (bitwise-and #xff (arithmetic-shift lit -16)))
     1367                   (integer->char (bitwise-and #xff (arithmetic-shift lit -8)))
     1368                   (integer->char (bitwise-and #xff lit)) ) ) )
     1369         ((number? lit)
     1370          (string-append "\x55" (number->string lit) "\x00") )
     1371         ((symbol? lit)
     1372          (let ((str (##sys#slot lit 1)))
     1373            (string-append
     1374             "\x01"
     1375             (encode-size (string-length str))
     1376             str) ) )
     1377         ((##sys#immediate? lit)
     1378          (bomb "invalid literal - can not encode" lit))
     1379         ((##core#inline "C_byteblockp" lit)
     1380          (##sys#string-append ; relies on the fact that ##sys#string-append doesn't check
     1381           (string-append
     1382            (string (integer->char (getbits lit)))
     1383            (encode-size (getsize lit)) )
     1384           lit) )
     1385         (else
     1386          (let ((len (getsize lit)))
     1387            (string-intersperse
     1388             (cons*
     1389              (string (integer->char (getbits lit)))
     1390              (encode-size len)
     1391              (list-tabulate len (lambda (i) (encode-literal (##sys#slot lit i)))))
     1392             ""))))) )
  • chicken/branches/release/c-platform.scm

    r5358 r7276  
    3737
    3838
    39 #{compiler
     39(private compiler
    4040  compiler-arguments process-command-line
    4141  default-standard-bindings default-extended-bindings side-effecting-standard-bindings
     
    6969  membership-test-operators membership-unfold-limit valid-compiler-options valid-compiler-options-with-argument
    7070  target-include-file default-profiling-declarations
    71   default-optimization-passes internal-bindings
     71  default-optimization-passes internal-bindings big-fixnum?
    7272  generate-code make-variable-list make-argument-list generate-foreign-stubs foreign-type-declaration
    73   foreign-argument-conversion foreign-result-conversion}
     73  foreign-argument-conversion foreign-result-conversion)
    7474
    7575
     
    134134  '(debug output-file include-path heap-size stack-size unit uses keyword-style require-extension
    135135          inline-limit profile-name disable-warning emit-exports import
    136     prelude postlude prologue epilogue nursery extend feature compress-literals
     136    prelude postlude prologue epilogue nursery extend feature
     137    compress-literals                   ; DEPRECATED
    137138    heap-growth heap-shrinkage heap-initial-size ffi-define ffi-include-path) )
    138139
     
    868869                                [(eq? number-type 'fixnum)]
    869870                                [n (first (node-parameters val))]
    870                                 [(fixnum? n)] )
     871                                [(and (fixnum? n) (not (big-fixnum? n)))] )
    871872                       (if (negative? n)
    872873                           (make-node
  • chicken/branches/release/chicken-bug.1

    r6251 r7276  
    3939has been passed on the command line, then a description of the problem
    4040is read from standard input, until EOF (CTRL-D) is read.
     41
     42The report will be automatically e-mailed to the CHICKEN maintainers,
     43if an SMTP connection can be established. If no connection can be
     44made, the bug report will be written to a file in the current directory,
     45which should be sent to CHICKEN maintainers as it contains various
     46useful bits of information that make it easier to classify the
     47problem described.
     48
    4149Bug reports should be as detailed as possible. It is also very helpful
    4250to include code that reproduces the problem. The more detailed the input
     
    4654.SH BUGS
    4755Submit bug reports by e-mail to
    48 .I felix@call-with-current-continuation.org
     56.I chicken-janitors@nongnu.org
    4957
    5058.SH AUTHOR
  • chicken/branches/release/chicken-bug.scm

    r6252 r7276  
    22
    33
    4 (use posix utils)
     4(use srfi-13 posix utils tcp extras)
    55
    66
     
    1818(define-constant +bug-report-file+ "chicken-bug-report.~a-~a-~a")
    1919
    20 (define-constant +destinations+
     20(define-constant +fallbackdestinations+
    2121  "chicken-janitors@nongnu.org\nchicken-hackers@nongnu.org\nchicken-users@nongnu.org\nfelix@call-with-current-continuation.org")
    2222
     23(define-constant +destination+ "chicken-janitors@nongnu.org")
     24(define-constant +mxservers+ (list "mx10.gnu.org" "mx20.gnu.org"))
    2325
    2426(define-foreign-variable +cc+ c-string "C_TARGET_CC")
     
    2830
    2931(define (collect-info)
     32  (print "\n--------------------------------------------------\n")
    3033  (print "This is a bug report generated by chicken-bug(1).\n")
    3134  (print "Date:\t" (seconds->string (current-seconds)) "\n")
     
    3639  (print "\tsoftware version:\t" (software-version))
    3740  (print "\tbuild platform:\t" (build-platform) "\n")
    38   (print "CHICKEN version is:\t" (chicken-version #t) "\n")
     41  (print "CHICKEN version is:\n" (chicken-version #t) "\n")
    3942  (print "Home directory:\t" (chicken-home) "\n")
    4043  (printf "Include path:\t~s~%~%" ##sys#include-pathnames)
     
    6871  -                    read description from standard input
    6972
     73Generates a bug report file from user input or alternatively
     74from the contents of files given on the command line.
     75
    7076EOF
    7177)
     
    7783This is the CHICKEN bug report generator. Please enter a detailed
    7884description of the problem you have encountered and enter CTRL-D (EOF)
    79 once you have finished. Presss CTRL-C to abort the program:
     85once you have finished. Press CTRL-C to abort the program. You can
     86also pass the description from a file (just abort now and re-invoke
     87"chicken-bug" with one or more input files given on the command-line)
    8088
    8189EOF
     
    112120    (unless files
    113121      (set! msg (string-append msg "\n\n" (user-input))))
     122    (newline)
    114123    (match-let ((#(_ _ _ day mon yr _ _ _ _) (seconds->local-time (current-seconds))))
    115       (let* ((file (sprintf +bug-report-file+ (+ 1900 yr) (justify mon) (justify day)))
    116              (port (if stdout (current-output-port) (open-output-file file))))
    117         (with-output-to-port port
    118           (lambda ()
    119             (print msg)
    120             (collect-info) ) )
    121         (unless stdout
    122           (close-output-port port)
    123           (print "\nA bug report has been written to `" file "'. Please send it to")
    124           (print "one of the following addresses:\n\n" +destinations+) ) ) ) ) )
     124        (if stdout
     125            (begin
     126                (print msg)
     127                (collect-info))
     128            (try-mail
     129                +mxservers+
     130                (sprintf +bug-report-file+ (+ 1900 yr) (justify mon) (justify day))
     131                (mail-headers)
     132                (with-output-to-string
     133                    (lambda ()
     134                        (print msg)
     135                        (collect-info))))))))
     136      ;(let* ((file (sprintf +bug-report-file+ (+ 1900 yr) (justify mon) (justify day)))
     137        ;     (port (if stdout (current-output-port) (open-output-file file))))
     138        ;(with-output-to-port port
     139        ;  (lambda ()
     140        ;    (print msg)
     141        ;    (collect-info) ) )
     142        ;(unless stdout
     143        ;  (close-output-port port)
     144        ;  (print "\nA bug report has been written to `" file "'. Please send it to")
     145        ;  (print "one of the following addresses:\n\n" +destinations+) ) ) ) ) )
     146
     147(define (try-mail servs fname hdrs msg)
     148    (if (null? servs)
     149        (begin
     150            (with-output-to-file fname
     151                (lambda () (print msg)))
     152            (print "\nCould not send mail automatically!\n\nA bug report has been written to `" fname "'.  Please send it to")
     153            (print "one of the following addresses:\n\n" +fallbackdestinations+))
     154        (or (send-mail (car servs) msg hdrs fname)
     155            (try-mail (cdr servs) fname hdrs msg))))
     156
     157(define (mail-date-str tm)
     158    (string-append
     159        (case (vector-ref tm 6)
     160            ((0) "Sun, ")
     161            ((1) "Mon, ")
     162            ((2) "Tue, ")
     163            ((3) "Wed, ")
     164            ((4) "Thu, ")
     165            ((5) "Fri, ")
     166            ((6) "Sat, "))
     167        (string-pad (number->string (vector-ref tm 3)) 2 #\0)
     168        (case (vector-ref tm 4)
     169            ((0)  " Jan ")
     170            ((1)  " Feb ")
     171            ((2)  " Mar ")
     172            ((3)  " Apr ")
     173            ((4)  " May ")
     174            ((5)  " Jun ")
     175            ((6)  " Jul ")
     176            ((7)  " Aug ")
     177            ((8)  " Sep ")
     178            ((9)  " Oct ")
     179            ((10) " Nov ")
     180            ((11) " Dec "))
     181        (number->string (+ 1900 (vector-ref tm 5)))
     182        " "
     183        (string-pad (number->string (vector-ref tm 2)) 2 #\0)
     184        ":"
     185        (string-pad (number->string (vector-ref tm 1)) 2 #\0)
     186        ":"
     187        (string-pad (number->string (vector-ref tm 0)) 2 #\0)
     188        " +0000"))
     189
     190(define (mail-headers)
     191    (string-append
     192        "Date: " (mail-date-str (seconds->utc-time (current-seconds))) "\r\n"
     193        "From: \"chicken-bug user\" <chicken-bug-command@callcc.org>\r\n"
     194        "To: \"Chicken Janitors\" <chicken-janitors@nongnu.org>\r\n"
     195        "Subject: Automated chicken-bug output -- "))
     196
     197(define (mail-read i o)
     198    (let ((v   (condition-case (read-line i)
     199                   (var () (close-input-port i) (close-output-port o) #f))))
     200        (if v
     201            (if (char-numeric? (string-ref v 0))
     202                (string->number (substring v 0 3))
     203                (mail-read i o))
     204            #f)))
     205
     206(define (mail-write i o m)
     207    (let ((v   (condition-case (display m o)
     208                   (var () (close-input-port i) (close-output-port o) #f))))
     209        (if v
     210            (mail-read i o)
     211            #f)))
     212
     213(define (mail-check i o v e k)
     214    (if (and v (= v e))
     215        #t
     216        (begin
     217            (close-input-port i)
     218            (close-output-port o)
     219            (k #f))))
     220
     221(define (send-mail serv msg hdrs fname)
     222  (print "connecting to " serv " ...")
     223    (receive (i o)
     224        (tcp-connect serv 25)
     225        (call-with-current-continuation
     226            (lambda (k)
     227                (mail-check i o (mail-read i o) 220 k)
     228                (mail-check i o (mail-write i o "HELO callcc.org\r\n") 250 k)
     229                (mail-check i o (mail-write i o "MAIL FROM:<chicken-bug-command@callcc.org>\r\n") 250 k)
     230                (mail-check i o (mail-write i o "RCPT TO:<chicken-janitors@nongnu.org>\r\n") 250 k)
     231                (mail-check i o (mail-write i o "DATA\r\n") 354 k)
     232                (mail-check i o (mail-write i o (string-append hdrs fname "\r\n\r\n" msg "\r\n.\r\n")) 250 k)
     233                (display "QUIT" o)
     234                (close-input-port i)
     235                (close-output-port o)
     236                (print "Bug report successfully mailed to the Chicken maintainers.\nThank you very much!\n\n")
     237                #t))))
    125238
    126239(main (command-line-arguments))
  • chicken/branches/release/chicken-ffi-macros.scm

    r6175 r7276  
    361361     (cons ',new args) ) )
    362362
    363 (define-deprecated-macro foreign-callback-lambda foreign-safe-lambda)
    364 (define-deprecated-macro foreign-callback-lambda* foreign-safe-lambda*)
    365 (define-deprecated-macro foreign-callback-wrapper foreign-safe-wrapper)
    366 
    367363
    368364;;; Not for general use, yet
  • chicken/branches/release/chicken-more-macros.scm

    r6175 r7276  
    363363   (##sys#check-syntax 'define-constant form '(symbol _))
    364364   `(##core#define-constant ',(car form) ,(cadr form)) ) )
    365 
    366 (##sys#register-macro-2                 ; DEPRECATED
    367  'critical-section
    368  (lambda (form)
    369    `(##sys#dynamic-wind
    370         ##sys#disable-interrupts
    371         (lambda () ,@form)
    372         ##sys#enable-interrupts) ) )
    373365
    374366(##sys#register-macro-2
  • chicken/branches/release/chicken-setup.scm

    r6577 r7276  
    4444          create-directory test-compile try-compile copy-file run-verbose
    4545          required-chicken-version required-extension-version
    46           cross-chicken ##sys#current-source-filename) )
     46          cross-chicken ##sys#current-source-filename host-extension) )
     47
     48
     49;;; Constants, variables and parameters
    4750
    4851#>
     
    118121  '("-help" "-uninstall" "-list" "-run" "-repository" "-program-path" "-version" "-script"
    119122    "-fetch" "-host" "-proxy" "-keep" "-verbose" "-csc-option" "-dont-ask" "-no-install" "-docindex" "-eval"
    120     "-debug" "-ls" "-release" "-test" "-fetch-tree" "-tree" "-svn" "-local" "-destdir" "-revision") )
     123    "-debug" "-ls" "-release" "-test" "-fetch-tree" "-tree" "-svn" "-local" "-destdir" "-revision"
     124    "-host-extension") )
    121125
    122126(define-constant short-options
    123   '(#\h #\u #\l #\r #\R #\P #\V #\s #\f #\H #\p #\k #\v #\c #\d #\n #\i #\e #\D #f #f #\t #f #f #f #f #f #f) )
     127  '(#\h #\u #\l #\r #\R #\P #\V #\s #\f #\H #\p #\k #\v #\c #\d #\n #\i #\e #\D #f #f #\t #f #f #f #f #f #f
     128    #f) )
    124129
    125130(define *installed-executables*
     
    134139  (or (and-let* ((p (getenv "CHICKEN_PREFIX")))
    135140        (make-pathname p "bin") )
    136       (getenv "CHICKEN_HOME")
    137141      (foreign-value "C_INSTALL_BIN_HOME" c-string) ) )
    138142
     
    154158(define program-path (make-parameter *install-bin-path*))
    155159(define (cross-chicken) (##sys#fudge 39))
    156 
    157 (define create-directory/parents
    158   (let ([create-directory create-directory])
    159     (lambda (dir)
    160       (let loop ([dir dir])
    161         (when (and dir (not (directory? dir)))
    162           (loop (pathname-directory dir))
    163           (create-directory dir))) ) ) )
    164 
    165 (define create-directory
    166   (let ()
    167     (define (verb dir)
    168       (when (setup-verbose-flag) (printf "  creating directory `~a'~%~!" dir)) )
    169     (if *windows-shell*
    170         (lambda (dir)
    171           (verb dir)
    172           (create-directory/parents dir) )
    173         (lambda (dir)
    174           (verb dir)
    175           (system* "mkdir -p ~a" (quotewrap dir) ) ) ) ) )
    176 
    177 (define (quotewrap str)
    178   (if (or (string-any char-whitespace? str)
    179           (and *windows-shell* (string-any (lambda (c) (char=? c #\/)) str)))
    180       (string-append "\"" str "\"")
    181       str) )
     160(define host-extension (make-parameter #f))
    182161
    183162(define setup-root-directory (make-parameter #f))
     
    189168(define *remove-command* (if *windows-shell* "del /Q /S" "rm -fr"))
    190169(define *move-command* (if *windows-shell* 'move 'mv))
    191 
    192170(define *gzip-program* 'gzip)
    193171(define *tar-program* 'tar)
    194 
    195172(define *fetch-only* #f)
    196173(define *temporary-directory* #f)
     
    217194
    218195
     196;;; File-system routines
     197
     198(define create-directory/parents
     199  (let ([create-directory create-directory])
     200    (lambda (dir)
     201      (let loop ([dir dir])
     202        (when (and dir (not (directory? dir)))
     203          (loop (pathname-directory dir))
     204          (create-directory dir))) ) ) )
     205
     206(define create-directory
     207  (let ()
     208    (define (verb dir)
     209      (when (setup-verbose-flag) (printf "  creating directory `~a'~%~!" dir)) )
     210    (if *windows-shell*
     211        (lambda (dir)
     212          (verb dir)
     213          (create-directory/parents dir) )
     214        (lambda (dir)
     215          (verb dir)
     216          (system* "mkdir -p ~a" (quotewrap dir) ) ) ) ) )
     217
     218
     219;;; Helper stuff
     220
     221(define (quotewrap str)
     222  (if (or (string-any char-whitespace? str)
     223          (and *windows-shell* (string-any (lambda (c) (char=? c #\/)) str)))
     224      (string-append "\"" str "\"")
     225      str) )
     226
    219227(define (abort-setup)
    220228  (*abort-hook* #f) )
     
    292300  `(run (csc ,@explist) ) )
    293301
     302
     303;;; "make" functionality
     304
    294305(define (make:find-matching-line str spec)
    295306  (let ((match? (lambda (s) (string=? s str))))
     
    301312                               (list (car line))
    302313                               (car line))))
    303                (if (ormap match? names)
     314               (if (any match? names)
    304315                   line
    305316                   (loop (cdr lines)))))))))
     
    311322  (and (or (list? spec) (make:form-error "specification is not a list" spec))
    312323       (or (pair? spec) (make:form-error "specification is an empty list" spec))
    313        (andmap
     324       (every
    314325        (lambda (line)
    315326          (and (or (and (list? line) (<= 2 (length line) 3))
     
    317328               (or (or (string? (car line))
    318329                       (and (list? (car line))
    319                             (andmap string? (car line))))
     330                            (every string? (car line))))
    320331                   (make:form-error "line does not start with a string or list of strings" line))
    321332               (let ((name (car line)))
    322333                 (or (list? (cadr line))
    323334                     (make:line-error "second part of line is not a list" (cadr line) name)
    324                      (andmap (lambda (dep)
     335                     (every (lambda (dep)
    325336                               (or (string? dep)
    326337                                   (make:form-error "dependency item is not a string" dep)))
     
    333344(define (make:check-argv argv)
    334345  (or (string? argv)
    335       (andmap string? argv)
     346      (every string? argv)
    336347      (error "argument is not a string or string list" argv)))
    337348
     
    358369                      (let ((reason
    359370                             (or (not date)
    360                                  (ormap (lambda (dep)
     371                                 (any (lambda (dep)
    361372                                          (let ((dep2 (fixmaketarget dep)))
    362373                                            (unless (file-exists? dep2)
     
    404415  (case-lambda
    405416   ((spec) (make:make/proc/helper spec '()))
    406    ((spec argv) (make:make/proc/helper spec argv))))
    407 
    408 (define-macro (make spec #!optional (argv '()))
     417   ((spec argv)
     418    (make:make/proc/helper
     419     spec
     420     (if (vector? argv)
     421         (vector->list argv)
     422         argv) ) ) ) )
     423
     424(define-macro (make spec #!optional (argv ''()))
    409425  (let ((form-error (lambda (s . p) (apply error s spec p))))
    410426    (and (or (list? spec) (form-error "illegal specification (not a sequence)"))
    411427         (or (pair? spec) (form-error "empty specification"))
    412          (andmap
     428         (every
    413429          (lambda (line)
    414430            (and (or (and (list? line) (>= (length line) 2))
     
    428444                             spec))
    429445                ,argv)))
     446
     447
     448;;; Create new repository file
     449
     450(define (create-repository-file eggdir)
     451  (let ((eggs
     452         (filter-map
     453          (lambda (d)
     454            (and-let* ((mf (or (file-exists? (make-pathname d d "meta"))
     455                               (file-exists? (make-pathname (list d "trunk") d "meta")))))
     456              (display mf (current-error-port))
     457              (newline (current-error-port))
     458              (cons d (with-input-from-file mf read)) ) )
     459          (directory eggdir))) )
     460    (write-char #\()
     461    (for-each
     462     (lambda (e)
     463       (let ((needs (assq 'needs (cdr e))))
     464         (pp `(,(string->symbol (car e))
     465               ()
     466               ,(conc e ".egg")
     467               ,@(if needs (cdr needs) '())))))
     468     *eggs*)
     469    (write-char #\))))
     470
     471
     472;;; Show usage information
    430473
    431474(define (usage)
     
    453496  -e  -eval EXPRESSION           evaluate expression
    454497  -t  -test                      run test suite, if it exists
     498      -host-extension            compile any extensions in "host" mode
    455499      -ls EXTENSION              list installed files for extension
    456500      -fetch-tree                download and show repository catalog
     501      -create-tree               create repository catalog from SVN checkout
    457502      -tree FILENAME             use repository catalog from given file
    458503      -svn URL                   fetch extension from subversion repository
     
    467512  )
    468513  (exit) )
     514
     515
     516;;; Processing setup scripts
    469517
    470518(define (make-setup-info-pathname fn #!optional (rpath (repository-path)))
     
    620668     ("a" (if *windows-shell* "lib" "a"))
    621669     (x x) ) ) )
     670
     671
     672;;; Installation
    622673
    623674(define (install-extension id files #!optional (info '()))
     
    719770    (delete-file* (make-setup-info-pathname (->string ext)))))
    720771
     772
     773;;; More helper stuff
     774
    721775(define (repo-path #!optional ddir?)
    722776  (let ((p (if (and ddir? *destdir*)
     
    796850   (sprintf "#ifdef __cplusplus~%extern \"C\"~%#endif~%char ~a();~%int main() { ~a(); return 0; }~%" proc proc)
    797851   ldflags: (conc "-l" name) ) )
     852
     853
     854;;; HTTP repository access
    798855
    799856(define (find-header name)
     
    913970           (x (error "(internal) invalid host" x)) ) ) ) )
    914971
     972(define (requirements reqs)
     973  (fold
     974   (lambda (r reqs)
     975     (cond ((symbol? r)
     976            (let ((node (assq r *repository-tree*)))
     977              (cond (node (append (requirements (cdddr node)) (list (car node)) reqs))
     978                    ((memq r ##sys#core-library-modules) reqs)
     979                    (else (error "broken dependencies: extension does not exist" r) ) ) ) )
     980           (else (error "invalid requirement spec" r))))
     981   '()
     982   reqs) )
     983
    915984(define (fetch-file ext)
    916   (define (requirements reqs)
    917     (fold
    918      (lambda (r reqs)
    919        (cond ((symbol? r)
    920               (let ((node (assq r *repository-tree*)))
    921                 (cond (node (append (requirements (cdddr node)) (list (car node)) reqs))
    922                       ((memq r ##sys#core-library-modules) reqs)
    923                       (else (error "Broken dependencies: extension does not exist" r) ) ) ) )
    924              (else (requirements (eval-req r) )) ) )
    925      '()
    926      reqs) )
    927985  (and (or *dont-ask*
    928986           (yes-or-no?
     
    9431001              (let ((a (and *repository-tree* (assq (string->symbol ext) *repository-tree*))))
    9441002                (when *debug* (printf "catalog entry: ~s~%" a))
    945                 (cond (a (let ((reqs (remove extension-info (delete-duplicates (requirements (cdddr a)) eq?))))
     1003                (cond (a (let ((reqs (remove extension-information (delete-duplicates (requirements (cdddr a)) eq?))))
    9461004                           (when (pair? reqs)
    9471005                             (print "downloading required extensions " reqs " ...")
     
    9521010                      (else
    9531011                       (error "Extension does not exist in the repository" ext)) ) ) ) ) ) )
     1012
     1013
     1014;;; Main entry point
    9541015
    9551016(define (install filename)
     
    9771038             (when df
    9781039               (loop (pathname-file filename))))))))
     1040
     1041
     1042;;; Documentation index generation
    9791043
    9801044(define (doc-index #!optional ddir?)
     
    11071171          (display "</tbody></table></body></font></html>\n") ) ) ) ) )
    11081172
     1173
     1174;;; Output stuff
     1175
    11091176(define (format-string str cols #!optional right (padc #\space))
    11101177  (let* ((len (string-length str))
     
    11141181        (string-append str pad) ) ) )
    11151182
     1183(define get-terminal-width
     1184  (let ((default-width 78)) ; Standard default terminal width
     1185    (lambda ()
     1186      (let ((cop (current-output-port)))
     1187        (if (terminal-port? cop)
     1188            (with-exception-handler
     1189             (lambda (_)
     1190               default-width)
     1191             (lambda ()
     1192               (call-with-values
     1193                   (lambda () (terminal-size cop))
     1194                   (lambda (_ cols) cols))))
     1195             default-width)))))
     1196
    11161197(define (list-installed)
    1117   (for-each
    1118    (lambda (f)
    1119      (and-let* ((info (extension-information f)))
    1120        (print (format-string (->string f) 32)
    1121               " "
    1122               (format-string
    1123                (or (and-let* ((v (assq 'version info)))
    1124                      (sprintf "Version: ~A" (cadr v)) )
    1125                    "")
    1126                32 #t)
    1127               (or (and-let* ((r (assq 'release info)))
    1128                     (sprintf " (Release ~a)" (cadr r)) )
    1129                   "") ) ) )
    1130    (sort (delete-duplicates
    1131           (grep "^[^.].*\\.*$" (map pathname-file (directory (repository-path)))) string=?)
    1132          string<?) ) )
     1198  (let* ((line-width (get-terminal-width))
     1199         (eggs (sort (delete-duplicates
     1200                      (grep "^[^.].*\\.*$"
     1201                            (map pathname-file
     1202                                 (directory (repository-path)))) string=?)
     1203                     string<?))
     1204         (version-number-width
     1205          (fold
     1206           (lambda (egg maxlen)
     1207             (max maxlen
     1208                  (or (and-let* ((info (extension-information egg))
     1209                                 (v (assq 'version info)))
     1210                                (string-length (->string (cadr v))))
     1211                      0))) 0 eggs))
     1212         (version-width (fx+ version-number-width 9))
     1213         (release-width 22)
     1214         (name-width (fxmax (- line-width version-width release-width 3) 12)))
     1215    (for-each
     1216     (lambda (f)
     1217       (and-let* ((info (extension-information f)))
     1218                 (print (format-string (->string f) name-width)
     1219                        " "
     1220                        (format-string
     1221                         (or (and-let*
     1222                              ((v (assq 'version info)))
     1223                              (sprintf "Version: ~A"
     1224                                       (format-string (->string (cadr v))
     1225                                                      version-number-width #t)))
     1226                             "")
     1227                         version-width #t)
     1228                        " "
     1229                        (or (and-let* ((r (assq 'release info)))
     1230                                      (sprintf "(Release ~a)" (cadr r)) )
     1231                            "") ) ) )
     1232     eggs)))
     1233
     1234
     1235;;; Command line processing
    11331236
    11341237(define (main args)
     
    12591362         (set! *dont-ask* #t)
    12601363         (loop more) )
     1364        (("-create-tree" dir . more)
     1365         (create-repository-file dir)
     1366         (set! anydone #t)
     1367         (loop more) )
    12611368        (("-fetch-tree" . more)
    12621369         (set! *fetch-tree-only* #t)
    12631370         (set! anydone #t)
     1371         (loop more) )
     1372        (("-host-extension" . more)
     1373         (host-extension #t)
    12641374         (loop more) )
    12651375        (((or "-run" "-script" "-proxy" "-host" "-csc-option" "-ls" "-destdir" "-tree" "-local" "-svn" "-eval"))
     
    12971407           (build-doc-index) )
    12981408         (unless *keep-stuff*
    1299              (for-each
    1300               (lambda (f)
    1301                 (run (,*remove-command* ,(quotewrap f))) )
    1302               *fetched-eggs*))
     1409           (for-each
     1410            (lambda (f)
     1411              (run (,*remove-command* ,(quotewrap f))) )
     1412            *fetched-eggs*))
    13031413         #f) ) ) ) )
    13041414
  • chicken/branches/release/chicken.1

    r6423 r7276  
    5353.B \-check\-syntax
    5454Aborts compilation process after macro-expansion and syntax checks.
    55 
    56 .TP
    57 .B \-compress\-literals\ threshold
    58 Compiles quoted literals that exceed the size
    59 .BI threshold
    60 as strings
    61 and parse the strings at run-time. This reduces the size of the code and
    62 speeds up compile-times of the host C compiler, but has a small run-time
    63 performance penalty. The size of a literal is computed by counting recursively the objects
    64 in the literal, so a vector counts as 1 plus the count of the elements,
    65 a pair counts as the counts of the car and the cdr, respectively.
    66 All other objects count 1.
    6755
    6856.TP
     
    222210.I \;
    223211\.
    224 The environment variable
    225 .B CHICKEN_HOME
    226 is also considered as a search path.
    227212
    228213.TP
     
    423408
    424409.TP
    425 .B CHICKEN_HOME
    426 Should contain the pathname where support- and include-files can be found.
     410.B CHICKEN_PREFIX
     411Is used as a prefix directory for support files, include-files and libraries.
    427412
    428413.TP
  • chicken/branches/release/chicken.h

    r6180 r7276  
    280280#define ___byte_vector      unsigned char *
    281281#define ___symbol           char *
    282 #define ___callback
    283282#define ___safe
    284283#define ___declare(x, y)
     
    981980#define C_a_int_to_num(ptr, n, i)       C_int_to_num(ptr, i)
    982981#define C_a_unsigned_int_to_num(ptr, n, i)  C_unsigned_int_to_num(ptr, i)
     982#define C_a_double_to_num(ptr, n)       C_double_to_number(C_flonum(ptr, n))
    983983#define C_a_i_vector                    C_vector
    984984#define C_list                          C_a_i_list
     
    10831083#define C_u_i_bit_setp(x, i)            C_mk_bool((C_unfix(x) & (1 << C_unfix(i))) != 0)
    10841084
     1085#ifdef C_BIG_ENDIAN
     1086# ifdef C_SIXTY_FOUR
     1087#  define C_lihdr(x, y, z)              ((C_LAMBDA_INFO_TYPE >> 56) & 0xff), \
     1088                                        0, 0, 0, 0, (x), (y), (z)
     1089# else
     1090#  define C_lihdr(x, y, z)              ((C_LAMBDA_INFO_TYPE >> 24) & 0xff), \
     1091                                        (x), (y), (z)
     1092# endif
     1093#else
     1094# ifdef C_SIXTY_FOUR
     1095#  define C_lihdr(x, y, z)              (z), (y), (x), 0, 0, 0, 0, \
     1096                                        ((C_LAMBDA_INFO_TYPE >> 56) & 0xff)
     1097# else
     1098#  define C_lihdr(x, y, z)              (z), (y), (x), \
     1099                                        ((C_LAMBDA_INFO_TYPE >> 24) & 0xff)
     1100# endif
     1101#endif
     1102
    10851103#define C_end_of_main
    10861104
     
    11171135
    11181136C_varextern C_TLS void (C_fcall *C_restart_trampoline)(void *proc) C_regparm C_noret;
     1137C_varextern C_TLS void (*C_pre_gc_hook)(int mode);
    11191138C_varextern C_TLS void (*C_post_gc_hook)(int mode, long ms);
    11201139C_varextern C_TLS void (*C_panic_hook)(C_char *msg);
     
    11611180C_fctexport C_word C_fcall C_callback(C_word closure, int argc);
    11621181C_fctexport C_word C_fcall C_callback_wrapper(void *proc, int argc);
    1163 C_fctexport void C_fcall C_callback_adjust_stack_limits(C_word *base);
     1182C_fctexport void C_fcall C_callback_adjust_stack_limits(C_word *base); /* DEPRECATED */
     1183C_fctexport void C_fcall C_callback_adjust_stack(C_word *base, int size);
    11641184C_fctexport void CHICKEN_parse_command_line(int argc, char *argv[], C_word *heap, C_word *stack, C_word *symbols);
    11651185C_fctexport void C_fcall C_toplevel_entry(C_char *name) C_regparm;
     
    15041524#endif
    15051525
     1526C_fctexport C_word C_fcall C_decode_literal(C_word **ptr, C_char *str) C_regparm;
     1527
    15061528/* defined in eval.scm: */
    15071529C_fctexport  void  CHICKEN_get_error_message(char *buf,int bufsize);
  • chicken/branches/release/chicken.scm

    r4845 r7276  
    3939
    4040
    41 #{compiler
     41(private compiler
    4242  compiler-arguments
    4343  default-standard-bindings default-extended-bindings side-effecting-standard-bindings
     
    7171  membership-test-operators membership-unfold-limit valid-compiler-options valid-compiler-options-with-argument
    7272  generate-code make-variable-list make-argument-list generate-foreign-stubs foreign-type-declaration
    73   foreign-argument-conversion foreign-result-conversion}
     73  foreign-argument-conversion foreign-result-conversion)
    7474
    7575
  • chicken/branches/release/compiler.scm

    r5982 r7276  
    6464; (always-bound {<name>})
    6565; (foreign-declare {<string>})
    66 ; (foreign-parse {<string>})
    6766; (block)
    6867; (separate)
    6968; (run-time-macros)
    7069; (export {<name>})
    71 ; (compress-literals [<threshold>])
    7270; (safe-globals)
    73 ; (namespace <name> {<symbol})
    7471; (custom-declare (<tag> <name> <filename> <arg> ...) <string> ...)
    7572; (data <tag1> <exp1> ...)
     
    252249
    253250
    254 #{compiler
     251(private compiler
    255252  compiler-arguments process-command-line explicit-use-flag inline-list not-inline-list
    256253  default-standard-bindings default-extended-bindings side-effecting-standard-bindings
     
    270267  broken-constant-nodes inline-substitutions-enabled loop-lambda-names expand-profile-lambda
    271268  profile-lambda-list profile-lambda-index emit-profile expand-profile-lambda
    272   direct-call-ids foreign-type-table first-analysis callback-names namespace-table disabled-warnings
     269  direct-call-ids foreign-type-table first-analysis callback-names disabled-warnings
    273270  initialize-compiler canonicalize-expression expand-foreign-lambda update-line-number-database! scan-toplevel-assignments
    274271  compiler-warning import-table use-import-table compiler-macro-table compiler-macros-enabled
     
    287284  pprint-expressions-to-file foreign-type-check estimate-foreign-result-size scan-used-variables scan-free-variables
    288285  topological-sort print-version print-usage initialize-analysis-database export-list csc-control-file
    289   estimate-foreign-result-location-size compressed-literals-initializer unused-variables
     286  estimate-foreign-result-location-size unused-variables
    290287  expand-foreign-callback-lambda default-optimization-passes default-optimization-passes-when-trying-harder
    291288  units-used-by-default words-per-flonum disable-stack-overflow-checking
     
    293290  membership-test-operators membership-unfold-limit valid-compiler-options valid-compiler-options-with-argument
    294291  make-random-name final-foreign-type real-name-table real-name set-real-name! safe-globals-flag
    295   location-pointer-map literal-compression-threshold compressed-literals compressable-literal
     292  location-pointer-map
    296293  lookup-exports-file undefine-shadowed-macros process-lambda-documentation emit-syntax-trace-info
    297294  generate-code make-variable-list make-argument-list generate-foreign-stubs foreign-type-declaration
    298295  process-custom-declaration do-lambda-lifting file-requirements emit-closure-info export-file-name
    299   foreign-argument-conversion foreign-result-conversion foreign-type-convert-argument foreign-type-convert-result}
     296  foreign-argument-conversion foreign-result-conversion foreign-type-convert-argument foreign-type-convert-result
     297  big-fixnum?)
    300298
    301299(eval-when (compile eval)
     
    332330(define-constant real-name-table-size 997)
    333331(define-constant import-table-size 997)
    334 (define-constant default-literal-compression-threshold 50)
    335332(define-constant default-inline-max-size 10)
    336333
     
    362359(define source-filename #f)
    363360(define export-list #f)
    364 (define compressed-literals '())
    365 (define literal-compression-threshold #f)
    366 (define compressed-literals-initializer #f)
    367361(define safe-globals-flag #f)
    368362(define explicit-use-flag #f)
    369363(define disable-stack-overflow-checking #f)
    370 (define namespace-table '())
    371364(define require-imports-flag #f)
    372365(define emit-unsafe-marker #f)
     
    483476           => (lambda (val) (walk (car val) ae me dest)) ]
    484477          [(and inline-table-used (##sys#hash-table-ref inline-table x))
    485            => (lambda (val) (walk val ae me dest)) ]
     478           => (lambda (val)
     479                (walk val ae me dest)) ]
    486480          [(assq x foreign-variables)
    487481           => (lambda (fv)
     
    530524                      (walk xexpanded ae me dest) ]
    531525                     [(and inline-table-used (##sys#hash-table-ref inline-table name))
    532                       => (lambda (val) (walk (cons val (cdr x)) ae me dest)) ]
     526                      => (lambda (val)
     527                           (walk (cons val (cdr x)) ae me dest)) ]
    533528                     [else
    534529                      (case name
     
    544539                        ((quote)
    545540                         (##sys#check-syntax 'quote x '(quote _))
    546                          (let* ([lit (cadr x)]
    547                                 [cf (and literal-compression-threshold
    548                                          (compressable-literal lit literal-compression-threshold) ) ] )
    549                            (if cf
    550                                (let ([var (gensym 'lf)])
    551                                  (debugging 'o "compressing literal of size" cf)
    552                                  (set! compressed-literals
    553                                    (alist-cons var (write-to-string lit) compressed-literals) )
    554                                  (set! always-bound (cons var always-bound))
    555                                  (set! block-globals (cons var block-globals))
    556                                  var)
    557                                x) ) )
     541                         x)
    558542
    559543                        ((##core#check)
     
    11601144          (set! block-globals (lset-difference eq? block-globals syms))
    11611145          (set! export-list (lset-union eq? syms (or export-list '())))))
    1162        ((compress-literals)
    1163         (set! literal-compression-threshold
    1164           (or (and (pair? (cdr spec)) (number? (cadr spec)) (cadr spec))
    1165               default-literal-compression-threshold) )
    1166         (when (and (list? spec) (= 3 (length spec)))
    1167           (set! compressed-literals-initializer (third spec)) ) )
    11681146       ((emit-exports)
    11691147        (cond ((null? (cdr spec))
     
    11851163                n
    11861164                (quit "invalid argument to `inline-limit' declaration" spec) ) ) ) )
    1187        ((namespace)
    1188         (check-decl spec 2)
    1189         (let* ([syms (cdr spec)]
    1190                [ns (car syms)] )
    1191           (if (every symbol? syms)
    1192               (let ([oldsyms (or (and-let* ([a (assq ns namespace-table)]) (cdr a)) '())])
    1193                 (set! namespace-table
    1194                   (alist-update! ns (lset-union eq? oldsyms (cdr syms)) namespace-table eq?) ) )
    1195               (quit "invalid arguments to `namespace' declaration: ~S" spec) ) ) )
    11961165       ((constant)
    11971166        (let ((syms (cdr spec)))
     
    20902059(define (prepare-for-code-generation node db)
    20912060  (let ([literals '()]
     2061        [lambda-info-literals '()]
    20922062        [lambdas '()]
    20932063        [temporaries 0]
     
    22812251          ((quote)
    22822252           (let ((c (first params)))
    2283              (cond ((fixnum? c)
     2253             (cond ((and (fixnum? c) (not (big-fixnum? c)))
    22842254                    (immediate-literal c) )
    22852255                   ((number? c)
    22862256                    (cond ((eq? 'fixnum number-type)
    2287                            (cond ((integer? c)
     2257                           (cond ((and (integer? c) (not (big-fixnum? c)))
    22882258                                  (compiler-warning
    22892259                                   'type
     
    23032273      (cond [(immediate? x) (immediate-literal x)]
    23042274            [(and (number? x) (inexact? x)
    2305                   (list-index (lambda (y) (and (number? y) (inexact? y) (= x y))) literals) )
     2275                  (list-index (lambda (y) (and (number? y) (inexact? y) (= x y)))
     2276                              literals) )
    23062277             => values]
    2307             [(posq x literals) => values]
     2278            ((##core#inline "C_lambdainfop" x)
     2279             (let ((i (length lambda-info-literals)))
     2280               (set! lambda-info-literals
     2281                 (append lambda-info-literals (list x))) ;*** see below
     2282               (vector i) ) )
     2283            [(posq x literals) => identity]
    23082284            [else (new-literal x)] ) )
    23092285
    23102286    (define (new-literal x)
    23112287      (let ([i (length literals)])
    2312         (set! literals (append literals (list x))) ; could be optimized
     2288        (set! literals (append literals (list x))) ;*** could (should) be optimized
    23132289        i) )
    23142290
     
    23362312      (debugging 'o "fast global references" fastrefs)
    23372313      (debugging 'o "fast global assignments" fastsets)
    2338       (values node2 literals lambdas) ) ) )
     2314      (values node2 literals lambda-info-literals lambdas) ) ) )
  • chicken/branches/release/csc.scm

    r6577 r7276  
    5151#endif
    5252
     53#ifndef C_TARGET_LDFLAGS
     54# define C_TARGET_LDFLAGS  C_INSTALL_LDFLAGS
     55#endif
     56
    5357#ifndef C_TARGET_BIN_HOME
    5458# define C_TARGET_BIN_HOME  C_INSTALL_BIN_HOME
     
    8791(define-foreign-variable TARGET_CFLAGS c-string "C_TARGET_CFLAGS")
    8892(define-foreign-variable INSTALL_CFLAGS c-string "C_INSTALL_CFLAGS")
     93(define-foreign-variable TARGET_LDFLAGS c-string "C_TARGET_LDFLAGS")
     94(define-foreign-variable INSTALL_LDFLAGS c-string "C_INSTALL_LDFLAGS")
    8995(define-foreign-variable INSTALL_MORE_LIBS c-string "C_INSTALL_MORE_LIBS")
    9096(define-foreign-variable INSTALL_MORE_STATIC_LIBS c-string "C_INSTALL_MORE_STATIC_LIBS")
     
    118124(define arguments (command-line-arguments))
    119125(define host-mode (member "-host" arguments))
     126(define cross-chicken (##sys#fudge 39))
    120127
    121128(define (prefix str dir default)
     
    130137
    131138(define home
    132   (or (getenv "CHICKEN_HOME")
    133       (quotewrap
    134        (prefix "" "share" (if host-mode INSTALL_SHARE_HOME TARGET_SHARE_HOME)))))
     139  (quotewrap
     140   (prefix "" "share" (if host-mode INSTALL_SHARE_HOME TARGET_SHARE_HOME))))
    135141
    136142(define translator
     
    159165      (lambda (s) (quotewrap s)) ; allow filenames w/ whitespace
    160166      (lambda (s) s)))
     167
    161168(define default-compilation-optimization-options (string-split (if host-mode INSTALL_CFLAGS TARGET_CFLAGS)))
    162169(define best-compilation-optimization-options default-compilation-optimization-options)
    163 (define default-linking-optimization-options '())
    164 (define best-linking-optimization-options '())
     170(define default-linking-optimization-options (string-split (if host-mode INSTALL_LDFLAGS TARGET_LDFLAGS)))
     171(define best-linking-optimization-options default-linking-optimization-options)
    165172
    166173(define-constant simple-options
     
    177184    -inline-limit -profile-name -disable-warning -import -require-static-extension
    178185    -feature -debug-level -heap-growth -heap-shrinkage -heap-initial-size -emit-exports
    179     -compress-literals) )
     186    -compress-literals) )               ; DEPRECATED
    180187
    181188(define-constant shortcuts
     
    331338
    332339    -i -case-insensitive        don't preserve case of read symbols   
    333     -K -keyword-style STYLE     allow alternative keyword syntax (prefix or suffix)
     340    -K -keyword-style STYLE     allow alternative keyword syntax (prefix, suffix or none)
    334341    -run-time-macros            macros are made available at run-time
    335342
     
    437444    -debug MODES                display debugging output for the given modes
    438445    -compiler PATHNAME          use other compiler than default `chicken'
    439     -compress-literals NUMBER   compile literals above threshold as strings
    440446    -disable-c-syntax-checks    disable syntax checks of C code fragments
    441447    -raw                        do not generate implicit init- and exit code                           
     
    566572                (set! verbose #t)
    567573                (t-options "-verbose")
    568                 (set! compile-options (cons "-v -Q" compile-options))
     574                (set! compile-options (cons* "-v" "-Q" compile-options))
    569575                (set! link-options (cons "-v" link-options)) ]
    570576               [(|-A| -analyze-only)
     
    588594                (set! gui #t)
    589595                (when mingw
    590                   (set! link-options (cons* "kernel32.lib" "user32.lib" "gdi32.lib" link-options))
     596                  (set! link-options
     597                    (cons* "-lkernel32" "-luser32.lib" "-lgdi32" "-mwindows"
     598                           link-options))
    591599                  (set! compile-options (cons "-DC_WINDOWS_GUI" compile-options))) ]
    592600               [(-framework)
     
    809817
    810818(define (run-linking)
    811   (let ([files (map cleanup-filename
     819  (let ((files (map cleanup-filename
    812820                    (append object-files
    813                             (nth-value 0 (static-extension-info)) ) ) ] )
     821                            (nth-value 0 (static-extension-info)) ) ) )
     822        (target (cleanup-filename target-filename)))
    814823    (unless (zero?
    815824             ($system
     
    819828                      (append
    820829                       files
    821                        (list (string-append link-output-flag (cleanup-filename target-filename))
     830                       (list (string-append link-output-flag target)
    822831                             (linker-options)
    823832                             (linker-libraries #f) ) ) ) ) ) )
    824833      (exit last-exit-code) )
     834    (when (and osx (or (not cross-chicken) host-mode))
     835      (unless (zero? ($system
     836                      (string-append
     837                       "install_name_tool -change libchicken.dylib "
     838                       (quotewrap
     839                        (make-pathname
     840                         (prefix "" "lib"
     841                                 (if host-mode
     842                                     INSTALL_LIB_HOME
     843                                     TARGET_RUN_LIB_HOME))
     844                         "libchicken.dylib") )
     845                       " "
     846                       target) ) )
     847        (exit last-exit-code) ) )
    825848    (unless keep-files (for-each $delete-file generated-object-files)) ) )
    826849
  • chicken/branches/release/csi.1

    r6226 r7276  
    7575pathnames separated by
    7676.B \; .
    77 The environment variable
    78 .B CHICKEN_HOME
    79 is also considered as a search path.
    8077
    8178.TP
     
    141138
    142139.TP
    143 .B CHICKEN_HOME
    144 Should contain the pathname of a directory where interpreter
    145 support-files can be found. This path is also added to the list of
    146 pathnames where include-filesd are searched.
     140.B CHICKEN_PREFIX
     141Is used as a prefix directory for support files, include-files and libraries.
    147142
    148143.TP
  • chicken/branches/release/csi.scm

    r6175 r7276  
    5353(include "banner")
    5454
    55 
    56 #{csi
     55(private csi
    5756  print-usage print-banner
    5857  run hexdump del
     
    6160  deldups tty-input?
    6261  history-list history-count history-add history-ref
    63   trace-indent trace-indent-level traced-procedure-entry traced-procedure-exit}
     62  trace-indent trace-indent-level traced-procedure-entry traced-procedure-exit)
    6463
    6564(declare
     
    6766    ##sys#windows-platform)
    6867  (hide parse-option-string bytevector-data member* canonicalize-args do-trace do-untrace
    69         traced-procedures describer-table
     68        traced-procedures describer-table dirseparator?
    7069        findall trace-indent command-table do-break do-unbreak broken-procedures) )
    7170
     
    131130;;; Chop terminating separator from pathname:
    132131
     132(define (dirseparator? c)
     133  (or (char=? c #\\) (char=? c #\/)))
     134
    133135(define chop-separator
    134   (let ([pds ##sys#pathname-directory-separator]
    135         [substring substring] )
     136  (let ([substring substring] )
    136137    (lambda (str)
    137       (let ([len (sub1 (##sys#size str))])
    138         (if (and (fx> len 0) (char=? (string-ref str len) pds))
     138      (let* ((len (sub1 (##sys#size str)))
     139             (c (string-ref str len)))
     140        (if (and (fx> len 0) (dirseparator? c))
    139141            (substring str 0 len)
    140142            str) ) ) ) )
     
    162164      (let ([path (getenv "PATH")])
    163165        (and (> (##sys#size name) 0)
    164              (cond [(char=? ##sys#pathname-directory-separator (string-ref name 0)) (addext name)]
    165                    [(string-index (lambda (c) (char=? c ##sys#pathname-directory-separator)) name)
     166             (cond [(dirseparator? (string-ref name 0)) (addext name)]
     167                   [(string-index dirseparator? name)
    166168                    (and-let* ([p (_getcwd buf 256)])
    167                       (addext (string-append (chop-separator p) (string ##sys#pathname-directory-separator) name)) ) ]
     169                      (addext (string-append (chop-separator p) "/" name)) ) ]
    168170                   [(addext name)]
    169171                   [else
    170                     (let ([name2 (string-append (string ##sys#pathname-directory-separator) name)])
     172                    (let ([name2 (string-append "/" name)])
    171173                      (let loop ([ps (string-split path ";")])
    172174                        (and (pair? ps)
     
    849851    (let* ([eval? (member* '("-e" "-eval") args)]
    850852           [batch (or script (member* '("-b" "-batch") args) eval?)]
    851            [quiet (or script (member* '("-q" "-quiet") args) eval?)]
     853           [quietflag (member* '("-q" "-quiet") args)]
     854           [quiet (or script quietflag eval?)]
    852855           [ipath (map chop-separator (string-split (or (getenv "CHICKEN_INCLUDE_PATH") "") ";"))] )     
    853856      (define (collect-options opt)
     
    864867              (load fn)
    865868              (let* ([prefix (chop-separator (or (getenv "HOME") "."))]
    866                      [fn (string-append prefix (string ##sys#pathname-directory-separator) init-file)] )
     869                     [fn (string-append prefix "/" init-file)] )
    867870                (when (file-exists? fn)
    868871                  (load fn) ) ) ) ) )
     872      (when quietflag (set! ##sys#eval-debug-level 0))
    869873      (when (member* '("-h" "-help" "--help") args)
    870874        (print-usage)
  • chicken/branches/release/debian/changelog

    r5897 r7276  
     1chicken (2.732-0.1) unstable; urgency=low
     2
     3  * New upstream version.
     4
     5 -- Ivan Raikov <raikov@oist.jp>  Sat, 01 Dec 2007 14:30:55 +0900
     6
    17chicken (2.703-0.1) unstable; urgency=low
    28
     
    155161
    156162 -- zhaoway <zw@debian.org>  Mon, 21 Jan 2002 20:40:17 +0800
     163 
  • chicken/branches/release/debian/rules

    r5884 r7276  
    1616MAKE:=$(MAKE) PLATFORM=linux
    1717PREFIX=/usr
    18 BINARYVERSION=1
     18BINARYVERSION=3
    1919
    2020build: build-stamp
     
    2222        dh_testdir
    2323#       CFLAGS="$(CFLAGS)" ./configure --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
    24         $(MAKE) MAKEINFO_PROGRAM_OPTIONS="" CFLAGS="$(CFLAGS)" PREFIX="$(PREFIX)" MANDIR="$(PREFIX)/share/man" INFODIR="$(PREFIX)/share/info" SHAREDIR="$(PREFIX)/share/chicken" EGGDIR="/var/lib/chicken/$(BINARYVERSION)"
     24        $(MAKE) MAKEINFO_PROGRAM_OPTIONS="" CFLAGS="$(CFLAGS)" PREFIX="$(PREFIX)" MANDIR="$(PREFIX)/share/man" INFODIR="$(PREFIX)/share/info" SHAREDIR="$(PREFIX)/share" EGGDIR="/var/lib/chicken/$(BINARYVERSION)" MAKEINFO_PROGRAM_OPTIONS= HOSTNAME=debian
    2525        touch build-stamp
    2626
     
    4444        dh_clean -k
    4545        dh_installdirs
    46         $(MAKE) install PREFIX="$(CURDIR)/debian/tmp/usr" MANDIR="$(CURDIR)/debian/tmp/usr/share/man" INFODIR="$(CURDIR)/debian/tmp/usr/share/info" SHAREDIR="$(CURDIR)/debian/tmp/usr/share/chicken" EGGDIR="$(CURDIR)/debian/tmp/var/lib/chicken/$(BINARYVERSION)"
     46# The directories here have to be prefixed by $(CURDIR)/debian/tmp
     47# because that is the location where the binary package files are
     48# placed by dpkg-buildpackage. If absolute files are specified,
     49# i.e. /var/lib/chicken, then those files will be installed on the
     50# build system, but will not end up in the package.
     51        $(MAKE) install PREFIX="$(CURDIR)/debian/tmp/usr" MANDIR="$(CURDIR)/debian/tmp/usr/share/man" INFODIR="$(CURDIR)/debian/tmp/usr/share/info" SHAREDIR="$(CURDIR)/debian/tmp/usr/share" EGGDIR="$(CURDIR)/debian/tmp/var/lib/chicken/$(BINARYVERSION)" MAKEINFO_PROGRAM_OPTIONS= HOSTNAME=debian
    4752
    4853binary-common:
     
    5257        dh_installdocs
    5358        dh_installman
    54         dh_installinfo chicken.info
     59# The asterisk in chicken.info* is necessary, because Debian makeinfo
     60# is very different from the standard makeinfo, and it is incredibly
     61# difficult to convince it to produce standalone Texinfo files.
     62        dh_installinfo chicken.info*
    5563        dh_installchangelogs ChangeLog.20070807
    5664        dh_link
  • chicken/branches/release/defaults.make

    r6577 r7276  
    3939NURSERY ?= (128*1024)
    4040STACKDIRECTION ?= 1
     41CROSS_CHICKEN ?= 0
    4142
    4243# directories
    4344
     45DESTDIR =
    4446ifeq ($(PLATFORM),mingw)
    4547PREFIX ?= c:/devtools
     
    4749PREFIX ?= /usr/local
    4850endif
    49 DESTDIR = $(PREFIX)
    50 BINDIR = $(DESTDIR)/bin
    51 LIBDIR = $(DESTDIR)/lib
    52 SHAREDIR = $(DESTDIR)/share
     51
     52BINDIR = $(PREFIX)/bin
     53LIBDIR = $(PREFIX)/lib
     54SHAREDIR = $(PREFIX)/share
    5355DATADIR = $(SHAREDIR)/chicken
    54 MANDIR = $(SHAREDIR)/man/man1
     56TOPMANDIR = $(SHAREDIR)/man
     57MANDIR = $(TOPMANDIR)/man1
    5558INFODIR = $(SHAREDIR)/info
    56 INCDIR = $(DESTDIR)/include
     59INCDIR = $(PREFIX)/include
    5760DOCDIR = $(DATADIR)/doc
    58 EGGDIR = $(DESTDIR)/lib/chicken/$(BINARYVERSION)
     61CHICKENLIBDIR = $(LIBDIR)/chicken
     62EGGDIR = $(CHICKENLIBDIR)/$(BINARYVERSION)
     63
     64ifeq ($(PLATFORM),mingw)
     65BINDIR = $(PREFIX)\\bin
     66LIBDIR = $(PREFIX)\\lib
     67SHAREDIR = $(PREFIX)\\share
     68DATADIR = $(SHAREDIR)\\chicken
     69TOPMANDIR = $(SHAREDIR)\\man
     70MANDIR = $(TOPMANDIR)\\man1
     71INFODIR = $(SHAREDIR)\\info
     72INCDIR = $(PREFIX)\\include
     73DOCDIR = $(DATADIR)\\doc
     74CHICKENLIBDIR = $(LIBDIR)\\chicken
     75EGGDIR = $(CHICKENLIBDIR)\\$(BINARYVERSION)
     76else
     77IBINDIR = $(BINDIR)
     78ILIBDIR = $(LIBDIR)
     79ISHAREDIR = $(SHAREDIR)
     80IDATADIR = $(DATADIR)
     81ITOPMANDIR = $(TOPMANDIR)
     82IMANDIR = $(MANDIR)
     83IINFODIR = $(INFODIR)
     84IINCDIR = $(INCDIR)
     85IDOCDIR = $(DOCDIR)
     86ICHICKENLIBDIR = $(CHICKENLIBDIR)
     87IEGGDIR = $(EGGDIR)
     88endif
    5989
    6090# commands
    6191
    62 ifdef HOST
    63 C_COMPILER ?= $(HOST)-gcc
    64 CXX_COMPILER ?= $(HOST)-g++
    65 LIBRARIAN ?= $(HOST)-ar
     92ifdef HOSTSYSTEM
     93C_COMPILER ?= $(HOSTSYSTEM)-gcc
     94CXX_COMPILER ?= $(HOSTSYSTEM)-g++
     95LIBRARIAN ?= $(HOSTSYSTEM)-ar
    6696else
    6797C_COMPILER ?= gcc
     
    77107ASSEMBLER ?= $(C_COMPILER)
    78108MAKEINFO_PROGRAM ?= -makeinfo
     109ifeq ($(PLATFORM),mingw)
     110INSTALL_PROGRAM ?= copy
     111MAKEDIR_COMMAND ?= -mkdir
     112else
     113INSTALL_PROGRAM ?= install
    79114MAKEDIR_COMMAND ?= mkdir
    80 INSTALL_PROGRAM ?= install
     115endif
    81116POSTINSTALL_STATIC_LIBRARY ?= true
    82117POSTINSTALL_PROGRAM ?= true
     
    86121# target variables
    87122
    88 ifdef TARGET
    89 TARGET_C_COMPILER ?= $(TARGET)-$(C_COMPILER)
    90 TARGET_CXX_COMPILER ?= $(TARGET)-$(CXX_COMPILER)
     123ifdef TARGETSYSTEM
     124TARGET_C_COMPILER ?= $(TARGETSYSTEM)-$(C_COMPILER)
     125TARGET_CXX_COMPILER ?= $(TARGETSYSTEM)-$(CXX_COMPILER)
    91126else
    92127TARGET_C_COMPILER ?= $(C_COMPILER)
     
    97132TARGET_C_COMPILER_OPTIMIZATION_OPTIONS ?= $(C_COMPILER_OPTIMIZATION_OPTIONS)
    98133TARGET_PREFIX ?= $(PREFIX)
     134TARGET_RUN_PREFIX ?= $(TARGET_PREFIX)
    99135TARGET_LIBRARIES ?= $(LIBRARIES)
    100 
    101 ifneq ($(TARGET_C_COMPILER),$(HOST_C_COMPILER))
     136TARGET_LINKER_OPTIONS ?= $(LINKER_OPTIONS)
     137
     138ifneq ($(TARGET_C_COMPILER),$(C_COMPILER))
    102139CROSS_CHICKEN = 1
    103140else
     
    122159C_COMPILER_PCRE_OPTIONS ?= -DPCRE_STATIC
    123160C_COMPILER_SHARED_OPTIONS ?= -fPIC -DPIC
    124 LINKER_OPTIONS ?= -L.
    125 LINKER_STATIC_OPTIONS ?= $(LINKERFLAGS)
     161LINKER_EXECUTABLE_OPTIONS ?= -L.
     162LINKER_STATIC_OPTIONS ?= $(LINKER_EXECUTABLE_OPTIONS)
    126163LINKER_OUTPUT_OPTION ?= -o
    127164LINKER_LIBRARY_OPTION ?= -l
     
    132169REMOVE_COMMAND_OPTIONS ?= /f /q
    133170REMOVE_COMMAND_RECURSIVE_OPTIONS ?= /f /s /q
     171MAKE_WRITABLE_COMMAND ?= rem
    134172else
    135173REMOVE_COMMAND_OPTIONS ?= -f
    136174REMOVE_COMMAND_RECURSIVE_OPTIONS ?= -fr
     175MAKE_WRITABLE_COMMAND ?= chmod a+rw
    137176endif
    138177MAKEINFO_PROGRAM_OPTIONS ?= --no-split
     178ifneq ($(PLATFORM),mingw)
    139179INSTALL_PROGRAM_SHARED_LIBRARY_OPTIONS ?= -m755
    140180INSTALL_PROGRAM_STATIC_LIBRARY_OPTIONS ?= -m644
     
    142182INSTALL_PROGRAM_FILE_OPTIONS ?= -m644
    143183MAKEDIR_COMMAND_OPTIONS ?= -p
     184endif
    144185ASSEMBLER_OPTIONS ?= $(C_COMPILER_OPTIONS)
    145186ASSEMBLER_OUTPUT_OPTION ?= -o
    146187ASSEMBLER_COMPILE_OPTION ?= -c
     188ifdef STATICBUILD
     189PRIMARY_LIBCHICKEN ?= libchicken$(A)
     190else
     191ifeq ($(PLATFORM),cygwin)
     192PRIMARY_LIBCHICKEN = cygchicken-0.dll
     193LIBCHICKEN_SO_FILE = cygchicken-0.dll
     194LIBUCHICKEN_SO_FILE = cyguchicken-0.dll
     195else
    147196PRIMARY_LIBCHICKEN ?= libchicken$(SO)
     197LIBCHICKEN_SO_FILE ?= libchicken$(SO)
     198LIBUCHICKEN_SO_FILE ?= libuchicken$(SO)
     199endif
     200endif
    148201UNINSTALLINFO_PROGRAM_OPTIONS ?= --delete
    149202LIBCHICKEN_SO_LIBRARIES ?= $(LIBRARIES)
     
    163216BUILD_TAG ?= compiled $(BUILD_TIME) on $(HOSTNAME) ($(UNAME_SYS))
    164217
     218ifdef LOCKTOSPACE
     219C_COMPILER_BUILD_RUNTIME_OPTIONS += -DC_LOCK_TOSPACE
     220endif
     221
    165222# file extensions
    166223
     
    190247CHICKEN_LIBRARY_OPTIONS = $(CHICKEN_OPTIONS) -explicit-use
    191248CHICKEN_PROGRAM_OPTIONS = $(CHICKEN_OPTIONS) -no-lambda-info
     249CHICKEN_COMPILER_OPTIONS = $(CHICKEN_PROGRAM_OPTIONS) -extend private-namespace.scm
    192250CHICKEN_UNSAFE_OPTIONS = -unsafe -no-lambda-info
    193251
     
    206264CHICKEN_SHARED_EXECUTABLE = $(CHICKEN_PROGRAM)-shared$(EXE)
    207265CSI_SHARED_EXECUTABLE = $(CSI_PROGRAM)-shared$(EXE)
    208 TARGETS ?= libchicken$(A) libuchicken$(A) $(CHICKEN_STATIC_EXECUTABLE) \
     266TARGETLIBS ?= libchicken$(A) libuchicken$(A)
     267TARGETS ?= $(TARGETLIBS) $(CHICKEN_STATIC_EXECUTABLE) \
    209268        $(CSI_STATIC_EXECUTABLE) $(CHICKEN_PROFILE_PROGRAM)$(EXE) \
    210269        $(CSC_PROGRAM)$(EXE) \
     
    215274CHICKEN_SHARED_EXECUTABLE = $(CHICKEN_PROGRAM)$(EXE)
    216275CSI_SHARED_EXECUTABLE = $(CSI_PROGRAM)$(EXE)
    217 TARGETS ?= libchicken$(A) libuchicken$(A) $(CHICKEN_SHARED_EXECUTABLE) \
     276TARGETLIBS ?= libchicken$(A) libuchicken$(A) \
     277        $(LIBCHICKEN_SO_FILE) $(LIBUCHICKEN_SO_FILE)
     278TARGETS ?= $(TARGETLIBS) $(CHICKEN_SHARED_EXECUTABLE) \
    218279        $(CSI_SHARED_EXECUTABLE) $(CHICKEN_PROFILE_PROGRAM)$(EXE) \
    219         $(CSC_PROGRAM)$(EXE) libchicken$(SO) \
    220         libuchicken$(SO) $(CHICKEN_SETUP_PROGRAM)$(EXE) chicken.info \
     280        $(CSC_PROGRAM)$(EXE) $(CHICKEN_SETUP_PROGRAM)$(EXE) chicken.info \
    221281        $(CHICKEN_BUG_PROGRAM)$(EXE)
    222282endif
     
    243303        echo "# define C_INSTALL_CFLAGS \"$(C_COMPILER_OPTIONS) $(C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@
    244304        echo "#endif" >>$@
     305        echo "#ifndef C_INSTALL_LDFLAGS" >>$@
     306        echo "# define C_INSTALL_LDFLAGS \"$(LINKER_OPTIONS) $(LINKER_OPTIMIZATION_OPTIONS)\"" >>$@
     307        echo "#endif" >>$@
    245308        echo "#ifndef C_INSTALL_SHARE_HOME" >>$@
    246309        echo "# define C_INSTALL_SHARE_HOME \"$(DATADIR)\"" >>$@
     
    288351        echo "# define C_TARGET_CFLAGS \"$(TARGET_C_COMPILER_OPTIONS) $(TARGET_C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@
    289352        echo "#endif" >>$@
     353        echo "#ifndef C_TARGET_LDFLAGS" >>$@
     354        echo "# define C_TARGET_LDFLAGS \"$(TARGET_LINKER_OPTIONS) $(TARGET_LINKER_OPTIMIZATION_OPTIONS)\"" >>$@
     355        echo "#endif" >>$@
    290356        echo "#ifndef C_CROSS_CHICKEN" >>$@
    291357        echo "# define C_CROSS_CHICKEN $(CROSS_CHICKEN)" >>$@
     
    295361        echo "#endif" >>$@
    296362        echo "#ifndef C_TARGET_RUN_LIB_HOME" >>$@
    297         echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
     363        echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)/lib\"" >>$@
    298364        echo "#endif" >>$@
    299365        echo "#ifndef C_TARGET_SHARE_HOME" >>$@
     
    325391        echo "#endif" >>$@
    326392endif
     393#
  • chicken/branches/release/distribution/manifest

    r6580 r7276  
    202202tests/fixnum-tests.scm
    203203tests/path-tests.scm
     204tests/r4rstest.out
    204205tweaks.scm
    205206utils.scm
     
    254255rules.make
    255256defaults.make
     257private-namespace.scm
     258misc/makedist.scm
  • chicken/branches/release/eval.scm

    r6428 r7276  
    112112(define-foreign-variable installation-home c-string "C_INSTALL_SHARE_HOME")
    113113
    114 (define pds ##sys#pathname-directory-separator)
    115 (define pdss (string ##sys#pathname-directory-separator))
    116 
    117114(define ##sys#core-library-modules
    118115  '(extras lolevel utils tcp regex regex-extras posix match srfi-1 srfi-4 srfi-13 srfi-14 srfi-18))
     
    147144  (let ([getenv getenv])
    148145    (lambda ()
    149       (or (getenv "CHICKEN_HOME")
    150           (and-let* ((p (getenv "CHICKEN_PREFIX")))
     146      (or (and-let* ((p (getenv "CHICKEN_PREFIX")))
    151147            (##sys#string-append
    152148             p
    153              (if (char=? (string-ref p (fx- (##sys#size p) 1)) ##sys#pathname-directory-separator)
     149             (if (memq (string-ref p (fx- (##sys#size p) 1)) '(#\\ #\/))
    154150                 "share"
    155151                 "/share") ) )
     
    11201116    (let loop ([i (fx- (##sys#size str) 1)])
    11211117      (and (not (zero? i))
    1122            (if (char=? pds (##core#inline "C_subchar" str i))
     1118           (if (memq (##core#inline "C_subchar" str i) '(#\\ #\/))
    11231119               i
    11241120               (loop (fx- i 1)) ) ) ) )
     
    11561152                 (or (##sys#dload (##sys#make-c-string fname) topentry #t)
    11571153                     (and (not (has-sep? fname))
    1158                           (##sys#dload (##sys#make-c-string (string-append "." pdss fname)) topentry #t) ) ) )
     1154                          (##sys#dload (##sys#make-c-string (##sys#string-append "./" fname)) topentry #t) ) ) )
    11591155            (call-with-current-continuation
    11601156             (lambda (abrt)
     
    11931189  (set! load
    11941190    (lambda (filename . evaluator)
    1195       (fluid-let ([##sys#current-namespace ##sys#current-namespace])
    1196         (##sys#load filename (:optional evaluator #f) #f) ) ) )
     1191      (##sys#load filename (:optional evaluator #f) #f) ) )
    11971192  (set! load-relative
    11981193    (lambda (filename . evaluator)
    1199       (fluid-let ([##sys#current-namespace ##sys#current-namespace])
    1200         (##sys#load
    1201          (if (char=? pds (string-ref filename 0))
    1202              filename
    1203              (##sys#string-append ##sys#current-load-path filename) )
    1204          (:optional evaluator #f) #f) ) ) )
     1194      (##sys#load
     1195       (if (memq (string-ref filename 0) '(#\\ #\/))
     1196           filename
     1197           (##sys#string-append ##sys#current-load-path filename) )
     1198       (:optional evaluator #f) #f) ) )
    12051199  (set! load-noisily
    12061200    (lambda (filename #!key (evaluator #f) (time #f) (printer #f))
    1207       (fluid-let ([##sys#current-namespace ##sys#current-namespace])
    1208         (##sys#load filename evaluator #t time printer) ) ) ) )
     1201      (##sys#load filename evaluator #t time printer) ) ) )
    12091202
    12101203(define ##sys#load-library-extension    ; this is crude...
     
    12841277    (lambda (id loc)
    12851278      (define (err) (##sys#error loc "invalid extension path" id))
     1279      (define (sep? c) (or (char=? #\\ c) (char=? #\/ c)))
    12861280      (let ([p (cond [(string? id) id]
    12871281                     [(symbol? id) (##sys#symbol->string id)]
     
    12971291                             (if (null? (##sys#slot id 1))
    12981292                                 ""
    1299                                  pdss)
     1293                                 "/")
    13001294                             (loop (##sys#slot id 1)) ) ) ) ] ) ] )
    13011295        (let check ([p p])
    13021296          (let ([n (##sys#size p)])
    13031297            (cond [(fx= 0 n) (err)]
    1304                   [(char=? pds (string-ref p 0))
     1298                  [(sep? (string-ref p 0))
    13051299                   (check (##sys#substring p 1 n)) ]
    1306                   [(char=? pds (string-ref p (fx- n 1)))
     1300                  [(sep? (string-ref p (fx- n 1)))
    13071301                   (check (##sys#substring p 0 (fx- n 1))) ]
    13081302                  [else p] ) ) ) ) ) ) )
     
    13111305  (make-parameter
    13121306   (or (getenv repository-environment-variable)
    1313        (getenv "CHICKEN_HOME")
    13141307       install-egg-home) ) )
    13151308
     
    13211314    (lambda (p inc?)
    13221315        (define (check path)
    1323           (let ([p0 (string-append path pdss p)])
     1316          (let ([p0 (string-append path "/" p)])
    13241317            (and (or (file-exists? (##sys#string-append p0 ##sys#load-dynamic-extension))
    13251318                     (file-exists? (##sys#string-append p0 source-file-extension)) )
     
    13831376    (lambda (id loc)
    13841377      (let* ((p (##sys#canonicalize-extension-path id loc))
    1385              (rpath (string-append (##sys#repository-path) pdss p ".")) )
     1378             (rpath (string-append (##sys#repository-path) "/" p ".")) )
    13861379        (cond ((file-exists? (string-append rpath setup-file-extension))
    13871380               => (cut with-input-from-file <> read) )
     
    13901383(define (extension-information ext)
    13911384  (##sys#extension-information ext 'extension-information) )
    1392 
    1393 (define extension-info extension-information) ; DEPRECATED
    13941385
    13951386(define ##sys#lookup-runtime-requirements
     
    16891680            (cond ((eq? paths '()) fname)
    16901681                  ((test (string-append (##sys#slot paths 0)
    1691                                         pdss
     1682                                        "/"
    16921683                                        fname) ) )
    16931684                  (else (loop (##sys#slot paths 1))) ) ) ) ) ) )
     
    21212112                 (lambda ()
    21222113                   (set! ##sys#read-error-with-line-number #f)
    2123                    (set! ##sys#default-namespace-prefix #f)
    21242114                   (set! ##sys#enable-qualifiers #t)
    2125                    (set! ##sys#current-namespace #f)
    21262115                   (resetports)
    21272116                   (c #f) ) ) ) )
  • chicken/branches/release/extras.scm

    r6363 r7276  
    6868     ##sys#gcd ##sys#lcm ##sys#fudge ##sys#check-list ##sys#user-read-hook) ) ] )
    6969
    70 #{extras
    71   reverse-string-append generic-write hashtab-default-size hashtab-threshold hashtab-rehash hashtab-primes-table}
     70(private
     71 extras
     72  reverse-string-append generic-write hashtab-default-size hashtab-threshold hashtab-rehash hashtab-primes-table)
    7273
    7374(declare
  • chicken/branches/release/library.scm

    r6577 r7276  
    160160
    161161
    162 (define-constant namespace-size 997)
    163162(define-constant namespace-max-id-len 31)
    164163(define-constant char-name-table-size 37)
     
    20162015(define ##sys#default-read-info-hook #f)
    20172016(define ##sys#read-error-with-line-number #f)
    2018 (define ##sys#current-namespace #f)
    2019 (define ##sys#default-namespace-prefix #f)
    20202017(define ##sys#enable-qualifiers #t)
    20212018(define (##sys#read-prompt-hook) #f)    ; just here so that srfi-18 works without eval
     
    23562353                            (loop i) ) ) ) ) ) )
    23572354
    2358           (define (r-namespace)
    2359             (set! ##sys#current-namespace (##sys#make-vector namespace-size '()))
    2360             (let* ([ns (r-next-token)]
    2361                    [nslen (##sys#size ns)]
    2362                    [p (##sys#make-string 1)] )
    2363               (when (fx> nslen namespace-max-id-len)
    2364                 (set! ns (##sys#substring ns 0 namespace-max-id-len))
    2365                 (set! nslen namespace-max-id-len) )
    2366               (##sys#setbyte p 0 (##sys#size ns))
    2367               (let ([prefix (##sys#string-append p ns)])
    2368                 (let loop ([toks '()])
    2369                   (r-spaces)
    2370                   (cond [(memq (##sys#peek-char-0 port) '(#\} #\$)) ;*** change this to (char=? #\$ (##sys#peek-char-0 port)) later
    2371                          (##sys#read-char-0 port)
    2372                          (for-each
    2373                           (lambda (tok)
    2374                             (let ([i (##core#inline
    2375                                       "C_fixnum_modulo"
    2376                                       (##core#inline "C_hash_string" tok) namespace-size)])
    2377                               (##sys#setslot
    2378                                ##sys#current-namespace i
    2379                                (cons (cons tok (##sys#intern-symbol (##sys#string-append prefix tok)))
    2380                                      (##sys#slot ##sys#current-namespace i) ) ) ) )
    2381                           toks) ]
    2382                         [else (loop (cons (r-next-token) toks))] ) ) ) ) )
    2383 
    23842355          (define (r-ext-symbol)
    23852356            (let* ([p (##sys#make-string 1)]
     
    24082379                                   (##sys#substring tok 0 (fx- len 1)) ) ) )
    24092380                     => build-keyword]  ; ugh
    2410                     [(not ##sys#current-namespace) (build-symbol tok)]
    2411                     [else
    2412                      (let ([i (##core#inline "C_fixnum_modulo" (##core#inline "C_hash_string" tok) namespace-size)])
    2413                        (let loop ([bucket (##sys#slot ##sys#current-namespace i)])
    2414                          (if (null? bucket)
    2415                              (build-symbol tok)
    2416                              (let ([e (##sys#slot bucket 0)])
    2417                                (if (string=? tok (##sys#slot e 0))
    2418                                    (##sys#slot e 1)
    2419                                    (loop (##sys#slot bucket 1)) ) ) ) ) ) ] ) ) )
     2381                    [else (build-symbol tok)])))
    24202382
    24212383          (define (build-symbol tok)
    2422             (##sys#intern-symbol
    2423              (if ##sys#default-namespace-prefix
    2424                  (##sys#string-append ##sys#default-namespace-prefix tok)
    2425                  tok) ) )
     2384            (##sys#intern-symbol tok) )
    24262385         
    24272386          (define (build-keyword tok)
     
    24842443                                  (##sys#read-char-0 port)
    24852444                                  (r-comment) (readrec) )
    2486                                  ((#\{)
    2487                                   (##sys#read-char-0 port)
    2488                                   (r-namespace) (readrec) )
    24892445                                 ((#\#)
    24902446                                  (##sys#read-char-0 port)
     
    25292485                                 (else (##sys#user-read-hook dchar port)) ) ) ) ) ) )
    25302486                  ((#\() (r-list #\( #\)))
     2487                  ((#\{) (r-list #\{ #\}))
    25312488                  ((#\[)
    25322489                   (r-list #\[ #\]) )
    2533                   ((#\) #\])
     2490                  ((#\) #\] #\})
    25342491                   (##sys#read-char-0 port)
    25352492                   (container c) )
    2536                   ((#\{ #\})
    2537                    (##sys#read-char-0 port)
    2538                    (##sys#read-error port "illegal character" c))
    25392493                  ((#\") (r-string #\"))
    25402494                  ((#\.) (r-number #f))
     
    28762830                ((##core#inline "C_portp" x)
    28772831                 (if (##sys#slot x 1)
    2878                      (outstr port "#<input port ")
    2879                      (outstr port "#<output port ") )
     2832                     (outstr port "#<input port \"")
     2833                     (outstr port "#<output port \"") )
    28802834                 (outstr port (##sys#slot x 3))
    2881                  (outchr port #\>) )
     2835                 (outstr port "\">") )
    28822836                ((##core#inline "C_vectorp" x)
    28832837                 (let ((n (##core#inline "C_block_size" x)))
     
    31813135                   (if (##sys#fudge 32) " gchooks" "")
    31823136                   (if (##sys#fudge 35) " applyhook" "")
     3137                   (if (##sys#fudge 22) " lockts" "")
    31833138                   (if (##sys#fudge 39) " cross" "") ) ) )
    31843139        (string-append
     
    31913146      +build-version+) )
    31923147
    3193 (define ##sys#pathname-directory-separator
    3194   (if ##sys#windows-platform #\\ #\/) )
     3148(define ##sys#pathname-directory-separator #\/) ; DEPRECATED
    31953149
    31963150
     
    32583212
    32593213(define feature? ##sys#feature?)
    3260 (define test-feature? ##sys#feature?)   ; DEPRECATED
    32613214
    32623215
     
    33133266
    33143267(define get-call-chain ##sys#get-call-chain)
    3315 (define print-backtrace print-call-chain) ; DEPRECATED
    33163268
    33173269
    33183270;;; Interrupt handling:
    3319 
    3320 (let ([count 0])                        ; DEPRECATED
    3321   (set! ##sys#enable-interrupts
    3322     (lambda val
    3323       (set! count (fx+ count (if (pair? val) (car val) 1)))
    3324       (when (eq? count 0) (##core#inline "C_enable_interrupts")) ) )
    3325   (set! ##sys#disable-interrupts
    3326     (lambda ()
    3327       (when (eq? count 0) (##core#inline "C_disable_interrupts"))
    3328       (set! count (fx- count 1)) ) ) )
    3329 
    3330 (define enable-interrupts ##sys#enable-interrupts) ; DEPRECATED
    3331 (define disable-interrupts ##sys#disable-interrupts) ; DEPRECATED
    33323271
    33333272(define (##sys#user-interrupt-hook)
     
    42384177
    42394178
    4240 ;;; andmap + ormap:
     4179;;; andmap + ormap: DEPRECATED
    42414180
    42424181(define andmap
     
    42584197(define ormap
    42594198  (lambda (f first . rest)
    4260     (if (null? first)
    4261         (or)
    4262         (let ([lists (cons first rest)])
    4263           (or (apply f (map (lambda (x) (car x)) lists))
    4264               (apply ormap f (map (lambda (x) (cdr x)) lists)) ) ) ) ) )
     4199    (and (pair? first)
     4200         (let ([lists (cons first rest)])
     4201           (or (apply f (map (lambda (x) (car x)) lists))
     4202               (apply ormap f (map (lambda (x) (cdr x)) lists)) ) ) ) ) )
    42654203
    42664204
  • chicken/branches/release/lolevel.scm

    r6257 r7276  
    687687      (ipc-hook-0 ##sys#last-invalid-procedure args) ) ) )
    688688
    689 (define invalid-procedure-call-handler set-invalid-procedure-call-handler!) ; DEPRECATED
    690 
    691689(define (unbound-variable-value . val)
    692690  (set! ##sys#unbound-variable-value-hook
  • chicken/branches/release/manual/Accessing external objects

    r5945 r7276  
    203203(some-struct-ycoord-set! C-POINTER NUMBER)
    204204</enscript>
     205
     206
    205207=== define-foreign-enum
    206208
    207  [syntax] (define-foreign-enum TYPENAME ITEM ...)
     209 [syntax] (define-foreign-enum TYPESPEC [USE-ALIASES] ENUMSPEC ...)
    208210
    209211Defines a foreign type (as with {{define-foreign-type}}) that maps the elements
     
    211213symbols.
    212214
    213 {{TYPENAME}} specifies a foreign type that converts a symbol argument from the
    214 set {{ITEM ...}} into the appropriate enum value when passed as an argument to
     215{{TYPESPEC}} specifies a foreign type that converts a symbol argument from the
     216set {{ENUMSPEC ...}} into the appropriate enum value when passed as an argument to
    215217a foreign function.
    216218
     
    220222supported in this case).
    221223
    222 {{TYPENAME}} maybe a symbol or a list of the form {{(SCHEMENAME REALTYPE
    223 [DEFAULT-SCHEME-VALUE])}}, where {{REALTYPE}} designates the native type used.
    224 The default native type is {{"TYPENAME"}}. The {{DEFAULT-SCHEME-VALUE}}
    225 overrides the default result of mapping from the native type; i.e. when no such
    226 mapping exists. When supplied the form is used unquoted, otherwise the result
    227 is {{'()}}.
    228 
    229 {{ITEM}} is a symbol or a list of the form {{(SCHEMENAME REALTYPE
     224{{TYPESPEC}} maybe a TYPENAME symbol or a list of the form {{(SCHEMENAME
     225REALTYPE [DEFAULT-SCHEME-VALUE])}}, where {{REALTYPE}} designates the native
     226type used. The default type specification is {{(TYPENAME TYPENAME)}}. The
     227{{DEFAULT-SCHEME-VALUE}} overrides the default result of mapping from the
     228native type; i.e. when no such mapping exists. When supplied the form is used
     229unquoted, otherwise the result is {{'()}}.
     230
     231{{ENUMSPEC}} is a TYPENAME symbol or a list of the form {{(SCHEMENAME REALTYPE
    230232[SCHEME-VALUE])}}, where {{REALTYPE}} designates the native type used. The
    231 default native type is {{"ITEM"}}. The {{SCHEME-VALUE}} overrides the result of
    232 mapping from the native type. When supplied the form is used unquoted,
    233 otherwise the {{SCHEMENAME}} symbol is returned.
     233default enum specification is {{(TYPENAME TYPENAME)}}. The {{SCHEME-VALUE}}
     234overrides the result of mapping from the native type. When supplied the form is
     235used unquoted, otherwise the {{SCHEMENAME}} symbol is returned.
     236
     237{{USE-ALIASES}} is an optional boolean flag that determines whether an alias or
     238the {{SCHEMENAME}} is used as the defined foreign variable name. The default
     239is {{#t}}.
    234240
    235241Additionally two procedures are defined named {{SCHEMENAME->number}} and
     
    238244takes one argument and converts a numeric value into its scheme value.
    239245
    240 Note that the specification of a scheme value override means the mapping may
    241 not be closed! {{(number->SCHEMENAME (SCHEMENAME->number SCHEMENAME))}} may not
    242 equal {{SCHEMENAME}}.
     246Note that the specification of a scheme value override ({{SCHEME-VALUE}}) means
     247the mapping may not be closed! {{(number->SCHEMENAME (SCHEMENAME->number
     248SCHEMENAME))}} may not equal {{SCHEMENAME}}.
    243249
    244250Here a heavily contrived example:
  • chicken/branches/release/manual/Acknowledgements

    r5945 r7276  
    88T. Kurt Bond, Ashley Bone, Dominique Boucher, Terence Brannon, Roy
    99Bryant, Adam Buchbinder, Hans Bulfone, Category 5, Taylor Campbell,
    10 Esteban U. Caamano Castro, Franklin Chen, Thomas Chust, Gian Paolo
    11 Ciceri, John Cowan, Grzegorz Chrupa&#322;a, James Crippen, Tollef Fog
    12 Heen, Alejandro Forero Cuervo, Linh Dang, Brian Denheyer, dgym, Chris
    13 Double, Jarod Eells, Petter Egesund, Steve Elkins, Daniel B. Faken,
    14 Will Farr, Graham Fawcett, Marc Feeley, Fizzie, Kimura Fuyuki, Tony
    15 Garnock-Jones, Martin Gasbichler, Joey Gibson, Stephen C. Gilardi,
    16 Joshua Griffith, Johannes Groedem, Damian Gryski, Mario Domenech
    17 Goulart, Andreas Gustafsson, Sven Hartrumpf, Jun-ichiro itojun Hagino,
    18 Ahdi Hargo, Matthias Heiler, Karl M. Hegbloom, William P. Heinemann,
    19 Bill Hoffman, Bruce Hoult, Hans Huebner, Markus Huelsmann, Goetz
    20 Isenmann, Paulo Jabardo, David Janssens, Christian Jaeger, Dale
    21 Jordan, Valentin Kamyshenko, Daishi Kato, Peter Keller, Brad Kind, Ron
    22 Kneusel, Matthias Koeppe, Krysztof Kowa&#322;czyk, Andre Kuehne, Todd
    23 R. Kueny Sr, Goran Krampe, David Krentzlin, Ben Kurtz, Micky
    24 Latowicki, John Lenz, Kirill Lisovsky, Kon Lovett, Dennis Marti,
    25 Charles Martin, Bob McIsaac, Alain Mellan, Eric Merrit, Perry Metzger,
    26 Scott G. Miller, Mikael, Bruce Mitchener, Chris Moline, Eric E. Moore,
    27 Julian Morrison, Dan Muresan, Lars Nilsson, Ian Oversby, o.t., Gene
    28 Pavlovsky, Levi Pearson, Nicolas Pelletier, Carlos Pita, Robin Lee
    29 Powell, Pupeno, Davide Puricelli, Doug Quale, Eric Raible, Ivan
    30 Raikov, Joel Reymont, Andreas Rottman, David Rush, Lars Rustemeier,
    31 Daniel Sadilek, Oskar Schirmer, Burton Samograd, Reed Sheridan, Ronald
    32 Schroeder, Spencer Schumann, Alex Shinn, Ivan Shmakov, Shmul, Tony
    33 Sidaway, Jeffrey B. Siegal, Andrey Sidorenko, Michele Simionato,
    34 Volker Stolz, Jon Strait, Dorai Sitaram, Robert Skeels, Jason Songhurst, Clifford
    35 Stein, Sunnan, Zbigniew Szadkowski, Mike Thomas, Minh Thu, Christian
    36 Tismer, Andre van Tonder, John Tobey, Henrik Tramberend, Vladimir
    37 Tsichevsky, Neil van Dyke, Sander Vesik, Panagiotis Vossos, Shawn
    38 Wagner, Peter Wang, Ed Watkeys, Thomas Weidner, Goeran Weinholt,
    39 Matthew Welland, Joerg Wittenberger, Peter Wright, Mark Wutka, Richard
    40 Zidlicky and Houman Zolfaghari for bug-fixes, tips and suggestions.
     10Naruto Canada, Esteban U. Caamano Castro, Franklin Chen, Thomas Chust,
     11Gian Paolo Ciceri, John Cowan, Grzegorz Chrupa&#322;a, James Crippen,
     12Tollef Fog Heen, Alejandro Forero Cuervo, Linh Dang, Brian Denheyer,
     13dgym, Don, Chris Double, Jarod Eells, Petter Egesund, Steve Elkins,
     14Daniel B. Faken, Will Farr, Graham Fawcett, Marc Feeley, Fizzie,
     15Kimura Fuyuki, Tony Garnock-Jones, Martin Gasbichler, Joey Gibson,
     16Stephen C. Gilardi, Joshua Griffith, Johannes Groedem, Damian Gryski,
     17Mario Domenech Goulart, Andreas Gustafsson, Sven Hartrumpf, Jun-ichiro
     18itojun Hagino, Ahdi Hargo, Matthias Heiler, Karl M. Hegbloom, William
     19P. Heinemann, Bill Hoffman, Bruce Hoult, Hans Huebner, Markus
     20Huelsmann, Goetz Isenmann, Paulo Jabardo, David Janssens, Christian
     21Jaeger, Dale Jordan, Valentin Kamyshenko, Daishi Kato, Peter Keller,
     22Brad Kind, Ron Kneusel, Matthias Koeppe, Krysztof Kowa&#322;czyk,
     23Andre Kuehne, Todd R. Kueny Sr, Goran Krampe, David Krentzlin, Ben
     24Kurtz, Micky Latowicki, John Lenz, Kirill Lisovsky, Kon Lovett, Dennis
     25Marti, Charles Martin, Bob McIsaac, Alain Mellan, Eric Merrit, Perry
     26Metzger, Scott G. Miller, Mikael, Bruce Mitchener, Chris Moline, Eric
     27E. Moore, Julian Morrison, Dan Muresan, Lars Nilsson, Ian Oversby,
     28o.t., Gene Pavlovsky, Levi Pearson, Nicolas Pelletier, Carlos Pita,
     29Robin Lee Powell, Pupeno, Davide Puricelli, Doug Quale, Eric Raible,
     30Ivan Raikov, Joel Reymont, Eric Rochester, Andreas Rottman, David
     31Rush, Lars Rustemeier, Daniel Sadilek, Oskar Schirmer, Burton
     32Samograd, Reed Sheridan, Ronald Schroeder, Spencer Schumann, Alex
     33Shinn, Ivan Shmakov, Shmul, Tony Sidaway, Jeffrey B. Siegal, Andrey
     34Sidorenko, Michele Simionato, Volker Stolz, Jon Strait, Dorai Sitaram,
     35Robert Skeels, Jason Songhurst, Clifford Stein, Sunnan, Zbigniew
     36Szadkowski, Rick Taube, Mike Thomas, Minh Thu, Christian Tismer, Andre
     37van Tonder, John Tobey, Henrik Tramberend, Vladimir Tsichevsky, Neil
     38van Dyke, Sander Vesik, Panagiotis Vossos, Shawn Wagner, Peter Wang,
     39Ed Watkeys, Thomas Weidner, Goeran Weinholt, Matthew Welland, Joerg
     40Wittenberger, Peter Wright, Mark Wutka, Richard Zidlicky and Houman
     41Zolfaghari for bug-fixes, tips and suggestions.
    4142
    4243CHICKEN uses the PCRE regular expression package ([[http://www.pcre.org]]),
    4344which is written by Philip Hazel.
    4445
    45 Special thanks to Brandon van Every for contributing the
    46 [[http://www.cmake.org|CMake]] support and for helping
    47 with Windows build issues.
     46Special thanks to Brandon van Every for contributing the (now defunct)
     47[[http://www.cmake.org|CMake]] support and for helping with Windows
     48build issues.
    4849
    4950Also special thanks to Benedikt Rosenau for his constant encouragement.
     
    5960; Andrew Wilcox : queues.
    6061; Andrew Wright : pattern matcher.
     62; [[Alex Shinn]] : {{scheme-complete.el}} emacs tab-completion
    6163
    6264Previous: [[FAQ]]
  • chicken/branches/release/manual/C interface

    r5945 r7276  
    283283
    284284
     285=== C_pre_gc_hook
     286
     287 [C Variable] void (*C_pre_gc_hook)(int mode)
     288
     289If not {{NULL}}, the function pointed to by this variable will be
     290called before each garbage collection with a flag indicating what kind
     291of collection was performed (either {{0}} for a minor collection or
     292{{2}} for a resizing collection). A "resizing" collection means a
     293secondary collection that moves all live data into a enlarged (or
     294shrinked) heap-space. Minor collections happen very frequently, so the
     295hook function should not consume too much time. The hook function may
     296not invoke Scheme callbacks.
     297
     298Note that resizing collections may be nested in normal major collections.
     299
    285300=== C_post_gc_hook
    286301
    287  [C Variable] void (*C_post_gc_hook)(int mode)
    288 
    289 If not {{NULL}}, the function pointed to by this variable will be called
    290 after each garbage collection with a flag indicating what kind of collection
    291 was performed (either {{0}} for a minor collection or {{1}} for a major
    292 collection). Minor collections happen very frequently, so the hook function
    293 should not consume too much time. The hook function may not invoke Scheme
    294 callbacks.
    295 
    296 
    297 
    298 An example:
     302 [C Variable] void (*C_post_gc_hook)(int mode, long ms)
     303
     304If not {{NULL}}, the function pointed to by this variable will be
     305called after each garbage collection with a flag indicating what kind
     306of collection was performed (either {{0}} for a minor collection,
     307{{1}} for a major collection or {{2}} for a resizing
     308collection). Minor collections happen very frequently, so the hook
     309function should not consume too much time. The hook function may not
     310invoke Scheme callbacks. The {{ms}} argument records the number of
     311milliseconds required for the garbage collection, if the collection
     312was a major one. For minor collections the value of the {{ms}} argument
     313is undefined.
     314
     315
     316
     317=== An example for simple calls to foreign code involving callbacks
    299318
    300319 % cat foo.scm
     
    335354
    336355
    337 '''Notes:'''
     356=== Notes:
    338357
    339358Scheme procedures can call C functions, and C functions can call
  • chicken/branches/release/manual/Callbacks

    r5945 r7276  
    7575stack with the {{C_save}} macro.
    7676
    77 === C_callback_adjust_stack_limits
     77=== C_callback_adjust_stack
    7878
    79  [C function] void C_callback_adjust_stack_limits (C_word *ptr)
     79 [C function] void C_callback_adjust_stack (C_word *ptr, int size)
    8080
    8181The runtime-system uses the stack as a special allocation area and
    82 internally holds pointers to estimated limits to distinguish between Scheme
    83 data objects inside the stack from objects outside of it.
    84 If you invoke callbacks at wildly differing stack-levels,
    85 these limits may shift from invocation to invocation. Callbacks defined
    86 with {{define-external}} will perform appropriate adjustments automatically,
    87 but if you invoke {{C_callback}} manually, you should perform a
    88 {{C_callback_adjust_stack_limits}} to make sure the internal limits are
    89 set properly. {{ptr}} should point to some data object on the stack. The
    90 call will make sure the limits are adjusted so that the value pointed to
    91 by {{ptr}} is located in the stack.
     82internally holds pointers to estimated limits to distinguish between
     83Scheme data objects inside the stack from objects outside of it.  If
     84you invoke callbacks at wildly differing stack-levels, these limits
     85may shift from invocation to invocation. Callbacks defined with
     86{{define-external}} will perform appropriate adjustments
     87automatically, but if you invoke {{C_callback}} manually, you should
     88perform a {{C_callback_adjust_stack}} to make sure the internal limits
     89are set properly. {{ptr}} should point to some data object on the
     90stack and {{size}} is the number of words contained in the data object
     91(or some estimate). The call will make sure the limits are adjusted so
     92that the value pointed to by {{ptr}} is located in the stack.
    9293
    9394Previous: [[Embedding]]
  • chicken/branches/release/manual/Data representation

    r5945 r7276  
    3131C_SCHEME_END_OF_FILE}}
    3232
    33 Collectively, bits 1 and 2 are known as the ''immediate mark bits''.  When bit 1 is set, the object is a fixnum, as described above.  When bit 2 is set, it is an immediate object other than a fixnum.  If neither is set, the object is non-immediate, as described below.  (By definition, bits 1 and 2 may not both be set.)
     33Collectively, bits 1 and 2 are known as the ''immediate mark bits''.  When bit 1 is set, the object is a fixnum, as described above, and bit 2 is part of its value.  When bit 1 is clear but bit 2 is set, it is an immediate object other than a fixnum.  If neither bit 1 nor bit 2 is set, the object is non-immediate, as described below.
    3434
    3535=== Non-immediate objects
  • chicken/branches/release/manual/Declarations

    r5945 r7276  
    7171
    7272
    73 === compress-literals
    74 
    75  [declaration specifier] (compress-literals [THRESHOLD [INITIALIZER]])
    76 
    77 The same as the {{-compress-literals}} compiler option.
    78 The threshold argument defaults to 50. If the optional argument {{INITIALIZER}}
    79 is given, then the literals will not be created at module startup,
    80 but when the procedure with this name will be called.
    81 
    8273=== constant
    8374
  • chicken/branches/release/manual/Deviations from the standard

    r5945 r7276  
    33== Deviations from the standard
    44
    5 * Identifiers are by default case-sensitive (see [[http://galinha.ucpel.tche.br:8080/Using%20the%20compiler#Compiler%20command%20line%20format|Compiler command line format]]).
     5Identifiers are by default case-sensitive (see
     6[[http://galinha.ucpel.tche.br:8080/Using%20the%20compiler#Compiler%20command%20line%20format|Compiler
     7command line format]]).
    68
    7 * [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 {{libffi}} library is available on this platform, and if it is installed, then CHICKEN can take advantage of this. See the [[http://chicken.wiki.br/chicken/README|README]] file for more details.
     9[4.1.3] The maximal number of arguments that may be passed to a
     10compiled procedure or macro is 120.  A macro-definition that has a
     11single rest-parameter can have any number of arguments.  If the
     12{{libffi}} library is available on this platform, and if it is
     13installed, then CHICKEN can take advantage of this. See the
     14[[http://chicken.wiki.br/chicken/README|README]] file for more
     15details.
    816
    9 * [4.2.2] {{letrec}} does evaluate the initial values for the bound variables sequentially and not in parallel, that is:
     17[4.2.2] {{letrec}} does evaluate the initial values for the bound
     18variables sequentially and not in parallel, that is:
    1019
    1120  (letrec ((x 1) (y 2)) (cons x y))
     
    2635      (cons x y) ) )
    2736
    28 * [4.3] {{syntax-rules}} macros are not provided but available separately.
     37[4.3] {{syntax-rules}} macros are not provided but available
     38separately.
    2939
    30 * [6.1] {{equal?}} compares all structured data recursively, while R5RS specifies that {{eqv?}} is used for data other than pairs, strings and vectors.
     40[6.1] {{equal?}} compares all structured data recursively, while R5RS
     41specifies that {{eqv?}} is used for data other than pairs, strings and
     42vectors.
    3143
    32 * [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.
     44[6.2.4] The runtime system uses the numerical string-conversion
     45routines of the underlying C library and so does only understand
     46standard (C-library) syntax for floating-point constants.
    3347
    34 * [6.2.5] There is no built-in support for rationals, complex numbers or extended-precision integers (bignums). The routines {{complex?}}, {{real?}} and {{rational?}} are identical to the standard procedure {{number?}}. The procedures {{numerator}}, {{denominator}}, {{rationalize}}, {{make-rectangular}} and {{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.
     48[6.2.5] There is no built-in support for rationals, complex numbers or
     49extended-precision integers (bignums). The routines {{complex?}},
     50{{real?}} and {{rational?}} are identical to the standard procedure
     51{{number?}}. The procedures {{numerator}}, {{denominator}},
     52{{rationalize}}, {{make-rectangular}} and {{make-polar}} are not
     53implemented. Fixnums are limited to ±2<nowiki><sup>30</sup></nowiki>
     54(or ±2<nowiki><sup>62</sup></nowiki> on 64-bit hardware).  Support for
     55extended numbers is available as a separate package, provided the GNU
     56multiprecision library is installed.
    3557
    36 * [6.2.6] The procedure {{string->number}} does not obey read/write invariance on inexact numbers.
     58[6.2.6] The procedure {{string->number}} does not obey read/write
     59invariance on inexact numbers.
    3760
    38 * [6.4] The maximum number of values that can be passed to continuations captured using {{call-with-current-continuation}} is 120.
     61[6.4] The maximum number of values that can be passed to continuations
     62captured using {{call-with-current-continuation}} is 120.
    3963
    40 * [6.5] Code evaluated in {{scheme-report-environment}} or {{null-environment}} still sees non-standard syntax.
     64[6.5] Code evaluated in {{scheme-report-environment}} or
     65{{null-environment}} still sees non-standard syntax.
    4166
    42 * [6.6.2] The procedure {{char-ready?}} always returns {{#t}} for terminal ports.  The procedure {{read}} does not obey read/write invariance on inexact numbers.
     67[6.6.2] The procedure {{char-ready?}} always returns {{#t}} for
     68terminal ports.  The procedure {{read}} does not obey read/write
     69invariance on inexact numbers.
    4370
    44 * [6.6.3] The procedures {{write}} and {{display}} do not obey read/write invariance to inexact numbers.
     71[6.6.3] The procedures {{write}} and {{display}} do not obey
     72read/write invariance to inexact numbers.
    4573
    46 * [6.6.4] The {{transcript-on}} and {{transcript-off}} procedures are not implemented.
     74[6.6.4] The {{transcript-on}} and {{transcript-off}} procedures are
     75not implemented.
    4776
    4877Previous: [[Supported language]]
  • chicken/branches/release/manual/Extensions to the standard

    r5945 r7276  
    66{{| ... |}}.
    77
    8 [2.3] The brackets {{[ ... ]}} are provided as an alternative syntax
    9 for {{( ... )}}.  A number of reader extensions is provided. See
    10 [[Non-standard read syntax]].
     8[2.3] The brackets {{[ ... ]}} and the braces {{ { ... } }} are
     9provided as an alternative syntax for {{( ... )}}.  A number of reader
     10extensions is provided. See [[Non-standard read syntax]].
    1111
    1212[4] Numerous non-standard macros are provided. See
     
    3131* 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.
    3232* 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 {{#f}}. The corresponding <initializer> is evaluated in an environment in which all previous parameters have been bound.
    33 * 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. These remaining arguments are also eligible to be bound to keyword-parameters, in which case the argument will be a member of both the rest-parameter list and the keyword-parameter. If there is no rest-parameter and there are no matching keyword-parameters, then it shall be an error for there to be any remaining arguments left unbound.
    34 * If {{#!key}} was specified in the parameter-list, there shall 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. It shall be an error if the first member of an argument pair is not a keyword, unless there is a rest-parameter. 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 {{#f}}. The corresponding <initializer> is evaluated in an environment in which all previous parameters have been bound.
     33* 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.
     34* If {{#!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 {{#f}}. The corresponding <initializer> is evaluated in an environment in which all previous parameters have been bound.
     35
     36Needing 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.
     37Note 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.
    3538
    3639It shall be an error for an {{<ident>}} to appear more than once in a parameter-list.
    3740
    38 Keyword arguments are internally handled as rest-parameters with subsequent processing
    39 of the argument list. Extra arguments (for example by specifying keyword arguments
    40 but no rest argument) are not checked and simply ignored.
     41If 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.
     42
    4143
    4244Example:
     
    155157{{#:append}}.
    156158
     159[6.7] The {{exit}} procedure exits a program right away and does ''not'' invoke pending {{dynamic-wind}} thunks.
     160
    157161Previous: [[Deviations from the standard]]
    158162
  • chicken/branches/release/manual/Foreign type specifiers

    r5945 r7276  
    1212
    1313As argument: any value ({{#f}} is false, anything else is true).
    14 As result: anything different from 0 and the {{NULL}}-pointer
    15 is {{#t}}.
     14
     15As result: anything different from 0 and the {{NULL}} pointer is {{#t}}.
    1616
    1717=== byte unsigned-byte
     
    4848=== number
    4949
    50 A floating-point number. Similar to {{double}}, but when used as a result
    51 type, then either an exact integer or a floating-point number is returned, depending
     50A floating-point number. Similar to {{double}}, but when used as a result type,
     51then either an exact integer or a floating-point number is returned, depending
    5252on whether the result fits into an exact integer or not.
    5353
     
    5555
    5656A symbol, which will be passed to foreign code as a zero-terminated string.
     57
    5758When declared as the result of foreign code, the result should be a string and
    5859a symbol with the same name will be interned in the symbol table (and returned
     
    6162=== scheme-pointer
    6263
    63 An untyped pointer to the contents of a non-immediate Scheme object
    64 (not allowed as return type).  The value {{#f}} is also allowed
    65 and is passed as a {{NULL}} pointer.
    66 Don't confuse this type with {{(pointer ...)}} which means something
     64An untyped pointer to the contents of a non-immediate Scheme object (not
     65allowed as return type). The value {{#f}} is also allowed and is passed as a
     66{{NULL}} pointer.
     67
     68Don't confuse this type with {{(c-pointer ...)}} which means something
    6769different (a machine-pointer object).
    6870
    6971=== nonnull-scheme-pointer
    7072
    71 As {{pointer}}, but guaranteed not to be {{#f}}.
    72 Don't confuse this type with {{(nonnull-pointer ...)}} which means something
     73As {{scheme-pointer}}, but guaranteed not to be {{#f}}.
     74
     75Don't confuse this type with {{(nonnull-c-pointer ...)}} which means something
    7376different (a machine-pointer object).
    7477
    7578=== c-pointer
    7679
    77 An untyped operating-system pointer or a locative.  The value {{#f}} is also
    78 allowed and is passed as a {{NULL}} pointer.  If uses as the type of
     80An untyped operating-system pointer or a locative. The value {{#f}} is also
     81allowed and is passed as a {{NULL}} pointer. If uses as the type of
    7982a return value, a {{NULL}} pointer will be returned as {{#f}}.
    8083
     
    8386As {{c-pointer}}, but guaranteed not to be {{#f/NULL}}.
    8487
    85 === [nonnull-] blob
    86 
    87 A blob object, passed as a pointer to its contents. Arguments
    88 of type {{blob}} may optionally be {{#f}}, which is
    89 passed as a NULL pointer.  This is not allowed as a return type.
    90 
    91 === [nonnull-] u8vector [nonnull-] u16vector [nonnull-] u32vector [nonnull-] s8vector [nonnull-] s16vector [nonnull-] s32vector [nonnull-] f32vector [nonnull-] f64vector
    92 
    93 A SRFI-4 number-vector object, passed as a pointer to its
    94 contents. These type specifiers are not allowed
    95 as return types.
     88=== blob
     89
     90A blob object, passed as a pointer to its contents. Arguments of type {{blob}}
     91may optionally be {{#f}}, which is passed as a NULL pointer.
     92
     93This is not allowed as a return type.
     94
     95=== nonnull-blob
     96
     97As {{blob}}, but guaranteed not to be {{#f}}.
     98
     99=== u8vector u16vector u32vector s8vector s16vector s32vector f32vector f64vector
     100
     101A SRFI-4 number-vector object, passed as a pointer to its contents.
     102
     103These type specifiers are not allowed as return types.
     104
     105=== nonnull-u8vector nonnull-u16vector nonnull-u32vector nonnull-s8vector nonnull-s16vector nonnull-s32vector nonnull-f32vector nonnull-f64vector
     106
     107As {{u8vector ...}}, but guaranteed not to be {{#f}}.
    96108
    97109=== c-string
    98110
    99 A C string (zero-terminated). The value {{#f}}
    100 is also allowed and is passed as a {{NULL}} pointer. If uses as
    101 the type of a return value, a {{NULL}} pointer will be returned as
    102 {{#f}}. Note that the string is copied (with a zero-byte appended)
    103 when passed as an argument to a foreign function. Also a return value
     111A C string (zero-terminated). The value {{#f}} is also allowed and is passed as
     112a {{NULL}} pointer. If uses as the type of a return value, a {{NULL}} pointer
     113will be returned as {{#f}}. Note that the string is copied (with a zero-byte
     114appended) when passed as an argument to a foreign function. Also a return value
    104115of this type is copied into garbage collected memory.
    105116
     
    110121=== [nonnull-] c-string*
    111122
    112 Similar to {{[nonnull-]c-string}}, but if used as a result-type,
    113 the pointer returned by the foreign code will be freed (using the
    114 C-libraries {{free(1)}})
    115 after copying. This type specifier is not valid as a result type
    116 for callbacks defined with {{define-external}}.
     123Similar to {{[nonnull-] c-string}}, but if used as a result-type, the pointer
     124returned by the foreign code will be freed (using the C-libraries {{free(1)}})
     125after copying. This type specifier is not valid as a result type for callbacks
     126defined with {{define-external}}.
    117127
    118128=== [nonnull-] unsigned-c-string[*]
     
    122132=== c-string-list
    123133
    124 Expects a pointer to a list of C strings teminated by a {{NULL}} pointer
    125 and returns a list of strings. Only valid as a result type of non-callback
    126 functions.
     134Expects a pointer to a list of C strings teminated by a {{NULL}} pointer and
     135returns a list of strings.
     136
     137Only valid as a result type of non-callback functions.
    127138
    128139=== c-string-list*
     
    133144=== void
    134145
    135 Specifies an undefined return value. Not allowed as argument type.
     146Specifies an undefined return value.
     147
     148Not allowed as argument type.
    136149
    137150=== (const TYPE)
     
    143156An enumeration type. Handled internally as an {{integer}}.
    144157
    145 === (pointer TYPE) (c-pointer TYPE)
     158=== (c-pointer TYPE)
    146159
    147160An operating-system pointer or a locative to an object of {{TYPE}}.
    148161
    149 === (nonnull-pointer TYPE) (nonnull-c-pointer TYPE)
    150 
    151 As {{(pointer TYPE)}}, but guaranteed not to be {{#f/NULL}}.
     162=== (nonnull-c-pointer TYPE)
     163
     164As {{(c-pointer TYPE)}}, but guaranteed not to be {{#f/NULL}}.
    152165
    153166=== (ref TYPE)
     
    158171=== (struct NAME)
    159172
    160 A struct of the name {{NAME}}, which should be a string. Structs
    161 can not be directly passed as arguments to foreign function, neither
     173A struct of the name {{NAME}}, which should be a string.
     174
     175Structs cannot be directly passed as arguments to foreign function, neither
    162176can they be result values. Pointers to structs are allowed, though.
    163177
    164178=== (template TYPE ARGTYPE ...)
    165179
    166 A C++ template type. For example {{vector<int>}} would be specified
    167 as {{(template "vector" int)}}. Template types can not be directly passed
    168 as arguments or returned as results.
     180A C++ template type. For example {{vector<int>}} would be specified as
     181{{(template "vector" int)}}.
     182
     183Template types cannot be directly passed as arguments or returned as results.
    169184
    170185=== (union NAME)
    171186
    172 A union of the name {{NAME}}, which should be a string. Unions can
    173 not be directly passed as arguments to foreign function, neither can
     187A union of the name {{NAME}}, which should be a string.
     188
     189Unions cannot be directly passed as arguments to foreign function, neither can
    174190they be result values. Pointers to unions are allowed, though.
    175191
    176192=== (instance CNAME SCHEMECLASS)
    177193
    178 A pointer to a C++ class instance. {{CNAME}} should designate
    179 the name of the C++ class, and {{SCHEMECLASS}} should be the class
    180 that wraps the instance pointer. Normally {{SCHEMECLASS}}
    181 should be a subclass of {{<c++-object>}}.
     194A pointer to a C++ class instance. {{CNAME}} should designate the name of the
     195C++ class, and {{SCHEMECLASS}} should be the class that wraps the instance
     196pointer. Normally {{SCHEMECLASS}} should be a subclass of {{<c++-object>}}.
    182197
    183198=== (instance-ref CNAME SCHEMECLASS)
     
    187202=== (function RESULTTYPE (ARGUMENTTYPE1 ... [...]) [CALLCONV])
    188203
    189 A function pointer. {{CALLCONV}} specifies an optional calling
    190 convention and should be a string. The meaning of this string is entirely
    191 platform dependent.  The value {{#f}} is also allowed and is passed
    192 as a {{NULL}} pointer.
     204A function pointer. {{CALLCONV}} specifies an optional calling convention and
     205should be a string. The meaning of this string is entirely platform dependent.
     206The value {{#f}} is also allowed and is passed as a {{NULL}} pointer.
    193207
    194208=== Mappings
     
    215229</td></tr><tr><td>number</td><td>
    216230double
    217 </td></tr><tr><td>[nonnull-]pointer</td><td>
    218 void *
    219231</td></tr><tr><td>[nonnull-]c-pointer</td><td>
    220232void *
     
    247259</td></tr><tr><td>void</td><td>
    248260void
    249 </td></tr><tr><td>([nonnull-]pointer TYPE)</td><td>
     261</td></tr><tr><td>([nonnull-]c-pointer TYPE)</td><td>
    250262TYPE *
    251263</td></tr><tr><td>(enum NAME)</td><td>
  • chicken/branches/release/manual/Locations

    r5945 r7276  
    5050<enscript highlight=scheme>
    5151(define-external foo int)
    52 ((foreign-lambda* void (((pointer int) ip)) "*ip = 123;")
     52((foreign-lambda* void (((c-pointer int) ip)) "*ip = 123;")
    5353  (location foo))
    5454foo                                                                               ==> 123
     
    6464
    6565(define modf
    66   (foreign-lambda double "modf" double (pointer double)) )
     66  (foreign-lambda double "modf" double (c-pointer double)) )
    6767
    6868(let-location ([i double])
  • chicken/branches/release/manual/Non-standard macros and special forms

    r5945 r7276  
    55== Non-standard macros and special forms
    66
    7 === Making extra libraries and extensions availablee
     7=== Making extra libraries and extensions available
    88
    99==== require-extension
     
    1212 [syntax] (use ID ...)
    1313
    14 This form does all necessary steps to make the libraries or extensions given
    15 in {{ID ...}} available. It loads syntactic extension, if needed and generates
     14This form does all the necessary steps to make the libraries or extensions given
     15in {{ID ...}} available. It loads syntactic extensions, if needed and generates
    1616code for loading/linking with core library modules or separately installed
    1717extensions. {{use}} is just a shorter alias for {{require-extension}}.
    18 This implementation of {{require-extension}} is compliant to [[http://srfi.schemers.org/srfi-55/srfi-55.html|SRFI-55]]
     18This implementation of {{require-extension}} is compliant with [[http://srfi.schemers.org/srfi-55/srfi-55.html|SRFI-55]]
    1919(see the [[http://srfi.schemers.org/srfi-55/srfi-55.html|SRFI-55]] document for more information).
    2020
     
    2424* If {{ID}} names a built-in feature {{chicken srfi-0 srfi-2 srfi-6 srfi-8 srfi-9 srfi-10 srfi-17 srfi-23 srfi-30 srfi-39 srfi-55}}, then nothing is done.
    2525* If {{ID}} names one of the syntactic extensions {{chicken-more-macros chicken-ffi-macros}}, then this extension will be loaded.
    26 * {{ID}} names one of the core library units shipped with CHICKEN, then a {{(load-library 'ID)}} will be performed.
    27 * {{ID}} names an installed extension with the {{syntax}} or {{require-at-runtime}} attribute, then the equivalent of {{(require-for-syntax 'ID)}} is performed, probably followed by {{(require ...)}} for any run-time requirements.
    28 * Otherwise {{(require-extension ID)}} is equivalent to {{(require 'ID)}}.
    29 
    30 During compilation one of the following happens instead:
     26* If {{ID}} names one of the core library units shipped with CHICKEN, then a {{(load-library 'ID)}} will be performed.
     27* If {{ID}} names an installed extension with the {{syntax}} or {{require-at-runtime}} attribute, then the equivalent of {{(require-for-syntax 'ID)}} is performed, probably followed by {{(require ...)}} for any run-time requirements.
     28* Otherwise, {{(require-extension ID)}} is equivalent to {{(require 'ID)}}.
     29
     30During compilation, one of the following happens instead:
    3131
    3232* If {{ID}} names a built-in feature {{chicken srfi-0 srfi-2 srfi-6 srfi-8 srfi-9 srfi-10 srfi-17 srfi-23 srfi-30 srfi-39 srfi-55}}, then nothing is done.
    3333* If {{ID}} names one of the syntactic extensions {{chicken-more-macros chicken-ffi-macros}}, then this extension will be loaded at compile-time, making the syntactic extensions available in compiled code.
    34 * If {{ID}} names one of the core library units shipped with CHICKEN, or if the option {{-uses ID}} has been passed to the compiler then a {{(declare (uses ID))}} is generated.
     34* If {{ID}} names one of the core library units shipped with CHICKEN, or if the option {{-uses ID}} has been passed to the compiler, then a {{(declare (uses ID))}} is generated.
    3535* If {{ID}} names an installed extension with the {{syntax}} or {{require-at-runtime}} attribute, then the equivalent of {{(require-for-syntax 'ID)}} is performed, and code is emitted to {{(require ...)}} any needed run-time requirements.
    3636* Otherwise {{(require-extension ID)}} is equivalent to {{(require 'ID)}}.
     
    483483The following feature-identifiers are available in all situations: {{(machine-byte-order)}}, {{(machine-type)}}, {{(software-type)}}, {{(software-version)}}, where the actual feature-identifier is platform dependent.
    484484
    485 In addition the following feature-identifiers may exist: {{applyhook}}, {{extraslot}}, {{ptables}}, {{dload}}, {{libffi}}.
     485In addition the following feature-identifiers may exist: {{applyhook}}, {{extraslot}}, {{ptables}}, {{dload}}.
    486486
    487487For further information, see the documentation for [[http://srfi.schemers.org/srfi-0/srfi-0.html|SRFI-0]].
  • chicken/branches/release/manual/The User's Manual

    r5945 r7276  
    33== The User's Manual
    44
    5 ''(This document describes version 2.702)''
     5''(This document describes version 2.739)''
    66
    77'''CHICKEN is a compiler that translates Scheme source files into C''', which in
  • chicken/branches/release/manual/Unit eval

    r5945 r7276  
    166166; [parameter] repository-path :
    167167Contains a string naming the path to the extension repository, which defaults to
    168 either the value of the environment variable {{CHICKEN_REPOSITORY}}, the value
    169 of the environment variable {{CHICKEN_HOME}} or the default library path
     168either the value of the environment variable {{CHICKEN_REPOSITORY}}
     169or the default library path
    170170(usually {{/usr/local/lib/chicken}} on UNIX systems).
    171171
     
    205205from one of the following locations:
    206206
    207 * the current include path, which defaults to the pathnames given in {{CHICKEN_INCLUDE_PATH}} and {{CHICKEN_HOME}}.
     207* the current include path, which defaults to the pathnames given in {{CHICKEN_INCLUDE_PATH}}.
    208208* the current directory
    209209
     
    249249
    250250Returns a string given the installation directory (usually {{/usr/local/share/chicken}} on UNIX-like systems).
    251 If the environment variable {{CHICKEN_HOME}} is set, then its value will be returned. As a last option,
     251As a last option,
    252252if the environment variable {{CHICKEN_PREFIX}} is set, then {{chicken-home}} will return
    253253{{$CHICKEN_PREFIX/share}}.
  • chicken/branches/release/manual/Unit extras

    r5945 r7276  
    177177
    178178 [procedure] (fprintf PORT FORMATSTRING ARG ...)
    179  [procedure] (printf FORMATSTRING ARG)
     179 [procedure] (printf FORMATSTRING ARG ...)
    180180 [procedure] (sprintf FORMATSTRING ARG ...)
    181181
    182182Simple formatted output to a given port ({{fprintf}}), the
    183 value of {{(current-output-port)}} ({{printf}}) or a string
     183value of {{(current-output-port)}} ({{printf}}), or a string
    184184({{sprintf}}).  The {{FORMATSTRING}} can contain any sequence
    185 of characters. The character `~' prefixes special formatting directives:
     185of characters.  There must be at least as many {{ARG}} arguments given as there are format directives that require an argument in {{FORMATSTRING}}.  Extra {{ARG}} arguments are ignored.  The character `~' prefixes special formatting directives:
    186186
    187187<table>
     
    476476Line-input and -output. {{PORT}} defaults to the value of
    477477{{(current-input-port)}} and {{(current-output-port)}},
    478 respectively. if the optional argument {{LIMIT}} is given and
     478respectively. If the optional argument {{LIMIT}} is given and
    479479not {{#f}}, then {{read-line}} reads at most {{LIMIT}}
    480 characters per line.
     480characters per line. {{read-line}} returns a string without the terminating newline and {{write-line}} adds a terminating newline  before outputting.
    481481
    482482
  • chicken/branches/release/manual/Unit library

    r5945 r7276  
    44== Unit library
    55
    6 This unit contains basic Scheme definitions. This unit is used by default, unless the program
    7 is compiled with the {{-explicit-use}} option.
     6This unit contains basic Scheme definitions. This unit is used by default,
     7unless the program is compiled with the {{-explicit-use}} option.
    88
    99=== Arithmetic
     
    1919==== Binary integer operations
    2020
    21 Binary integer operations. {{arithmetic-shift}} shifts the argument
    22 {{N1}} by {{N2}} bits to the left. If {{N2}} is negative, than {{N1}}
    23 is shifted to the right.  These operations only accept exact integers
    24 or inexact integers in word range (32 bit signed on 32-bit platforms,
    25 or 64 bit signed on 64-bit platforms).
     21Binary integer operations. {{arithmetic-shift}} shifts the argument {{N1}} by
     22{{N2}} bits to the left. If {{N2}} is negative, than {{N1}} is shifted to the
     23right. These operations only accept exact integers or inexact integers in word
     24range (32 bit signed on 32-bit platforms, or 64 bit signed on 64-bit
     25platforms).
    2626
    2727; [procedure] (bitwise-and N1 ...)
     
    3535 [procedure] (bit-set? N INDEX)
    3636
    37 Returns {{#t}} if the bit at the position {{INDEX}} in the integer {{N}} is set,
    38 or {{#f}} otherwise. The rightmost/least-significant bit is bit 0.
     37Returns {{#t}} if the bit at the position {{INDEX}} in the integer {{N}} is
     38set, or {{#f}} otherwise. The rightmost/least-significant bit is bit 0.
    3939
    4040
     
    4747==== Arithmetic fixnum operations
    4848
    49 These procedures do not check their arguments, so non-fixnum
    50 parameters will result in incorrect results. {{fxneg}} negates its
    51 argument.
     49These procedures do not check their arguments, so non-fixnum parameters will
     50result in incorrect results. {{fxneg}} negates its argument.
    5251
    5352On division by zero, {{fx/}} and {{fxmod}} signal a condition of kind
     
    8180
    8281In safe mode, these procedures throw a type error with non-float
    83 arguments (except {{flonum?}}, which returns {{#f}}).  In unsafe mode,
    84 these procedures do not check their arguments.  A non-flonum argument
     82arguments (except {{flonum?}}, which returns {{#f}}). In unsafe mode,
     83these procedures do not check their arguments. A non-flonum argument
    8584in unsafe mode can crash the system.
    8685
     
    104103 [procedure] (signum N)
    105104
    106 Returns {{1}} if {{N}} is positive, {{-1}} if {{N}} 
     105Returns {{1}} if {{N}} is positive, {{-1}} if {{N}}
    107106is negative or {{0}} if {{N}} is zero. {{signum}} is exactness preserving.
    108107
     
    122121 [procedure] (current-output-port [PORT])
    123122
    124 Returns default output port.  If {{PORT}} is given, then that port is selected as the new current output port.
    125 
    126 Note that the default output port is not buffered.
    127 Use [[Unit posix#Setting the file buffering mode|{{set-buffering-mode!}}]] if you need a different behaviour.
     123Returns default output port. If {{PORT}} is given, then that port is selected
     124as the new current output port.
     125
     126Note that the default output port is not buffered. Use [[Unit posix#Setting the
     127file buffering mode|{{set-buffering-mode!}}]] if you need a different behavior.
    128128
    129129==== current-error-port
     
    131131 [procedure] (current-error-port [PORT])
    132132
    133 Returns default error output port. If {{PORT}} is given, then that
    134 port is selected as the new current error output port.
    135 
    136 Note that the default error output port is not buffered.
    137 Use [[Unit posix#Setting the file buffering mode|{{set-buffering-mode!}}]] if you need a different behaviour.
     133Returns default error output port. If {{PORT}} is given, then that port is
     134selected as the new current error output port.
     135
     136Note that the default error output port is not buffered. Use [[Unit
     137posix#Setting the file buffering mode|{{set-buffering-mode!}}]] if you need a
     138different behavior.
    138139
    139140==== flush-output
     
    149150 [procedure] (port-name [PORT])
    150151
    151 Fetch filename from {{PORT}}. This returns the filename that was
    152 used to open this file.  Returns a special tag string, enclosed into
    153 parentheses for non-file ports. {{PORT}} defaults to the value of {{(current-input-port)}}.
     152Fetch filename from {{PORT}}. This returns the filename that was used to open
     153this file. Returns a special tag string, enclosed into parentheses for
     154non-file ports. {{PORT}} defaults to the value of {{(current-input-port)}}.
    154155
    155156
     
    158159 [procedure] (port-position [PORT])
    159160
    160 Returns the current position of {{PORT}} as two values: row and
    161 column number.  If the port does not support such an operation an error
    162 is signaled. This procedure is currently only available for input ports.
    163 {{PORT}} defaults to the value of {{(current-input-port)}}.
     161Returns the current position of {{PORT}} as two values: row and column number.
     162If the port does not support such an operation an error is signaled. This
     163procedure is currently only available for input ports. {{PORT}} defaults to the
     164value of {{(current-input-port)}}.
    164165
    165166
     
    172173
    173174
    174 
    175 
    176175=== Files
    177 
    178 
    179 
    180176
    181177==== delete-file
     
    203199
    204200
    205 
    206 
    207201=== String ports
    208 
    209 
    210 
    211202
    212203==== get-output-string
     
    239230
    240231CHICKEN maintains a global list of ''features'' naming functionality available
    241 int the current system. Additionally the {{cond-expand}} form accesses this
     232in the current system. Additionally the {{cond-expand}} form accesses this
    242233feature list to infer what features are provided. Predefined features are
    243234{{chicken}}, and the SRFIs (Scheme Request For Implementation) provided by the
     
    288279
    289280Keywords are special symbols prefixed with {{#:}} that evaluate
    290 to themselves.  Procedures can use keywords to accept optional named
    291 parameters in addition to normal required parameters.  Assignment to
     281to themselves. Procedures can use keywords to accept optional named
     282parameters in addition to normal required parameters. Assignment to
    292283and bindings of keyword symbols is not allowed.
    293284The parameter {{keyword-style}} and the compiler/interpreter option
     
    302293
    303294Returns the argument from {{ARGLIST}} specified under the keyword
    304 {{KEYWORD}}.  If the keyword is not found, then the zero-argument
     295{{KEYWORD}}. If the keyword is not found, then the zero-argument
    305296procedure {{THUNK}} is invoked and the result value is returned. If
    306297{{THUNK}} is not given, {{#f}} is returned.
     
    344335
    345336
    346 CHICKEN implements the (currently withdrawn) [[http://srfi.schemers.org/srfi-12/srfi-12.html|SRFI-12]]
    347 exception system. For more information, see the [[http://srfi.schemers.org/srfi-12/srfi-12.html|SRFI-12]]
    348 document.
     337CHICKEN implements the (currently withdrawn)
     338[[http://srfi.schemers.org/srfi-12/srfi-12.html|SRFI-12]] exception system. For
     339more information, see the
     340[[http://srfi.schemers.org/srfi-12/srfi-12.html|SRFI-12]] document.
    349341
    350342
     
    361353</enscript>
    362354
    363 If provided, {{VARIABLE}} will be bound to the signalled exception
     355If provided, {{VARIABLE}} will be bound to the signaled exception
    364356object. {{BODY ...}} is executed when the exception is a property-
    365357or composite condition with the kinds given {{KIND ...}} (unevaluated).
    366 If no clause applies, the exception is re-signalled in the same dynamic
     358If no clause applies, the exception is re-signaled in the same dynamic
    367359context as the {{condition-case}} form.
    368360
     
    388380 [procedure] (breakpoint [NAME])
    389381
    390 Programmatically triggers a breakpoint (similar to the {{,br}} top-level csi command).
    391 
    392 
    393 
    394 All error-conditions signalled by the system are of kind {{exn}}.
     382Programmatically triggers a breakpoint (similar to the {{,br}} top-level csi
     383command).
     384
     385All error-conditions signaled by the system are of kind {{exn}}.
    395386The following composite conditions are additionally defined:
    396387
     
    399390<tr><td> (exn arity)
    400391
    401 Signalled when a procedure is called with the wrong number of arguments.
     392Signaled when a procedure is called with the wrong number of arguments.
    402393
    403394</td></tr><tr><td> (exn type)
    404395
    405 Signalled on type-mismatch errors, for example when an argument of the wrong
    406 type is passed to a builtin procedure.
     396Signaled on type-mismatch errors, for example when an argument of the wrong
     397type is passed to a built-in procedure.
    407398
    408399</td></tr><tr><td> (exn arithmetic)
    409400
    410 Signalled on arithmetic errors, like division by zero.
     401Signaled on arithmetic errors, like division by zero.
    411402
    412403</td></tr><tr><td> (exn i/o)
    413404
    414 Signalled on input/output errors.
     405Signaled on input/output errors.
    415406
    416407</td></tr><tr><td> (exn i/o file)
    417408
    418 Signalled on file-related errors.
     409Signaled on file-related errors.
    419410
    420411</td></tr><tr><td> (exn i/o net)
    421412
    422 Signalled on network errors.
     413Signaled on network errors.
    423414
    424415</td></tr><tr><td> (exn bounds)
    425416
    426 Signalled on errors caused by accessing non-existent elements of a collection.
     417Signaled on errors caused by accessing non-existent elements of a collection.
    427418
    428419</td></tr><tr><td> (exn runtime)
    429420
    430 Signalled on low-level runtime-system error-situations.
     421Signaled on low-level runtime-system error-situations.
    431422
    432423</td></tr><tr><td> (exn runtime limit)
    433424
    434 Signalled when an internal limit is exceeded (like running out of memory).
     425Signaled when an internal limit is exceeded (like running out of memory).
    435426
    436427</td></tr><tr><td> (exn match)
    437428
    438 Signalled on errors raised by failed matches (see the section on {{match}}).
     429Signaled on errors raised by failed matches (see the section on {{match}}).
    439430
    440431</td></tr><tr><td> (exn syntax)
    441432
    442 Signalled on syntax errors.
     433Signaled on syntax errors.
    443434
    444435</td></tr><tr><td> (exn breakpoint)
    445436
    446 Signalled when a breakpoint is reached.
     437Signaled when a breakpoint is reached.
    447438
    448439</td></tr>
     
    454445* All error-exceptions (of the kind {{exn}}) are non-continuable.
    455446
    456 * Error-exceptions of the {{exn}} kind have additional {{arguments}} and {{location}} properties that contain the arguments passed to the exception-handler and the name of the procedure where the error occurred (if available).
    457 
    458 * When the {{posix}} unit is available and used, then a user-interrupt ({{signal/int}}) signals an exception of the kind {{user-interrupt}}.
    459 
    460 * the procedure {{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.
    461 
    462 * 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.
     447* Error-exceptions of the {{exn}} kind have additional {{arguments}} and
     448{{location}} properties that contain the arguments passed to the
     449exception-handler and the name of the procedure where the error occurred (if
     450available).
     451
     452* When the {{posix}} unit is available and used, then a user-interrupt
     453({{signal/int}}) signals an exception of the kind {{user-interrupt}}.
     454
     455* the procedure {{condition-property-accessor}} accepts an optional third
     456argument. If the condition does not have a value for the desired property and
     457if the optional argument is given, no error is signaled and the accessor
     458returns the third argument.
     459
     460* In composite conditions all properties are currently collected in a single
     461property-list, so in the case that to conditions have the same named property,
     462only one will be visible.
    463463
    464464
     
    475475the list is a string containing the name of the executing program. The
    476476other items are the arguments passed to the application. This list is
    477 freshly created on every invocation of {{(argv)}}.  It depends on
     477freshly created on every invocation of {{(argv)}}. It depends on
    478478the host-shell whether arguments are expanded ('globbed') or not.
    479479
     
    486486(Invokes {{exit-handler}}).
    487487
    488 
     488Note that pending {{dynamic-wind}} thunks are ''not'' invoked when exiting your program in this way.
    489489==== build-platform
    490490
     
    530530 [procedure] (machine-byte-order)
    531531
    532 Returns the symbol {{little-endian}} or {{big-endian}}, depending on the machine's byte-order.
     532Returns the symbol {{little-endian}} or {{big-endian}}, depending on the
     533machine's byte-order.
    533534
    534535
     
    557558 [procedure] (on-exit THUNK)
    558559
    559 Schedules the zero-argument procexdures {{THUNK}} to be executed before
    560 the process exits, either explicitly via {{exit}} or implicitly after exection
    561 of the last toplevel form. Note that finalizers for unreferenced finalized
     560Schedules the zero-argument procedures {{THUNK}} to be executed before
     561the process exits, either explicitly via {{exit}} or implicitly after execution
     562of the last top-level form. Note that finalizers for unreferenced finalized
    562563data are run before exit procedures.
    563564
     
    600601 [procedure] (c-runtime)
    601602
    602 Returns a symbol that designates what kind of C runtime library has been linked with this version of the Chicken
    603 libraries. Possible return values are {{static}}, {{dynamic}} or {{unknown}}. On systems not compiled
    604 with the Microsoft C compiler, {{c-runtime}} always returns {{unknown}}.
     603Returns a symbol that designates what kind of C runtime library has been linked
     604with this version of the Chicken libraries. Possible return values are
     605{{static}}, {{dynamic}} or {{unknown}}. On systems not compiled with the
     606Microsoft C compiler, {{c-runtime}} always returns {{unknown}}.
    605607
    606608
     
    676678Prints error message, writes all extra arguments to the
    677679value of {{(current-error-port)}} and invokes the
    678 current exception-handler.  This conforms to
     680current exception-handler. This conforms to
    679681[[http://srfi.schemers.org/srfi-23/srfi-23.html|SRFI-23]].
    680682If {{LOCATION}} is given and a symbol, it specifies the ''location'' (the name
     
    690692is only generated in code compiled without {{-no-trace}} and evaluated code.
    691693If the optional argument {{START}} is given, the backtrace starts
    692 at this offset, i.e. when {{START}} is 1, the next to last trace-entry 
     694at this offset, i.e. when {{START}} is 1, the next to last trace-entry
    693695is printed, and so on. If the optional argument {{THREAD}} is given, then
    694696the call-chain will only be constructed for calls performed by this thread.
     
    755757 [procedure] (gc [FLAG])
    756758
    757 Invokes a garbage-collection and returns the number of free bytes
    758 in the heap. The flag specifies whether a minor ({{#f}}) or
    759 major ({{#t}}) GC is to be triggered. If no argument is given,
    760 {{#t}} is assumed. An explicit {{#t}} argument will cause all pending finalizers to be executed.
     759Invokes a garbage-collection and returns the number of free bytes in the heap.
     760The flag specifies whether a minor ({{#f}}) or major ({{#t}}) GC is to be
     761triggered. If no argument is given, {{#t}} is assumed. An explicit {{#t}}
     762argument will cause all pending finalizers to be executed.
     763
    761764==== memory-statistics
    762765
    763766 [procedure] (memory-statistics)
    764767
    765 Performs a major garbage collection and returns a three element vector 
     768Performs a major garbage collection and returns a three element vector
    766769containing the total heap size in bytes, the number of bytes currently
    767770used and the size of the nursery (the first heap generation). Note
     
    776779Registers a procedure of one argument {{PROC}}, that will be
    777780called as soon as the non-immediate data object {{X}} is about to
    778 be garbage-collected (with that object as its argument).  Note that
     781be garbage-collected (with that object as its argument). Note that
    779782the finalizer will '''not''' be called while interrupts are disabled.
    780783This procedure returns {{X}}.
     
    798801
    799802
    800 ==== andmap
    801 
    802  [procedure] (andmap PROC LIST1 ...)
    803 
    804 Repeatedly calls {{PROC}} with arguments taken from {{LIST1 ...}}. 
    805 If any invocation should return {{#f}}, the result of
    806 {{andmap}} is {{#f}}. If all invocations return a true result,
    807 then the result of {{andmap}} is {{#t}}.
    808 
    809 
    810 ==== ormap
    811 
    812  [procedure] (ormap PROC LIST1 ...)
    813 
    814 Repeatedly calls {{PROC}} with arguments taken from {{LIST1 ...}}. 
    815 If any invocation should return a value different from
    816 {{#f}}, then this value is returned as the  result of
    817 {{ormap}}. If all invocations return '''#f''',
    818 then the result of {{ormap}} is {{#f}}.
    819 
    820 
    821803==== promise?
    822804
     
    835817 [procedure] (reverse-list->string LIST)
    836818
    837 Returns a string with the characters in {{LIST}} in reverse order. This is equivalent to
    838 {{(list->string (reverse LIST))}}, but much more efficient.
     819Returns a string with the characters in {{LIST}} in reverse order. This is
     820equivalent to {{(list->string (reverse LIST))}}, but much more efficient.
    839821
    840822
    841823
    842824=== Generating uninterned symbols
    843 
    844 
    845825
    846826==== gensym
     
    860840
    861841
    862 
    863 
    864842=== Standard Input/Output
    865843
     
    878856Outputs the optional arguments {{EXP1 ...}} using {{display}} and
    879857writes a newline character to the port that is the value of
    880 {{(current-output-port)}}.  Returns its first argument, or
    881 {{(void)}} when no supplied arguments.
     858{{(current-output-port)}}. Returns {{(void)}}.
    882859
    883860
     
    887864
    888865Similar to {{print}}, but does not output a terminating newline
    889 character and performs a {{flush-outout}} after writing its arguments.
     866character and performs a {{flush-output}} after writing its arguments.
    890867
    891868
     
    893870
    894871=== User-defined named characters
    895 
    896 
    897872
    898873==== char-name
     
    904879If {{SYMBOL-OR-CHAR}} is a symbol, then {{char-name}} returns
    905880the character with this name, or {{#f}} if no character is defined
    906 under this name.  If {{SYMBOL-OR-CHAR}} is a character, then the
     881under this name. If {{SYMBOL-OR-CHAR}} is a character, then the
    907882name of the character is returned as a symbol, or {{#f}} if the
    908883character has no associated name.
     
    910885If the optional argument {{CHAR}} is provided, then
    911886{{SYMBOL-OR-CHAR}} should be a symbol that will be the new name of
    912 the given character.  If multiple names designate the same character,
     887the given character. If multiple names designate the same character,
    913888then the {{write}} will use the character name that was defined last.
    914889
     
    925900
    926901
    927 
    928 
    929902=== Blobs
    930903
     
    936909 [procedure] (make-blob SIZE)
    937910
    938 Returns a blob object of {{SIZE}} bytes,
    939 aligned on an 8-byte boundry,
    940 un-initialized.
     911Returns a blob object of {{SIZE}} bytes, aligned on an 8-byte boundary,
     912uninitialized.
    941913
    942914==== blob?
     
    967939
    968940
    969 
    970 
    971941=== Vectors
    972 
    973 
    974942
    975943==== vector-copy!
     
    989957 [procedure] (vector-resize VECTOR N [INIT])
    990958
    991 Creates and returns a new vector with the contents of {{VECTOR}} and length {{N}}.
    992 If {{N}} is greater than the original length of {{VECTOR}}, then all additional
    993 items are initialized to {{INIT}}. If {{INIT}} is not specified, the
     959Creates and returns a new vector with the contents of {{VECTOR}} and length
     960{{N}}. If {{N}} is greater than the original length of {{VECTOR}}, then all
     961additional items are initialized to {{INIT}}. If {{INIT}} is not specified, the
    994962contents are initialized to some unspecified value.
    995963
    996964
    997965
    998 
    999 
    1000966=== The unspecified value
    1001967
    1002 
    1003 
    1004968==== void
    1005969
     
    1010974
    1011975
    1012 
    1013 
    1014976=== Continuations
    1015977
    1016 
    1017 
    1018978==== call/cc
    1019979
     
    1027987 [procedure] (continuation-capture PROCEDURE)
    1028988
    1029 Creates a continuation object representing the current continuation and tail-calls
    1030 {{PROCEDURE}} with this continuation as the single argument.
     989Creates a continuation object representing the current continuation and
     990tail-calls {{PROCEDURE}} with this continuation as the single argument.
    1031991
    1032992More information about this continuation API can be found in the paper
    1033 [[http://repository.readscheme.org/ftp/papers/sw2001/feeley.pdf]] ''A Better API for first class
    1034 Continuations'' by Marc Feeley.
     993[[http://repository.readscheme.org/ftp/papers/sw2001/feeley.pdf]] ''A Better
     994API for first class Continuations'' by Marc Feeley.
    1035995
    1036996
     
    1039999 [procedure] (continuation? X)
    10401000
    1041 Returns {{#t}} if {{X}} is a continuation object, or {{#f}} otherwise.
     1001Returns {{#t}} if {{X}} is a continuation object, or {{#f}} otherwise. Please
     1002note that this applies only to continuations created by the Continuation API,
     1003but not by call/cc, i.e.: {{(call-with-current-continuation continuation?)}}
     1004returns {{#f}}, whereas {{(continuation-capture continuation?)}} returns
     1005{{#t}}.
    10421006
    10431007
     
    10681032=== Setters
    10691033
    1070 SRFI-17 is fully implemented. For more information see: [[http://srfi.schemers.org/srfi-17/srfi-17.html|SRFI-17]].
     1034SRFI-17 is fully implemented. For more information see:
     1035[[http://srfi.schemers.org/srfi-17/srfi-17.html|SRFI-17]].
    10711036
    10721037==== setter
     
    10741039 [procedure] (setter PROCEDURE)
    10751040
    1076 Returns the setter-procedure of {{PROCEDURE}}, or signals an error if {{PROCEDURE}}
    1077 has no associated setter-procedure.
    1078 
    1079 Note that {{(set! (setter PROC) ...)}} for a procedure that has no associated setter procedure
    1080 yet is a very slow operation (the old procedure is replaced by a modified copy, which involves a
    1081 garbage collection).
     1041Returns the setter-procedure of {{PROCEDURE}}, or signals an error if
     1042{{PROCEDURE}} has no associated setter-procedure.
     1043
     1044Note that {{(set! (setter PROC) ...)}} for a procedure that has no associated
     1045setter procedure yet is a very slow operation (the old procedure is replaced by
     1046a modified copy, which involves a garbage collection).
    10821047
    10831048
     
    10861051 [procedure] (getter-with-setter GETTER SETTER)
    10871052
    1088 Returns a copy of the procedure {{GETTER}} with the associated setter procedure {{SETTER}}.
    1089 Contrary to the SRFI specification, the setter of the returned procedure may be changed.
     1053Returns a copy of the procedure {{GETTER}} with the associated setter procedure
     1054{{SETTER}}. Contrary to the SRFI specification, the setter of the returned
     1055procedure may be changed.
     1056
    10901057
    10911058
    10921059=== Reader extensions
    1093 
    1094 
    10951060
    10961061==== define-reader-ctor
     
    11061071 [procedure] (set-read-syntax! CHAR-OR-SYMBOL PROC)
    11071072
    1108 When the reader is encounting the non-whitespace character {{CHAR}} while reading
     1073When the reader encounters the non-whitespace character {{CHAR}} while reading
    11091074an expression from a given port, then the procedure {{PROC}} will be called with
    11101075that port as its argument. The procedure should return a value that will be returned
     
    11661131
    11671132
     1133=== Property lists
     1134
     1135As in other Lisp dialects, CHICKEN supports "property lists" associated with symbols.
     1136Properties are accessible via a key that can be any kind of value but which will
     1137be compared using {{eq?}}.
     1138
     1139==== get
     1140
     1141  [procedure] (get SYMBOL PROPERTY [DEFAULT])
     1142
     1143Returns the value stored under the key {{PROPERTY}} in the property
     1144list of {{SYMBOL}}. If no such property is stored, returns
     1145{{DEFAULT}}. The {{DEFAULT}} is optional and defaults to {{#f}}.
     1146
     1147==== put!
     1148
     1149  [procedure] (put! SYMBOL PROPERTY VALUE)
     1150  [setter] (set! (get SYMBOL PROPERTY) VALUE)
     1151
     1152Stores {{VALUE}} under the key {{PROPERTY}} in the property list of
     1153{{SYMBOL}} replacing any previously stored value.
     1154
     1155==== remprop!
     1156
     1157  [procedure] (remprop! SYMBOL PROPERTY)
     1158
     1159Deletes the first property matching the key {{PROPERTY}} in the property list
     1160of {{SYMBOL}}. Returns {{#t}} when a deletion performed, and {{#f}} otherwise.
     1161
     1162==== symbol-plist
     1163
     1164  [procedure] (symbol-plist SYMBOL)
     1165  [setter] (set! (symbol-plist SYMBOL) LST)
     1166
     1167Returns the property list of {{SYMBOL}} or sets it.
     1168
     1169==== get-properties
     1170
     1171  [procedure] (get-properties SYMBOL PROPERTIES)
     1172
     1173Searches the property list of {{SYMBOL}} for the first property with a key in
     1174the list {{PROPERTIES}}. Returns 3 values: the matching property key, value,
     1175and the tail of property list after the matching property. When no match found
     1176all values are {{#f}}.
     1177
     1178{{PROPERTIES}} may also be an atom, in which case it is treated as a list of
     1179one element.
     1180
    11681181
    11691182Previous: [[Parameters]]
  • chicken/branches/release/manual/Unit posix

    r5945 r7276  
    1212All errors related to failing file-operations will signal a condition
    1313of kind {{(exn i/o file)}}.
     14
     15
     16=== Constants
     17
     18==== File-control Commands
     19
     20===== fcntl/dupfd
     21===== fcntl/getfd
     22===== fcntl/setfd
     23===== fcntl/getfl
     24===== fcntl/setfl
     25
     26==== Standard I/O file-descriptors
     27
     28===== fileno/stdin
     29===== fileno/stdout
     30===== fileno/stderr
     31
     32==== Open flags
     33
     34===== open/rdonly
     35===== open/wronly
     36===== open/rdwr
     37===== open/read
     38===== open/write
     39===== open/creat
     40===== open/append
     41===== open/excl
     42===== open/noctty
     43===== open/nonblock
     44===== open/trunc
     45===== open/sync
     46===== open/fsync
     47===== open/binary
     48===== open/text
     49
     50==== Permission bits
     51
     52===== perm/irusr
     53===== perm/iwusr
     54===== perm/ixusr
     55===== perm/irgrp
     56===== perm/iwgrp
     57===== perm/ixgrp
     58===== perm/iroth
     59===== perm/iwoth
     60===== perm/ixoth
     61===== perm/irwxu
     62===== perm/irwxg
     63===== perm/irwxo
     64===== perm/isvtx
     65===== perm/isuid
     66===== perm/isgid
     67
    1468
    1569=== Directories
     
    141195
    142196<enscript highlight=scheme>
    143 (with-output-to-pipe 
     197(with-output-to-pipe
    144198  "gs -dNOPAUSE -sDEVICE=jpeg -dBATCH -sOutputFile=signballs.jpg -g600x600 -q -"
    145199  (lambda ()
     
    207261together).  The optional {{MODE}} should be a bitmask composed of one
    208262or more permission values like {{perm/irusr}} and is only relevant
    209 when a new file is created. The default mode is 
     263when a new file is created. The default mode is
    210264{{perm/irwxu | perm/irgrp | perm/iroth}}.
    211265
     
    268322==== file-control
    269323
    270  [procedure] (file-control FILENO COMMAND  [ARGUMENT])
     324 [procedure] (file-control FILENO COMMAND [ARGUMENT])
    271325
    272326Performs the fcntl operation {{COMMAND}} with the given
    273327{{FILENO}} and optional {{ARGUMENT}}. The return value is
    274328meaningful depending on the {{COMMAND}}.
    275 
    276 ==== fcntl/dupfd
    277 ==== fcntl/getfd
    278 ==== fcntl/setfd
    279 ==== fcntl/getfl
    280 ==== fcntl/setfl
    281 
    282 These variables contain commands for {{file-control}}.
    283 
    284 ==== fileno/stdin
    285 ==== fileno/stdout
    286 ==== fileno/stderr
    287 
    288 These variables contain file-descriptors for the standard I/O files.
    289 
    290 ==== open/rdonly
    291 ==== open/wronly
    292 ==== open/rdwr
    293 ==== open/read
    294 ==== open/write
    295 ==== open/creat
    296 ==== open/append
    297 ==== open/excl
    298 ==== open/noctty
    299 ==== open/nonblock
    300 ==== open/trunc
    301 ==== open/sync
    302 ==== open/fsync
    303 ==== open/binary
    304 ==== open/text
    305 
    306 Flags for use with {{file-open}}.
    307329
    308330==== open-input-file*
     
    354376not {{#f}}, then the file-statistics vector will be resolved for
    355377symbolic links (otherwise symbolic links are not resolved).
     378Note that for very large files, the {{file-size}} value may be an
     379inexact integer.
    356380
    357381==== file-position
     
    368392Returns the size of the file designated by {{FILE}}.  {{FILE}}
    369393may be a filename or a file-descriptor.  If the file does not exist,
    370 an error is signaled.
     394an error is signaled. Note that for very large files, {{file-size}} may
     395return an inexact integer.
    371396
    372397==== regular-file?
     
    375400
    376401Returns true, if {{FILENAME}} names a regular file (not a directory or symbolic link).
     402
     403==== file-owner
     404
     405 [procedure] (file-owner FILE)
     406
     407Returns the user-id of {{FILE}}.  {{FILE}} may be a filename
     408or a file-descriptor.
     409
     410==== file-permissions
     411
     412 [procedure] (file-permissions FILE)
     413
     414Returns the permission bits for {{FILE}}. You can test this value
     415by performing bitwise operations on the result and the {{perm/...}}
     416values.  {{FILE}} may be a filename or a file-descriptor.
     417
     418==== file-read-access?
     419==== file-write-access?
     420==== file-execute-access?
     421
     422 [procedure] (file-read-access? FILENAME)
     423 [procedure] (file-write-access? FILENAME)
     424 [procedure] (file-execute-access? FILENAME)
     425
     426These procedures return {{#t}} if the current user has read,
     427write or execute permissions on the file named {{FILENAME}}.
    377428
    378429
     
    402453Exceptions: {{(exn bounds)}}, {{(exn i/o file)}}
    403454
     455==== change-file-mode
     456
     457 [procedure] (change-file-mode FILENAME MODE)
     458
     459Changes the current file mode of the file named {{FILENAME}}
     460to {{MODE}} using the {{chmod()}} system call.  The
     461{{perm/...}} variables contain the various permission bits and can
     462be combinded with the {{bitwise-ior}} procedure.
     463
     464==== change-file-owner
     465
     466 [procedure] (change-file-owner FILENAME UID GID)
     467
     468Changes the owner information of the file named {{FILENAME}} to
     469the user- and group-ids {{UID}} and {{GID}} (which should be
     470exact integers) using the {{chown()}} system call.
     471
    404472
    405473=== Processes
     
    416484
    417485Returns the process ID of the parent of the current process.
     486
     487==== process-group-id
     488
     489 [procedure] (process-group-id PID)
     490
     491Returns the process group ID of the process specified by {{PID}}.
    418492
    419493==== process-execute
     
    512586if a signal occurred.
    513587
     588==== create-session
     589
     590 [procedure] (create-session)
     591
     592Creates a new session if the calling process is not a process group leader and returns
     593the session ID.
     594
    514595
    515596=== Hard and symbolic links
     
    541622
    542623
    543 === Permissions
    544 
    545 ==== file-owner
    546 
    547  [procedure] (file-owner FILE)
    548 
    549 Returns the user-id of {{FILE}}.  {{FILE}} may be a filename
    550 or a file-descriptor.
    551 
    552 ==== file-permissions
    553 
    554  [procedure] (file-permissions FILE)
    555 
    556 Returns the permission bits for {{FILE}}. You can test this value
    557 by performing bitwise operations on the result and the {{perm/...}}
    558 values.  {{FILE}} may be a filename or a file-descriptor.
    559 
    560 ==== file-read-access?
    561 ==== file-write-access?
    562 ==== file-execute-access?
    563 
    564  [procedure] (file-read-access? FILENAME)
    565  [procedure] (file-write-access? FILENAME)
    566  [procedure] (file-execute-access? FILENAME)
    567 
    568 These procedures return {{#t}} if the current user has read,
    569 write or execute permissions on the file named {{FILENAME}}.
    570 
    571 ==== change-file-mode
    572 
    573  [procedure] (change-file-mode FILENAME MODE)
    574 
    575 Changes the current file mode of the file named {{FILENAME}}
    576 to {{MODE}} using the {{chmod()}} system call.  The
    577 {{perm/...}} variables contain the various permission bits and can
    578 be combinded with the {{bitwise-ior}} procedure.
    579 
    580 ==== change-file-owner
    581 
    582  [procedure] (change-file-owner FILENAME UID GID)
    583 
    584 Changes the owner information of the file named {{FILENAME}} to
    585 the user- and group-ids {{UID}} and {{GID}} (which should be
    586 exact integers) using the {{chown()}} system call.
     624=== Retrieving user & group information
    587625
    588626==== current-user-id
    589 ==== current-group-id
    590 ==== current-effective-user-id
    591 ==== current-effective-group-id
    592627
    593628 [procedure] (current-user-id)
    594629 [setter] (set! (current-user-id) UID)
     630
     631Get or set the real user-id of the current process.
     632
     633==== current-effective-user-id
     634
     635 [procedure] (current-effective-user-id)
     636 [setter] (set! (current-effective-user-id) UID)
     637
     638Get or set the effective user-id of the current process.
     639
     640==== user-information
     641
     642 [procedure] (user-information USER [AS-VECTOR])
     643
     644If {{USER}} specifes a valid username (as a string) or user ID, then the user
     645database is consulted and a list of 7 values are returned: the user-name, the
     646encrypted password, the user ID, the group ID, a user-specific string, the home
     647directory and the default shell. When {{AS-VECTOR}} is {{#t}} a vector of 7
     648elements is returned instead of a list. If no user with this name or id then
     649{{#f}} is returned.
     650
     651==== current-group-id
     652
    595653 [procedure] (current-group-id)
    596654 [setter] (set! (current-group-id) GID)
    597  [procedure] (current-effective-user-id)
    598  [setter] (set! (current-effective-user-id) UID)
     655
     656Get or set the real group-id of the current process.
     657
     658==== current-effective-group-id
     659
    599660 [procedure] (current-effective-group-id)
    600661 [setter] (set! (current-effective-group-id) GID)
    601662
    602 Get or set the real/effective user- and group-ids of the current process.
    603 
    604 ==== process-group-id
    605 
    606  [procedure] (process-group-id PID)
    607 
    608 Returns the process group ID of the process specified by {{PID}}.
     663Get or set the effective group-id of the current process.
     664ID can be found, then {{#f}} is returned.
    609665
    610666==== group-information
     
    623679Returns a list with the supplementary group IDs of the current user.
    624680
     681
     682=== Changing user & group information
     683
    625684==== set-groups!
    626685
     
    635694 [procedure] (initialize-groups USERNAME BASEGID)
    636695
    637 Sets the supplementrary group IDs of the current user to the IDs from the user with name {{USERNAME}} 
     696Sets the supplementrary group IDs of the current user to the IDs from the user with name {{USERNAME}}
    638697(a string), including {{BASEGID}}.
    639698
    640699Only the superuser may invoke this procedure.
    641 
    642 ==== perm/irusr
    643 ==== perm/iwusr
    644 ==== perm/ixusr
    645 ==== perm/irgrp
    646 ==== perm/iwgrp
    647 ==== perm/ixgrp
    648 ==== perm/iroth
    649 ==== perm/iwoth
    650 ==== perm/ixoth
    651 ==== perm/irwxu
    652 ==== perm/irwxg
    653 ==== perm/irwxo
    654 ==== perm/isvtx
    655 ==== perm/isuid
    656 ==== perm/isgid
    657 
    658 These variables contain permission bits as used in {{change-file-mode}}.
    659700
    660701==== set-process-group-id!
     
    664705
    665706Sets the process group ID of the process specifed by {{PID}} to {{PGID}}.
    666 
    667 ==== user-information
    668 
    669  [procedure] (user-information USER)
    670 
    671 If {{USER}} specifes a valid username (as a string) or user ID, then
    672 the user database is consulted and a list of 7 values are returned: the user-name,
    673 the encrypted password, the user ID, the group ID, a user-specific string,
    674 the home directory and the default shell. If no user with this name or
    675 ID can be found, then {{#f}} is returned.
    676 
    677 ==== create-session
    678 
    679  [procedure] (create-session)
    680 
    681 Creates a new session if the calling process is not a process group leader and returns
    682 the session ID.
    683707
    684708
     
    813837
    814838Returns a association list of the environment variables and their
    815 current values. 
     839current values.
    816840
    817841==== setenv
     
    9891013Recursively traverses the contents of {{DIRECTORY}} (which should
    9901014be a string) and invokes the procedure {{ACTION}} for all files
    991 for which the procedure {{PREDICATE}} is true.  {{PREDICATE}}
     1015in which the procedure {{PREDICATE}} is true.  {{PREDICATE}}
    9921016may me a procedure of one argument or a regular-expression string.
    9931017{{ACTION}} should be a procedure of two arguments: the currently
     
    9951019{{ACTION}}, or, if this is the first invocation, the value
    9961020of {{IDENTITY}}. {{ACTION}} defaults to {{cons}},
    997 {{IDENTITY}} defaults to {{()}}.  {{LIMIT}} should a
     1021{{IDENTITY}} defaults to {{()}}.  {{LIMIT}} should be a
    9981022procedure of one argument that is called for each nested directory
    9991023and which should return true, if that directory is to be traversed
    10001024recursively. {{LIMIT}} may also be an exact integer that
    1001 gives the maximum recursion depth. A depth of {{0}} means the
    1002 files in the specified directory are traversed but not any nested
    1003 directories. {{LIMIT}} may also be {{#f}} (the default),
     1025gives the maximum recursion depth. For example, a depth of {{0}} means that only files in the top-level, specified directory are to be traversed. In this case, all nested directories are ignored.  {{LIMIT}} may also be {{#f}} (the default),
    10041026which is equivalent to {{(constantly #t)}}.
    10051027
     
    12571279 process-group-id  set-process-group-id!
    12581280 create-symbolic-link  read-symbolic-link
    1259  file-truncate 
     1281 file-truncate
    12601282 file-lock  file-lock/blocking  file-unlock  file-test-lock
    12611283 create-fifo  fifo?
     
    12661288 terminal-port?  terminal-name
    12671289 process-fork  process-signal
    1268  parent-process-id 
     1290 parent-process-id
    12691291 set-root-directory!
    12701292 utc-time->seconds
     
    12851307
    12861308These variables contains special flags that specify the exact semantics of {{process-spawn}}:
    1287 {{spawn/overlay}} replaces the current process with the new one. 
    1288 {{spawn/wait}} suspends execution of the current process until the spawned process returns. 
     1309{{spawn/overlay}} replaces the current process with the new one.
     1310{{spawn/wait}} suspends execution of the current process until the spawned process returns.
    12891311{{spawn/nowait}} does the opposite ({{spawn/nowaito}} is identical, according to the Microsoft
    12901312documentation) and runs the process asynchronously.
  • chicken/branches/release/manual/Unit regex

    r5945 r7276  
    7171
    7272
     73=== regexp*
     74
     75 [procedure] (regexp* STRING [OPTIONS [TABLES]])
     76
     77Returns a precompiled regular expression object for {{string}}. The optional
     78argument {{OPTIONS}} must be a list of option symbols. The optional argument
     79{{TABLES}} must be a character definitions table (not defined here).
     80
     81
     82Option Symbols:
     83
     84; caseless : Character case insensitive match
     85; multiline : Equivalent to Perl's /m option
     86; dotall : Equivalent to Perl's /s option
     87; extended : Ignore whitespace
     88; anchored : Anchor pattern match
     89; dollar-endonly : `$' metacharacter in the pattern matches only at the end of the subject string
     90; extra : Currently of very little use
     91; notbol : First character of the string is not the beginning of a line
     92; noteol : End of the string is not the end of a line
     93; ungreedy : Inverts the "greediness" of the quantifiers so that they are not greedy by default
     94; notempty : The empty string is not considered to be a valid match
     95; utf8 : UTF-8 encoded characters
     96; no-auto-capture : Disables the use of numbered capturing parentheses
     97; no-utf8-check : Skip valid UTF-8 sequence check
     98; auto-callout : Automatically inserts callout items (not defined here)
     99; partial : Partial match ok
     100; firstline : An unanchored pattern is required to match before or at the first newline
     101; dupnames : Names used to identify capturing subpatterns need not be unique
     102; newline-cr : Newline definition is `\r'
     103; newline-lf : Newline definition is `\n'
     104; newline-crlf : Newline definition is `\r\n'
     105; newline-anycrlf : Newline definition is any of `\r', `\n', or `\r\n'
     106; newline-any : ewline definition is any Unicode newline sequence
     107; bsr-anycrlf : `\R' escape sequence matches only CR, LF, or CRLF
     108; bsr-unicode : `\R' escape sequence matches only Unicode newline sequence
     109
     110; dfa-shortest : Currently unused
     111; dfa-restart : Currently unused
     112
     113
    73114=== regexp?
    74115
     
    77118Returns {{#t}} if {{X}} is a precompiled regular expression,
    78119or {{#f}} otherwise.
     120
     121
     122=== regexp-optimize
     123
     124 [procedure] (regexp-optimize RX)
     125 
     126Perform available optimizations for the precompiled regular expression {{RX}}.
     127Returns {{#t}} when optimization performed, and {{#f}} otherwise.
    79128
    80129
     
    134183  => ("this" "is" "a" "string" "1," "2," "3,")
    135184
    136 (string-split-fields "," s #:suffix))
     185(string-split-fields "," s #:suffix)
    137186 
    138187  => ("this is a string 1" " 2" " 3")
     
    175224<enscript highlight=scheme>
    176225(string-substitute* "<h1>Hello, world!</h1>"
    177                     '(("<[/A-Za-z0-9]+>" . ""))))
     226                    '(("<[/A-Za-z0-9]+>" . "")))
    178227
    179228=>  "Hello, world!"
     
    194243
    195244
     245=== make-anchored-pattern
     246
     247 [procedure] (make-anchored-pattern REGEXP [WITHOUT-BOL [WITHOUT-EOL]])
     248
     249Makes an anchored pattern from {{REGEXP}} (a string or a precompiled regular
     250expression) and returns the updated pattern. When {{WITHOUT-BOL}} is {{#t}} the
     251beginning-of-line anchor is not added. When {{WITHOUT-EOL}} is {{#t}} the
     252end-of-line anchor is not added.
     253
     254The {{WITHOUT-BOL}} and {WITHOUT-EOL}} arguments are ignored for a precompiled regular
     255expression.
     256
     257
    196258Previous: [[Unit match]]
    197259
  • chicken/branches/release/manual/Unit srfi-18

    r5945 r7276  
    7070Readies the suspended thread {{THREAD}}.
    7171
     72=== thread-wait-for-i/o!
     73
     74 [procedure] (thread-wait-for-i/o! FD [MODE])
     75
     76Suspends the current thread until input ({{MODE}} is {{#:input}}), output ({{MODE}} is {{#:output}})
     77or both ({{MODE}} is {{#:all}}) is available. {{FD}} should be a file-descriptor (not a port!) open
     78for input or output, respectively.
     79
    7280=== time->milliseconds
    7381
  • chicken/branches/release/manual/Unit utils

    r5945 r7276  
    143143
    144144Calls {{PROCEDURE}} for each line read from {{PORT}} (which defaults to the
    145 value of {{(current-input-port)}}. The argument passed to {{PORCEDURE}}
     145value of {{(current-input-port)}}. The argument passed to {{PROCEDURE}}
    146146is a string with the contents of the line, excluding any line-terminators.
    147147When all input has been read from the port, {{for-each-line}} returns some unspecified value.
     
    230230===  Miscellaneous handy things
    231231
    232 ==== shift!
     232==== shift! DEPRECATED
    233233
    234234 [procedure] (shift! LIST [DEFAULT])
     
    245245The list must contain at least 2 elements.
    246246
    247 ==== unshift!
     247==== unshift! DEPRECATED
    248248
    249249 [procedure] (unshift! X PAIR)
  • chicken/branches/release/manual/Using the compiler

    r5945 r7276  
    3636
    3737; -check-syntax : Aborts compilation process after macro-expansion and syntax checks.
    38 
    39 ; -compress-literals THRESHOLD : Compiles quoted literals that exceed the size {{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.
    4038
    4139; -debug MODES : Enables one or more compiler debugging modes. {{MODES}} is a string of characters that select debugging information about the compiler that will be printed to standard output.
     
    124122; -import FILENAME : Read exports from linked or loaded libraries from given file. See also {{-check-imports}}. This is equivalent to declaring {{(declare (import FILENAME))}}. Implies {{-check-imports}}.
    125123
    126 ; -include-path PATHNAME : Specifies an additional search path for files included via the {{include}} special form. This option may be given multiple times. If the environment variable {{CHICKEN_INCLUDE_PATH}} is set, it should contain a list of alternative include pathnames separated by {{;}}. The environment variable {{CHICKEN_HOME}} is also considered as a search path.
     124; -include-path PATHNAME : Specifies an additional search path for files included via the {{include}} special form. This option may be given multiple times. If the environment variable {{CHICKEN_INCLUDE_PATH}} is set, it should contain a list of alternative include pathnames separated by {{;}}.
    127125
    128126; -inline : Enable procedure inlining for known procedures of a size below the threshold (which can be set through the {{-inline-limit}} option).
    129127
    130 ; -inline-limit THRESHOLD : Sets the maximum size of a potentially inlinable procedure. This option is only effective when inlining has been enabled with the {{-inline}} option. The default threshold is {{10}}.
     128; -inline-limit THRESHOLD : Sets the maximum size of a potentially inlinable procedure. The default threshold is {{10}}.
    131129
    132130; -keyword-style STYLE : Enables alternative keyword syntax, where {{STYLE}} may be either {{prefix}} (as in Common Lisp), {{suffix}} (as in DSSSL) or {{none}}. Any other value is ignored. The default is {{suffix}}.
     
    397395Linux or FreeBSD:
    398396
    399 Let's take a simple "Hello, world!":
     397Let's take a simple example.
    400398
    401399<enscript highlight=scheme>
     
    405403</enscript>
    406404
     405  % chicken hello.scm -optimize-level 3 -output-file hello.c
     406
    407407Compiled to C, we get {{hello.c}}. We need the files {{chicken.h}} and
    408 {{runtime.c}}, which contain the basic runtime system, plus the three basic library
    409 files {{library.c}}, {{eval.c}} and {{extras.c}} which contain the same functionality as the
    410 library linked into a plain CHICKEN-compiled application, or which is available by default in the
     408{{runtime.c}}, which contain the basic runtime system, plus the three
     409basic library files {{library.c}}, {{eval.c}} and {{extras.c}} which
     410contain the same functionality as the library linked into a plain
     411CHICKEN-compiled application, or which is available by default in the
    411412interpreter, {{csi}}:
    412413
    413  % csc hello.scm -O2 -d1
    414 
    415 A simple makefile is needed as well:
    416 
    417 <enscript highlight=makefile>
    418 # Makefile for UNIX systems
    419 
    420 hello: hello.o runtime.o library.o eval.o extras.o
    421        $(CC) -o hello hello.o runtime.o library.o eval.o extras.o -lm
    422 
    423 hello.o: chicken.h
    424 runtime.o: chicken.h
    425 library.o: chicken.h
    426 eval.o: chicken.h
    427 extras.o: chicken.h
    428 </enscript>
     414  % cd /tmp
     415  %echo '(print "Hello World.")' > hello.scm
     416  % cp $CHICKEN_BUILD/runtime.c .
     417  % cp $CHICKEN_BUILD/library.c .
     418  % cp $CHICKEN_BUILD/eval.c    .
     419  % cp $CHICKEN_BUILD/extras.c  .
     420  % gcc -static -Os -fomit-frame-pointer runtime.c library.c eval.c \
     421    extras.c hello.c -o hello -lm
    429422
    430423Now we have all files together, and can create an tarball containing all the files:
     
    433426 % gzip hello.tar
    434427
    435 This is of naturally rather simplistic. Things like enabling dynamic loading, estimating
     428This is naturally rather simplistic. Things like enabling dynamic loading, estimating
    436429the optimal stack-size and selecting supported features of the host system would need
    437430more configuration- and build-time support. All this can be addressed using more
  • chicken/branches/release/manual/Using the interpreter

    r5945 r7276  
    3232; -h  -help : Write a summary of the available command line options to standard output and exit.
    3333
    34 ; -I  -include-path PATHNAME : Specifies an alternative search-path for files included via the {{include}} special form. This option may be given multiple times. If the environment variable {{CHICKEN_INCLUDE_PATH}} is set, it should contain a list of alternative include pathnames separated by {{;}}. The environment variable {{CHICKEN_HOME}} is also considered as a search path.
     34; -I  -include-path PATHNAME : Specifies an alternative search-path for files included via the {{include}} special form. This option may be given multiple times. If the environment variable {{CHICKEN_INCLUDE_PATH}} is set, it should contain a list of alternative include pathnames separated by {{;}}.
    3535
    3636; -k  -keyword-style STYLE : Enables alternative keyword syntax, where {{STYLE}} may be either {{prefix}} (as in Common Lisp) or {{suffix}} (as in DSSSL). Any other value is ignored.
     
    4040; -w  -no-warnings : Disables any warnings that might be issued by the reader or evaluated code.
    4141
    42 ; -q  -quiet : Do not print a startup message.
     42; -q  -quiet : Do not print a startup message. Also disables generation of call-trace information for interpreted code.
    4343
    4444; -s  -script PATHNAME : This is equivalent to {{-batch -quiet -no-init PATHNAME}}. Arguments following {{PATHNAME}} are available by using  {{command-line-arguments}} and are not processed as interpreter options. Extra options in the environment variable {{CSI_OPTIONS}} are ignored.
     
    155155#;5> (fac 3)                        ==> 6
    156156</enscript>
     157k
    157158
    158159; ,utr SYMBOL ... : Disables tracing of the given toplevel procedures.
     
    203204
    204205 #;1> (define-record point x y)
    205  #;2> (set-describer! 'point (lambda (pt o) (print "a point with x=" (point-x pt) " and y=" (point-y pt))))
     206 #;2> (set-describer! 'point
     207        (lambda (pt o)
     208          (print "a point with x=" (point-x pt) " and y=" (point-y pt))))
    206209 #;3> ,d (make-point 1 2)
    207210 a point with x=1 and y=2
     
    220223 (use readline regex)
    221224 (current-input-port (make-gnu-readline-port))
    222  (gnu-history-install-file-manager (string-append (or (getenv "HOME") ".") "/.csi.history"))
     225 (gnu-history-install-file-manager
     226   (string-append (or (getenv "HOME") ".") "/.csi.history"))
    223227
    224228More details are available in [[http://www.call-with-current-continuation.org/eggs/readline.html|the egg's documentation]].
  • chicken/branches/release/manual/chicken-setup

    r5945 r7276  
    8181
    8282The optional argument {{INFOLIST}} should be an association list that
    83 maps symbols to values, this list will be stored as {{ID.setup}} at the same
     83maps symbols to values, this list will be stored as {{ID.setup-info}} at the same
    8484location as the extension code. Currently the following properties are used:
    8585
     
    118118
    119119Copies the given files into the examples directory, which is usually
    120 {{$prefix/share/chicken/examples}} (equivalent to {{$CHICKEN_HOME/examples}}
     120{{$prefix/share/chicken/examples}}
    121121or {{(make-pathname (chicken-home) "examples")}}).
    122122
     
    270270
    271271Holds the path where executables are installed and defaults to either {{$CHICKEN_PREFIX/bin}},
    272 if the environment variable {{CHICKEN_PREFIX}} is set, {{$CHICKEN_HOME}} or the
     272if the environment variable {{CHICKEN_PREFIX}} is set or the
    273273path where the CHICKEN binaries ({{chicken}}, {{csi}}, etc.) are installed.
    274274
     
    325325 [procedure] (cross-chicken)
    326326
    327 Retrusn {{#t}} if this system is configured for cross-compilation or {{#f}}
     327Returns {{#t}} if this system is configured for cross-compilation or {{#f}}
    328328otherwise.
     329
     330
     331==== host-extension
     332
     333 [parameter] host-extension
     334
     335For a cross-compiling CHICKEN, when compiling an extension, then it
     336should be built for the host environment (as opposed to the target
     337environment). This parameter is controlled by the {{-host-extension}} command-line
     338option. A setup script should perform the proper steps of compiling any
     339code by passing {{-host}} when invoking {{csc}} or using the {{compile}}
     340macro.
    329341
    330342
     
    515527; {{-r  -run FILENAME}} : Load and execute given file.
    516528; {{-s  -script FILENAME}} :Executes the given Scheme source file with all remaining arguments and exit. The ''she-bang'' shell script header is recognized, so you can write Scheme scripts that use {{chicken-setup}} just as with {{csi}}.
    517 ; {{-e  -eval EXPRESSION}} : Evaluates the given expression(s).
    518 ; {{-v  -verbose}} : Display additional debug information.
    519 ; {{-k  -keep}} : Keep temporary files and directories.
    520 ; {{-c  -csc-option OPTION}} : Passes {{OPTION}} as an extra argument to invocations of the compiler-driver ({{csc}}). This works only if {{csc}} is invoked as {{(run (csc ...))}}.
    521 ; {{-d  -dont-ask}} : Do not ask the user before trying to download required extensions.
    522 ; {{-n  -no-install}} : Do not install generated binaries and/or support files. Any invocations of {{install-program}}, {{install-extension}} or {{install-script}} will be be no-ops.
    523 ; {{-i  -docindex}} : Displays the path to the index-page of any installed extension-documentation. If the index page does not exist, it is created.
     529; {{-e  -eval EXPRESSION}} : Evaluates the given expression(s)
     530; {{-v  -verbose}} : Display additional debug information
     531; {{-k  -keep}} : Keep temporary files and directories
     532; {{-c  -csc-option OPTION}} : Passes {{OPTION}} as an extra argument to invocations of the compiler-driver ({{csc}}); this works only if {{csc}} is invoked as {{(run (csc ...))}}
     533; {{-d  -dont-ask}} : Do not ask the user before trying to download required extensions
     534; {{-n  -no-install}} : Do not install generated binaries and/or support files; any invocations of {{install-program}}, {{install-extension}} or {{install-script}} will be be no-ops
     535; {{-i  -docindex}} : Displays the path to the index-page of any installed extension-documentation; if the index page does not exist, it is created
    524536; {{-t  -test EXTENSION ...}} : return success if all given extensions are installed
    525537; {{-ls EXTENSION}} : List installed files for extension
    526538; {{-fetch-tree}} : Download and print the repository catalog
    527 ; {{-t  -test}} : If the extension sources contain a directory named {{tests}} and this directory includes a file named {{run.scm}} then this file is executed (with {{tests}} being the current working directory).
     539; {{-create-tree DIRECTORY}} : Create a fresh, minimal repository catalog and writes it to stdout
     540; {{-t  -test}} : If the extension sources contain a directory named {{tests}} and this directory includes a file named {{run.scm}} then this file is executed (with {{tests}} being the current working directory)
    528541; {{-tree FILENAME}} : Download and show the repository catalog
    529542; {{-svn URL}} : Fetch extension from [[http://subversion.tigris.org|Subversion]] repository
     
    531544; {{-local PATHNAME}} : Fetch extension from local file
    532545; {{-destdir PATHNAME}} : Specify alternative installation prefix (for packaging)
    533 ; {{--}} : Ignore all following arguments.
     546; {{-host-extension}} : Compile extension in "host" mode (sets the parameter {{host-extension}} to {{#f}})
     547; {{--}} : Ignore all following arguments
    534548
    535549Note that the options are processed exactly in the order in which they appear in the command-line.
     
    543557{{chicken-setup -fetch}}) and extract its contents with a separate
    544558program (like {{winzip}}). the {{CHICKEN_REPOSITORY}} environment
    545 variable has to be set (in addition to {{CHICKEN_HOME}}) to a
     559variable has to be set to a
    546560directory where your compiled extensions should be located.
    547561
  • chicken/branches/release/manual/faq

    r5945 r7276  
    9595
    9696There is an extension based on the GNU Multiprecision Package that implements most of the full
    97 numeric tower, see http://www.call-with-current-continuation.org/eggs/numbers.html.
     97numeric tower, see [[numbers]].
    9898
    9999
     
    488488
    489489Under CHICKENs implementation policy, tail recursion is achieved simply by avoiding
    490 to return from a function call. Since the programs is CPS converted, a continuous
     490to return from a function call. Since the programs are CPS converted, a continuous
    491491sequence of nested procedure calls is performed. At some stage the stack-space has
    492492to run out and the current procedure and its parameters (including the current
     
    535535
    536536<enscript highlight=scheme>
    537 ; The regex egg is required for ##csi#name-of-symbols-starting-with
    538 (require 'readline)
     537(require-extension readline)
    539538(current-input-port (make-gnu-readline-port))
    540539(gnu-history-install-file-manager (string-append (or (getenv "HOME") ".") "/.csi.history"))
  • chicken/branches/release/match.scm

    r1213 r7276  
    123123 (run-time-macros)
    124124 (disable-interrupts)
    125  (usual-integrations) )
     125 (usual-integrations)
     126 (hide every))
    126127
    127128(cond-expand
     
    133134
    134135
     136(define (every fn lst)
     137  (or (null? lst)
     138      (and (fn (car lst)) (every fn (cdr lst)))))
     139
     140
    135141;;; Macros
    136142