~ chicken-core (chicken-5) 8ac1b6935bbe14bb2c0cc1c0d478546f43f29b54
commit 8ac1b6935bbe14bb2c0cc1c0d478546f43f29b54 Author: Peter Bex <peter.bex@xs4all.nl> AuthorDate: Sun May 18 14:20:25 2014 +0200 Commit: Peter Bex <peter.bex@xs4all.nl> CommitDate: Sun May 18 14:20:25 2014 +0200 Manually merge latest wiki changes into the manual diff --git a/manual/Acknowledgements b/manual/Acknowledgements index 14283c2f..3d045560 100644 --- a/manual/Acknowledgements +++ b/manual/Acknowledgements @@ -71,6 +71,7 @@ CHICKEN contains code from several people: ; Marc Feeley : pretty-printer. ; Richard Kelsey, Jonathan Rees and Taylor Campbell : {{syntax-rules}} expander +; Mikael Djurfeldt : topological sort used by compiler. ; Aubrey Jaffer : implementation of {{dynamic-wind}}. ; Richard O'Keefe : sorting routines. ; Alex Shinn : the [[http://synthcode.com/scheme/irregex/|irregex]] regular expression package. diff --git a/manual/Callbacks b/manual/Callbacks index aa7f7490..de53a8d3 100644 --- a/manual/Callbacks +++ b/manual/Callbacks @@ -61,7 +61,7 @@ accessible from Scheme just like any other foreign variable defined by '''Note:''' don't be tempted to assign strings or bytevectors to external variables. Garbage collection -moves those objects around, so it is very bad idea to assign pointers +moves those objects around, so it is a very bad idea to assign pointers to heap-data. If you have to do so, then copy the data object into statically allocated memory (for example by using {{object-evict}}). diff --git a/manual/Modules b/manual/Modules index 38bad00c..758cd80f 100644 --- a/manual/Modules +++ b/manual/Modules @@ -388,7 +388,7 @@ must be available separately. === Functors A ''functor'' is a higher-order module that can be parameterized with -other modules. A functor defines the body of a module for a set or +other modules. A functor defines the body of a module for a set of argument modules and can be instantiated with concrete module names specializing the code contained in the functor. This is best explained with a silly and pointless example: @@ -453,7 +453,7 @@ by ''instantiating'' the functor for specific input modules: </enscript> Inside {{BODY}}, references to {{ARGUMENTMODULE}} will be replaced by -the corresponding {{MODUELNAME}} argument. The instantiation expands +the corresponding {{MODULENAME}} argument. The instantiation expands into the complete functor-code {{BODY}} and as such can be considered a particular sort of macro-expansion. Note that there is no requirement that a specific export of an argument-module must be diff --git a/manual/Unit eval b/manual/Unit eval index 181d3688..865294b9 100644 --- a/manual/Unit eval +++ b/manual/Unit eval @@ -187,6 +187,12 @@ if the environment variable {{CHICKEN_PREFIX}} is set, then {{chicken-home}} wil Evaluates {{EXP}} and returns the result of the evaluation. The second argument is optional and defaults to the value of {{(interaction-environment)}}. +'''Note''': if you want to eval an expression containing chicken special forms you must + + (use chicken-syntax) + +before calling {{eval}}. + --- Previous: [[Unit library]] diff --git a/manual/Unit ports b/manual/Unit ports index 4c6521c9..cc5b5216 100644 --- a/manual/Unit ports +++ b/manual/Unit ports @@ -39,9 +39,9 @@ and buffering the character). * {{READ-STRING!}} is called when {{read-string!}} is called (or the higher-level non-mutating {{read-string}}). It will be invoked with 4 arguments: the port created by {{make-input-port}}, the number of -bytes to read, the string buffer in which to read (which may be +bytes to read, a string (or sometimes a blob) to read into (which may be assumed to be big enough to hold the data) and the offset into the -string at which to put the data to read. It should return the number +buffer at which to put the data to read. It should return the number of bytes that have successfully been read, which should always be equal to the requested bytes unless EOF was hit, in which case it can be less. If this procedure is not provided or {{#f}}, the buffer will diff --git a/manual/Using the interpreter b/manual/Using the interpreter index 0db4817b..14ae4ccb 100644 --- a/manual/Using the interpreter +++ b/manual/Using the interpreter @@ -174,7 +174,7 @@ The toplevel loop understands a number of special commands: ; ,ln FILENAME ... : Load files and print result(s) of each top-level expression. -; ,m MODULENAME : switches the "current module" to {{MODULENAME}}, so expressions will be evaluated in the context of the given module. In compiled modules, only exported bindings will be visible to interactively entered code. In interpreted modules all bindings are visible. +; ,m MODULENAME : switches the "current module" to {{MODULENAME}}, so expressions will be evaluated in the context of the given module. To switch back to toplevel, use {{#f}} as a MODULENAME. In compiled modules, only exported bindings will be visible to interactively entered code. In interpreted modules all bindings are visible. ; ,p EXP : Pretty-print evaluated expression {{EXP}}. diff --git a/manual/faq b/manual/faq index b9452e5c..e53fdf37 100644 --- a/manual/faq +++ b/manual/faq @@ -98,7 +98,7 @@ protocol. Such a design would make native threads in Chicken essentially equivalent to Unix processes and shared memory. For a different approach to concurrency, please see the -[[/egg/mpi|mpi]] egg. +[[http://wiki.call-cc.org/egg/mpi|mpi]] egg. ==== Does CHICKEN support Unicode strings? @@ -720,7 +720,7 @@ Compile the program that uses the module: ==== Why is my program which uses regular expressions so slow? -The regular expression engine has recently be replaced by [[/users/alex shinn|alex shinn]]'s excellent +The regular expression engine has recently be replaced by [[http://wiki.call-cc.org/users/alex shinn|alex shinn]]'s excellent {{irregex}} library, which is fully implemented in Scheme. Precompiling regular expressions to internal form is somewhat slower than with the old PCRE-based regex engine. It is advisable to use {{irregex}} to precompile regular expressions @@ -777,13 +777,13 @@ and wrap calls to {{set-finalizer!}} in it. ==== Does CSI support history and autocompletion? -CSI doesn't support it natively but it can be activated with the [[http://wiki.call-cc.org/egg/readline|readline]] egg. -After installing the egg, add the following to your {{~/.csirc}} or equivalent file: +CSI doesn't support it natively but it can be activated with one of the [[http://wiki.call-cc.org/egg/readline|readline]], [[http://wiki.call-cc.org/egg/linenoise|linenoise]] or [[http://wiki.call-cc.org/egg/parley|parley]] eggs. Out of these three, the parley egg is recommended. +After installing parley, add the following to your {{~/.csirc}} or equivalent file: <enscript highlight=scheme> - (require-extension readline) - (current-input-port (make-gnu-readline-port)) - (gnu-history-install-file-manager (string-append (or (getenv "HOME") ".") "/.csi.history")) +(use parley) +(let ((old (current-input-port))) + (current-input-port (make-parley-port old))) </enscript> Users of *nix-like systems (including Cygwin), may also want to check out [[http://utopia.knoware.nl/~hlub/rlwrap/|rlwrap]]. This program lets you "wrap" another process (e.g. {{rlwrap csi}}) with the readline library, giving you history, autocompletion, and the ability to set the keystroke set. Vi fans can get vi keystrokes by adding "set editing-mode vi" to their {{.inputrc}} file. @@ -795,6 +795,16 @@ runtime and, if the file loaded is a Scheme source code file (instead of a shared object), it will be interpreted (even if the caller program is compiled). +==== How do I use extended (non-standard) syntax in evaluated code at run-time? + +Normally, only standard Scheme syntax is available to the evaluator. To +use the extensions provided in the CHICKEN compiler and interpreter, +add: + +<enscript highlight=scheme> +(require-library chicken-syntax) +</enscript> + === Extensions ==== Where is "chicken-setup" ? @@ -812,7 +822,7 @@ It should contain the path where you want eggs to be installed: $ chicken-install -init ~/eggs/lib/chicken/5 $ chicken-install -p ~/eggs/ extensionname -In order to make programs (including csi) see these eggs, you should set this variable when you run them. See the [[/man/4/Extensions#Changing repository location|Extensions/Changing repository location]] section of the manual for more information on that. +In order to make programs (including csi) see these eggs, you should set this variable when you run them. See the [[Extensions#Changing repository location|Extensions/Changing repository location]] section of the manual for more information on that. Alternatively, you can call the {{repository-path}} Scheme procedure before loading the eggs, as in:Trap