1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-19 02:00:26 +02:00

merge from guile master

Had to fix up .gitignore for some conflicts.
This commit is contained in:
Andy Wingo 2008-08-26 12:51:19 -07:00
commit fdc0a82263
205 changed files with 6262 additions and 2236 deletions

View file

@ -1,3 +1,7 @@
2008-04-26 Ludovic Courtès <ludo@gnu.org>
* Makefile.am (EXAMPLE_SMOB_FILES): Remove `COPYING'.
2008-01-22 Neil Jerram <neil@ossau.uklinux.net>
* COPYING: Removed.

View file

@ -1,6 +1,6 @@
## Process this file with Automake to create Makefile.in
##
## Copyright (C) 1998, 2002, 2006 Free Software Foundation, Inc.
## Copyright (C) 1998, 2002, 2006, 2008 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
@ -27,7 +27,7 @@ SUBDIRS = ref tutorial goops r5rs
# man_MANS = guile.1
EXAMPLE_SMOB_FILES = \
ChangeLog Makefile README COPYING image-type.c image-type.h myguile.c
ChangeLog Makefile README image-type.c image-type.h myguile.c
OLDFMT = oldfmt.c

View file

@ -1,3 +1,71 @@
2008-07-17 Neil Jerram <neil@ossau.uklinux.net>
* scheme-using.texi (Evaluating Scheme Code): Document use of
`C-u' prefix with evaluation commands.
2008-07-05 Ludovic Courtès <ludo@gnu.org>
* api-data.texi (Symbol Primitives): Add `scm_c_symbol_length ()'.
2008-06-30 Julian Graham <joolean@gmail.com>
* srfi-modules.texi (SRFI-18): New section.
(SRFI-19 Time): Mention SRFI-18's `current-time'.
2008-06-28 Ludovic Courtès <ludo@gnu.org>
* api-modules.texi (Using Guile Modules): Substitute "syntax
transformer" to "system transformer". Reported by Sebastian
Tennant <sebyte@smolny.plus.com>.
2008-06-01 Ludovic Courtès <ludo@gnu.org>
* srfi-modules.texi (SRFI-88): Fix URL.
2008-05-14 Julian Graham <joolean@gmail.com>
* api-scheduling.texi (Mutexes and Condition Variables): Add
documentation for new functions "scm_mutex_owner",
"scm_mutex_level", and "scm_mutex_locked_p". Update
documentation for function "scm_lock_mutex_timed" to reflect
addition of optional ownership argument.
2008-05-07 Ludovic Courtès <ludo@gnu.org>
* Makefile.am (autoconf-macros.texi): Avoid use of GNU Make
specific `$<' variable. This broke with BSD Make as found on
FreeBSD 6.2.
2008-05-05 Neil Jerram <neil@ossau.uklinux.net>
* scheme-using.texi (Using Guile in Emacs): Add concept index
entries `GDS' and `Emacs'.
* api-debug.texi (Debugging): Add concept index entry `Debugging'.
2008-05-04 Ludovic Courtès <ludo@gnu.org>
* guile.texi (Guile Modules): Include `autoconf.texi'.
* autoconf.texi (Autoconf Support): Mention `pkg-config'.
(Autoconf Macros): Document `pkg-config' support.
2008-04-26 Ludovic Courtès <ludo@gnu.org>
* srfi-modules.texi (SRFI-88): New section.
* api-data.texi (Keyword Read Syntax): Add reference to
`SRFI-88'.
2008-04-17 Neil Jerram <neil@ossau.uklinux.net>
* posix.texi (File System): New doc for file-exists?.
2008-04-15 Ludovic Courtès <ludo@gnu.org>
* api-data.texi (Keywords): Mention postfix syntax.
(Keyword Read Syntax): Document `postfix' read option.
* api-options.texi (Reader options): Update examples.
(Examples of option use): Likewise.
2008-03-28 Neil Jerram <neil@ossau.uklinux.net>
* libguile-concepts.texi (Multi-Threading): Fix typo.
@ -6,7 +74,7 @@
Applying patch from Julian Graham, containing minor fixes to his
thread enhancements:
* api-scheduling.texi (Mutexes and Condition Variables): Change
`flag' to `flags' in docstring.
@ -42,14 +110,14 @@
(Examples): Moved to api-debug.texi.
(Tracing, Old Tracing): Promoted one level.
(New Tracing, Tracing Compared): Removed.
2008-03-08 Julian Graham <joolean@gmail.com>
* api-scheduling.texi (Threads): Add documentation for new
* api-scheduling.texi (Threads): Add documentation for new
functions "scm_thread_p" and new "scm_join_thread_timed".
(Mutexes and Condition Variables): Add documentation for new
functions "scm_make_mutex_with_flags", "scm_mutex_p",
"scm_lock_mutex_timed", "scm_unlock_mutex_timed", and
(Mutexes and Condition Variables): Add documentation for new
functions "scm_make_mutex_with_flags", "scm_mutex_p",
"scm_lock_mutex_timed", "scm_unlock_mutex_timed", and
"scm_condition_variable_p".
2008-02-11 Neil Jerram <neil@ossau.uklinux.net>
@ -211,7 +279,7 @@
(lib-version.texi): New target.
* guile.texi: Include `lib-version.texi'.
* api-data.texi (Conversion): Link to `The ice-9 i18n Module' when
describing `string->number'.
(String Comparison): Likewise.
@ -399,7 +467,7 @@
* api-debug.texi (Debug on Error): Note need to handling of errors
in C.
* api-debug.texi (Debugging): New intro text. New subsection
"Evaluation Model". Moved existing subsections "Capturing the
Stack or Innermost Stack Frame", "Examining the Stack", "Examining
@ -435,7 +503,7 @@
* api-evaluation.texi (Fly Evaluation): Add scm_c_eval_string.
(Loading): Add scm_c_primitive_load.
Reported by Jon Wilson.
2006-06-25 Kevin Ryde <user42@zip.com.au>
* posix.texi (Time): In tm:gmtoff, give example values, note not the
@ -569,7 +637,7 @@
* api-data.texi (Operations Related to Symbols):
Documented `scm_take_locale_symbol ()'.
2005-12-15 Kevin Ryde <user42@zip.com.au>
* api-evaluation.texi (Fly Evaluation): Add scm_call_4, suggested by
@ -660,7 +728,7 @@
* misc-modules.texi (Formatted Output): Show modifiers like ~:d
instead of in words.
2005-08-06 Kevin Ryde <user42@zip.com.au>
* api-compound.texi (List Modification): In filter, return may share a
@ -1007,7 +1075,7 @@
* api-i18n.texi: New file.
* Makefile.am (guile_TEXINFOS): Added it.
* guile.texi: Include it.
2004-09-16 Kevin Ryde <user42@zip.com.au>
* api-utility.texi (Equality): Revise for clarity.
@ -1062,16 +1130,16 @@
Ran a (docstring-process-module "(guile)") and moved entries from
new-docstrings.texi to their appropriate place.
* api-undocumented.texi: New file.
2004-08-21 Marius Vollmer <mvo@zagadka.de>
From Richard Todd, Thanks!
* scheme-scripts.texi (Invoking Guile): documented new '-L'
switch.
2004-08-20 Marius Vollmer <mvo@zagadka.de>
* gh.texi: Updated transition section with new recommended things.
@ -1082,7 +1150,7 @@
mutation-sharing substrings.
(Symbols): Document scm_from_locale_symbol and
scm_from_locale_symboln.
2004-08-18 Kevin Ryde <user42@zip.com.au>
* posix.texi (Network Sockets and Communication): Add SOCK_RDM and
@ -1144,7 +1212,7 @@
scm_is_complex, scm_is_number, scm_c_make_rectangular,
scm_c_make_polar, scm_c_real_part, scm_c_imag_part,
scm_c_magnitude, and scm_c_angle.
2004-08-02 Marius Vollmer <marius.vollmer@uni-dortmund.de>
* gh.texi: Replaced references to scm_num2* with scm_to_* and
@ -1180,7 +1248,7 @@
* api-deprecated.texi: Removed.
* intro.texi (Discouraged and Deprecated): General information
about deprecation, etc.
2004-07-30 Marius Vollmer <marius.vollmer@uni-dortmund.de>
* misc-modules.texi (Formatted Output): Changed @w to @w{} in
@ -1265,7 +1333,7 @@
* Makefile.am (CLEANFILES): Remove guile.cps guile.fns guile.rns
guile.tps guile.vrs guile.tmp, cleaned by automake these days.
2004-05-06 Marius Vollmer <marius.vollmer@uni-dortmund.de>
* scheme-smobs.texi: Updated for new SCM_SMOB_* macros.
@ -1348,7 +1416,7 @@
* scheme-control.texi (while do): Expand and clarify `do', in
particular note iteration binds fresh locations, rather than values
"stored".
* srfi-modules.texi (SRFI-4): Revise for clarity, give each function
explicitly rather than showing TAG so Emacs info-look can find them,
merge "SRFI-4 - Read Syntax" and "SRFI-4 - Procedures" into just one
@ -1378,7 +1446,7 @@
2004-01-21 Marius Vollmer <mvo@zagadka.de>
Added copyright notices to all TeXinfo files.
* fdl.texi: New.
* guile.texi: Include it as an appendix.
* preface.texi: State that the manual is FDL.
@ -1400,7 +1468,7 @@
* misc-modules.texi (Queues): New chapter.
* guile.texi (Top): Add it.
2004-01-09 Kevin Ryde <user42@zip.com.au>
* scheme-compound.texi (Bit Vectors): Revise for clarity, following
@ -1455,7 +1523,7 @@
* scheme-data.texi: Include exact rationals.
From Stephen Compall. Thanks!
* intro.texi (What is Guile?): Add @acronym for POSIX, R5RS, GUI,
and HTTP. Conclude linking libguile. Say what one can find *for*.
@ -1536,7 +1604,7 @@
* data-rep.texi, scheme-memory.texi (scm_remember_upto_here_1,
scm_remember_upto_here_2): Moved from data-rep.texi to
scheme-memory.texi.
2003-10-02 Kevin Ryde <user42@zip.com.au>
* scheme-io.texi (String Ports): In call-with-output-string, note proc
@ -1867,7 +1935,7 @@
remainder and modulo round their results.
* scheme-io.texi (Reading): In read-char and peek-char, fix typos "?"
in @rnindex. In port-column, use @: after i.e.
in @rnindex. In port-column, use @: after i.e.
(Writing): In get-print-state, two spaces after full stop. Add write,
revise display.
@ -1886,7 +1954,7 @@
2003-04-30 Marius Vollmer <marius.vollmer@uni-dortmund.de>
* posix.texi (scm_c_port_for_each): Added.
* posix.texi (scm_c_port_for_each): Added.
2003-04-26 Neil Jerram <neil@ossau.uklinux.net>
@ -2017,7 +2085,7 @@
Configuration.
The following doc updates are from Ian Sheldon - thanks!
* scheme-data.texi (Appending Strings, Regexp Functions, Match
Structures): Add examples.
(Regular Expressions): Add instruction to use (ice-9 regex)
@ -2055,7 +2123,7 @@
* intro.texi: Updated GNu ftp server name. Use "-lguile" instead
of "libguile.a". Some small fixes/improvements.
* scheme-reading.texi: Added www.schemers.org. Removed foldoc,
it's too generic. Updated 'teach yourself ...' URL.
@ -2066,7 +2134,7 @@
2002-08-14 Marius Vollmer <mvo@zagadka.ping.de>
* scheme-evaluation.texi (eval-string): Updated.
* scheme-evaluation.texi (eval-string): Updated.
* scheme-scheduling.texi (Fluids): Touched up a bit, added
with-fluids.
@ -2106,7 +2174,7 @@
* scheme-memory.texi (Memory Blocks): add scm_calloc, scm_gc_calloc.
correct typos.
2002-08-05 Marius Vollmer <marius.vollmer@uni-dortmund.de>
* intro.texi, srfi-modules.texi: Added (use-modules (ice-9
@ -2150,7 +2218,7 @@
rather than deprecated section. Hence this change. Added
`@deftp' for scm_t_bits data type so that a proper index entry is
added for this. Thanks to Richard Y. Kim!
* data-rep.texi (Subrs): Changed scm_make_gsubr to
scm_c_define_gsubr. Thanks to Richard Y. Kim!
@ -2187,13 +2255,13 @@
* scheme-debug.texi (Debugging): Rename chapter `Debugging
Infrastructure' and reorganize its contents.
* scheme-debug.texi (Debugging), scheme-control.texi (Handling
Errors): Move display-error to error-focussed section.
* scheme-debug.texi (Debugging), debugging.texi (Backtrace): Move
backtrace to user-level debugging chapter.
* scheme-debug.texi (Debugging), scheme-procedures.texi (Procedure
Properties): Move procedure-name, procedure-source and
procedure-environment to procedures chapter.
@ -2276,7 +2344,7 @@
* scheme-utility.texi (Hooks): Further updates. New material on
GC hooks.
* scheme-evaluation.texi (Fly Evaluation): Note disappearance of
eval2 and read-and-eval!.

View file

@ -1,6 +1,6 @@
## Process this file with Automake to create Makefile.in
##
## Copyright (C) 1998, 2004, 2006 Free Software Foundation, Inc.
## Copyright (C) 1998, 2004, 2006, 2008 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
@ -86,7 +86,8 @@ include $(top_srcdir)/am/pre-inst-guile
autoconf.texi: autoconf-macros.texi
autoconf-macros.texi: $(top_srcdir)/guile-config/guile.m4
$(preinstguiletool)/snarf-guile-m4-docs $< > $(srcdir)/$@
$(preinstguiletool)/snarf-guile-m4-docs $(top_srcdir)/guile-config/guile.m4 \
> $(srcdir)/$@
lib-version.texi: $(top_srcdir)/GUILE-VERSION
cat "$^" | grep '^LIBGUILE_.*_MAJOR' | \

View file

@ -4647,6 +4647,11 @@ immediately after creating the Scheme string. In certain cases, Guile
can then use @var{str} directly as its internal representation.
@end deftypefn
The size of a symbol can also be obtained from C:
@deftypefn {C Function} size_t scm_c_symbol_length (SCM sym)
Return the number of characters in @var{sym}.
@end deftypefn
Finally, some applications, especially those that generate new Scheme
code dynamically, need to generate symbols for use in the generated
@ -4901,7 +4906,7 @@ makes them easy to type.
Guile's keyword support conforms to R5RS, and adds a (switchable) read
syntax extension to permit keywords to begin with @code{:} as well as
@code{#:}.
@code{#:}, or to end with @code{:}.
@menu
* Why Use Keywords?:: Motivation for keyword usage.
@ -5046,9 +5051,16 @@ If the @code{keyword} read option is set to @code{'prefix}, Guile also
recognizes the alternative read syntax @code{:NAME}. Otherwise, tokens
of the form @code{:NAME} are read as symbols, as required by R5RS.
@cindex SRFI-88 keyword syntax
If the @code{keyword} read option is set to @code{'postfix}, Guile
recognizes the SRFI-88 read syntax @code{NAME:} (@pxref{SRFI-88}).
Otherwise, tokens of this form are read as symbols.
To enable and disable the alternative non-R5RS keyword syntax, you use
the @code{read-set!} procedure documented in @ref{User level options
interfaces} and @ref{Reader options}.
interfaces} and @ref{Reader options}. Note that the @code{prefix} and
@code{postfix} syntax are mutually exclusive.
@smalllisp
(read-set! keywords 'prefix)
@ -5061,6 +5073,16 @@ interfaces} and @ref{Reader options}.
@result{}
#:type
(read-set! keywords 'postfix)
type:
@result{}
#:type
:type
@result{}
:type
(read-set! keywords #f)
#:type

View file

@ -8,6 +8,7 @@
@node Debugging
@section Debugging Infrastructure
@cindex Debugging
In order to understand Guile's debugging facilities, you first need to
understand a little about how the evaluator works and what the Scheme
stack is. With that in place we explain the low level trap calls that

View file

@ -1,6 +1,6 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 2008
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -329,12 +329,12 @@ Signal error if module name is not resolvable.
@c FIXME::martin: Is this correct, and is there more to say?
@c FIXME::martin: Define term and concept `system transformer' somewhere.
@c FIXME::martin: Define term and concept `syntax transformer' somewhere.
@deffn syntax use-syntax module-name
Load the module @code{module-name} and use its system
transformer as the system transformer for the currently defined module,
as well as installing it as the current system transformer.
Load the module @code{module-name} and use its syntax
transformer as the syntax transformer for the currently defined module,
as well as installing it as the current syntax transformer.
@end deffn
@deffn syntax @@ module-name binding-name

View file

@ -1,6 +1,6 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -491,7 +491,7 @@ Here is the list of reader options generated by typing
values.
@smalllisp
keywords #f Style of keyword recognition: #f or 'prefix
keywords #f Style of keyword recognition: #f, 'prefix or 'postfix
case-insensitive no Convert symbols to lower case.
positions yes Record positions of source code expressions.
copy no Copy source code expressions.
@ -729,7 +729,7 @@ ABORT: (misc-error)
Type "(backtrace)" to get more information.
guile> (read-options 'help)
keywords #f Style of keyword recognition: #f or 'prefix
keywords #f Style of keyword recognition: #f, 'prefix or 'postfix
case-insensitive no Convert symbols to lower case.
positions yes Record positions of source code expressions.
copy no Copy source code expressions.

View file

@ -90,8 +90,8 @@ execution and triggering this execution. They will not be executed
automatically.
@menu
* System asyncs::
* User asyncs::
* System asyncs::
* User asyncs::
@end menu
@node System asyncs
@ -279,11 +279,11 @@ Return @code{#t} iff @var{obj} is a thread; otherwise, return
@deffnx {C Function} scm_join_thread_timed (thread, timeout, timeoutval)
Wait for @var{thread} to terminate and return its exit value. Threads
that have not been created with @code{call-with-new-thread} or
@code{scm_spawn_thread} have an exit value of @code{#f}. When
@code{scm_spawn_thread} have an exit value of @code{#f}. When
@var{timeout} is given, it specifies a point in time where the waiting
should be aborted. It can be either an integer as returned by
@code{current-time} or a pair as returned by @code{gettimeofday}.
When the waiting is aborted, @var{timeoutval} is returned (if it is
should be aborted. It can be either an integer as returned by
@code{current-time} or a pair as returned by @code{gettimeofday}.
When the waiting is aborted, @var{timeoutval} is returned (if it is
specified; @code{#f} is returned otherwise).
@end deffn
@ -378,9 +378,9 @@ in all threads is one way to avoid such problems.
@deffn {Scheme Procedure} make-mutex . flags
@deffnx {C Function} scm_make_mutex ()
@deffnx {C Function} scm_make_mutex_with_flags (SCM flags)
Return a new mutex. It is initially unlocked. If @var{flags} is
Return a new mutex. It is initially unlocked. If @var{flags} is
specified, it must be a list of symbols specifying configuration flags
for the newly-created mutex. The supported flags are:
for the newly-created mutex. The supported flags are:
@table @code
@item unchecked-unlock
Unless this flag is present, a call to `unlock-mutex' on the returned
@ -398,7 +398,7 @@ The returned mutex will be recursive.
@deffn {Scheme Procedure} mutex? obj
@deffnx {C Function} scm_mutex_p (obj)
Return @code{#t} iff @var{obj} is a mutex; otherwise, return
Return @code{#t} iff @var{obj} is a mutex; otherwise, return
@code{#f}.
@end deffn
@ -409,16 +409,20 @@ function is equivalent to calling `make-mutex' and specifying the
@code{recursive} flag.
@end deffn
@deffn {Scheme Procedure} lock-mutex mutex [timeout]
@deffn {Scheme Procedure} lock-mutex mutex [timeout [owner]]
@deffnx {C Function} scm_lock_mutex (mutex)
@deffnx {C Function} scm_lock_mutex_timed (mutex, timeout)
Lock @var{mutex}. If the mutex is already locked by another thread
then block and return only when @var{mutex} has been acquired.
@deffnx {C Function} scm_lock_mutex_timed (mutex, timeout, owner)
Lock @var{mutex}. If the mutex is already locked, then block and
return only when @var{mutex} has been acquired.
When @var{timeout} is given, it specifies a point in time where the
waiting should be aborted. It can be either an integer as returned
by @code{current-time} or a pair as returned by @code{gettimeofday}.
When the waiting is aborted, @code{#f} is returned.
When @var{timeout} is given, it specifies a point in time where the
waiting should be aborted. It can be either an integer as returned
by @code{current-time} or a pair as returned by @code{gettimeofday}.
When the waiting is aborted, @code{#f} is returned.
When @var{owner} is given, it specifies an owner for @var{mutex} other
than the calling thread. @var{owner} may also be @code{#f},
indicating that the mutex should be locked but left unowned.
For standard mutexes (@code{make-mutex}), and error is signalled if
the thread has itself already locked @var{mutex}.
@ -429,7 +433,7 @@ call increments the lock count. An additional @code{unlock-mutex}
will be required to finally release.
If @var{mutex} was locked by a thread that exited before unlocking it,
the next attempt to lock @var{mutex} will succeed, but
the next attempt to lock @var{mutex} will succeed, but
@code{abandoned-mutex-error} will be signalled.
When a system async (@pxref{System asyncs}) is activated for a thread
@ -441,7 +445,7 @@ executed. When the async returns, the wait resumes.
Arrange for @var{mutex} to be locked whenever the current dynwind
context is entered and to be unlocked when it is exited.
@end deftypefn
@deffn {Scheme Procedure} try-mutex mx
@deffnx {C Function} scm_try_mutex (mx)
Try to lock @var{mutex} as per @code{lock-mutex}. If @var{mutex} can
@ -454,23 +458,44 @@ the return is @code{#f}.
@deffnx {C Function} scm_unlock_mutex (mutex)
@deffnx {C Function} scm_unlock_mutex_timed (mutex, condvar, timeout)
Unlock @var{mutex}. An error is signalled if @var{mutex} is not locked
and was not created with the @code{unchecked-unlock} flag set, or if
and was not created with the @code{unchecked-unlock} flag set, or if
@var{mutex} is locked by a thread other than the calling thread and was
not created with the @code{allow-external-unlock} flag set.
If @var{condvar} is given, it specifies a condition variable upon
which the calling thread will wait to be signalled before returning.
(This behavior is very similar to that of
(This behavior is very similar to that of
@code{wait-condition-variable}, except that the mutex is left in an
unlocked state when the function returns.)
When @var{timeout} is also given, it specifies a point in time where
the waiting should be aborted. It can be either an integer as
returned by @code{current-time} or a pair as returned by
@code{gettimeofday}. When the waiting is aborted, @code{#f} is
When @var{timeout} is also given, it specifies a point in time where
the waiting should be aborted. It can be either an integer as
returned by @code{current-time} or a pair as returned by
@code{gettimeofday}. When the waiting is aborted, @code{#f} is
returned. Otherwise the function returns @code{#t}.
@end deffn
@deffn {Scheme Procedure} mutex-owner mutex
@deffnx {C Function} scm_mutex_owner (mutex)
Return the current owner of @var{mutex}, in the form of a thread or
@code{#f} (indicating no owner). Note that a mutex may be unowned but
still locked.
@end deffn
@deffn {Scheme Procedure} mutex-level mutex
@deffnx {C Function} scm_mutex_level (mutex)
Return the current lock level of @var{mutex}. If @var{mutex} is
currently unlocked, this value will be 0; otherwise, it will be the
number of times @var{mutex} has been recursively locked by its current
owner.
@end deffn
@deffn {Scheme Procedure} mutex-locked? mutex
@deffnx {C Function} scm_mutex_locked_p (mutex)
Return @code{#t} if @var{mutex} is locked, regardless of ownership;
otherwise, return @code{#f}.
@end deffn
@deffn {Scheme Procedure} make-condition-variable
@deffnx {C Function} scm_make_condition_variable ()
Return a new condition variable.
@ -478,7 +503,7 @@ Return a new condition variable.
@deffn {Scheme Procedure} condition-variable? obj
@deffnx {C Function} scm_condition_variable_p (obj)
Return @code{#t} iff @var{obj} is a condition variable; otherwise,
Return @code{#t} iff @var{obj} is a condition variable; otherwise,
return @code{#f}.
@end deffn

View file

@ -8,10 +8,10 @@
@node Autoconf Support
@chapter Autoconf Support
When Guile is installed, a set of autoconf macros is also installed as
PREFIX/share/aclocal/guile.m4. This chapter documents the macros provided in
that file, as well as the high-level guile-tool Autofrisk. @xref{Top,The GNU
Autoconf Manual,,autoconf}, for more info.
When Guile is installed, a pkg-config description file and a set of
Autoconf macros is installed. This chapter documents pkg-config and
Autoconf support, as well as the high-level guile-tool Autofrisk.
@xref{Top,The GNU Autoconf Manual,,autoconf}, for more info.
@menu
* Autoconf Background:: Why use autoconf?
@ -45,7 +45,38 @@ checks.
@node Autoconf Macros
@section Autoconf Macros
The macro names all begin with "GUILE_".
@cindex pkg-config
@cindex autoconf
GNU Guile provides a @dfn{pkg-config} description file, installed as
@file{@var{prefix}/lib/pkgconfig/guile-1.8.pc}, which contains all the
information necessary to compile and link C applications that use Guile.
The @code{pkg-config} program is able to read this file and provide this
information to application programmers; it can be obtained at
@url{http://pkg-config.freedesktop.org/}.
The following command lines give respectively the C compilation and link
flags needed to build Guile-using programs:
@example
pkg-config guile-1.8 --cflags
pkg-config guile-1.8 --libs
@end example
To ease use of pkg-config with Autoconf, pkg-config comes with a
convenient Autoconf macro. The following example looks for Guile and
sets the @code{GUILE_CFLAGS} and @code{GUILE_LIBS} variables
accordingly, or prints an error and exits if Guile was not found:
@findex PKG_CHECK_MODULES
@example
PKG_CHECK_MODULES([GUILE], [guile-1.8])
@end example
Guile comes with additional Autoconf macros providing more information,
installed as @file{@var{prefix}/share/aclocal/guile.m4}. Their names
all begin with @code{GUILE_}.
@c see Makefile.am
@include autoconf-macros.texi

View file

@ -177,6 +177,8 @@ x
* Guile Modules::
* Autoconf Support::
Appendices
* Data Representation:: All the details.
@ -362,6 +364,8 @@ available through both Scheme and C interfaces.
@include scsh.texi
@include scheme-debugging.texi
@include autoconf.texi
@include data-rep.texi
@include fdl.texi

View file

@ -956,6 +956,11 @@ If @var{suffix} is provided, and is equal to the end of
@end lisp
@end deffn
@deffn {Scheme Procedure} file-exists? filename
Return @code{#t} if the file named @var{filename} exists, @code{#f} if
not.
@end deffn
@node User Information
@subsection User Information

View file

@ -359,6 +359,8 @@ debugger to continue.)
@node Using Guile in Emacs
@section Using Guile in Emacs
@cindex GDS
@cindex Emacs
There are several options for working on Guile Scheme code in Emacs.
The simplest are to use Emacs's standard @code{scheme-mode} for
editing code, and to run the interpreter when you need it by typing
@ -986,6 +988,14 @@ region contains a balanced expression, or try to expand the region so
that it does; it uses the region exactly as it is.
@end table
If you type @kbd{C-u} before one of these commands, GDS will
immediately pop up a Scheme stack buffer, showing the requested
evaluation, so that you can single step through it. (This is achieved
by setting a @code{<source-trap>} trap at the start of the requested
evaluation; see @ref{Source Traps} for more on how those work.) The
Scheme stack display, and the options for continuing through the code,
are described in the next two sections.
@node Displaying the Scheme Stack
@subsection Displaying the Scheme Stack

View file

@ -1,6 +1,6 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2007
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -34,6 +34,7 @@ get the relevant SRFI documents from the SRFI home page
* SRFI-14:: Character-set library.
* SRFI-16:: case-lambda
* SRFI-17:: Generalized set!
* SRFI-18:: Multithreading support
* SRFI-19:: Time/Date library.
* SRFI-26:: Specializing parameters
* SRFI-31:: A special form `rec' for recursive evaluation
@ -45,6 +46,7 @@ get the relevant SRFI documents from the SRFI home page
* SRFI-60:: Integers as bits.
* SRFI-61:: A more general `cond' clause
* SRFI-69:: Basic hash tables.
* SRFI-88:: Keyword objects.
@end menu
@ -1677,6 +1679,344 @@ The same as the Guile core @code{make-procedure-with-setter}
@end defun
@node SRFI-18
@subsection SRFI-18 - Multithreading support
@cindex SRFI-18
This is an implementation of the SRFI-18 threading and synchronization
library. The functions and variables described here are provided by
@example
(use-modules (srfi srfi-18))
@end example
As a general rule, the data types and functions in this SRFI-18
implementation are compatible with the types and functions in Guile's
core threading code. For example, mutexes created with the SRFI-18
@code{make-mutex} function can be passed to the built-in Guile
function @code{lock-mutex} (@pxref{Mutexes and Condition Variables}),
and mutexes created with the built-in Guile function @code{make-mutex}
can be passed to the SRFI-18 function @code{mutex-lock!}. Cases in
which this does not hold true are noted in the following sections.
@menu
* SRFI-18 Threads:: Executing code
* SRFI-18 Mutexes:: Mutual exclusion devices
* SRFI-18 Condition variables:: Synchronizing of groups of threads
* SRFI-18 Time:: Representation of times and durations
* SRFI-18 Exceptions:: Signalling and handling errors
@end menu
@node SRFI-18 Threads
@subsubsection SRFI-18 Threads
Threads created by SRFI-18 differ in two ways from threads created by
Guile's built-in thread functions. First, a thread created by SRFI-18
@code{make-thread} begins in a blocked state and will not start
execution until @code{thread-start!} is called on it. Second, SRFI-18
threads are constructed with a top-level exception handler that
captures any exceptions that are thrown on thread exit. In all other
regards, SRFI-18 threads are identical to normal Guile threads.
@defun current-thread
Returns the thread that called this function. This is the same
procedure as the same-named built-in procedure @code{current-thread}
(@pxref{Threads}).
@end defun
@defun thread? obj
Returns @code{#t} if @var{obj} is a thread, @code{#f} otherwise. This
is the same procedure as the same-named built-in procedure
@code{thread?} (@pxref{Threads}).
@end defun
@defun make-thread thunk [name]
Call @code{thunk} in a new thread and with a new dynamic state,
returning the new thread and optionally assigning it the object name
@var{name}, which may be any Scheme object.
Note that the name @code{make-thread} conflicts with the
@code{(ice-9 threads)} function @code{make-thread}. Applications
wanting to use both of these functions will need to refer to them by
different names.
@end defun
@defun thread-name thread
Returns the name assigned to @var{thread} at the time of its creation,
or @code{#f} if it was not given a name.
@end defun
@defun thread-specific thread
@defunx thread-specific-set! thread obj
Get or set the ``object-specific'' property of @var{thread}. In
Guile's implementation of SRFI-18, this value is stored as an object
property, and will be @code{#f} if not set.
@end defun
@defun thread-start! thread
Unblocks @var{thread} and allows it to begin execution if it has not
done so already.
@end defun
@defun thread-yield!
If one or more threads are waiting to execute, calling
@code{thread-yield!} forces an immediate context switch to one of them.
Otherwise, @code{thread-yield!} has no effect. @code{thread-yield!}
behaves identically to the Guile built-in function @code{yield}.
@end defun
@defun thread-sleep! timeout
The current thread waits until the point specified by the time object
@var{timeout} is reached (@pxref{SRFI-18 Time}). This blocks the
thread only if @var{timeout} represents a point in the future. it is
an error for @var{timeout} to be @code{#f}.
@end defun
@defun thread-terminate! thread
Causes an abnormal termination of @var{thread}. If @var{thread} is
not already terminated, all mutexes owned by @var{thread} become
unlocked/abandoned. If @var{thread} is the current thread,
@code{thread-terminate!} does not return. Otherwise
@code{thread-terminate!} returns an unspecified value; the termination
of @var{thread} will occur before @code{thread-terminate!} returns.
Subsequent attempts to join on @var{thread} will cause a ``terminated
thread exception'' to be raised.
@code{thread-terminate!} is compatible with the thread cancellation
procedures in the core threads API (@pxref{Threads}) in that if a
cleanup handler has been installed for the target thread, it will be
called before the thread exits and its return value (or exception, if
any) will be stored for later retrieval via a call to
@code{thread-join!}.
@end defun
@defun thread-join! thread [timeout [timeout-val]]
Wait for @var{thread} to terminate and return its exit value. When a
time value @var{timeout} is given, it specifies a point in time where
the waiting should be aborted. When the waiting is aborted,
@var{timeoutval} is returned if it is specified; otherwise, a
@code{join-timeout-exception} exception is raised
(@pxref{SRFI-18 Exceptions}). Exceptions may also be raised if the
thread was terminated by a call to @code{thread-terminate!}
(@code{terminated-thread-exception} will be raised) or if the thread
exited by raising an exception that was handled by the top-level
exception handler (@code{uncaught-exception} will be raised; the
original exception can be retrieved using
@code{uncaught-exception-reason}).
@end defun
@node SRFI-18 Mutexes
@subsubsection SRFI-18 Mutexes
The behavior of Guile's built-in mutexes is parameterized via a set of
flags passed to the @code{make-mutex} procedure in the core
(@pxref{Mutexes and Condition Variables}). To satisfy the requirements
for mutexes specified by SRFI-18, the @code{make-mutex} procedure
described below sets the following flags:
@itemize @bullet
@item
@code{recursive}: the mutex can be locked recursively
@item
@code{unchecked-unlock}: attempts to unlock a mutex that is already
unlocked will not raise an exception
@item
@code{allow-external-unlock}: the mutex can be unlocked by any thread,
not just the thread that locked it originally
@end itemize
@defun make-mutex [name]
Returns a new mutex, optionally assigning it the object name
@var{name}, which may be any Scheme object. The returned mutex will be
created with the configuration described above. Note that the name
@code{make-mutex} conflicts with Guile core function @code{make-mutex}.
Applications wanting to use both of these functions will need to refer
to them by different names.
@end defun
@defun mutex-name mutex
Returns the name assigned to @var{mutex} at the time of its creation,
or @code{#f} if it was not given a name.
@end defun
@defun mutex-specific mutex
@defunx mutex-specific-set! mutex obj
Get or set the ``object-specific'' property of @var{mutex}. In Guile's
implementation of SRFI-18, this value is stored as an object property,
and will be @code{#f} if not set.
@end defun
@defun mutex-state mutex
Returns information about the state of @var{mutex}. Possible values
are:
@itemize @bullet
@item
thread @code{T}: the mutex is in the locked/owned state and thread T
is the owner of the mutex
@item
symbol @code{not-owned}: the mutex is in the locked/not-owned state
@item
symbol @code{abandoned}: the mutex is in the unlocked/abandoned state
@item
symbol @code{not-abandoned}: the mutex is in the
unlocked/not-abandoned state
@end itemize
@end defun
@defun mutex-lock! mutex [timeout [thread]]
Lock @var{mutex}, optionally specifying a time object @var{timeout}
after which to abort the lock attempt and a thread @var{thread} giving
a new owner for @var{mutex} different than the current thread. This
procedure has the same behavior as the @code{lock-mutex} procedure in
the core library.
@end defun
@defun mutex-unlock! mutex [condition-variable [timeout]]
Unlock @var{mutex}, optionally specifying a condition variable
@var{condition-variable} on which to wait, either indefinitely or,
optionally, until the time object @var{timeout} has passed, to be
signalled. This procedure has the same behavior as the
@code{unlock-mutex} procedure in the core library.
@end defun
@node SRFI-18 Condition variables
@subsubsection SRFI-18 Condition variables
SRFI-18 does not specify a ``wait'' function for condition variables.
Waiting on a condition variable can be simulated using the SRFI-18
@code{mutex-unlock!} function described in the previous section, or
Guile's built-in @code{wait-condition-variable} procedure can be used.
@defun condition-variable? obj
Returns @code{#t} if @var{obj} is a condition variable, @code{#f}
otherwise. This is the same procedure as the same-named built-in
procedure
(@pxref{Mutexes and Condition Variables, @code{condition-variable?}}).
@end defun
@defun make-condition-variable [name]
Returns a new condition variable, optionally assigning it the object
name @var{name}, which may be any Scheme object. This procedure
replaces a procedure of the same name in the core library.
@end defun
@defun condition-variable-name condition-variable
Returns the name assigned to @var{thread} at the time of its creation,
or @code{#f} if it was not given a name.
@end defun
@defun condition-variable-specific condition-variable
@defunx condition-variable-specific-set! condition-variable obj
Get or set the ``object-specific'' property of
@var{condition-variable}. In Guile's implementation of SRFI-18, this
value is stored as an object property, and will be @code{#f} if not
set.
@end defun
@defun condition-variable-signal! condition-variable
@defunx condition-variable-broadcast! condition-variable
Wake up one thread that is waiting for @var{condition-variable}, in
the case of @code{condition-variable-signal!}, or all threads waiting
for it, in the case of @code{condition-variable-broadcast!}. The
behavior of these procedures is equivalent to that of the procedures
@code{signal-condition-variable} and
@code{broadcast-condition-variable} in the core library.
@end defun
@node SRFI-18 Time
@subsubsection SRFI-18 Time
The SRFI-18 time functions manipulate time in two formats: a
``time object'' type that represents an absolute point in time in some
implementation-specific way; and the number of seconds since some
unspecified ``epoch''. In Guile's implementation, the epoch is the
Unix epoch, 00:00:00 UTC, January 1, 1970.
@defun current-time
Return the current time as a time object. This procedure replaces
the procedure of the same name in the core library, which returns the
current time in seconds since the epoch.
@end defun
@defun time? obj
Returns @code{#t} if @var{obj} is a time object, @code{#f} otherwise.
@end defun
@defun time->seconds time
@defunx seconds->time seconds
Convert between time objects and numerical values representing the
number of seconds since the epoch. When converting from a time object
to seconds, the return value is the number of seconds between
@var{time} and the epoch. When converting from seconds to a time
object, the return value is a time object that represents a time
@var{seconds} seconds after the epoch.
@end defun
@node SRFI-18 Exceptions
@subsubsection SRFI-18 Exceptions
SRFI-18 exceptions are identical to the exceptions provided by
Guile's implementation of SRFI-34. The behavior of exception
handlers invoked to handle exceptions thrown from SRFI-18 functions,
however, differs from the conventional behavior of SRFI-34 in that
the continuation of the handler is the same as that of the call to
the function. Handlers are called in a tail-recursive manner; the
exceptions do not ``bubble up''.
@defun current-exception-handler
Returns the current exception handler.
@end defun
@defun with-exception-handler handler thunk
Installs @var{handler} as the current exception handler and calls the
procedure @var{thunk} with no arguments, returning its value as the
value of the exception. @var{handler} must be a procedure that accepts
a single argument. The current exception handler at the time this
procedure is called will be restored after the call returns.
@end defun
@defun raise obj
Raise @var{obj} as an exception. This is the same procedure as the
same-named procedure defined in SRFI 34.
@end defun
@defun join-timeout-exception? obj
Returns @code{#t} if @var{obj} is an exception raised as the result of
performing a timed join on a thread that does not exit within the
specified timeout, @code{#f} otherwise.
@end defun
@defun abandoned-mutex-exception? obj
Returns @code{#t} if @var{obj} is an exception raised as the result of
attempting to lock a mutex that has been abandoned by its owner thread,
@code{#f} otherwise.
@end defun
@defun terminated-thread-exception? obj
Returns @code{#t} if @var{obj} is an exception raised as the result of
joining on a thread that exited as the result of a call to
@code{thread-terminate!}.
@end defun
@defun uncaught-exception? obj
@defunx uncaught-exception-reason exc
@code{uncaught-exception?} returns @code{#t} if @var{obj} is an
exception thrown as the result of joining a thread that exited by
raising an exception that was handled by the top-level exception
handler installed by @code{make-thread}. When this occurs, the
original exception is preserved as part of the exception thrown by
@code{thread-join!} and can be accessed by calling
@code{uncaught-exception-reason} on that exception. Note that
because this exception-preservation mechanism is a side-effect of
@code{make-thread}, joining on threads that exited as described above
but were created by other means will not raise this
@code{uncaught-exception} error.
@end defun
@node SRFI-19
@subsection SRFI-19 - Time/Date Library
@cindex SRFI-19
@ -1844,8 +2184,10 @@ Return the current time of the given @var{type}. The default
@var{type} is @code{time-utc}.
Note that the name @code{current-time} conflicts with the Guile core
@code{current-time} function (@pxref{Time}). Applications wanting to
use both will need to use a different name for one of them.
@code{current-time} function (@pxref{Time}) as well as the SRFI-18
@code{current-time} function (@pxref{SRFI-18 Time}). Applications
wanting to use more than one of these functions will need to refer to
them by different names.
@end defun
@defun time-resolution [type]
@ -3216,6 +3558,56 @@ Answer a hash value appropriate for equality predicate @code{equal?},
@code{hash} is a backwards-compatible replacement for Guile's built-in
@code{hash}.
@node SRFI-88
@subsection SRFI-88 Keyword Objects
@cindex SRFI-88
@cindex keyword objects
@uref{http://srfi.schemers.org/srfi-88/srfi-88.html, SRFI-88} provides
@dfn{keyword objects}, which are equivalent to Guile's keywords
(@pxref{Keywords}). SRFI-88 keywords can be entered using the
@dfn{postfix keyword syntax}, which consists of an identifier followed
by @code{:} (@pxref{Reader options, @code{postfix} keyword syntax}).
SRFI-88 can be made available with:
@example
(use-modules (srfi srfi-88))
@end example
Doing so installs the right reader option for keyword syntax, using
@code{(read-set! keywords 'postfix)}. It also provides the procedures
described below.
@deffn {Scheme Procedure} keyword? obj
Return @code{#t} if @var{obj} is a keyword. This is the same procedure
as the same-named built-in procedure (@pxref{Keyword Procedures,
@code{keyword?}}).
@example
(keyword? foo:) @result{} #t
(keyword? 'foo:) @result{} #t
(keyword? "foo") @result{} #f
@end example
@end deffn
@deffn {Scheme Procedure} keyword->string kw
Return the name of @var{kw} as a string, i.e., without the trailing
colon. The returned string may not be modified, e.g., with
@code{string-set!}.
@example
(keyword->string foo:) @result{} "foo"
@end example
@end deffn
@deffn {Scheme Procedure} string->keyword str
Return the keyword object whose name is @var{str}.
@example
(keyword->string (string->keyword "a b c")) @result{} "a b c"
@end example
@end deffn
@c srfi-modules.texi ends here