Commit e33fbaa2 authored by Erick's avatar Erick

Added UTF-8 support to most of the string functions (string-ref string-set!,...

Added UTF-8 support to most of the string functions (string-ref string-set!, string-upcase, string-downcase, ...). Comparisons are not done yet
parent f1f00e4a
;;;;
;;;; lib.stk -- Library for STklos Documentation Building
;;;;
;;;; Copyright 2003-2010 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
;;;; Copyright 2003-2011 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@essi.fr]
;;;; Creation date: 20-Dec-2003 23:23 (eg)
;;;; Last file update: 10-Aug-2010 09:19 (eg)
;;;; Last file update: 27-May-2011 23:16 (eg)
;;;;
(load "srfi.stk")
......@@ -71,7 +71,7 @@
(define R4RS-rgxp (string->regexp "R4RS"))
(define R5RS-rgxp (string->regexp "R5RS"))
(define STklos-rgxp (string->regexp "STklos"))
(define linebrk-rgxp (string->regexp ""))
(define linebrk-rgxp (string->regexp "@l"))
(define (fontified-code code)
(blockquote
......@@ -90,8 +90,8 @@
(define (rewrite-for-skribe def)
;; rewrite |f| and |t|
(set! def (regexp-replace-all "\\|(f|t)\\|" def "|#\\1|"))
;; rewrite |%f| and |%t|
(set! def (regexp-replace-all "\\|%(f|t)\\|" def "|#\\1|"))
;; rewrite |xxx| in @code{xxx}
(set! def (regexp-replace-all var-rgxp def ",(code [\\1])"))
;; rewrite => in an arrow
......
;;;;
;;;; bonus.stk -- Useful primitives not in R5RS
;;;;
;;;; Copyright © 2000-2010 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;; Copyright © 2000-2011 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 14-Jun-2000 17:24 (eg)
;;;; Last file update: 9-Aug-2010 18:39 (eg)
;;;; Last file update: 27-May-2011 22:58 (eg)
;;;;
......@@ -31,7 +31,7 @@
* (gensym prefix)
*
* Creates a new symbol. The print name of the generated symbol
* consists of a prefix (which defaults to ,(q [|G|])) followed by the decimal
* consists of a prefix (which defaults to ,(q [G|])) followed by the decimal
* representation of a number. If |prefix| is specified, it must be
* either a string or a symbol.
* @lisp
......@@ -58,7 +58,7 @@ doc>
* (remove pred list)
*
* |Remove| returns |list| without the elements that satisfy predicate |pred|:
* £
* @l
* The list is not disordered -- elements that appear in the result list occur
* in the same order as they occur in the argument list. |Remove!| does the
* same job than |remove| by physically modifying its |list| argument
......@@ -80,10 +80,10 @@ doc>
* |equal?|, to find all elements of |list| that are equal to |x|, and
* deletes them from |list|. The dynamic order in which the various
* applications of |=| are made is not specified.
* £
* @l
* The list is not disordered -- elements that appear in the result
* list occur in the same order as they occur in the argument list.
* £
* @l
* The comparison procedure is used in this way: |(= x ei)|. That is,
* |x| is always the first argument, and a list element is always the
* second argument. The comparison procedure will be used to compare
......@@ -112,23 +112,23 @@ doc>
*
* |every| applies the predicate |pred| across the lists, returning true if
* the predicate returns true on every application.
* £
* @l
* If there are n list arguments |list1| ... |listn|, then |pred| must be
* a procedure taking n arguments and returning a boolean result.
* £
* @l
* |every| applies pred to the first elements of the |listi| parameters. If
* this application returns false, every immediately returns |¤f|.
* this application returns false, every immediately returns |%f|.
* Otherwise, it iterates, applying |pred| to the second elements of the |listi|
* parameters, then the third, and so forth. The iteration stops when a
* false value is produced or one of the lists runs out of values.
* In the latter case, |every| returns the true value produced by its final
* application of pred. The application of pred to the last element of the
* lists is a tail call.
* £
* If one of the |listi| has no elements, |every| simply returns |¤t|.
* £
* @l
* If one of the |listi| has no elements, |every| simply returns |%t|.
* @l
* Like |any|, every's name does not end with a question mark -- this is to
* indicate that it does not return a simple boolean (|¤t| or |¤f|), but a
* indicate that it does not return a simple boolean (|%t| or |%f|), but a
* general value.
doc>
|#
......@@ -154,20 +154,20 @@ doc>
*
* |any| applies the predicate across the lists, returning true if the
* predicate returns true on any application.
* £
* @l
* If there are n list arguments |list1| ... |listn|, then |pred| must be
* a procedure taking n arguments.
* £
* @l
* |any| applies |pred| to the first elements of the |listi| parameters. If
* this application returns a true value, |any| immediately returns that value.
* Otherwise, it iterates, applying |pred| to the second elements of the |listi|
* parameters, then the third, and so forth. The iteration stops when a true
* value is produced or one of the lists runs out of values; in the latter case,
* any returns |¤f|. The application of |pred| to the last element of the
* any returns |%f|. The application of |pred| to the last element of the
* lists is a tail call.
* £
* @l
* Like every, |any|'s name does not end with a question mark -- this is
* to indicate that it does not return a simple boolean (|¤t| or |¤f|), but
* to indicate that it does not return a simple boolean (|%t| or |%f|), but
* a general value.
*
* @lisp
......@@ -366,7 +366,7 @@ doc>
* computes a hash code for an object and returns the hash code as a non
* negative integer. Objets with the same hash code are stored in an A-list
* registered in the bucket corresponding to the key.
* £
* @l
* If omitted,
* ,(itemize
* (item [|hash| defaults to the |hash-table-hash| procedure (see
......@@ -421,7 +421,7 @@ doc>
* Returns an ``association list'' built from the entries in |hash|.
* Each entry in |hash| will be represented as a pair whose |car| is the
* entry's key and whose |cdr| is its value.
* £
* @l
* ,(bold "Note:") the order of pairs in the resulting list is unspecified.
* @lisp
* (let ((h (make-hash-table)))
......@@ -469,7 +469,7 @@ doc>
* table with the value |(update-fun current-value)|. If no value is
* associated to |key|, a new entry in the table is first inserted
* before updating it (this new entry being the result of calling |thunk|).
* £
* @l
* Note that the expression
* @lisp
* (hash-table-update!/default hash key update-fun default)
......@@ -525,7 +525,7 @@ doc>
* |func|. The value |final-value| returned by |hash-table-fold| is the
* return value of the last invocation of |func|. The order in which |func| is
* called for different associations is unspecified.
* £
* @l
* For instance, the following expression
* @lisp
* (hash-table-fold ht (lambda (k v acc) (+ acc 1)) 0)
......@@ -628,7 +628,7 @@ doc>
* Returns the setter associated to a |proc|. Setters are defined in the
* ,(link-srfi 17) document. A setter proc, can be used in a generalized
* assignment, as described in |set!|.
* £
* @l
* To associate |s| to the procedure |p|, use the following form:
* @lisp
* (set! (setter p) s)
......@@ -1320,7 +1320,7 @@ doc>
* The options must be composed of either an integer or one of the
* following symbols |read|, |write| or |execute|. Giving no option to |chmod|
* is equivalent to pass it the integer |0|. If the operation succeeds,
* |chmod| returns |¤t|; otherwise it returns |¤f|.
* |chmod| returns |%t|; otherwise it returns |%f|.
*
* @lisp
* (chmod "~/.stklos/stklosrc" 'read 'execute)
......@@ -1384,7 +1384,7 @@ doc>
* The environment in which the
* receive-expression is evaluated is extended by binding |<variable1>|, ...,
* |<variablen>| to fresh locations.
* £
* @l
* The |<expression>| is evaluated, and its
* values are stored into those locations. (It is an error if |<expression>|
* does not have exactly n values.)
......@@ -1434,7 +1434,7 @@ doc>
* Each |<clause>| should have the form |(<formals> <body>)|, where
* |<formals>| is a formal arguments list as for |lambda|.
* Each |<body>| is a |<tail-body>|, as defined in R5RS.
* £
* @l
* A |case-lambda| expression evaluates to a procedure that
* accepts a variable number of arguments and is lexically scoped in
* the same manner as procedures resulting from |lambda|
......@@ -1446,10 +1446,10 @@ doc>
* locations, the |<body>| is evaluated in the extended environment,
* and the results of |<body>| are returned as the results of the
* procedure call.
* £
* @l
* It is an error for the arguments not to agree with the |<formals>|
* of any |<clause>|.
* £
* @l
* This form is defined in ,(link-srfi 16).
*
* @lisp
......@@ -1597,7 +1597,7 @@ doc>
* (srfi <extension-argument> ...)
* @end lisp
* where |<extension-argument>|s may be any Scheme-values.
* £
* @l
* If an |<extension-argument>| is a nonnegative integer, the functionality
* of the indicated SRFIs is made available in the context in
* which the require-extension form appears. For instance,
......@@ -1661,7 +1661,7 @@ doc>
* (get-environment-variable name)
*
* Returns the value of the named environment variable as a string, or
* |¤f| if the named environment variable is not found. The name argument
* |%f| if the named environment variable is not found. The name argument
* is expected to be a string. This function is similar to the |getenv|. It
* has been added to be support ,(link-srfi 98).
|#
......
;;;;
;;;; c o m p i l e r . s t k -- STklos Compiler
;;;;
;;;; Copyright 2000-2010 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;; Copyright 2000-2011 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 26-Feb-2000 10:47 (eg)
;;;; Last file update: 23-Dec-2010 20:16 (eg)
;;;; Last file update: 23-Jun-2011 20:21 (eg)
;;;;
(define-module STKLOS-COMPILER
......@@ -404,7 +404,7 @@ doc>
* value of the first expression that evaluates to a false value is
* returned. Any remaining expressions are not evaluated. If all the
* expressions evaluate to true values, the value of the last expression
* is returned. If there are no expressions then |t| is returned.
* is returned. If there are no expressions then |%t| is returned.
*
* @lisp
* (and (= 2 2) (> 2 1)) => #t
......@@ -445,7 +445,7 @@ doc>
* value of the first expression that evaluates to a true value is
* returned. Any remaining expressions are not evaluated. If all
* expressions evaluate to false values, the value of the last expression
* is returned. If there are no expressions then |f| is returned.
* is returned. If there are no expressions then |%f| is returned.
*
* @lisp
* (or (= 2 2) (> 2 1)) => #t
......@@ -1015,7 +1015,7 @@ doc>
(memq fct '(fx+ fx*))) ; commutative only
(oper2 (if (eq? fct 'fx+)
'IN-SINT-FXADD2
'INT-SINT-FXMUL2)
'IN-SINT-FXMUL2)
b a))
((small-integer-constant? b)
(oper2 (case fct
......
;;;;
;;;; date.stk -- Date and Time Operations
;;;;
;;;; Copyright 2002-2006 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;; Copyright 2002-2011 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 3-Apr-2002 10:06 (eg)
;;;; Last file update: 3-Feb-2006 17:47 (eg)
;;;; Last file update: 27-May-2011 23:01 (eg)
;;;;
;;;; ======================================================================
......@@ -34,7 +34,7 @@
<doc EXT time?
* (time? obj)
*
* Return |t| if |obj| is a time object, othererwise returns |f|.
* Return |%t| if |obj| is a time object, othererwise returns |%f|.
doc>
|#
(define (time? obj)
......@@ -108,7 +108,7 @@ doc>
<doc EXT date?
* (date? obj)
*
* Return |t| if |obj| is a date, and otherwise returns |f|.
* Return |%t| if |obj| is a date, and otherwise returns |%f|.
doc>
|#
(define (date? obj)
......
;;;;
;;;; ffi.stk -- FFI support
;;;;
;;;; Copyright © 2007-2010 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
;;;; Copyright © 2007-2011 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@essi.fr]
;;;; Creation date: 14-Bun-2007 09:24 (eg)
;;;; Last file update: 21-Aug-2010 14:16 (eg)
;;;; Last file update: 27-May-2011 23:21 (eg)
;;;;
(define make-external-function #f)
......@@ -98,7 +98,7 @@
* element is the name of the parameter, and the second one is a type
* keyword. All the types defined in the above table, except
* |:void|, are allowed for the parameters of a foreign function.
* £
* @linebreak
* |Define-external| accepts several options:
* ,(itemize
* (item [
......
;;;;
;;;; getopt.stk -- getopt
;;;;
;;;; Copyright © 2001-2006 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;; Copyright © 2001-2011 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 26-Oct-2001 08:40 (eg)
;;;; Last file update: 5-Dec-2006 13:50 (eg)
;;;; Last file update: 27-May-2011 22:50 (eg)
;;;;
;;;;
......@@ -37,7 +37,7 @@
* This procedure is only bound inside a |parse-arguments| form.
* It pretty prints the help associated to the clauses of the
* |parse-arguments| form on the given port. If the argument
* |as-sexpr| is passed and is notf|, the help strings are
* |as-sexpr| is passed and is not| #f|, the help strings are
* printed on |port| as ,(emph "S-expr")s. This is useful if the help
* strings need to be manipulated by a program.
*
......
;;;;
;;;; load.stk -- Extended load function
;;;;
;;;; Copyright 2000-2010 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;; Copyright 2000-2011 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 17-May-2000 14:55 (eg)
;;;; Last file update: 16-Oct-2010 16:07 (eg)
;;;; Last file update: 27-May-2011 23:03 (eg)
;;;;
......@@ -88,10 +88,10 @@ doc>
* their apparition
* order) to the file name given to |load| or |try-load| until the file
* can be loaded.
*
* @l
* The initial value of the current load path can be set from the shell, by
* setting the |STKLOS_LOAD_PATH| shell variable.
*
* @l
* Giving a |value| to the parameter |load-path| permits to change the
* current list of paths.
doc>
......@@ -144,7 +144,7 @@ doc>
* |load-verbose| is a parameter object. It permits to display the
* path name of the files which are loaded by |load| or |try-load| on
* the current error port, when set to a true value. If |load-verbose|
* is set to |f|, no message is printed.
* is set to |%f|, no message is printed.
doc>
|#
(define load-verbose
......@@ -269,12 +269,12 @@ doc>
* that should be loaded by the procedure |load| given the name |str|.
* The string returned depends of the current load path and of the
* currently accepted suffixes.
*
* @l
* The other forms of |find-path| are more general and allow to give a path
* list (a list of strings representing supposed directories) and a set
* of suffixes (given as a list of strings too) to try for finding a file.
* If no file is found, |find-path| returns |f|.
*
* If no file is found, |find-path| returns |%f|.
* @l
* For instance, on a "classical" Unix box:
* @lisp
* (find-path "passwd" '("/bin" "/etc" "/tmp"))
......@@ -305,8 +305,8 @@ doc>
* previously ,(q (emph "provided")). |Provide| permits to store |string| in
* the list of already provided files. Providing a file permits to avoid
* subsequent loads of this file. |Require/provide| is more or less equivalent to
* a |require| followed by a |provide|. |Provided?| returns |t| if
* |string| was already provided; it returns |f| otherwise.
* a |require| followed by a |provide|. |Provided?| returns |%t| if
* |string| was already provided; it returns |%f| otherwise.
doc>
|#
(define %%require #f)
......
......@@ -31,7 +31,7 @@
;;; by Eugene Kohlbecker and in R4RS Appendix.
;;;
;;;
;;; Last file update: 30-Oct-2010 21:09 (eg)
;;; Last file update: 27-May-2011 23:04 (eg)
#|
STklos Implementation Notes
......@@ -114,11 +114,11 @@ doc>
* <syntax-rules>, beginning with the leftmost syntax-rule. When a match is
* found, the macro use is transcribed hygienically according to the
* template.
*
* @l
* Each pattern begins with the name for the macro. This name is not
* involved in the matching and is not considered a pattern variable or
* literal identifier.
*
* @l
* ,(bold "Note:") For a complete description of the Scheme pattern language,
* refer to R5RS.
doc>
......
;;;;
;;;; module.stk -- Module stuff
;;;;
;;;; Copyright 2000-2007 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;; Copyright 2000-2011 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 1-Jun-2000 12:26 (eg)
;;;; Last file update: 26-Apr-2007 17:47 (eg)
;;;; Last file update: 27-May-2011 23:05 (eg)
;;;;
......@@ -38,7 +38,7 @@
* Returns the value bound to |symbol| in |module|. If |symbol| is not bound,
* an error is signaled if no |default| is provided, otherwise |symbol-value|
* returns |default|.
*
* @l
* Note that this function searches the value of |symbol| in |module|
* ,(bold "and") all the modules it imports whereas |symbol-value| searches
* only in |module|.
......@@ -130,13 +130,13 @@ doc>
* Here, two modules are defined and they both bind the symbol |a| to a
* value. However, since |a| has been defined in two distinct modules
* they denote two different locations.
*
* @l
* The |STklos| module, which is predefined, is a special module which
* contains all the ,(emph "global variables") of a R5RS program. A symbol
* defined in the |STklos| module, if not hidden by a local definition, is
* always visible from inside a module. So, in the previous exemple, the
* |x| symbol refers the |x| symbol defined in the |STklos| module.
*
* @l
* The result of |define-module| is ,(emph "void").
doc>
|#
......@@ -188,7 +188,7 @@ doc>
* (<module1> <module2> ...)
* @end lisp
* which exports it.
*
* @l
* If several |import| clauses appear in a module, the set of
* imported modules is determined by appending the various list of modules
* in their apparition order.
......@@ -224,13 +224,13 @@ doc>
* @end lisp
* In this case, only the symbols |c| and |d| are imported from
* module |M2|.
*
* @l
* ,(bold "Note:") Importations are not ,(emph "transitive"): when
* the module ,(emph "C") imports the module ,(emph "B") which is an importer
* of module ,(emph "A") the symbols of ,(emph "A") are not visible
* from ,(emph "C"), except by explicitly importing the ,(emph "A")
* module from ,(emph "C").
*
* @l
* ,(bold "Note:") The module |STklos|, which contains the ,(emph "global
* variables") is always implicitly imported from a module. Furthermore,
* this module is always placed at the end of the list of imported modules.
......@@ -331,11 +331,11 @@ doc>
* the current module. By default, symbols defined in a module are not
* visible outside this module, excepted if they appear in an |export|
* clause.
*
* @l
* If several |export| clauses appear in a module, the set of
* exported symbols is determined by ``,(emph "unionizing")'' symbols exported
* in all the |export| clauses.
*
* @l
* The result of |export| is ,(emph "void").
doc>
|#
......@@ -377,12 +377,12 @@ doc>
* |mod|. If this symbol is not bound, an error is signaled if no |default| is
* provided, otherwise |in-module| returns |default|. Note that the value of |s|
* is searched in |mod| and all the modules it imports.
*
* @l
* This form is in fact a shortcut. In effect,
* @lisp
* (in-module my-module foo)
* @end lisp
*
* @l
* is equivalent to
* @lisp
* (symbol-value* 'foo (find-module 'my-module))
......
;;;;
;;;; pp.stk -- Pretty Printer
;;;;
;;;; Copyright 2002-2007 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;; Copyright 2002-2011 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
......@@ -23,7 +23,7 @@
;;;; Copyright (c) 1991, Marc Feeley
;;;;
;;;; Creation date: 10-May-2002 16:22 (eg)
;;;; Last file update: 30-Apr-2007 00:28 (eg)
;;;; Last file update: 27-May-2011 22:52 (eg)
;;;;
#|
......@@ -34,8 +34,8 @@
* This function tries to obtain a pretty-printed representation of |sexpr|.
* The pretty-printed form is written on |port| with lines which are no
* more long than |width| characters. If |port| is omitted if defaults to
* the current error port. As a special convention, if |port| is |t|,
* output goes to the current output port and if |port| is |f|, the output
* the current error port. As a special convention, if |port| is |%t|,
* output goes to the current output port and if |port| is |%f|, the output
* is returned as a string by |pretty-print|.
* Note that |pp| is another name for |pretty-print|.
*
......
;;;;
;;;; process.stk -- Process management for STklos
;;;;
;;;; Copyright © 2000-2010 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;; Copyright © 2000-2011 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can reistribute it and/or modify
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 12-Dec-2000 14:04 (eg)
;;;; Last file update: 7-Nov-2010 14:22 (eg)
;;;; Last file update: 27-May-2011 23:05 (eg)
;;;;
#|
......@@ -52,7 +52,7 @@
*
* (item [|:wait| must be followed by a boolean value. This value
* specifies if the process must be run asynchronously or not. By
* default, the process is run asynchronously (i.e. |:wait| is |¤f|).])
* default, the process is run asynchronously (i.e. |:wait| is |%f|).])
*
* (item [|:host| must be followed by a string. This string represents
* the name of the machine on which the command must be executed. This
......@@ -65,7 +65,7 @@
* the process. If the process is run without ,(emph "fork") the Scheme
* program is lost. This feature mimics the ``|exec|'' primitive of the
* Unix shells. By default, a fork is executed before running the process
* (i.e. |:fork| is |¤t|). This option works on Unix implementations only.])
* (i.e. |:fork| is |%t|). This option works on Unix implementations only.])
* )
*
* The following example launches a process which executes the
......
;;;;
;;;; r5rs.stk -- R5RS function written in Scheme
;;;;
;;;; Copyright © 2000-2009 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;; Copyright © 2000-2011 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 14-Jun-2000 12:27 (eg)
;;;; Last file update: 3-Oct-2009 21:50 (eg)
;;;; Last file update: 27-May-2011 23:08 (eg)
;;;;
......@@ -74,7 +74,7 @@
* ,(itemize
* (item [
* |variable|: if a value is passed when the procedure is called, it will be
* stored in the binding of the corresponding variable, otherwise the value |¤f|
* stored in the binding of the corresponding variable, otherwise the value |%f|
* will be stored in it.
* ])
* (item [
......@@ -85,11 +85,11 @@
* (item [
* |(variable value test?)|: if a value is passed when the procedure is called, it
* will be stored in the binding of the corresponding variable, otherwise |value|
* will be stored in it. Furthermore, |test?| will be given the value |¤t| if
* a value is passed for the given variable, otherwise |test?| is set to |¤f|
* will be stored in it. Furthermore, |test?| will be given the value |%t| if
* a value is passed for the given variable, otherwise |test?| is set to |%f|
* ])
* )
* £
* @l
*
* Hereafter are some examples using |:optional| parameters
* @lisp
......@@ -147,7 +147,7 @@ doc>
* (set! (<proc> <arg> ...) <expression>)
*
* The first form of |set!| is the R5RS one:
* £
* @l
* |<Expression>| is evaluated, and the resulting value is stored in
* the location to which |<variable>| is bound. |<Variable>| must be bound
* either in some region enclosing the |set!| expression or at top level.
......@@ -160,7 +160,7 @@ doc>
* @end lisp
*
* The second form of |set!| is defined in ,(link-srfi 17):
* £
* @l
* This special form |set!|
* is extended so the first operand can be a procedure application, and not
* just a variable. The procedure is typically one that extracts a component
......@@ -250,7 +250,7 @@ doc>
* accepts one argument; this procedure is then called on the value of
* the |<test>| and the value(s) returned by this procedure is(are)
* returned by the cond expression.
* £
* @l
* If all |<test>|s evaluate to false
* values, and there is no else clause, then the result of the
* conditional expression is ,(emph "void"); if there is an else clause,
......@@ -352,7 +352,7 @@ doc>
* where each |<init>| is an expression, and |<body>| should be a sequence of one or
* more expressions. It is an error for a |<variable>| to appear more than once in
* the list of variables being bound.
* £
* @l
* The |<init>|s are evaluated in the current environment (in some
* unspecified order), the |<variable>|s are bound to fresh locations holding the
* results, the |<body>| is evaluated in the extended environment, and the value(s)
......@@ -402,7 +402,7 @@ doc>
*
* In a |let*|, |<bindings>| should have the same form as in a |let| (however, a
* <variable> can appear more than once in the list of variables being bound).
* £
* @l
* |Let*| is similar to |let|, but the bindings are performed sequentially
* from left to right, and the region of a binding indicated by
* @lisp
......@@ -480,29 +480,29 @@ doc>
* bound, how they are to be initialized at the start, and how they are
* to be updated on each iteration. When a termination condition is met,
* the loop exits after evaluating the |<expr>|s.
* £
* @l
* |Do| expressions are evaluated as follows: The |<init>| expressions
* are evaluated (in some unspecified order), the |<var>|s are bound
* to fresh locations, the results of the |<init>| expressions are stored
* in the bindings of the |<var>|s, and then the iteration phase
* begins.
* £
* @l
* Each iteration begins by evaluating |<test>|; if the result is false
* then the |<command>| expressions are evaluated in order for effect,
* the |<step>| expressions are evaluated in some unspecified order, the
* |<var>|s are bound to fresh locations, the results of the |<step>|s
* are stored in the bindings of the |<var>|s, and the next iteration
* begins.
* £
* @l
* If |<test>| evaluates to a true value, then the |<expr>|s are
* evaluated from left to right and the value(s) of the last |<expr>|
* is(are) returned. If no |<expr>|s are present, then the value of
* the do expression is ,(emph "void").
* £
* @l
* The region of the binding of a |<var>| consists of the entire do
* expression except for the |<init>|s. It is an error for a |<var>| to
* appear more than once in the list of do variables.
* £
* @l
* A |<step>| may be omitted, in which case the effect is the same as if
* @lisp
* (<var> <init> <var>)
......@@ -711,17 +711,17 @@ doc>
* that later time and will instead use the continuation that was in effect
* when the escape procedure was created. Calling the escape procedure may cause
* the invocation of before and after thunks installed using |dynamic-wind|.
* £
* @l
* The escape procedure accepts the same number of arguments as
* the continuation to the original call to
* |call-with-current-continuation|. Except for continuations created
* by the |call-with-values| procedure, all continuations take exactly
* one value.
* £
* @l
* The escape procedure that is passed to proc has unlimited extent
* just like any other procedure in Scheme. It may be stored in variables
* or data structures and may be called as many times as desired.
* £
* @l
* The following examples show only the most common ways in which
* |call-with-current-continuation| is used. If all real uses were as simple
* as these examples, there would be no need for a procedure with the power
......@@ -756,7 +756,7 @@ doc>
* is for structured, non-local exits from loops or procedure bodies,
* but in fact |call-with-current-continuation| is extremely useful
* for implementing a wide variety of advanced control structures.
* £
* @l
* Whenever a Scheme expression is evaluated there is a continuation
* wanting the result of the expression. The continuation represents
* an entire (default) future for the computation. If the expression
......@@ -773,7 +773,7 @@ doc>
* |Call-with-current-continuation| allows Scheme
* programmers to do that by creating a procedure that acts just
* like the current continuation.
* £
* @l
* ,(bold "Note:") |call/cc| is just another name for
* |call-with-current-continuation|.
doc>
......@@ -785,7 +785,7 @@ doc>
* Current version of |dynamic-wind| mimics the R5RS one. In particular, it
* does not yet interact with |call-with-current-continuation| as required by
* R5RS.
* £
* @l
* Calls |thunk| without arguments, returning the result(s) of this call.
* |Before| and |after| are called, also without arguments, as required by
* the following rules (note that in the absence of calls to continuations
......@@ -810,7 +810,7 @@ doc>
* (item [It is also exited when execution is within the dynamic
* extent and a continuation is invoked that was captured while not within
* the dynamic extent.]))
* £
* @l
* If a second call to |dynamic-wind| occurs within the dynamic extent
* of the call to thunk and then a continuation is invoked in such a
* way that the afters from these two invocations of |dynamic-wind|
......@@ -931,7 +931,7 @@ doc>
* When the thunk returns, the port is closed and the previous default is
* restored. |With-input-from-file| and |with-output-to-file| return(s)
* the value(s) yielded by thunk.
* £
* @l
* The following example uses a pipe port opened for reading. It permits to
* read all the lines produced by an external ,(emph "ls") command (i.e. the
* output of the ,(emph "ls") command is ,(emph "redirected") to the Scheme pipe
......@@ -1081,7 +1081,7 @@ doc>
* be opened, an error is signaled. If |proc| returns, then the port is closed
* automatically and the value(s) yielded by the proc is(are) returned.
* If proc does not return, then the port will not be closed automatically.