Neil Jerram [Sun, 8 Feb 2009 22:02:15 +0000 (22:02 +0000)]
Merge branch 'master' into ossau-gds-dev
Neil Jerram [Thu, 5 Feb 2009 22:11:26 +0000 (22:11 +0000)]
Allow @ to work with (ice-9 syncase)
(Reported by Panicz Maciej Godek.)
* test-suite/tests/syncase.test ("@ works with syncase"): New test.
* ice-9/syncase.scm (guile-macro): When a Guile macro transformer
produces a variable, don't pass it through sc-expand.
Neil Jerram [Thu, 5 Feb 2009 22:03:53 +0000 (22:03 +0000)]
Fix build when compiled with -Wundef -Werror
(Reported by David Fang)
* libguile/inline.h: Check if __APPLE_CC__ is defined before testing
its value.
Ludovic Courtès [Sun, 18 Jan 2009 19:21:44 +0000 (20:21 +0100)]
GOOPS: Statically allocate the PORT class array.
* libguile/goops.c (scm_port_class): Statically allocate it.
(create_port_classes): Don't use `scm_calloc ()'.
* libguile/goops.h (scm_port_class): Update declaration.
* libguile/ports.c (scm_make_port_type): When checking whether
GOOPS is initialized, check whether the first element of
SCM_PORT_CLASS is non-zero.
Ludovic Courtès [Sun, 18 Jan 2009 17:47:20 +0000 (18:47 +0100)]
Publish the maximum number of port types as `SCM_I_MAX_PORT_TYPE_COUNT'.
* libguile/goops.c (create_port_classes): Use
`SCM_I_MAX_PORT_TYPE_COUNT' instead of a hard-wired 256.
* libguile/objects.h (SCM_OUT_PCLASS_INDEX, SCM_INOUT_PCLASS_INDEX):
Likewise.
* libguile/ports.c (scm_make_port_type): Likewise.
* libguile/ports.h (SCM_I_MAX_PORT_TYPE_COUNT): New macro.
Ludovic Courtès [Sun, 18 Jan 2009 15:53:01 +0000 (16:53 +0100)]
GOOPS: Statically allocate the SMOB class array.
* libguile/goops.c (scm_smob_class): Statically allocate it.
(create_smob_classes): Don't malloc(3) `scm_smob_class'.
* libguile/goops.h (scm_smob_class): Update declaration.
* libguile/smob.c (scm_make_smob_type, scm_set_smob_apply): When
checking whether GOOPS is initialized, check whether the first element
of SCM_SMOB_CLASS is non-zero.
Ludovic Courtès [Sun, 18 Jan 2009 15:42:17 +0000 (16:42 +0100)]
Publish the maximum number of SMOB types as `SCM_I_MAX_SMOB_TYPE_COUNT'.
* libguile/goops.c (create_smob_classes): Refer to
`SCM_I_MAX_SMOB_TYPE_COUNT' rather than 255 (which is wrong) or 256.
* libguile/smob.c (MAX_SMOB_COUNT): Alias for `SCM_I_MAX_SMOB_TYPE_COUNT'.
* libguile/smob.h (SCM_I_MAX_SMOB_TYPE_COUNT): New macro.
Julian Graham [Tue, 20 Jan 2009 15:25:04 +0000 (10:25 -0500)]
Update SRFI-11 docs to use correct name for let*-values.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Andy Wingo [Wed, 28 Jan 2009 10:56:21 +0000 (11:56 +0100)]
cleanups to value and help help handlers
* ice-9/session.scm (*value-help-handlers*): Define object-documentation
as the default value help handler.
(remove-value-help-handler!, add-name-help-handler!)
(remove-name-help-handler!): Fix docs.
(help, help-doc): Fix so that we try object-documentation through
try-value-help, and we obey the docs regarding what happens with return
values.
Andy Wingo [Tue, 27 Jan 2009 12:43:07 +0000 (13:43 +0100)]
merge in from guile-lib: add some extensibility to `help'
* ice-9/session.scm (add-value-help-handler!)
(remove-value-help-handler!, add-name-help-handler!)
(remove-name-help-handler!): New public interfaces, to allow some basic
extensibility of the help interface. Merged in from guile-lib's (scheme
session).
Neil Jerram [Fri, 23 Jan 2009 01:26:16 +0000 (01:26 +0000)]
Fix build when scm_t_timespec is different from struct timespec
Reported by Roland Haeder. The declaration and definition of
scm_pthread_cond_timedwait were using possibly different types for the
third arg.
* THANKS: Added Roland Haeder.
* libguile/threads.h (scm_pthread_cond_timedwait): Use scm_t_timespec
for third arg rather than struct timespec, for consistency with the
function implementation.
Neil Jerram [Fri, 23 Jan 2009 01:02:46 +0000 (01:02 +0000)]
Fix MinGW HAVE_STRUCT_TIMESPEC build problem
Reported by Carlo Bramini. See the comment in _scm.h.
* THANKS: Add Carlo Bramini.
* libguile/_scm.h: Undefine HAVE_STRUCT_TIMESPEC.
Ludovic Courtès [Sun, 18 Jan 2009 11:53:01 +0000 (12:53 +0100)]
Remove useless cooperative multi-threading source files.
Ludovic Courtès [Sun, 18 Jan 2009 11:44:15 +0000 (12:44 +0100)]
Make variables related to the subr table size private and unsigned.
* libguile/procs.c (scm_subr_table_size, scm_subr_table_room): Made
`static' and `unsigned'.
(scm_c_make_subr)[entry]: Made `unsigned'.
* libguile/procs.h (scm_subr_table_size, scm_subr_table_room): Remove
declarations.
Neil Jerram [Sat, 17 Jan 2009 22:33:36 +0000 (22:33 +0000)]
Remove `INSTALL'
* INSTALL: Removed.
Neil Jerram [Thu, 15 Jan 2009 22:36:28 +0000 (22:36 +0000)]
Don't try to unlock already unlocked heap mutex
For each thread that goes into Guile mode, Guile pushes a cleanup
function, scm_leave_guile_cleanup, whose purpose is to execute
`scm_leave_guile ()' if the thread is terminated while in Guile mode.
The problem is that there are various places - like
scm_pthread_cond_wait, scm_without_guile and scm_std_select - where
the thread temporarily leaves Guile mode (which means unlocking the
heap mutex), and the cleanup function is still in place. Therefore if
the thread is terminated at these places, the cleanup function ends up
trying to unlock a mutex (the heap mutex) which isn't actually locked.
* libguile/threads.h (scm_i_thread): New heap_mutex_locked_by_self field.
* libguile/threads.c (scm_enter_guile): Set heap_mutex_locked_by_self.
(scm_leave_guile): Only unlock if heap_mutex_locked_by_self is 1.
(guilify_self_1): Initialize heap_mutex_locked_by_self.
(scm_i_thread_sleep_for_gc): Remove incorrect use of t->held_mutex
here.
Neil Jerram [Thu, 15 Jan 2009 01:07:15 +0000 (01:07 +0000)]
Invoke gnulib-tool with --no-vc-files option, and
remove files that should not have been committed to the repository.
Neil Jerram [Thu, 15 Jan 2009 00:56:53 +0000 (00:56 +0000)]
Revert lib/.gitignore and m4/.gitignore to how they should be
(before my confused Gnulib commits...)
Neil Jerram [Thu, 15 Jan 2009 00:09:21 +0000 (00:09 +0000)]
Revert unintended change to INSTALL made by commit
4a462e35440fdc3f10b0f88b3fb737fa76ed146d
Neil Jerram [Thu, 15 Jan 2009 00:04:02 +0000 (00:04 +0000)]
Add more missing Gnulib files
Neil Jerram [Wed, 14 Jan 2009 21:05:15 +0000 (21:05 +0000)]
Add more missing Gnulib files
Neil Jerram [Wed, 14 Jan 2009 20:50:51 +0000 (20:50 +0000)]
Add missing Gnulib file (m4/localcharset.m4)
Ludovic Courtès [Sun, 14 Dec 2008 20:07:09 +0000 (21:07 +0100)]
Fixlet for `run-benchmark.scm'.
* gc-benchmarks/run-benchmark.scm (%default-options): Default to the
empty list for `input'.
Ludovic Courtès [Tue, 11 Nov 2008 20:01:40 +0000 (21:01 +0100)]
gc-benchmarks: Adapt `gcold.scm' so that if conforms to the framework.
* gc-benchmarks/larceny/gcold.scm (main): Rename to `gcold-benchmark'.
(GCOld): Fix the order of the predicate and run-maker.
Ludovic Courtès [Tue, 11 Nov 2008 17:27:24 +0000 (18:27 +0100)]
gc-benchmarks: Add `gcold.scm', by Clinger, Hansen et al.
See http://www.ccs.neu.edu/home/will/Twobit/benchmarksAbout.html for
details.
Ludovic Courtès [Tue, 11 Nov 2008 17:20:15 +0000 (18:20 +0100)]
gc-benchmarks: Add `run-benchmark.scm'.
Ludovic Courtès [Tue, 11 Nov 2008 17:19:24 +0000 (18:19 +0100)]
gc-profile: Show the result of `(version)'.
* gc-benchmarks/gc-profile.scm (main): Show `(version)'.
Ludovic Courtès [Mon, 10 Nov 2008 21:49:29 +0000 (22:49 +0100)]
gc-benchmarks: Allow the iteration count to be passed to `gc-profile.scm'.
* gc-benchmarks/gc-profile.scm (*iteration-count*): New parameter.
(run-benchmark): Moved from `twobit-compat.scm'. Honor
`*iteration-count*'.
(%options): Add `--iterations'.
(show-help): Document it.
(main): Parameterize `*iteration-count*'.
Ludovic Courtès [Mon, 10 Nov 2008 19:30:33 +0000 (20:30 +0100)]
Import GC benchmarks from Larceny, by Hansen, Clinger, et al.
These GPLv2+-licensed GC benchmarks are available from
http://www.ccs.neu.edu/home/will/GC/sourcecode.html .
Ludovic Courtès [Fri, 7 Nov 2008 20:11:44 +0000 (21:11 +0100)]
gc-benchmarks: Add a Larceny/Twobit benchmark compatibility layer.
* gc-benchmarks/gc-profile.scm: Load "twobit-compat.scm".
(save-directory-excursion, load-larceny-benchmark): New procedures.
(%options): New variable.
(show-help, parse-args): New procedures.
(main): Use `parse-args' and `load-larceny-benchmark'.
Ludovic Courtès [Sun, 12 Oct 2008 21:51:03 +0000 (23:51 +0200)]
Add GC benchmarks.
Neil Jerram [Mon, 12 Jan 2009 21:48:17 +0000 (21:48 +0000)]
Make sure that we have a real on-the-stack alloca()
Because of how Guile saves and restores continuations (by copying the
stack), and how it uses alloca to create space for debug information
on the stack, we must have an alloca() that really does use the stack,
and not one that uses the heap.
To do this, we use the Gnulib "alloca-opt" module instead of "alloca".
This commit also updates the Gnulib sources from the current Gnulib
Git repository.
Neil Jerram [Sun, 4 Jan 2009 22:45:54 +0000 (22:45 +0000)]
NEWS entry for %fast-slot-ref/set! fix
Neil Jerram [Sun, 4 Jan 2009 21:32:23 +0000 (21:32 +0000)]
Fix implementation of %fast-slot-ref and %fast-slot-set!
* libguile/goops.c (scm_sys_fast_slot_ref, scm_sys_fast_slot_set_x):
Correct incantation for getting the number of slots of the specified
instance.
* libguile/goops.h (SCM_NUMBER_OF_SLOTS): Removed (because wrong).
* test-suite/standalone/test-fast-slot-ref.in: New standalone test.
* configure.in: Generate test-suite/standalone/test-fast-slot-ref.
* test-suite/standalone/Makefile.am (check_SCRIPTS): Add
test-fast-slot-ref.
Neil Jerram [Sun, 14 Dec 2008 14:42:08 +0000 (14:42 +0000)]
Update autogen.sh
* autogen.sh: Don't call guile-readline/autogen.sh; not needed because
autoreconf recurses itself. Remove copies of config.guess and
config.sub, which are now invalid because we don't have those files
in the top level directory. Remove mention of
--enable-maintainer-mode, as we don't use AM_MAINTAINER_MODE any
more.
Ludovic Courtès [Tue, 2 Dec 2008 19:51:12 +0000 (20:51 +0100)]
Delete redundant `config.{guess,sub}'.
Ludovic Courtès [Mon, 22 Dec 2008 15:24:04 +0000 (16:24 +0100)]
Fix typo in SRFI-19.
* srfi/srfi-19.scm (priv:string->date): Check for EOF on CH, not PORT.
Ludovic Courtès [Thu, 18 Dec 2008 21:43:57 +0000 (22:43 +0100)]
Update `INSTALL', from Automake 1.10.2.
Ludovic Courtès [Thu, 18 Dec 2008 21:38:06 +0000 (22:38 +0100)]
Don't use deprecated functions in `debug-malloc.c'.
* libguile/debug-malloc.c (scm_malloc_stats): Use
`scm_from_locale_string ()'. Patch by Linas Vepstas
<linasvepstas@gmail.com>.
Ludovic Courtès [Thu, 18 Dec 2008 21:34:23 +0000 (22:34 +0100)]
srfi-19: Fix `string->date' weekday lookup.
* srfi/srfi-19.scm (priv:locale-abbr-weekday->index): Use
`locale-day-short' since it expects integers in the range 1-7, unlike
`priv:locale-abbr-weekday'.
(priv:locale-long-weekday->index): Likewise.
* test-suite/tests/srfi-19.test ("SRFI date/time
library")["string->date works on Sunday"]: New test.
Neil Jerram [Sat, 13 Dec 2008 00:05:11 +0000 (00:05 +0000)]
Ignore gds-test.debug and gds-test.transcript
Neil Jerram [Fri, 12 Dec 2008 23:59:21 +0000 (23:59 +0000)]
Support multiple concurrent instances of Emacs + GDS server
By:
- Making the Unix socket name unique (for each Emacs instance), by
appending Emacs's PID to it.
- Changing the GDS server to listen on both Unix domain and TCP (and
not to mind if the TCP bind fails, which will happen if another GDS
instance has already bound to the TCP port number).
- Adding this unique Unix socket name to the environment (as
GDS_UNIX_SOCKET_NAME), so that Guile clients started from inside
Emacs can pick it up.
- Changing the GDS client code to look for GDS_UNIX_SOCKET_NAME in the
environment, and to connect to the Unix socket with that name
instead of over TCP.
Guile clients started outside Emacs will not find
GDS_UNIX_SOCKET_NAME and so will fall back to using TCP. This means
they will connect to whichever Emacs + GDS server instance started
first.
* emacs/gds-server.el (gds-start-server): Take both Unix socket name
and TCP port args, instead of just one (which could be either Unix
or TCP), and pass these on to `run-server'. Remove unused optional
bufname arg.
* emacs/gds.el (gds-unix-socket-name, gds-tcp-port): New variables.
(gds-socket-type-alist): Removed.
(gds-run-debug-server): Pass gds-unix-socket-name and gds-tcp-port
to gds-start-server. Add the Unix socket name to the environment.
(gds-server-socket-type): Note now obsolete.
* ice-9/gds-client.scm (connect-to-gds): Get Unix socket name from
environment, and connect to this in preference to using TCP.
* ice-9/gds-server.scm (run-server): Take both Unix socket name and
TCP port args. Listen and accept connections on both.
Neil Jerram [Fri, 12 Dec 2008 22:37:22 +0000 (22:37 +0000)]
Thank people who provided reports or fixes for GDS
(while it was a standalone project)
* THANKS (R Clayton, John Steele Scott, Thomas Wawrzinek): Added.
Neil Jerram [Fri, 12 Dec 2008 22:36:22 +0000 (22:36 +0000)]
Add more files that I wrote to the list in AUTHORS
* AUTHORS (Neil Jerram): Several files added.
Neil Jerram [Fri, 12 Dec 2008 22:32:59 +0000 (22:32 +0000)]
Add GDS test and documentation files
(Transferred from the remains of the old standalone guile-debugging
project at gna.org.)
* emacs/gds-faq.txt, emacs/gds-test.el, emacs/gds-test.sh,
emacs/gds-test.stdin, emacs/gds-tutorial.txt: New files.
Neil Jerram [Thu, 11 Dec 2008 01:39:26 +0000 (01:39 +0000)]
Add a GDS protocol hook, that we can use for testing
* emacs/gds.el (gds-protocol-hook): New hook.
(gds-debug-protocol): Run this hook for each received protocol form.
Neil Jerram [Wed, 10 Dec 2008 19:11:28 +0000 (19:11 +0000)]
Revert "(scm_shell_usage): Note need for subscription to bug-guile@gnu.org."
This reverts commit
f3e3f530c28cfa5c7830c5d9b01de6fc388bc42a, which is
appropriate because subscription is not now required for someone to
send a message to bug-guile@gnu.org.
Conflicts:
Neil Jerram [Wed, 10 Dec 2008 19:07:14 +0000 (19:07 +0000)]
Revert "Note need for subscription to bug-guile@gnu.org."
This reverts commit
cbea802b3763aa8cb43c88f7df272da3e41c32da, which is
appropriate because subscription is not now required for someone to
send a message to bug-guile@gnu.org.
Conflicts:
Neil Jerram [Wed, 10 Dec 2008 19:02:50 +0000 (19:02 +0000)]
Revert "(Reporting Bugs): Note need for subscription to"
This reverts commit
e563095988a1c64feb30307928bcc090828cdda9, which is
appropriate because subscription is not now required for someone to
send a message to bug-guile@gnu.org.
Conflicts:
Neil Jerram [Wed, 10 Dec 2008 18:57:20 +0000 (18:57 +0000)]
Revert "* README: Note need for subscription to bug-guile@gnu.org."
This reverts commit
51d079ab0d23e4175d333ce22eb3e74aeae5913d, which is
appropriate because subscription is not now required for someone to
send a message to bug-guile@gnu.org.
Ludovic Courtès [Wed, 10 Dec 2008 10:05:50 +0000 (11:05 +0100)]
i18n: Add comment about standardization of the `locale_t' API.
* libguile/i18n.c: Add pointer to the POSIX 2008 standardization of the
API.
Ludovic Courtès [Wed, 10 Dec 2008 09:44:24 +0000 (10:44 +0100)]
Fix erroneous differences in `NEWS' compared to `branch_release-1-8'.
Ludovic Courtès [Wed, 10 Dec 2008 09:06:46 +0000 (10:06 +0100)]
configure: Check for <ltdl.h>.
* configure.in: Check for <ltdl.h>, to clarify misconfigurations.
Ludovic Courtès [Wed, 10 Dec 2008 08:57:33 +0000 (09:57 +0100)]
configure: Don't substitute `DLPREOPEN'.
* configure.in: Don't substitute `DLPREOPEN' since it's no longer used
(see commit
72db29f200c38fca64a8ccd0d679821eb25de5a9).
Neil Jerram [Tue, 9 Dec 2008 23:56:51 +0000 (23:56 +0000)]
Remove everything to do with GDS Breakpoints
(which I now regard as an unsuccesful experiment)
This commit makes all affected files the same in master as they are in branch_release-1-8.
* doc/ref/api-debug.texi (Breakpoints): Removed.
* doc/ref/scheme-using.texi (GDS Introduction, GDS Getting Started,
Displaying the Scheme Stack): Remove mentions of breakpoints.
(Setting Specific Breakpoints, Setting GDS-managed Breakpoints,
Setting and Managing Breakpoints, Listing and Deleting Breakpoints,
Moving and Losing Breakpoints): Removed.
* emacs/gds-scheme.el (gds-bufferless-breakpoints,
gds-bpdef:behaviour, gds-bpdef:type, gds-bpdef:file-name,
gds-bpdef:proc-name, gds-bpdef:lc, gds-breakpoint-number,
gds-breakpoint-buffers, gds-breakpoint-programming,
gds-breakpoint-cache, gds-breakpoint-face,
gds-breakpoints-file-name, gds-delete-lost-breakpoints,
gds-bpdefs-cache, gds-read-breakpoints-file, gds-adopt-breakpoints,
gds-adopt-breakpoint, gds-make-breakpoint-overlay,
gds-send-breakpoint-to-client, gds-default-breakpoint-type,
gds-set-breakpoint, gds-defun-name-region,
gds-breakpoint-overlays-at, gds-write-breakpoints-file,
gds-fold-breakpoints, gds-delete-breakpoints, gds-delete-breakpoint,
gds-breakpoint-at-point, gds-union, gds-user-selected-breakpoint,
gds-describe-breakpoints, gds-describe-breakpoint,
gds-after-save-update-breakpoints, gds-breakpoint-map): Removed.
(gds-nondebug-protocol): Removed handling for `breakpoint' and
`get-breakpoints'.
* emacs/gds.el (gds-scheme-first-load): Removed.
* ice-9/debugging/Makefile.am (ice9_debugging_sources): Removed
breakpoints.scm and load-hooks.scm.
* ice-9/debugging/breakpoints.scm: Removed.
* ice-9/debugging/load-hooks.scm: Removed.
* ice-9/gds-client.scm (handle-nondebug-protocol): Remove everything
to do with breakpoints.
(breakpoints, set-gds-breakpoints): Removed.
(run-utility): Call `connect-to-gds' instead of `set-gds-breakpoints'.
Ludovic Courtès [Mon, 8 Dec 2008 20:34:08 +0000 (21:34 +0100)]
Mention the end of `ChangeLog' files in `NEWS'.
Ludovic Courtès [Mon, 8 Dec 2008 20:17:21 +0000 (21:17 +0100)]
Make `config.status' happier.
* guile-tools.in (datarootdir): New variable, needed since `pkgdatadir'
may refer to `${datarootdir}'.
Ludovic Courtès [Mon, 8 Dec 2008 07:06:34 +0000 (08:06 +0100)]
Add other missing Gnulib files.
Ludovic Courtès [Sun, 7 Dec 2008 21:01:50 +0000 (22:01 +0100)]
Remove useless references to Libtool's `dlpreopen' mechanism.
* libguile/Makefile.am (guile_LDFLAGS): Remove `@DLPREOPEN@' since it
has no effect.
* libguile/guile.c (main): Don't invoke `LTDL_SET_PRELOADED_SYMBOLS ()'
since it had no effect given how we invoke `libtool'. It also fixes
compatibility issues when using libltdl 1.5 with a Libtool 2.2
package.
Ludovic Courtès [Sun, 7 Dec 2008 21:34:47 +0000 (22:34 +0100)]
Add missing Gnulib M4 files.
Reported by Neil Jerram.
Neil Jerram [Sun, 7 Dec 2008 16:26:32 +0000 (16:26 +0000)]
Several new hash table tests, written by Gregory Marton.
* test-suite/tests/hash.test ("make-hash-table, hash-table?",
"hash-set and hash-ref", "auto-resizing hashx", "hashx"): New tests.
* AUTHORS, THANKS: Add Gregory Marton as a contributor.
Ludovic Courtès [Tue, 2 Dec 2008 18:42:39 +0000 (19:42 +0100)]
Fix sloppy bound checking in `string-{ref,set!}' with the empty string.
* libguile/strings.c (scm_string_ref): Add proper range checking for the
empty string.
(scm_string_set_x): Likewise.
Reported by Bill Schottstaedt <bil@ccrma.Stanford.EDU>.
* test-suite/tests/strings.test ("string-ref"): New test prefix.
("string-set!")["empty string", "empty string and non-zero index",
"out of range", "negative index", "regular string"]: New tests.
* NEWS: Update.
Ludovic Courtès [Tue, 2 Dec 2008 18:30:56 +0000 (19:30 +0100)]
Update `NEWS'.
Ludovic Courtès [Sun, 30 Nov 2008 19:26:56 +0000 (20:26 +0100)]
Fix potential deadlock in `make-struct'.
* libguile/struct.c (scm_make_struct): Remove critical section, as
suggested by Linas Vepstas <linasvepstas@gmail.com>. See
http://lists.gnu.org/archive/html/bug-guile/2008-11/msg00036.html for
a discussion.
Ludovic Courtès [Sun, 30 Nov 2008 18:37:29 +0000 (19:37 +0100)]
Make GNU Libtool 2.2.x happier.
* configure.in: Use `AC_CONFIG_MACRO_DIR([m4])'. Reverts patch
b01284227e180d223c97e1b9ba7e2cbd0ddded7e and makes `libtoolize' from
Libtool 2 happier (removes a couple of warnings).
* Makefile.am (ACLOCAL_AMFLAGS): Remove `-I guile-config' since that
directory only contains macros that we distribute, not macros that we
use.
Ludovic Courtès [Sun, 30 Nov 2008 17:43:41 +0000 (18:43 +0100)]
Check the return value of libc's functions to make `_FORTIFY_SOURCE=2' work.
This fixes bug #24009 reported by Martin Pitt.
* libguile/threads.c (guilify_self_1): Check the return value of
pipe(2).
(scm_std_select): Use `full_read ()' instead of `read ()' when reading
from WAKEUP_FD.
* libguile/async.c (scm_i_queue_async_cell): Use `full_write ()' instead
of write(2) when writing to SLEEP_FD.
* libguile/fports.c (fport_flush): Likewise.
* libguile/posix.c (getgroups): Use the return value of getgroups(2) as
NGROUPS.
(scm_nice): Get the return value of nice(2) to make glibc happy.
* libguile/scmsigs.c (take_signal): Use `full_write ()' instead of
write(2).
Ludovic Courtès [Sun, 30 Nov 2008 16:48:06 +0000 (17:48 +0100)]
Use Gnulib's `full-write' and `full-read' modules.
Ludovic Courtès [Sun, 30 Nov 2008 16:44:44 +0000 (17:44 +0100)]
Ludovic Courtès [Mon, 24 Nov 2008 21:04:44 +0000 (22:04 +0100)]
Use orthodox libtoology in `guile'.
* libguile/guile.c (main): Use `LTDL_SET_PRELOADED_SYMBOLS ()' instead
of our own trick.
Ludovic Courtès [Mon, 24 Nov 2008 08:40:00 +0000 (09:40 +0100)]
Run the handler of SRFI-34's `with-exception-handler' in the right dyn. env.
* srfi/srfi-34.scm (with-exception-handler): Use `with-throw-handler'
instead of `lazy-catch'.
* test-suite/tests/srfi-34.test ("SRFI 34")["`with-exception-handler'
invokes HANDLER in THUNK's dynamic env."]: New test.
* test-suite/tests/srfi-39.test: Use `(srfi srfi-34)'.
("SRFI-39")["SRFI-34"]: New test.
* NEWS: Update.
Ludovic Courtès [Mon, 24 Nov 2008 08:10:51 +0000 (09:10 +0100)]
Fix comments in `test-scm-c-read.c'.
* test-suite/standalone/test-scm-c-read.c (make_port): Fix comments.
Ludovic Courtès [Sat, 22 Nov 2008 14:48:16 +0000 (15:48 +0100)]
Add C unit test for `scm_c_read ()' and the port API.
* test-suite/standalone/Makefile.am (check_PROGRAMS, TESTS): Add
`test-scm-c-read'.
(test_scm_c_read_SOURCES, test_scm_c_read_CFLAGS,
test_scm_c_read_LDADD): New.
Neil Jerram [Sun, 23 Nov 2008 22:37:23 +0000 (22:37 +0000)]
Make scm_c_read use caller buffer only for unbuffered ports.
We recently modified scm_c_read so that it temporarily swaps the
caller's buffer with the port's normal read buffer, in order to
improve performance in the case where the port is unbuffered (which
actually means having a single-byte buffer) - but we implemented the
swap in the buffered case too. The latter turns out to be a bad idea
- because it means that the C code of a custom port implementation
cannot rely on a port's buffer always being the same as when it was
first set up - and so this commit reverts that. The buffer swapping
trick now applies to unbuffered ports only.
* libguile/ports.c (scm_c_read): Only do swapping of port and caller
buffer for unbuffered ports.
Ludovic Courtès [Thu, 13 Nov 2008 23:41:41 +0000 (00:41 +0100)]
Update `THANKS'.
Ludovic Courtès [Thu, 13 Nov 2008 23:35:32 +0000 (00:35 +0100)]
Update the thread stack base when `scm_with_guile' is invoked multiple times.
* NEWS: Update.
* libguile/threads.c (scm_i_init_thread_for_guile): When the thread is
already guilified, update `t->base' so that it corresponds to the new
stack base. Bug report and patch by Linas Vepstas <linasvepstas@gmail.com>.
* test-suite/standalone/Makefile.am (test_scm_with_guile_CFLAGS,
test_scm_with_guile_LDADD): New.
(check_PROGRAMS, TESTS): Add `test-scm-with-guile'.
Ludovic Courtès [Thu, 13 Nov 2008 22:27:25 +0000 (23:27 +0100)]
Augment `.gitignore'.
Ludovic Courtès [Thu, 13 Nov 2008 22:24:32 +0000 (23:24 +0100)]
Update "guile(1)" man page.
* doc/guile.1: Remove reference to the version and date. Mention R5RS,
instead of R4RS. Explicitly say that the full documentation is in
Texinfo (as other GNU packages do).
Ludovic Courtès [Thu, 13 Nov 2008 22:12:34 +0000 (23:12 +0100)]
Add "guile(1)" man page.
Robert Merkel's copyright assignment to the FSF had apparently been on
file for some time.
* NEWS: Update.
* doc/Makefile.am (dist_man1_MANS): New.
Neil Jerram [Sun, 26 Oct 2008 21:43:04 +0000 (21:43 +0000)]
Fix stack calibration-related errors when running make distcheck.
* libguile/Makefile.am (stack-limit-calibration.scm): Use $(srcdir), to
support building in a different directory.
(MOSTLYCLEANFILES): Add stack-limit-calibration.scm.
Neil Jerram [Fri, 24 Oct 2008 21:46:43 +0000 (22:46 +0100)]
Add measure-hwm.scm to the set of distribution files.
* libguile/Makefile.am (EXTRA_DIST): Add measure-hwm.scm.
Neil Jerram [Wed, 22 Oct 2008 07:45:42 +0000 (08:45 +0100)]
Fix hang in srfi-18.test
* libguile/threads.h (held_mutex): New field.
* libguile/threads.c (enqueue, remqueue, dequeue): Use critical
section to protect access to the queue.
(guilify_self_1): Initialize held_mutex field.
(on_thread_exit): If held_mutex non-null, unlock it.
(fat_mutex_unlock, fat_cond_free, scm_make_condition_variable,
fat_cond_signal, fat_cond_broadcast): Delete now unnecessary uses
of c->lock.
(fat_mutex_unlock): Pass m->lock to block_self() instead of
c->lock; move scm_i_pthread_mutex_unlock(m->lock) call from before
block_self() to after.
(scm_pthread_cond_wait, scm_pthread_cond_timedwait,
scm_i_thread_sleep_for_gc): Set held_mutex before pthread call;
reset it afterwards.
I was seeing a hang in srfi-18.test, when running make check in master,
in the "exception handler installation is thread-safe" test. It wasn't
100% reproducible, so looked like a race.
The problem is that wait-condition-variable is not actually
atomic in the way that it is supposed to be. It unlocks the mutex,
then starts waiting on the cond var. So it is possible for another
thread to lock the same mutex, and signal the cond var, before the
wait-condition-variable thread starts waiting.
In order for wait-condition-variable to be atomic - e.g. in a race
where thread A holds (Scheme-level) mutex M, and calls
(wait-condition-variable C M), and thread B calls (begin (lock-mutex
M) (signal-condition-variable C)) - it needs to call pthread_cond_wait
with the same underlying mutex as is involved in the `lock-mutex'
call. In terms of the threads.c code, this means that it has to use
M->lock, not C->lock.
block_self() used its mutex arg for two purposes: for protecting
access and changes to the wait queue, and for the pthread_cond_wait
call. But it wouldn't work reliably to use M->lock to protect C's
wait queue, because in theory two threads can call
(wait-condition-variable C M1) and (wait-condition-variable C M2)
concurrently, with M1 and M2 different. So we either have to pass
both C->lock and M->lock into block_self(), or use some other mutex to
protect the wait queue. For this patch, I switched to using the
critical section mutex, because that is a global and so easily
available. (If that turns out to be a problem for performance, we
could make each queue structure have its own mutex, but there's no
reason to believe yet that it is a problem, because the critical
section mutex isn't used much overall.)
So then we call block_self() with M->lock, and move where M->lock is
unlocked to after the block_self() call, instead of before.
That solves the first hang, but introduces a new one, when a SRFI-18
thread is terminated (`thread-terminate!') between being launched
(`make-thread') and started (`thread-start!'). The problem now is
that pthread_cond_wait is a cancellation point (see man
pthread_cancel), so the pthread_cond_wait call is one of the few
places where a thread-terminate! call can take effect. If the thread
is cancelled at that point, M->lock ends up still being locked, and
then when do_thread_exit() tries to lock M->lock again, it hangs.
The fix for that is a new `held_mutex' field in scm_i_thread, which is
set to point to the mutex just before a pthread_cond_(timed)wait call,
and set to NULL again afterwards. If on_thread_exit() finds that
held_mutex is non-NULL, it unlocks that mutex.
A detail is that checking and unlocking held_mutex must be done before
on_thread_exit() calls scm_i_ensure_signal_delivery_thread(), because
the innards of scm_i_ensure_signal_delivery_thread() can do another
pthread_cond_wait() call and so overwrite held_mutex. But that's OK,
because it's fine for the mutex check and unlock to happen outside
Guile mode.
Lastly, C->lock is then not needed, so I've removed it.
Neil Jerram [Fri, 17 Oct 2008 20:43:36 +0000 (21:43 +0100)]
Avoid `Stack overflow' errors when running `make check'
For explanation, see comments and text in the new file
libguile/measure-hwm.scm.
* .gitignore: Add libguile/stack-limit-calibration.scm.
* check-guile.in: Load libguile/stack-limit-calibration.scm.
* configure.in: Add AC_CONFIG_FILES to generate test-use-srfi from
test-use-srfi.in.
* libguile/Makefile.am (TESTS, TESTS_ENVIRONMENT,
stack-limit-calibration.scm): New targets, so that `make check'
calibrates the stack limit before running the Guile test suite.
* libguile/measure-hwm.scm: New file, calibrates stack limit for `make
check'.
* libguile/stackchk.c (scm_sys_get_stack_size): New primitive.
* libguile/stackchk.h (scm_sys_get_stack_size): New primitive
(declaration).
* test-suite/standalone/test-use-srfi: Renamed test-use-srfi.in, so
that ./configure can fill in variables in it.
* test-suite/standalone/test-use-srfi.in: Load
libguile/stack-limit-calibration.scm.
Ludovic Courtès [Fri, 10 Oct 2008 08:00:21 +0000 (10:00 +0200)]
Fix compilation error due to strict aliasing rules on `i386-unknown-freebsd7.0'.
* libguile/threads.c (scm_threads_mark_stacks): Cast `&t->regs' to
`(void *)' rather than `(SCM_STACKITEM *)' to avoid "warning:
dereferencing type-punned pointer will break strict-aliasing rules"
with GCC 4.2.1 on `i386-unknown-freebsd7.0'.
Ludovic Courtès [Thu, 9 Oct 2008 20:56:19 +0000 (22:56 +0200)]
Fix compilation of the hard copy of the R5RS, tutorial and GOOPS manual.
* doc/tutorial/Makefile.am (TEXINFO_TEX): Remove.
* doc/goops/Makefile.am (TEXINFO_TEX): Remove.
* doc/r5rs/Makefile.am (TEXINFO_TEX): Remove.
Ludovic Courtès [Thu, 9 Oct 2008 20:32:16 +0000 (22:32 +0200)]
Add test case to make sure `read' returns mutable strings.
* test-suite/tests/reader.test ("reading")["returned strings are
mutable"]: New test, as reported by szgyg <szgyg@ludens.elte.hu>.
Ludovic Courtès [Thu, 9 Oct 2008 20:21:33 +0000 (22:21 +0200)]
Revert "Make literal strings (i.e., returned by `read') read-only."
This reverts commit
fb2f8886c4d537b0c7d3e9e78a8d4e5e272a36f4.
The rationale is that `read' must return mutable strings, as reported
by szgyg <szgyg@ludens.elte.hu>.
Han-Wen Nienhuys [Sat, 13 Sep 2008 03:19:23 +0000 (00:19 -0300)]
Remove GH and its traces.
Ludovic Courtès [Thu, 25 Sep 2008 19:36:14 +0000 (21:36 +0200)]
Enclose `regexp.test' in a module.
* test-suite/tests/regexp.test: Add `define-module' clause.
Ludovic Courtès [Thu, 25 Sep 2008 19:07:06 +0000 (21:07 +0200)]
Fix handling of the FLAGS argument in `fold-matches'.
* ice-9/regex.scm (fold-matches): If FLAGS is non-null, use
`(car flags)', not `flags'.
* test-suite/tests/regexp.test ("fold-matches"): New test prefix.
* NEWS: Update.
Ludovic Courtès [Mon, 22 Sep 2008 21:03:20 +0000 (23:03 +0200)]
Make literal strings (i.e., returned by `read') read-only.
* libguile/read.c (scm_read_string): Use `scm_i_make_read_only_string ()' to
return a read-only string, as mandated by R5RS. Reported by Bill
Schottstaedt <bil@ccrma.Stanford.EDU>.
* libguile/strings.c (scm_i_make_read_only_string): New function.
(scm_i_shared_substring_read_only): Special-case the empty string
so that the read-only and read-write empty strings are `eq?'. This
optimization is relied on by the `substring/shared' `empty string'
test case in `srfi-13.test'.
* libguile/strings.h (scm_i_make_read_only_string): New declaration.
* test-suite/tests/strings.test ("string-set!")["literal string"]: New test.
* NEWS: Update.
Ludovic Courtès [Mon, 22 Sep 2008 20:51:36 +0000 (22:51 +0200)]
Make `symbol->string' return a read-only string.
* libguile/strings.c (scm_i_symbol_substring): Return a read-only string
since R5RS requires `symbol->string' to return a read-only string.
Reported by Bill Schottstaedt <bil@ccrma.Stanford.EDU>.
* test-suite/tests/symbols.test: Add `define-module' clause.
(exception:immutable-string): Adjust to current exception.
("symbol->string")["result is an immutable string"]: Use
`pass-if-exception' instead of `expect-fail-exception'.
* NEWS: Update.
Neil Jerram [Wed, 17 Sep 2008 20:46:40 +0000 (21:46 +0100)]
Fix for incorrect (gcd -2) => -2; should give 2.
(reported by Bill Schottstaedt)
* libguile/numbers.c (scm_gcd): When only one arg given, use scm_abs
to ensure that result is non-negative.
* test-suite/tests/numbers.test ("gcd"): New test, (gcd -2).
Ludovic Courtès [Thu, 18 Sep 2008 21:13:42 +0000 (23:13 +0200)]
Fix `strftime' documentation wrt. `%Z'.
* doc/ref/posix.texi (Time)[strftime]: Remove erroneous note saying
that `%Z' ignores `tm:zone'. Reported by Neil Jerram.
Neil Jerram [Sun, 14 Sep 2008 23:25:25 +0000 (00:25 +0100)]
Make multi-byte reads on unbuffered ports more efficient.
Idea and original patch were by Ludovic Courtès, this is Neil Jerram's
reworking of it.
* libguile/srfi-4.c (scm_uniform_vector_read_x): Use scm_c_read,
instead of equivalent code here.
* libguile/ports.c (scm_fill_input): Add assertion that read
buffer is empty when called.
(port_and_swap_buffer, swap_buffer): New, for...
(scm_c_read): Use caller's buffer for reading, to avoid making N
1-byte low-level read calls, in the case where the port is
unbuffered (or has a very small buffer).
Ludovic Courtès [Sun, 1 Jun 2008 17:31:36 +0000 (19:31 +0200)]
Add `uniform-vector-read!' benchmark.
Ludovic Courtès [Sat, 13 Sep 2008 18:09:08 +0000 (20:09 +0200)]
Include <config.h> in standalone tests.
* test-suite/standalone/Makefile.am (test_cflags): Add `-I$(top_builddir)' so
that <config.h> can be found.
(snarfcppopts): Likewise.
* test-suite/standalone/*.c: Include <config.h>.
Ludovic Courtès [Sat, 13 Sep 2008 13:35:27 +0000 (15:35 +0200)]
Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.
Ludovic Courtès [Fri, 12 Sep 2008 19:46:32 +0000 (21:46 +0200)]
Add `ChangeLog-2008' files to the distribution.
Ludovic Courtès [Fri, 12 Sep 2008 19:48:04 +0000 (21:48 +0200)]
Rename `ChangeLog' files to `ChangeLog-2008'.
Ludovic Courtès [Fri, 12 Sep 2008 09:30:04 +0000 (11:30 +0200)]
doc: Correct the default value of `%load-path'.
* doc/ref/api-options.texi (Build Config): Remove "." from the default value
of `%load-path'. Reported by David Séverin <david@altosw.be>.