Guile NEWS --- history of user-visible changes. -*- text -*-
-Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
See the end for copying conditions.
Please send Guile bug reports to bug-guile@gnu.org.
explicitly offered two independent decisions about the use of these
two packages.
+You can activate the readline support by issuing
+
+ (use-modules (readline-activator))
+ (activate-readline)
+
+from your ".guile" file, for example.
+
* Changes to the stand-alone interpreter
** All builtins now print as primitives.
* Changes to Scheme functions and syntax
+** Hooks
+
+A hook contains a list of functions which should be called on
+particular occasions in an existing program. Hooks are used for
+customization.
+
+A window manager might have a hook before-window-map-hook. The window
+manager uses the function run-hooks to call all functions stored in
+before-window-map-hook each time a window is mapped. The user can
+store functions in the hook using add-hook!.
+
+In Guile, hooks are first class objects.
+
+*** New function: make-hook [N_ARGS]
+
+Return a hook for hook functions which can take N_ARGS arguments.
+The default value for N_ARGS is 0.
+
+(See also scm_make_named_hook below.)
+
+*** New function: add-hook! HOOK PROC [APPEND_P]
+
+Put PROC at the beginning of the list of functions stored in HOOK.
+If APPEND_P is supplied, and non-false, put PROC at the end instead.
+
+PROC must be able to take the number of arguments specified when the
+hook was created.
+
+If PROC already exists in HOOK, then remove it first.
+
+*** New function: remove-hook! HOOK PROC
+
+Remove PROC from the list of functions in HOOK.
+
+*** New function: reset-hook! HOOK
+
+Clear the list of hook functions stored in HOOK.
+
+*** New function: run-hook HOOK ARG1 ...
+
+Run all hook functions stored in HOOK with arguments ARG1 ... .
+The number of arguments supplied must correspond to the number given
+when the hook was created.
+
+** The function `dynamic-link' now takes optional keyword arguments.
+ The only keyword argument that is currently defined is `:global
+ BOOL'. With it, you can control whether the shared library will be
+ linked in global mode or not. In global mode, the symbols from the
+ linked library can be used to resolve references from other
+ dynamically linked libraries. In non-global mode, the linked
+ library is essentially invisible and can only be accessed via
+ `dynamic-func', etc. The default is now to link in global mode.
+ Previously, the default has been non-global mode.
+
+ The `#:global' keyword is only effective on platforms that support
+ the dlopen family of functions.
+
** New function `provided?'
- Function: provided? FEATURE
Guile's and-let* macro was contributed by Michael Livshin.
-** New function: sorted? SEQUENCE LESS?
+** New sorting functions
+
+*** New function: sorted? SEQUENCE LESS?
Returns `#t' when the sequence argument is in non-decreasing order
according to LESS? (that is, there is no adjacent pair `... x y
...' for which `(less? y x)').
pair. It is an error if the sequence is neither a list nor a
vector.
-** New function: merge LIST1 LIST2 LESS?
+*** New function: merge LIST1 LIST2 LESS?
LIST1 and LIST2 are sorted lists.
Returns the sorted list of all elements in LIST1 and LIST2.
and that a < b1 in LIST1. Then a < b1 < b2 in the result.
(Here "<" should read "comes before".)
-** New procedure: merge! LIST1 LIST2 LESS?
+*** New procedure: merge! LIST1 LIST2 LESS?
Merges two lists, re-using the pairs of LIST1 and LIST2 to build
the result. If the code is compiled, and LESS? constructs no new
pairs, no pairs at all will be allocated. The first pair of the
result will be either the first pair of LIST1 or the first pair of
LIST2.
-** New function: sort SEQUENCE LESS?
+*** New function: sort SEQUENCE LESS?
Accepts either a list or a vector, and returns a new sequence
which is sorted. The new sequence is the same type as the input.
Always `(sorted? (sort sequence less?) less?)'. The original
sequence is not altered in any way. The new sequence shares its
elements with the old one; no elements are copied.
-** New procedure: sort! SEQUENCE LESS
+*** New procedure: sort! SEQUENCE LESS
Returns its sorted result in the original boxes. No new storage is
allocated at all. Proper usage: (set! slist (sort! slist <))
-** New function: stable-sort SEQUENCE LESS?
+*** New function: stable-sort SEQUENCE LESS?
Similar to `sort' but stable. That is, if "equal" elements are
ordered a < b in the original sequence, they will have the same order
in the result.
-** New function: stable-sort! SEQUENCE LESS?
+*** New function: stable-sort! SEQUENCE LESS?
Similar to `sort!' but stable.
Uses temporary storage when sorting vectors.
-** New functions: sort-list, sort-list!
+*** New functions: sort-list, sort-list!
Added for compatibility with scsh.
-** New function: random N [STATE]
+** New built-in random number support
+
+*** New function: random N [STATE]
Accepts a positive integer or real N and returns a number of the
same type between zero (inclusive) and N (exclusive). The values
returned have a uniform distribution.
state of the pseudo-random-number generator and is altered as a side
effect of the `random' operation.
-** New variable: *random-state*
+*** New variable: *random-state*
Holds a data structure that encodes the internal state of the
random-number generator that `random' uses by default. The nature
of this data structure is implementation-dependent. It may be
function correctly as a random-number state object in another
implementation.
-** New function: copy-random-state [STATE]
+*** New function: copy-random-state [STATE]
Returns a new object of type suitable for use as the value of the
variable `*random-state*' and as a second argument to `random'.
If argument STATE is given, a copy of it is returned. Otherwise a
copy of `*random-state*' is returned.
-** New function: seed->random-state SEED
+*** New function: seed->random-state SEED
Returns a new object of type suitable for use as the value of the
variable `*random-state*' and as a second argument to `random'.
SEED is a string or a number. A new state is generated and
initialized using SEED.
-** New function: random:uniform [STATE]
+*** New function: random:uniform [STATE]
Returns an uniformly distributed inexact real random number in the
range between 0 and 1.
-** New procedure: random:solid-sphere! VECT [STATE]
+*** New procedure: random:solid-sphere! VECT [STATE]
Fills VECT with inexact real random numbers the sum of whose
squares is less than 1.0. Thinking of VECT as coordinates in
space of dimension N = `(vector-length VECT)', the coordinates are
squares of the numbers is returned. VECT can be either a vector
or a uniform vector of doubles.
-** New procedure: random:hollow-sphere! VECT [STATE]
+*** New procedure: random:hollow-sphere! VECT [STATE]
Fills VECT with inexact real random numbers the sum of whose squares
is equal to 1.0. Thinking of VECT as coordinates in space of
dimension n = `(vector-length VECT)', the coordinates are uniformly
distributed over the surface of the unit n-shere. VECT can be either
a vector or a uniform vector of doubles.
-** New function: random:normal [STATE]
+*** New function: random:normal [STATE]
Returns an inexact real in a normal distribution with mean 0 and
standard deviation 1. For a normal distribution with mean M and
standard deviation D use `(+ M (* D (random:normal)))'.
-** New procedure: random:normal-vector! VECT [STATE]
+*** New procedure: random:normal-vector! VECT [STATE]
Fills VECT with inexact real random numbers which are independent and
standard normally distributed (i.e., with mean 0 and variance 1).
VECT can be either a vector or a uniform vector of doubles.
-** New function: random:exp STATE
+*** New function: random:exp STATE
Returns an inexact real in an exponential distribution with mean 1.
For an exponential distribution with mean U use (* U (random:exp)).
If unread-char is called multiple times, the unread characters will be
read again in last-in first-out order.
+** the procedures uniform-array-read! and uniform-array-write! now
+work on any kind of port, not just ports which are open on a file.
+
+** now 'l' in a port mode requests line buffering.
+
+** The procedure truncate-file now works on string ports as well
+as file ports. If the size argument is omitted, the current
+file position is used.
+
+** new procedure: lseek PORT/FDES OFFSET WHENCE
+The arguments are the same as for the old fseek procedure, but it
+works on string ports as well as random-access file ports.
+
+** the fseek procedure now works on string ports, since it has been
+redefined using lseek.
+
+** the setvbuf procedure now uses a default size if mode is _IOFBF and
+size is not supplied.
+
+** the newline procedure no longer flushes the port if it's not
+line-buffered: previously it did if it was the current output port.
+
+** open-pipe and close-pipe are no longer primitive procedures, but
+an emulation can be obtained using `(use-modules (ice-9 popen))'.
+
+** the freopen procedure has been removed.
+
+** new procedure: drain-input PORT
+Drains PORT's read buffers (including any pushed-back characters)
+and returns the contents as a single string.
+
** New function: map-in-order PROC LIST1 LIST2 ...
Version of `map' which guarantees that the procedure is applied to the
lists in serial order.
Read/write command line history from/to file. Returns #t on success
and #f if an error occured.
+** `ls' and `lls' in module (ice-9 ls) now handle no arguments.
+
+These procedures return a list of definitions available in the specified
+argument, a relative module reference. In the case of no argument,
+`(current-module)' is now consulted for definitions to return, instead
+of simply returning #f, the former behavior.
+
* Changes to the gh_ interface
** gh_scm2doubles
* Changes to the scm_ interface
+** Function: scm_make_named_hook (char* name, int n_args)
+
+Creates a hook in the same way as make-hook above but also
+binds a variable named NAME to it.
+
+This is the typical way of creating a hook from C code.
+
+Currently, the variable is created in the root module. This will
+change when we get the new module system.
+
+** The smob interface
+
+The interface for creating smobs has changed. For documentation, see
+data-rep.info (made from guile-core/doc/data-rep.texi).
+
+*** Deprecated function: SCM scm_newsmob (scm_smobfuns *)
+
+>>> This function will be removed in 1.3.4. <<<
+
+It is replaced by:
+
+*** Function: SCM scm_make_smob_type (const char *name, scm_sizet size)
+This function adds a new smob type, named NAME, with instance size
+SIZE to the system. The return value is a tag that is used in
+creating instances of the type. If SIZE is 0, then no memory will
+be allocated when instances of the smob are created, and nothing
+will be freed by the default free function.
+
+*** Function: void scm_set_smob_mark (long tc, SCM (*mark) (SCM))
+This function sets the smob marking procedure for the smob type
+specified by the tag TC. TC is the tag returned by
+`scm_make_smob_type'.
+
+*** Function: void scm_set_smob_free (long tc, SCM (*mark) (SCM))
+This function sets the smob freeing procedure for the smob type
+specified by the tag TC. TC is the tag returned by
+`scm_make_smob_type'.
+
+*** Function: void scm_set_smob_print (tc, print)
+
+ - Function: void scm_set_smob_print (long tc,
+ scm_sizet (*print) (SCM,
+ SCM,
+ scm_print_state *))
+
+This function sets the smob printing procedure for the smob type
+specified by the tag TC. TC is the tag returned by
+`scm_make_smob_type'.
+
+*** Function: void scm_set_smob_equalp (long tc, SCM (*equalp) (SCM, SCM))
+This function sets the smob equality-testing predicate for the
+smob type specified by the tag TC. TC is the tag returned by
+`scm_make_smob_type'.
+
+*** Macro: void SCM_NEWSMOB (SCM var, long tc, void *data)
+Make VALUE contain a smob instance of the type with type code TC and
+smob data DATA. VALUE must be previously declared as C type `SCM'.
+
+*** Macro: fn_returns SCM_RETURN_NEWSMOB (long tc, void *data)
+This macro expands to a block of code that creates a smob instance
+of the type with type code TC and smob data DATA, and returns that
+`SCM' value. It should be the last piece of code in a block.
+
+** The interfaces for using I/O ports and implementing port types
+(ptobs) have changed significantly. The new interface is based on
+shared access to buffers and a new set of ptob procedures.
+
+*** scm_newptob has been removed
+
+It is replaced by:
+
+*** Function: SCM scm_make_port_type (type_name, fill_buffer, write_flush)
+
+- Function: SCM scm_make_port_type (char *type_name,
+ int (*fill_buffer) (SCM port),
+ void (*write_flush) (SCM port));
+
+Similarly to the new smob interface, there is a set of function
+setters by which the user can customize the behaviour of his port
+type. See ports.h (scm_set_port_XXX).
+
+** scm_strport_to_string: New function: creates a new string from
+a string port's buffer.
+
** Plug in interface for random number generators
The variable `scm_the_rng' in random.c contains a value and three
function pointers which together define the current random number
*** Function: unsigned long scm_i_random (unsigned long M, scm_rstate *STATE)
Return a sample from the discrete uniform(0,M) distribution.
+
\f
Changes in Guile 1.3 (released Monday, October 19, 1998):